.td-wrap {
  max-width: 1000px;
  margin: 0 auto;
}

/* Extra lift/glow on top of the shared .btn styling, scoped to this page
   only so it doesn't affect other pages sharing theme.css. */
.td-wrap .btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(57, 255, 20, 0.25);
}

.td-wrap .btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.td-wrap .btn {
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.92) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.td-window {
  overflow: visible;
}

.td-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 16px;
}

.canvas-holder {
  position: relative;
  flex: 1 1 500px;
  max-width: 780px;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #060a06;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.08), inset 0 0 40px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: none;
}

.panel {
  flex: 0 0 300px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Matches the canvas's native height so the board stays fully visible. */
  max-height: 600px;
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.stat {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 9px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green-dim), transparent 70%);
  opacity: 0.7;
}

.stat:hover {
  border-color: var(--green-dim);
  transform: translateY(-1px);
}

.stat span {
  font-size: 0.72rem;
  color: var(--green-faint);
  letter-spacing: 0.02em;
}

.stat strong {
  font-size: 1.15rem;
  color: var(--green);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.35);
  transition: text-shadow 0.2s ease;
}

.panel h3 {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--green-faint);
  font-weight: normal;
}

.tower-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tower-btn:not([hidden]) {
  display: flex;
}

.tower-btn {
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  font-size: 0.82rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tower-btn:hover:not(:disabled):not(.selected) {
  border-color: var(--green-faint);
  transform: translateX(2px);
}

.tower-btn .emoji {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.tower-btn .info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1px;
}

.tower-btn .name {
  color: var(--text);
}

.tower-btn .desc {
  color: var(--green-faint);
  font-size: 0.7rem;
}

.tower-btn .cost {
  color: var(--yellow);
  font-weight: bold;
  white-space: nowrap;
}

.tower-btn.selected {
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.25);
  animation: selectedPulse 1.6s ease-in-out infinite;
}

@keyframes selectedPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(57, 255, 20, 0.25); }
  50% { box-shadow: 0 0 16px rgba(57, 255, 20, 0.45); }
}

.tower-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wave-row {
  display: flex;
  gap: 8px;
}

.wave-btn {
  flex: 1;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: bold;
  background: linear-gradient(180deg, rgba(57, 255, 20, 0.12), transparent);
  box-shadow: 0 0 0 rgba(57, 255, 20, 0);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.wave-btn:hover:not(:disabled) {
  box-shadow: 0 0 18px rgba(57, 255, 20, 0.4);
}

.wave-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.auto-btn {
  flex: 0 0 66px;
  font-size: 0.78rem;
  padding: 8px;
}

.auto-btn.active {
  background: var(--green);
  color: #04150a;
}

.hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--green-faint);
}

.ability-row {
  display: flex;
  gap: 8px;
}

.ability-btn {
  flex: 1;
  color: var(--yellow);
  border-color: #7a6a1a;
  font-size: 0.78rem;
  padding: 8px;
}

.ability-btn:hover:not(:disabled) {
  background: var(--yellow);
  color: #1a1500;
}

.ability-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.speed-btn {
  flex: 0 0 52px;
  font-size: 0.78rem;
  padding: 8px;
}

.speed-btn.active {
  background: var(--cyan);
  color: #002229;
  border-color: var(--cyan);
}

.tower-info-panel {
  border: 1px solid var(--cyan);
  border-radius: 4px;
  background: var(--bg);
  padding: 10px;
  flex-direction: column;
  gap: 8px;
  /* Kept separate from .panel-scroll and never squeezed by it, so the
     upgrade/path box for the tower you're looking at stays put while you
     scroll the tower list above - it gets its own scrollbar if a deep
     path's history makes it taller than the space left over. */
  flex-shrink: 0;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
  animation: popIn 0.15s ease;
}

.tower-info-panel:not([hidden]) {
  display: flex;
}

.tower-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--cyan);
}

.tower-info-close {
  background: transparent;
  border: none;
  color: var(--green-faint);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.tower-info-stats {
  margin: 0;
  font-size: 0.75rem;
  color: var(--green-faint);
}

.tower-target-section {
  display: flex;
  gap: 6px;
}

.tower-target-section:empty {
  display: none;
}

.target-btn {
  flex: 1;
  padding: 6px 4px;
  font-size: 0.7rem;
}

.target-btn.active {
  background: var(--green);
  color: #04150a;
}

.tower-path-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tower-path-section:empty {
  display: none;
}

.tower-path-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--green-faint);
  font-style: italic;
}

.tower-path-chosen {
  margin: 0;
  font-size: 0.75rem;
  color: var(--yellow);
}

.multipath-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.multipath-group:first-child {
  border-top: none;
  padding-top: 0;
}

.multipath-heading {
  margin: 0;
  font-size: 0.78rem;
  color: var(--cyan);
  font-weight: bold;
}

.path-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  font-size: 0.72rem;
  text-align: left;
}

.path-btn .path-name {
  color: var(--text);
  white-space: nowrap;
}

.path-btn .path-desc {
  flex: 1;
  color: var(--green-faint);
}

.path-btn .path-cost {
  color: var(--yellow);
  font-weight: bold;
  white-space: nowrap;
}

.tower-info-actions {
  display: flex;
  gap: 8px;
}

.tower-info-actions .btn {
  flex: 1;
  font-size: 0.78rem;
  padding: 8px;
}

.tower-sell-btn {
  color: var(--red);
  border-color: #5a2323;
}

.tower-sell-btn:hover:not(:disabled) {
  background: var(--red);
  color: #1a0000;
}

.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}

.game-over-overlay.visible {
  display: flex;
}

.game-over-box {
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 24px 32px;
  box-shadow: 0 0 30px rgba(255, 68, 68, 0.2);
  animation: popIn 0.2s ease;
}

.game-over-box h2 {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 1.4rem;
}

.game-over-box p {
  color: var(--text);
  font-size: 0.9rem;
}

/* Shown in place of a plain toast the instant a difficulty/mode medal is
   earned (see showMedalOverlay) - same canvas-scoped overlay pattern as
   .game-over-overlay/.game-over-box (its "you won" sibling), gold-themed
   instead of red so the two read as opposites at a glance. */
.medal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}

.medal-overlay.visible {
  display: flex;
}

.medal-box {
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--yellow);
  border-radius: 6px;
  padding: 24px 32px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.25);
  animation: popIn 0.2s ease;
}

.medal-box h2 {
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: 1.4rem;
}

.medal-box p {
  color: var(--text);
  font-size: 0.9rem;
  margin: 0 0 16px;
  max-width: 280px;
}

.medal-overlay-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.change-map-btn, .pause-btn, .codex-btn {
  margin-left: 10px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}

.pause-overlay:not([hidden]) {
  display: flex;
}

.pause-box {
  width: min(280px, 90vw);
  background: var(--bg-panel);
  border: 1px solid var(--green-dim);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.12);
  animation: popIn 0.18s ease;
}

.pause-box h2 {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 1.2rem;
}

.pause-box .btn {
  width: 100%;
}

.map-confirm-overlay {
  z-index: 350;
}

.map-confirm-message {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}

.map-confirm-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}

.map-picker-overlay:not([hidden]) {
  display: flex;
}

.map-picker-box {
  width: min(760px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--green-dim);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.12);
  animation: popIn 0.18s ease;
}

.map-picker-box h2 {
  margin: 0 0 16px;
  color: var(--green);
  font-size: 1.2rem;
}

.map-picker-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-picker-back {
  position: absolute;
  left: 0;
  top: -2px;
  padding: 5px 10px;
  font-size: 0.72rem;
}

/* ---- Screen 1: map select - small path thumbnail + name only ---- */
.map-thumb-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.map-thumb-svg {
  width: 100%;
  aspect-ratio: 26 / 20;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.map-thumb-name {
  font-size: 0.95rem;
  font-weight: bold;
}

/* All 14 medals (3 difficulties + 11 modes) at a glance per map, so
   earning one shows up right on the map-select screen, not just the
   difficulty/mode screens behind it. Grouped into one tinted cluster per
   difficulty tier (see .medal-tier-group) with a visible gap between
   clusters, rather than one flat row. */
.map-thumb-medals {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}

.medal-tier-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tier-color, var(--border)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tier-color, var(--border)) 40%, transparent);
}

.medal-dot {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  opacity: 0.45;
  filter: grayscale(1);
}

.medal-dot.earned {
  opacity: 1;
  filter: none;
  border-color: var(--medal-color, var(--yellow));
  box-shadow: 0 0 4px var(--medal-color, var(--yellow));
}

/* ---- Screen 3: sub-difficulty / game mode select ---- */
.mode-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.mode-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-left-width: 4px;
  border-left-style: solid;
}

.mode-card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.mode-card .mode-name {
  font-weight: bold;
  color: var(--text);
}

.mode-card .mode-desc {
  font-size: 0.72rem;
  color: var(--green-faint);
  line-height: 1.35;
}

/* Each mode (and Standard) gets its own colored medal icon - grey/dim "⚪"
   while unearned, the mode's own unique emoji+color (--medal-color, set
   inline per mode) once that difficulty's sprint threshold is cleared. */
.mode-medal {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  opacity: 0.5;
  filter: grayscale(1);
}

.mode-medal.earned {
  opacity: 1;
  filter: none;
  border-color: var(--medal-color, var(--yellow));
  box-shadow: 0 0 8px var(--medal-color, var(--yellow));
}

/* The Gauntlet (secret, Full-Clear-reward mode) - same "no single color
   fits this" reasoning as .map-thumb-card-prismatic. The card's left
   border cycles through the rainbow (a single edge can't use the
   gradient-clip trick); the circular medal badge reuses that same
   gradient-clip + prismaticShift animation since it IS a full border. */
.mode-card-prismatic {
  animation: prismaticBorderCycle 3s linear infinite;
}

@keyframes prismaticBorderCycle {
  0% { border-left-color: #ff3b3b; }
  16% { border-left-color: #ffae00; }
  33% { border-left-color: #fff700; }
  50% { border-left-color: #3bff6e; }
  66% { border-left-color: #3bb0ff; }
  83% { border-left-color: #a13bff; }
  100% { border-left-color: #ff3b3b; }
}

/* Grey/dim like every other unearned medal until actually beaten - only
   .earned gets the rainbow treatment, same earned/unearned contract as
   .mode-medal.earned above. */
.mode-medal-prismatic.earned {
  border: 2px solid transparent;
  background-image:
    linear-gradient(var(--bg-panel), var(--bg-panel)),
    linear-gradient(90deg, #ff3b3b, #ffae00, #fff700, #3bff6e, #3bb0ff, #a13bff, #ff3b3b);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-size: 100% 100%, 300% 100%;
  animation: prismaticShift 5s linear infinite;
  opacity: 1;
  filter: none;
}

.map-picker-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 560px) {
  .map-picker-list {
    grid-template-columns: 1fr;
  }
}

.map-picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: center;
  padding: 10px;
}

.map-picker-name {
  font-size: 1.05rem;
  font-weight: bold;
}

.map-picker-tier {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  margin: 2px 0;
}

.map-picker-tier-easy {
  color: var(--green);
  border: 1px solid var(--green-dim);
}

.map-picker-tier-medium {
  color: var(--yellow);
  border: 1px solid #7a6a1a;
}

.map-picker-tier-hard {
  color: var(--red);
  border: 1px solid #5a2323;
}

.map-picker-meta {
  font-size: 0.72rem;
  color: var(--green-faint);
}

/* The map's one save, shown as a directly clickable "resume" button
   instead of plain text (see .map-picker-meta above, still used for the
   "not started yet" case) - one click loads it, no detour through the
   mode screen required. */
.map-picker-continue-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 10px;
  border-color: var(--green);
  background: rgba(57, 255, 20, 0.08);
}

.map-picker-continue-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--green);
}

.map-picker-continue-meta {
  font-size: 0.68rem;
  color: var(--green-faint);
}

.map-picker-best {
  font-size: 0.65rem;
  color: var(--green-faint);
  opacity: 0.75;
  text-align: right;
  white-space: nowrap;
  line-height: 1.4;
}

.map-picker-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: var(--bg);
}

.map-picker-diff-row {
  display: flex;
  gap: 6px;
}

.map-picker-diff-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 0.7rem;
}

.map-picker-diff-btn.active {
  background: var(--green);
  color: #04150a;
}

.map-picker-diff-btn.has-save:not(.active)::after {
  content: " •";
  color: var(--cyan);
}

.map-picker-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.map-picker-header-row .map-picker-btn {
  width: auto;
  flex: 1;
  min-width: 0;
}

.map-picker-medal-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.map-picker-medal {
  font-size: 0.68rem;
  color: var(--green-faint);
  opacity: 0.6;
}

.map-picker-medal.earned {
  color: var(--medal-color, var(--yellow));
  opacity: 1;
  text-shadow: 0 0 6px var(--medal-color, var(--yellow));
}

/* Border color reflects the HIGHEST difficulty tier fully mastered (every
   medal in that tier, including all its modes, not just the plain
   difficulty medal) - bronze/silver/gold via --medal-color, set inline per
   card (see renderMapScreen) from the same DIFFICULTY_MEDAL_STYLES colors
   used everywhere else a difficulty gets a medal look. */
.map-thumb-card-mastered {
  border-color: var(--medal-color, var(--yellow));
  box-shadow: 0 0 12px color-mix(in srgb, var(--medal-color, var(--yellow)) 45%, transparent);
}

/* Full Clear (every one of the 14 medals on this one map) - a step above
   the flat bronze/silver/gold mastered border: an animated rainbow
   gradient border instead of a single --medal-color, since no one flat
   color fits "beat literally everything". */
.map-thumb-card-prismatic {
  border: 3px solid transparent;
  background-image:
    linear-gradient(var(--bg-panel), var(--bg-panel)),
    linear-gradient(90deg, #ff3b3b, #ffae00, #fff700, #3bff6e, #3bb0ff, #a13bff, #ff3b3b);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  background-size: 100% 100%, 300% 100%;
  animation: prismaticShift 5s linear infinite;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35);
}

@keyframes prismaticShift {
  from { background-position: 0 0, 0% 0; }
  to { background-position: 0 0, 300% 0; }
}

.codex-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}

.codex-overlay:not([hidden]) {
  display: flex;
}

.codex-box {
  width: min(560px, 92vw);
  max-height: 85vh;
  background: var(--bg-panel);
  border: 1px solid var(--green-dim);
  border-radius: 6px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.12);
  animation: popIn 0.18s ease;
}

.codex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.codex-header h2 {
  margin: 0;
  color: var(--green);
  font-size: 1.1rem;
}

.codex-close {
  background: transparent;
  border: none;
  color: var(--green-faint);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.codex-content {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.codex-section h3 {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.9rem;
}

.codex-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

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

.codex-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.codex-row-name {
  color: var(--text);
  font-weight: bold;
  display: block;
}

.codex-row-desc {
  color: var(--green-faint);
}

.tower-info-popup-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
}

/* Unlocked by typing cheat123 into the hidden bottom-left cheat box - a
   small always-available panel (not another full overlay) since it's meant
   to be left open and poked at mid-game, not stepped through like a dialog. */
.cheat-panel {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 60;
  background: var(--bg-panel);
  border: 1px solid var(--cyan);
  border-radius: 4px;
  padding: 8px;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font);
  font-size: 0.72rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.cheat-panel:not([hidden]) {
  display: flex;
}

.cheat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--cyan);
}

.cheat-panel-close {
  background: none;
  border: none;
  color: var(--green-faint);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.cheat-panel-close:hover {
  color: var(--red);
}

.cheat-panel-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cheat-panel-row label {
  color: var(--green-faint);
  width: 40px;
  flex-shrink: 0;
}

.cheat-panel-row input {
  width: 80px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.72rem;
  padding: 3px 5px;
}

.cheat-panel-row input:focus {
  outline: none;
  border-color: var(--cyan);
}

.cheat-panel-row .btn {
  padding: 3px 8px;
  font-size: 0.7rem;
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:first-child {
  padding-top: 0;
}

.setting-row:last-of-type {
  border-bottom: none;
}

.setting-row-toggle {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.setting-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text);
}

.setting-value {
  color: var(--cyan);
  font-weight: bold;
}

.setting-row input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  background: transparent;
}

#settingsReset {
  margin-top: 14px;
  width: 100%;
  font-size: 0.78rem;
  padding: 8px;
}

.achievement-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -20px);
  z-index: 500;
  background: var(--bg-panel);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.achievement-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
