:root {
  --sidebar-w: 0px;
  --tw-season-accent-rgb: 120, 180, 255;
  --tw-season-accent-hi-rgb: 150, 205, 255;
  --tw-season-accent-lo-rgb: 80, 120, 180;
}

html, body {
  height: 100%;
  margin: 0;
  background: #080a0e;
  color: #e6e9ef;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#root {
  height: 100%;
  display: flex;
  align-items: stretch;
  position: relative;
  overflow: hidden; /* prevent horizontal scroll during early layout */
}

#canvas {
  flex: 1 1 auto;
  display: block;
  min-width: 0; /* allow canvas to shrink in flex; prevents sidebar getting pushed off-screen */
  image-rendering: pixelated;
  background: #080a0e;
}

#sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w); /* never shrink; keep consistent with overlay inset */
  background: radial-gradient(1200px 600px at 40% 0%, rgba(120,180,255,0.10), transparent 55%),
              #0b0f14;
  border-left: 1px solid rgba(255,255,255,0.12);
  padding: 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

#sidebar-scroll {
  flex: 1 1 auto;
  overflow: auto;
  overflow-x: hidden;
  min-height: 0; /* allow overflow area to shrink in flex column */
  scrollbar-gutter: stable;
}

/* Top-right HUD cards (outside sidebar) stack vertically (Biome/Calendar/etc). */
.hud-right-stack {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 220px;
  max-width: calc(100vw - 26px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.hud-right-stack > * { width: 100%; }

/* Top-left HUD stack (draggable/dockable modules). */
.hud-left-stack {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 220px;
  max-width: calc(100vw - 26px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.hud-left-stack > * { width: 100%; }

.hud-modules {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hud-modules > * { width: 100%; }

.hud-mod { width: 100%; }

.hud-drag-handle {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
  color: rgba(240,244,255,0.82);
  cursor: grab;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}
.hud-drag-handle:hover { border-color: rgba(var(--tw-season-accent-rgb), 0.55); background: rgba(var(--tw-season-accent-rgb), 0.12); }
.hud-drag-handle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--tw-season-accent-rgb), 0.18); border-color: rgba(var(--tw-season-accent-rgb), 0.60); }
.hud-drag-handle:active { cursor: grabbing; }

.hud-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hud-drop-slot {
  border: 3px solid rgba(var(--tw-season-accent-rgb), 0.72);
  border-radius: 14px;
  box-sizing: border-box;
  background: rgba(var(--tw-season-accent-rgb), 0.06);
}

.hud-modules.hud-drop-target {
  outline: 3px solid rgba(var(--tw-season-accent-rgb), 0.28);
  outline-offset: 6px;
  border-radius: 16px;
}

.hud-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate3d(0,0,0);
  opacity: 0.98;
  filter: drop-shadow(0 18px 55px rgba(0,0,0,0.65));
}

.hud-drag-origin-hidden {
  display: none !important;
}

.hud-right-title {
  font-family: "Jersey 10", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 46px;
  line-height: 1;
  letter-spacing: 0.8px;
  color: rgb(var(--tw-season-accent-hi-rgb));
  text-shadow:
    0 2px 14px rgba(0,0,0,0.55),
    0 0 18px rgba(var(--tw-season-accent-rgb), 0.22);
  padding: 2px 2px 0;
  text-align: center;
  user-select: none;
}

.sidebar-version {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 10px;
  color: rgba(230,233,239,0.30);
  letter-spacing: 0.2px;
}

.sidebar-legend {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(230,233,239,0.82);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.sidebar-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.92;
}
.sidebar-legend .legend-sep {
  opacity: 0.35;
  margin: 0 2px;
}

/* Controls / movement legend HUD (stacked in top-right with other buttons/cards) */
.legend-card {
  width: 100%;
  border-radius: 14px;
  padding: 10px 10px 10px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 16px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
  background:
    radial-gradient(240px 120px at 20% 0%, rgba(120,180,255,0.16), transparent 60%),
    radial-gradient(220px 140px at 90% 90%, rgba(255,200,90,0.10), transparent 60%),
    rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
}

.legend-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.legend-title {
  font-weight: 900;
  letter-spacing: 0.4px;
  color: rgba(240,244,255,0.95);
}

.legend-close {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.28);
  color: rgba(240,244,255,0.92);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.legend-close:hover { border-color: rgba(var(--tw-season-accent-rgb), 0.55); background: rgba(var(--tw-season-accent-rgb), 0.14); }
.legend-close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--tw-season-accent-rgb), 0.18); border-color: rgba(var(--tw-season-accent-rgb), 0.60); }

.legend-body {
  font-size: 11px;
  line-height: 1.5;
  color: rgba(230,233,239,0.86);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.legend-body .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0.92;
}
.legend-body .legend-sep {
  opacity: 0.35;
  margin: 0 2px;
}

.legend-toggle {
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.32);
  color: rgba(240,244,255,0.92);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.2px;
}
.legend-toggle:hover { border-color: rgba(var(--tw-season-accent-rgb), 0.55); background: rgba(var(--tw-season-accent-rgb), 0.14); }
.legend-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--tw-season-accent-rgb), 0.18); border-color: rgba(var(--tw-season-accent-rgb), 0.60); }

.title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.section {
  margin-top: 14px;
}

.label {
  font-size: 12px;
  opacity: 0.75;
  margin-bottom: 6px;
}

#stats {
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
}

#events {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.98;
  white-space: pre-wrap;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.24);
  border-radius: 10px;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
}

/* Sidebar UI bits */
kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 1px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.3;
  color: #f3f6ff;
}

/* Modern sidebar HUD */
.hud {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hud-top {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 10px;
}

.hud-who {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}

.hud-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hud-section {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px;
}

.hud-section-title {
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 8px;
  color: #f3f6ff;
}

.hud-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hud-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.10));
  color: #f0f4ff;
  cursor: pointer;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.hud-btn:hover { border-color: rgba(120,180,255,0.45); background: rgba(120,180,255,0.14); }
.hud-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(120,180,255,0.18); border-color: rgba(120,180,255,0.60); }

.hud-key {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 900;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.14);
  color: #f6f8ff;
}
.hud-btn-label { font-weight: 800; }

.hud-note {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hud-note-text { opacity: 0.9; }

.hud-next {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.hud-stats { display: grid; gap: 6px; }
.hud-row {
  display: grid;
  grid-template-columns: var(--hud-k-w, 14ch) minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.hud-k {
  opacity: 0.75;
  font-size: 12px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-v {
  color: #eef2ff;
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  justify-self: end;
  text-align: right;
}

/* Rows with message-like content should read left-to-right and get more space. */
.hud-row-wide {
  --hud-k-w: 6ch;
}
.hud-row-wide .hud-v {
  justify-self: start;
  text-align: left;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.22);
  color: #f0f4ff;
}
.chip-on { border-color: rgba(80,220,140,0.45); background: rgba(80,220,140,0.12); }
.chip-bad { border-color: rgba(255,120,120,0.45); background: rgba(255,120,120,0.12); }
.chip-ok { border-color: rgba(80,220,140,0.55); background: rgba(80,220,140,0.18); }
.chip-warn { border-color: rgba(255,200,90,0.45); background: rgba(255,200,90,0.12); }

.side-card {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
}
.side-card-title {
  font-weight: 800;
  margin-bottom: 8px;
  color: #f3f6ff;
}

.side-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  color: #eef2ff;
  background: rgba(0,0,0,0.10);
}
.side-row + .side-row { margin-top: 4px; }

.side-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.side-right { opacity: 0.96; white-space: nowrap; color: #eef2ff; }

.side-muted { opacity: 0.9; color: rgba(240,244,255,0.92); }
.side-mono { font-variant-ligatures: none; }

.side-action {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
}
.side-action:hover.side-row {
  background: rgba(120,180,255,0.14);
  border-color: rgba(120,180,255,0.45);
}
.side-action:focus-visible.side-row {
  outline: none;
  box-shadow: 0 0 0 3px rgba(120,180,255,0.18);
  border-color: rgba(120,180,255,0.55);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.22);
  color: #f0f4ff;
}
.badge.ok { border-color: rgba(80,220,140,0.35); background: rgba(80,220,140,0.10); }
.badge.warn { border-color: rgba(255,200,90,0.35); background: rgba(255,200,90,0.10); }
.badge.bad { border-color: rgba(255,120,120,0.35); background: rgba(255,120,120,0.10); }

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
}

.modal.hidden { display: none; }

.panel {
  width: 560px;
  background: rgba(12,14,18,0.96);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 30px 90px rgba(0,0,0,0.6);
  padding: 18px;
  box-sizing: border-box;
}

/* The in-game UI modal needs more width for complex layouts like Market. */
#ui-modal .panel {
  width: 920px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.panel-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.panel-subtitle {
  opacity: 0.85;
  margin-bottom: 14px;
}

.input-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
}

.input-label {
  opacity: 0.8;
  font-size: 13px;
}

.input {
  background: #06080c;
  color: #e6e9ef;
  border: 1px solid rgba(255,255,255,0.20);
  padding: 10px 12px;
  outline: none;
  border-radius: 6px;
  font-size: 14px;
}

.input:focus {
  border-color: rgba(120,180,255,0.7);
  box-shadow: 0 0 0 3px rgba(120,180,255,0.15);
}

.panel-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.btn {
  background: #2d6cdf;
  border: 0;
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.btn:hover { filter: brightness(1.06); }

.panel-error {
  margin-top: 10px;
  color: #ffb4b4;
  min-height: 18px;
  white-space: pre-wrap;
}

.panel-ok {
  margin-top: 10px;
  color: rgba(160, 255, 200, 0.92);
  min-height: 18px;
  white-space: pre-wrap;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.panel-ok.active {
  opacity: 1;
  transform: translateY(0);
}

@keyframes okBounce {
  0% { transform: translateY(0) scale(1); }
  20% { transform: translateY(-1px) scale(1.06); }
  55% { transform: translateY(0) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}
.ok-bounce { animation: okBounce 520ms ease-out; }
.ok-green {
  border-color: rgba(80,220,140,0.65) !important;
  background: rgba(80,220,140,0.18) !important;
}
.panel-hint {
  margin-top: 12px;
  opacity: 0.7;
  font-size: 12px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
}

.tabs-spacer { flex: 1 1 auto; }

.tab {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #e6e9ef;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.tab.active {
  background: rgba(120,180,255,0.16);
  border-color: rgba(120,180,255,0.55);
}

.ui-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.22);
  border-radius: 10px;
  padding: 12px;
}

.card-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 10px;
  font-size: 13px;
  line-height: 1.5;
}

.kv .k { opacity: 0.8; }
.kv .v { opacity: 0.98; }

.craft-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.craft-row:first-child { border-top: 0; }

.craft-name { font-weight: 800; }
.craft-desc { opacity: 0.8; font-size: 12px; margin-top: 2px; }

.btn-secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: #e6e9ef;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}
.btn-secondary:hover { filter: brightness(1.06); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

/* Market layout (matches: top chart, bottom list + trade preview) */
.mk-meta {
  opacity: 0.85;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.mk-layout {
  display: grid;
  gap: 12px;
}

.mk-box-title {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.2px;
  text-transform: none;
  color: rgba(240,244,255,0.90);
  margin-bottom: 8px;
}

.mk-chart,
.mk-list,
.mk-trade {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px;
}

.mk-chart {
  height: 180px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
}

.mk-chart-inner {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.20);
}

.mk-chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.mk-chart-foot {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.mk-chart-sep { opacity: 0.35; }

.mk-bottom {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  min-height: 300px;
}

/* Inventory + crafting layout (2 rows; bottom 50/50) */
.ic-layout {
  display: grid;
  gap: 12px;
}

.ic-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 320px;
}

.ic-box {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px;
}

.ic-box-title {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.2px;
  color: rgba(240,244,255,0.90);
  margin-bottom: 8px;
}

.ic-selected-title { font-weight: 900; margin-bottom: 6px; }
.ic-selected-desc { opacity: 0.85; font-size: 12px; line-height: 1.5; margin-bottom: 10px; }
.ic-selected-sub { opacity: 0.85; font-size: 12px; margin-top: 8px; }
.ic-selected-actions { margin-top: 10px; }
.ic-selected-kv { margin-top: 8px; }

.ic-ingredients-title {
  font-weight: 800;
  text-transform: lowercase;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
  opacity: 0.92;
}

.ic-ingredients {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.ic-ingredients-empty {
  opacity: 0.75;
}

.ic-ingredient {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.ic-ingredient-left {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.ic-ingredient-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ic-ingredient-qty {
  font-weight: 900;
  opacity: 0.95;
}

.ic-ingredient.is-have { color: rgba(80, 220, 140, 0.95); }
.ic-ingredient.is-missing { color: rgba(255, 120, 120, 0.95); }

.ic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  grid-auto-rows: 54px;
  gap: 8px;
}

.ic-slot {
  position: relative;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 6px;
  color: #e6e9ef;
  cursor: pointer;
  display: grid;
  align-content: center;
  justify-items: center;
  overflow: hidden;
}

.ic-slot:hover { filter: brightness(1.07); }

.ic-slot.is-empty {
  opacity: 0.22;
  cursor: default;
  background: rgba(255,255,255,0.03);
}

.ic-slot.is-selected {
  border-color: rgba(120,180,255,0.70);
  background: rgba(120,180,255,0.14);
}

.ic-slot.is-equipped {
  border-color: rgba(255,190,120,0.55);
  background: rgba(255,190,120,0.12);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.45);
  filter: saturate(1.05);
}

.ic-slot-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,200,140,0.55);
  background: rgba(0,0,0,0.35);
  color: rgba(255,230,200,0.95);
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
  pointer-events: none;
}

.ic-slot-label {
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: 18px;
  line-height: 1;
  opacity: 0.95;
}

.ic-slot-qty {
  position: absolute;
  right: 6px;
  bottom: 5px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0.92;
  text-shadow: 0 1px 0 rgba(0,0,0,0.6);
}

.ic-slot-sub {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  font-size: 10px;
  line-height: 1.15;
  opacity: 0.78;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ic-slot-craft.is-locked { opacity: 0.55; }
.ic-slot-craft.is-craftable { border-color: rgba(80,220,140,0.35); }

.mk-list {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 300px;
}

.mk-list-inner {
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 8px;
  padding-top: 8px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.mk-grid {
  /* Reuse inventory/crafting icon grid sizing in the market tab. */
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  grid-auto-rows: 54px;
}

.mk-slot .ic-slot-label {
  font-size: 20px;
}

.mk-item {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.mk-item:hover { border-color: rgba(120,180,255,0.45); background: rgba(120,180,255,0.12); }
.mk-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(120,180,255,0.18); border-color: rgba(120,180,255,0.60); }
.mk-item.is-selected { border-color: rgba(120,180,255,0.65); background: rgba(120,180,255,0.16); }

.mk-item-name {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
}

/* On narrow screens, stack list above trade panel. */
@media (max-width: 720px) {
  .mk-chart { height: 160px; }
  .mk-bottom { grid-template-columns: 1fr; min-height: 0; }
}

.mk-trade {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  min-height: 300px;
}

.mk-trade-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 10px;
}

.mk-trade-kv {
  display: grid;
  grid-template-columns: 10ch 1fr;
  gap: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
}
.mk-trade-k { opacity: 0.72; }
.mk-trade-v { opacity: 0.96; text-align: right; font-variant-numeric: tabular-nums; }

.mk-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mk-side-btn.active {
  background: rgba(120,180,255,0.16);
  border-color: rgba(120,180,255,0.55);
}

.mk-qty {
  display: grid;
  grid-template-columns: 6ch 1fr;
  gap: 10px;
  align-items: center;
}
.mk-qty-label { opacity: 0.8; font-size: 12px; }

.mk-preview {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.16);
  border-radius: 12px;
  padding: 10px;
}
.mk-preview-title { font-weight: 900; margin-bottom: 8px; }
.mk-preview-body { display: grid; gap: 6px; }
.mk-preview-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.mk-preview-v { font-weight: 900; font-variant-numeric: tabular-nums; }
.mk-preview-sub { opacity: 0.80; min-height: 16px; }
.mk-preview-warn { margin-top: 6px; color: #ffb4b4; font-size: 12px; opacity: 0.95; min-height: 16px; }

.mk-actions {
  display: flex;
  justify-content: flex-end;
}
.mk-confirm { width: 100%; }

/* Market color semantics */
.mk-green { color: rgba(80, 220, 140, 0.95); }
.mk-red { color: rgba(255, 120, 120, 0.95); }
.mk-gold { color: rgba(255, 215, 90, 0.95); }

.mk-trade .btn-secondary.mk-buy {
  border-color: rgba(80, 220, 140, 0.40);
  background: rgba(80, 220, 140, 0.10);
}
.mk-trade .btn-secondary.mk-sell {
  border-color: rgba(255, 120, 120, 0.40);
  background: rgba(255, 120, 120, 0.10);
}
.mk-trade .btn-secondary.mk-buy.active { border-color: rgba(80, 220, 140, 0.70); background: rgba(80, 220, 140, 0.18); }
.mk-trade .btn-secondary.mk-sell.active { border-color: rgba(255, 120, 120, 0.70); background: rgba(255, 120, 120, 0.18); }

.mk-trade .btn-secondary.mk-confirm-buy {
  border-color: rgba(80, 220, 140, 0.55);
  background: rgba(80, 220, 140, 0.14);
}
.mk-trade .btn-secondary.mk-confirm-sell {
  border-color: rgba(255, 120, 120, 0.55);
  background: rgba(255, 120, 120, 0.14);
}


