:root {
  --bg: #070b12;
  --panel: rgba(12, 18, 32, 0.88);
  --border: rgba(56, 220, 200, 0.35);
  --teal: #3ce0c8;
  --teal-dim: #1a8f80;
  --amber: #f0b429;
  --text: #e8f4f2;
  --muted: #8aa8a4;
  --danger: #ff6b6b;
  --glass: blur(16px);
  --font-display: "Orbitron", system-ui, sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, monospace;
}

/* Commercial tiers */
.tier-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 180, 41, 0.28);
  background: rgba(240, 180, 41, 0.06);
}

.tier-bar-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  font-family: var(--font-display);
}

.tier-seg {
  flex: 1;
  min-width: 180px;
}

.tier-seg .seg-btn {
  font-size: 0.72rem;
  padding: 0.4rem 0.45rem;
}

.tier-active-blurb {
  margin: 0 0 0.75rem;
}

.maintenance-msg {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.1);
  color: #ffb4b4;
  font-size: 0.85rem;
}

.seg-btn.locked,
.seg-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}

.seg-btn.coming-soon,
.seg-btn.coming-soon:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  text-decoration: none;
  border-style: dashed;
  color: var(--muted);
}
.seg-btn.coming-soon.active {
  opacity: 1;
}

.tier-card.soon {
  opacity: 0.72;
  border-style: dashed;
}
.tier-card.soon .btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.coming-soon-panel {
  padding: 1.15rem 1rem;
  border-radius: 12px;
  border: 1px dashed rgba(240, 180, 41, 0.45);
  background: rgba(240, 180, 41, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-start;
}
.coming-soon-badge {
  display: inline-block;
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}
.tab.coming-soon-tab {
  opacity: 0.7;
  position: relative;
}
.tab.coming-soon-tab::after {
  content: "soon";
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--amber);
  margin-left: 0.25rem;
  text-transform: uppercase;
}

.gate-lock {
  padding: 1rem;
  border-radius: 10px;
  border: 1px dashed rgba(240, 180, 41, 0.4);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}

.fog-field.tier-locked {
  opacity: 0.55;
}

.tier-compare-panel {
  width: min(960px, 96vw);
  max-height: 90vh;
  overflow: auto;
}

.tier-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin: 0.5rem 0 1rem;
}

.tier-card {
  border: 1px solid rgba(56, 220, 200, 0.2);
  border-radius: 12px;
  padding: 0.9rem;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tier-card.active {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px rgba(240, 180, 41, 0.35);
}

.tier-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.tier-card-price {
  margin: 0;
  color: var(--teal);
  font-size: 0.85rem;
}

.tier-card-badge {
  margin: 0;
  font-size: 0.72rem;
  color: var(--amber);
  letter-spacing: 0.04em;
}

.tier-card ul {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  flex: 1;
}

.tier-card .btn {
  width: 100%;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-divider {
  border: none;
  border-top: 1px solid rgba(56, 220, 200, 0.2);
  margin: 0.75rem 0;
}

.admin-wallet-grid,
.admin-bps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
@media (max-width: 560px) {
  .admin-wallet-grid,
  .admin-bps-grid {
    grid-template-columns: 1fr;
  }
}

.admin-panel textarea.editor-select {
  resize: vertical;
  min-height: 3rem;
  font-family: inherit;
}

.jackpot-banner {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 180, 41, 0.45);
  background: linear-gradient(120deg, rgba(240, 180, 41, 0.12), rgba(60, 224, 200, 0.06));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
}
.jackpot-banner.hidden {
  display: none !important;
}
.jackpot-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}
.jackpot-value {
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 600;
}
.jackpot-season {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}

.admin-seed-result {
  margin: 0.65rem 0 0.25rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(60, 224, 200, 0.28);
  background: rgba(60, 224, 200, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-seed-headline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--teal);
}
.admin-seed-advice {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
.admin-seed-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  font-size: 0.75rem;
}
@media (max-width: 560px) {
  .admin-seed-breakdown {
    grid-template-columns: 1fr;
  }
}
.admin-seed-breakdown div {
  border: 1px solid rgba(56, 220, 200, 0.15);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: rgba(0, 0, 0, 0.25);
}
.admin-seed-breakdown strong {
  display: block;
  color: var(--amber);
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.btn.sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
}

.field em.muted {
  font-style: normal;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  overflow: hidden;
}

/* Play page: same site chrome as landing when not in a run */
body.play-body {
  --nav-h: 3.75rem;
  overflow: hidden;
}

body.play-body .play-site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 32;
}

body.play-body.is-playing .play-site-header,
body.play-body.is-playing .site-drawer,
body.play-body.is-playing .site-drawer-backdrop {
  display: none !important;
}

#app {
  position: relative;
  width: 100vw;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

body.play-body #app {
  height: 100vh;
  height: 100dvh;
}

/* Offset start / finish / scores panels under sticky site header */
body.play-body:not(.is-playing) .panel-screen {
  padding-top: calc(var(--nav-h) + 0.5rem);
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  align-items: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.play-body:not(.is-playing) .panel-screen .panel {
  margin: 0.5rem auto 1.5rem;
}

#game-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #05080f;
}

.overhead-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  display: block;
  background: #02050a;
  cursor: crosshair;
}

.overhead-hint {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(8, 14, 24, 0.82);
  border: 1px solid rgba(56, 220, 200, 0.2);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

/* In overhead, chrome only shows the CARTOGRAPH chip at top */
.ingame-chrome.overhead-mode {
  top: 0.85rem;
}

.btn.danger {
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 100, 100, 0.45);
  color: #ff8a8a;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
}

.btn.danger:hover {
  background: rgba(255, 80, 80, 0.22);
}

.lib-actions {
  margin-top: 0.5rem;
}

.lib-actions .btn {
  flex: 1;
  width: auto;
}

.hidden {
  display: none !important;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(60, 224, 200, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(240, 180, 41, 0.06), transparent 40%),
    rgba(4, 8, 14, 0.72);
  z-index: 20;
}

.panel {
  width: min(440px, 92vw);
  padding: 2rem 2.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 24px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: var(--glass);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(92vh, 900px);
  overflow: auto;
}

.panel.wide {
  width: min(560px, 94vw);
}

@media (max-width: 600px) {
  .panel {
    width: min(100%, calc(100vw - 1.25rem));
    padding: 1.15rem 1rem 1.35rem;
    max-height: none;
    gap: 0.7rem;
  }
  .panel.wide {
    width: min(100%, calc(100vw - 1.25rem));
  }
  .title {
    font-size: clamp(1.25rem, 6vw, 1.7rem);
  }
  .tier-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .tier-seg {
    min-width: 0;
    width: 100%;
  }
  .tabs {
    flex-wrap: wrap;
  }
  .tabs .tab {
    flex: 1 1 40%;
    min-width: 0;
    font-size: 0.72rem;
    padding: 0.55rem 0.4rem;
  }
  .controls-legend {
    font-size: 0.72rem;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.glass {
  position: relative;
}

.eyebrow {
  margin: 0 0 0.35rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--teal);
}

.title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: 0.08em;
  background: linear-gradient(120deg, var(--teal), #a8fff3 40%, var(--amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.title.sm {
  font-size: 1.45rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
  padding: 0.15rem 0;
}

.tab-pane {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.25rem 0 0.5rem;
}

.field > span:first-child {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.dim-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#dim-input,
#initials-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  text-align: center;
  padding: 0.55rem 0.75rem;
  outline: none;
}

#initials-input {
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

#dim-input:focus,
#initials-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(60, 224, 200, 0.15);
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 0.85rem 1.2rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  width: 100%;
  background: linear-gradient(135deg, #1a8f80, #3ce0c8);
  color: #04120f;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(60, 224, 200, 0.25);
}

.btn.primary:hover {
  box-shadow: 0 10px 36px rgba(60, 224, 200, 0.4);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
  min-width: 2.75rem;
}

.btn.link {
  width: 100%;
  margin-top: 0.75rem;
  background: transparent;
  color: var(--muted);
  border: none;
  letter-spacing: 0.08em;
}

.btn.link:hover {
  color: var(--teal);
}

.hud {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 10;
}

.hud-top {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stat-chip {
  background: rgba(8, 14, 24, 0.78);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  min-width: 5.5rem;
  backdrop-filter: blur(8px);
}

.stat-chip .label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.stat-chip .value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--teal);
}

.hud-hint {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(8, 14, 24, 0.65);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 220, 200, 0.15);
  white-space: nowrap;
}

.minimap-wrap {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(6, 10, 18, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.minimap-title {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--teal);
  text-align: center;
  margin-bottom: 0.35rem;
}

#minimap {
  display: block;
  width: 200px;
  height: 200px;
  border-radius: 6px;
  background: #02050a;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0 0.75rem;
}

.stats-grid > div {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(56, 220, 200, 0.18);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}

.stats-grid .label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stats-grid .value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text);
}

.stats-grid .score-cell {
  grid-column: 1 / -1;
  border-color: rgba(240, 180, 41, 0.35);
}

.stats-grid .value.score {
  font-size: 1.85rem;
  color: var(--amber);
}

.formula-note {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 1rem;
}

.highscore-entry .badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(240, 180, 41, 0.15);
  color: var(--amber);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}

.board {
  margin: 0.75rem 0 1rem;
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(56, 220, 200, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
}

.board table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.board th,
.board td {
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.board th {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  border-bottom: 1px solid rgba(56, 220, 200, 0.12);
}

.board td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.board tr:last-child td {
  border-bottom: none;
}

.board .rank {
  color: var(--teal-dim);
  width: 2rem;
}

.board .score-col {
  color: var(--amber);
  font-family: var(--font-display);
}

.row-actions {
  display: flex;
  gap: 0.6rem;
}

.row-actions .btn {
  flex: 1;
}

.toast {
  position: absolute;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(12, 18, 32, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Scrollbar */
.board::-webkit-scrollbar {
  width: 6px;
}
.board::-webkit-scrollbar-thumb {
  background: var(--teal-dim);
  border-radius: 4px;
}

/* Tabs */
.tabs,
.board-tabs {
  display: flex;
  gap: 0.55rem;
  margin: 0.25rem 0 0.5rem;
}

.dim-row {
  gap: 0.65rem;
}

.seg {
  gap: 0.5rem;
}

.fog-field {
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(56, 220, 200, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 0.35rem;
}

.check-row {
  margin: 0.5rem 0 0.75rem;
  gap: 0.65rem;
}

.board-label {
  margin: 0.5rem 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.chrome-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.fps-hint {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(8, 14, 24, 0.75);
  border: 1px solid rgba(56, 220, 200, 0.15);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  pointer-events: none;
}

/* Touch controls */
.touch-ui {
  position: absolute;
  inset: 0;
  z-index: 11;
  pointer-events: none;
}

.touch-ui:not(.hidden) {
  display: block;
}

.touch-stick-area {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 42%;
  height: 45%;
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1.25rem;
}

.touch-look-area {
  position: absolute;
  right: 0;
  top: 0;
  width: 55%;
  height: 100%;
  pointer-events: auto;
}

.touch-stick-base {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid rgba(60, 224, 200, 0.35);
  background: rgba(8, 14, 24, 0.45);
  position: relative;
}

.touch-stick-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(60, 224, 200, 0.55);
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -24px 0 0 -24px;
  transition: transform 0.05s linear;
}

.touch-label {
  position: absolute;
  bottom: 0.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.touch-look-area .touch-label {
  bottom: 1.5rem;
  right: 1.5rem;
  left: auto;
  transform: none;
}

.touch-dpad {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  width: 160px;
  height: 160px;
  pointer-events: auto;
}

.touch-ui.mode-overhead .touch-stick-area,
.touch-ui.mode-overhead .touch-look-area {
  display: none;
}

.touch-ui.mode-overhead .touch-dpad {
  display: block;
}

.touch-ui.mode-fps .touch-dpad {
  display: none;
}

.pad-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 14, 24, 0.75);
  color: var(--teal);
  font-size: 1rem;
  pointer-events: auto;
}

.pad-n { left: 56px; top: 0; }
.pad-s { left: 56px; bottom: 0; }
.pad-w { left: 0; top: 56px; }
.pad-e { right: 0; top: 56px; }

@media (hover: hover) and (pointer: fine) {
  .touch-ui {
    display: none !important;
  }
}

/* Maze editor */
.editor-screen {
  align-items: stretch;
  justify-content: stretch;
  padding: 0.75rem;
  background: rgba(4, 8, 14, 0.92);
}

.editor-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(56, 220, 200, 0.15);
}

.editor-header .title {
  margin: 0;
}

.editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 0;
}

.editor-tools {
  padding: 1rem;
  border-right: 1px solid rgba(56, 220, 200, 0.12);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.marker-teaser-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.marker-teaser-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mk-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.marker-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.marker-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(56, 220, 200, 0.12);
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}

.marker-legend-chip:hover,
.marker-legend-chip.active {
  border-color: rgba(56, 220, 200, 0.45);
  color: var(--text);
}

.marker-score-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--amber);
  line-height: 1.35;
}

.marker-config-preview {
  margin: 0;
  font-size: 0.78rem;
  color: var(--teal);
  font-family: var(--font-mono);
}

.marker-config-actions {
  margin-top: 0.15rem;
}

.config-type-field {
  margin: 0;
}

.editor-canvas-wrap {
  min-height: 0;
  position: relative;
  background: #02050a;
}

#editor-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.editor-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
}

.editor-status {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(56, 220, 200, 0.15);
  font-size: 0.85rem;
  color: var(--teal);
}

.tool-seg {
  flex-wrap: wrap;
}

.tool-seg .seg-btn {
  flex: 1 1 40%;
  min-width: 0;
}

@media (max-width: 800px) {
  .editor-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .editor-tools {
    border-right: none;
    border-bottom: 1px solid rgba(56, 220, 200, 0.12);
    max-height: 40vh;
  }
  .editor-canvas-wrap {
    min-height: 45vh;
  }
}

.marker-help {
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 220, 200, 0.18);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.marker-help strong {
  color: var(--teal);
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.marker-help-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.marker-config-title {
  color: var(--amber);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

/* Editor marker config modal */
.editor-marker-modal {
  z-index: 50;
  background: rgba(2, 6, 12, 0.72);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.marker-config-modal-panel {
  width: min(440px, 96vw);
  max-height: min(88vh, 720px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid rgba(240, 180, 41, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.marker-config-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.marker-config-modal-header .title {
  margin: 0.15rem 0 0;
}

.marker-config-meta {
  margin: 0;
}

.marker-config-help {
  padding: 0.55rem 0.65rem;
}

.marker-config-help strong {
  font-size: 0.72rem;
}

.marker-config-fields {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.marker-config-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.marker-config-fields input[type="text"],
.marker-config-fields input[type="number"],
.marker-config-fields textarea {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.45rem 0.55rem;
  text-transform: none;
  letter-spacing: normal;
}

.marker-config-fields textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.marker-config-fields .bool-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.85rem;
  color: var(--text);
}

.inventory-bar {
  position: absolute;
  top: 4.5rem;
  left: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: min(60vw, 420px);
  z-index: 11;
  pointer-events: none;
}

.inventory-lite {
  top: auto;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  justify-content: center;
}

.inv-chip {
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #93c5fd;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
}

.marker-modal {
  z-index: 40;
}

.marker-panel {
  width: min(480px, 94vw);
}

.marker-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.marker-choices .btn {
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.tab {
  flex: 1;
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.55rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}

.tab.active {
  color: #04120f;
  background: linear-gradient(135deg, #1a8f80, #3ce0c8);
  border-color: transparent;
}

.tab-pane.hidden {
  display: none !important;
}

.controls-legend {
  margin: 1rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}

.controls-legend strong {
  color: var(--teal);
  font-weight: 400;
}

.subtitle.sm {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.lib-hint {
  margin: 0 0 0.75rem;
}

.maze-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid rgba(56, 220, 200, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 0.75rem;
}

.maze-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.maze-row:last-child {
  border-bottom: none;
}

.maze-row .meta {
  font-size: 0.8rem;
  line-height: 1.35;
}

.maze-row .meta .name {
  color: var(--teal);
  letter-spacing: 0.06em;
}

.maze-row .meta .sub {
  color: var(--muted);
  font-size: 0.72rem;
}

.maze-row .actions {
  display: flex;
  gap: 0.35rem;
}

.maze-row .actions .btn {
  padding: 0.45rem 0.55rem;
  font-size: 0.65rem;
  width: auto;
  min-width: 0;
}

.btn.full {
  width: 100%;
}

.ingame-chrome {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.ingame-chrome .chrome-row,
.ingame-chrome .chrome-btn,
.ingame-chrome .view-chip {
  pointer-events: auto;
}

.ingame-chrome .chrome-btn {
  width: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.7rem;
  background: rgba(8, 14, 24, 0.88);
  border: 1px solid var(--border);
  color: var(--muted);
}

.ingame-chrome .chrome-btn.on {
  color: var(--amber);
  border-color: rgba(240, 180, 41, 0.45);
}

.aid-warning {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--amber);
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.3);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.category-badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}

.category-badge.clean {
  background: rgba(60, 224, 200, 0.12);
  color: var(--teal);
}

.category-badge.assisted {
  background: rgba(240, 180, 41, 0.15);
  color: var(--amber);
}

/* Segmented control */
.seg {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.seg-btn {
  flex: 1;
  min-width: 5.5rem;
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}

.seg-btn.active {
  color: #04120f;
  background: linear-gradient(135deg, #1a8f80, #3ce0c8);
  border-color: transparent;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  margin: 0.35rem 0 0.65rem;
}

.check-row input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--teal);
}

.fog-field .subfield {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fog-field .muted {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.view-chip {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--teal);
  background: rgba(8, 14, 24, 0.78);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.board-tabs.wrap {
  flex-wrap: wrap;
}

#fog-distance {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  text-align: center;
  padding: 0.45rem 0.6rem;
  outline: none;
}

#fog-distance:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(60, 224, 200, 0.15);
}

.fog-field.disabled-fog #fog-distance,
.fog-field.disabled-fog #fog-minus,
.fog-field.disabled-fog #fog-plus {
  opacity: 0.4;
  pointer-events: none;
}
