/* TBGeodash shares TBGStack's page, palette, score and game controls. The game itself is drawn in tbgeodash.js. */
.stage { background: linear-gradient(to top, #2a1368 0%, #1b0f4a 45%, #0a0720 100%); }
/* The canvas gets keyboard focus when a round starts. Without this, the browser draws its blue focus ring
   (and on phones a blue tap highlight) around the game on the first jump. */
.stage canvas { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
/* The score: one big number at the top, like the original */
.dash-score {
  position: absolute;
  top: calc(0.4rem + var(--safe-top));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
}

.dash-score strong {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 900;
  color: var(--yellow);
  text-shadow: 0 0 14px rgba(255, 233, 77, 0.6);
}

.dash-score span {
  font-size: 0.85rem;
}

.dash-score b {
  color: var(--cyan);
}

/* Fullscreen: the score, the progress bar, "Nivå N" and "Ta bort punkt" grow with the picture (--ui, see
   css/game-stage.css; the start screen grows by itself there) */
.dash-score > * {
  zoom: var(--ui, 1);
}


.dash-progress { position: absolute; top: calc(5.3rem * var(--ui, 1) + var(--safe-top)); left: 22%; right: 22%; height: calc(4px * var(--ui, 1)); background: #5ef0ff26; pointer-events: none; }
.dash-progress div { height: 100%; width: 0; background: var(--yellow); box-shadow: 0 0 8px #ffe94d80; }
.game-help { max-width: 60rem; color: var(--text-muted); }
#score-status { min-height: 1.4em; color: var(--cyan); }
/* The result screen sits low. "safe": if it is taller than the box (a phone, medals under the text) it starts at the
   top and js/game-ui.js shrinks it to fit, instead of its title sliding out above the box */
.overlay.overlay-light { justify-content: flex-end; justify-content: safe flex-end; background: linear-gradient(to top, rgba(14,10,36,0.9), rgba(14,10,36,0.55) 45%, transparent 75%); }
@media (max-width: 480px) { .stage { --aspect: 4 / 3; } .overlay p { font-size: 0.9rem; margin-bottom: 0.5rem; } .dash-score strong { font-size: 2.2rem; } }

/* "Nivå N" in the bottom-left corner while playing */
.dash-level { position: absolute; left: calc(0.8rem + var(--safe-left)); bottom: calc(0.2rem + var(--safe-bottom)); margin: 0; color: var(--text-muted); font-size: calc(0.85rem * var(--ui, 1)); font-weight: 800; font-style: italic; pointer-events: none; }

/* ---------- The menu (start, result, pause) ----------
   Owner, 2026-11-11: "allt ser rätt trist och wonky ut". One picture card per level in its own theme, ONE big play
   button, the small choices as quiet chips under it, and the result as a big number with a bar. */

/* The level behind the menu shows through in the middle; the edges are darker so the menu reads */
.overlay { background: radial-gradient(ellipse at 50% 42%, rgba(14, 10, 36, 0.5), rgba(14, 10, 36, 0.86) 78%); }
.overlay h2 { font-size: 2.6rem; margin-bottom: 0.7rem; letter-spacing: 0.02em; }
.overlay p { margin-bottom: 0.9rem; }
.overlay p[hidden] { display: none; }
/* The start screen's title: a small yellow cube hops in front of it, like the player */
.overlay.is-start h2::before {
  content: ""; display: inline-block; width: 0.62em; height: 0.62em; margin-right: 0.35em; vertical-align: 0.02em;
  background: var(--yellow); box-shadow: 0 0 14px rgba(255, 233, 77, 0.7);
  animation: dash-hop 2.6s cubic-bezier(0.3, 0, 0.5, 1) infinite;
}
@keyframes dash-hop {
  0%, 62%, 100% { transform: translateY(0) rotate(0deg); }
  78% { transform: translateY(-0.55em) rotate(90deg); }
  94% { transform: translateY(0) rotate(180deg); }
}

/* While a menu shows, the round's own numbers step back: only the record stays at the top */
.stage.menu-open .dash-score, .stage.menu-open .dash-progress, .stage.menu-open .dash-level { visibility: hidden; }
/* The record, under the start screen's title */
.overlay p.dash-best { margin: -0.3rem 0 0.5rem; font-size: 0.85rem; font-weight: 800; font-style: italic; text-transform: uppercase; color: var(--text-muted); }
.dash-best b { color: var(--cyan); }

/* The level cards (menu.js) */
.level-picker {
  display: flex; flex: none; flex-wrap: wrap; gap: 0.7rem; justify-content: center; width: 100%; max-width: 54rem; margin: 0 0 1rem;
  padding: 0.5rem 0.7rem 0.3rem;
}
.level-card {
  --edge: var(--cyan);
  position: relative; flex: 0 1 6.9rem; min-width: 4.7rem; height: 4.1rem; margin: 0; padding: 0; border: 0; cursor: pointer;
  background: var(--edge);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: transform 0.16s ease-out, filter 0.16s;
}
/* (.stage .level-card: stronger than game-stage.css's rule that makes every canvas in the box fill it) */
.stage .level-card .level-thumb {
  position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); display: block; object-fit: cover; cursor: inherit;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.level-num {
  position: absolute; left: 0.5rem; bottom: 0.3rem; font-size: 1.5rem; font-weight: 900; font-style: italic; line-height: 1;
  color: #fff; text-shadow: 0 0 6px #0e0a24, 0 2px 0 #0e0a24, 0 0 12px #0e0a24;
}
.level-badge { position: absolute; top: 0.3rem; right: 0.35rem; width: 1.15rem; height: 1.15rem; color: var(--yellow); filter: drop-shadow(0 0 3px #0e0a24) drop-shadow(0 1px 0 #0e0a24); }
.level-badge svg { width: 100%; height: 100%; display: block; }
/* How far you have come on the level: a thin line along the card's bottom */
.level-bar { position: absolute; left: 2px; right: 2px; bottom: 2px; height: 4px; background: rgba(14, 10, 36, 0.75); }
.level-bar i { display: block; height: 100%; background: var(--cyan); }
.level-card.is-done { --edge: var(--yellow); }
.level-card.is-done .level-bar i { background: var(--yellow); }
.level-card:hover:not(.is-locked), .level-card:focus-visible { transform: translateY(-3px); filter: brightness(1.15); }
.level-card:focus-visible { outline: none; --edge: #fff; }
/* The chosen level: bigger, a white edge, and it breathes a little */
.level-card.is-chosen { --edge: #fff; transform: translateY(-4px) scale(1.13); z-index: 1; animation: dash-chosen 1.8s ease-in-out infinite; }
@keyframes dash-chosen { 50% { filter: brightness(1.22); } }
/* Not open yet: the picture is dark and grey, a lock in the middle */
.level-card.is-locked { --edge: rgba(94, 240, 255, 0.28); cursor: not-allowed; }
.level-card.is-locked .level-thumb { filter: grayscale(0.85) brightness(0.42); }
.level-card.is-locked .level-num { opacity: 0.55; }
.level-card.is-locked .level-bar { display: none; }
.level-card.is-locked .level-badge { top: 50%; left: 50%; right: auto; width: 1.5rem; height: 1.5rem; margin: -0.8rem 0 0 -0.75rem; color: #d9d4f0; }
.level-card.is-shaking { animation: dash-shake 0.3s; }
@keyframes dash-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
/* CHALLENGES (Utmaningar, menu.js createChallengeCards): the same picture card, a little wider, a MAGENTA edge (they
   are hard), the name instead of a number; yellow once cleared. */
.challenge-card { --edge: var(--magenta, #ff3fb4); flex: 0 1 9.5rem; min-width: 6.5rem; }
.challenge-card.is-done { --edge: var(--yellow); }
.challenge-card .level-badge { color: var(--magenta, #ff3fb4); }
.challenge-card.is-done .level-badge { color: var(--yellow); }
.challenge-card .level-bar i { background: var(--magenta, #ff3fb4); }
.challenge-name {
  position: absolute; left: 0.45rem; right: 1.6rem; bottom: 0.4rem; font-size: 0.95rem; font-weight: 900; font-style: italic; line-height: 1.05;
  color: #fff; text-align: left; overflow-wrap: anywhere; text-shadow: 0 0 6px #0e0a24, 0 2px 0 #0e0a24, 0 0 12px #0e0a24;
}
.challenge-prov {
  position: absolute; top: 0.3rem; left: 0.45rem; padding: 0 0.3rem; font-size: 0.62rem; font-weight: 900; letter-spacing: 0.06em;
  color: #0e0a24; background: var(--yellow); transform: skewX(-8deg);
}

/* The play button: the one big thing to press */
.dash-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; min-width: 15rem;
  padding: 0.85rem 2.2rem; font-size: 1.3rem;
}
.dash-play-icon { width: 1.15em; height: 1.15em; display: block; }
.dash-play-icon svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.8)); }
.overlay.is-start .dash-play:not(:disabled) { animation: dash-breathe 2.2s ease-in-out infinite; }
@keyframes dash-breathe { 50% { filter: brightness(1.3); } }

/* How to jump: keys (or a finger), not a sentence */
.dash-hint { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 0.8rem; font-size: 0.9rem; font-weight: 700; color: var(--text-muted); }
.dash-hint[hidden] { display: none; }
.dash-hint-keys, .dash-hint-touch { display: inline-flex; align-items: center; gap: 0.3rem; }
.dash-hint kbd {
  font: inherit; font-size: 0.78rem; font-weight: 800; padding: 0.12rem 0.5rem; color: var(--text);
  background: rgba(14, 10, 36, 0.8); border: 1.5px solid rgba(94, 240, 255, 0.55); border-bottom-width: 3px; border-radius: 4px;
}
.dash-hint-icon { width: 1.25rem; height: 1.25rem; color: var(--cyan); }
.dash-hint-icon svg { width: 100%; height: 100%; display: block; }
.dash-hint-dot { opacity: 0.5; }
.dash-hint-touch, .dash-hint.is-touch .dash-hint-keys { display: none; }
.dash-hint.is-touch .dash-hint-touch { display: inline-flex; }

/* The small choices under the play button */
.practice-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; margin: 0.9rem 0 0; max-width: 36rem; }
.practice-row[hidden] { display: none; }
.dash-chip {
  display: inline-flex; align-items: center; margin: 0; line-height: 1.2; vertical-align: top; gap: 0.4rem; min-height: 2.2rem; padding: 0.3rem 0.85rem;
  font: inherit; font-size: 0.88rem; font-weight: 800; font-style: italic; text-decoration: none; cursor: pointer;
  color: var(--text); background: rgba(14, 10, 36, 0.72); border: 1.5px solid rgba(94, 240, 255, 0.4); border-radius: 999px;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.dash-chip[hidden] { display: none; }
.dash-chip [data-icon] { width: 1.05rem; height: 1.05rem; color: var(--cyan); flex: none; }
.dash-chip [data-icon] svg { width: 100%; height: 100%; display: block; }
.dash-chip:hover, .dash-chip:focus-visible { border-color: var(--cyan); background: rgba(94, 240, 255, 0.16); outline: none; }
/* Övning: a real switch – the knob slides and turns yellow when it is on */
.dash-knob { position: relative; width: 2rem; height: 1.1rem; flex: none; border-radius: 999px; background: rgba(255, 255, 255, 0.16); transition: background-color 0.15s; }
.dash-knob::after { content: ""; position: absolute; top: 0.15rem; left: 0.15rem; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: #d9d4f0; transition: transform 0.15s, background-color 0.15s; }
.dash-switch[aria-pressed="true"] { border-color: var(--yellow); color: var(--yellow); }
.dash-switch[aria-pressed="true"] [data-icon] { color: var(--yellow); }
.dash-switch[aria-pressed="true"] .dash-knob { background: rgba(255, 233, 77, 0.35); }
.dash-switch[aria-pressed="true"] .dash-knob::after { transform: translateX(0.9rem); background: var(--yellow); }
.practice-note { flex-basis: 100%; font-size: 0.82rem; color: var(--text-muted); }

/* The result: how far you came */
.dash-result { display: grid; justify-items: center; gap: 0.3rem; width: min(22rem, 100%); margin: 0 0 0.9rem; }
.dash-result[hidden] { display: none; }
.dash-result strong { font-size: 2.6rem; font-weight: 900; font-style: italic; line-height: 1; color: #fff; text-shadow: 0 0 14px rgba(94, 240, 255, 0.7); font-variant-numeric: tabular-nums; }
.dash-result-bar { position: relative; width: 100%; height: 0.55rem; background: rgba(94, 240, 255, 0.16); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.dash-result-bar i { display: block; height: 100%; width: 0; background: linear-gradient(to right, var(--cyan), #b7f8ff); }
/* The best before this round */
.dash-result-bar b { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--yellow); }
.dash-result span { font-size: 0.9rem; font-weight: 800; font-style: italic; color: var(--text-muted); }
.dash-result.is-record strong, .dash-result.is-complete strong { color: var(--yellow); text-shadow: 0 0 16px rgba(255, 233, 77, 0.7); }
.dash-result.is-record .dash-result-bar i, .dash-result.is-complete .dash-result-bar i { background: linear-gradient(to right, #ffc94d, var(--yellow)); }

/* Low boxes (phones, small windows): everything a size smaller. The cards never scroll sideways: they get a
   little narrower and then go on a second row, so no level is ever out of sight. */
@media (max-width: 640px), (max-height: 560px) {
  .overlay h2 { font-size: 1.7rem; margin-bottom: 0.35rem; }
  .level-picker { gap: 0.45rem; margin-bottom: 0.5rem; padding: 0.35rem 0.3rem 0.2rem; }
  .level-card { flex-basis: 4.4rem; min-width: 4rem; height: 2.6rem; }
  .level-num { font-size: 1.15rem; left: 0.4rem; bottom: 0.25rem; }
  .challenge-card { flex-basis: 6.6rem; }
  .challenge-name { font-size: 0.72rem; bottom: 0.3rem; }
  .dash-play { min-width: 11rem; padding: 0.55rem 1.4rem; font-size: 1.05rem; }
  .dash-hint { margin-top: 0.45rem; font-size: 0.78rem; }
  .practice-row { margin-top: 0.5rem; gap: 0.35rem; }
  .dash-chip { min-height: 1.9rem; padding: 0.2rem 0.65rem; font-size: 0.78rem; }
  .overlay p.dash-best { margin: -0.2rem 0 0.2rem; font-size: 0.72rem; }
  /* the number and the points side by side, the bar under them */
  .dash-result { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0.2rem 0.6rem; margin-bottom: 0.4rem; }
  .dash-result strong { font-size: 1.7rem; order: 0; }
  .dash-result span { order: 1; font-size: 0.78rem; }
  .dash-result-bar { order: 2; height: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay.is-start h2::before, .level-card.is-chosen, .overlay.is-start .dash-play:not(:disabled), .level-card.is-shaking { animation: none; }
}

/* Practice: the "remove point" button while practising */
.dash-remove-point {
  position: absolute; left: 50%; bottom: calc(0.5rem + var(--safe-bottom)); transform: translateX(-50%) skewX(-8deg);
  font: inherit; font-weight: 800; font-style: italic; font-size: calc(0.8rem * var(--ui, 1)); padding: 0.31em 0.875em;
  cursor: pointer; border: 2px solid var(--yellow); background: rgba(14, 10, 36, 0.6); color: var(--yellow); opacity: 0.6;
}
.dash-remove-point:hover, .dash-remove-point:focus-visible { opacity: 1; }
#stop-practice { margin-top: 0.5rem; }

/* The Spelarbanor screen: a scrolling list of buttons (one per level a player built) */
.player-list { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; width: min(24rem, 100%); max-height: 45%; margin: 0 0 1rem; overflow-y: auto; }
.player-list .player-level { justify-content: center; border-radius: 6px; }

/* Phones held upright: the Banverkstad link is right under the game box, so its chip steps aside */
@media (max-width: 480px) { #to-builder { display: none; } }
/* (css/style.css gives a game's "Spelarbanor" button a top margin: here it is one chip in a row) */
.overlay #player-levels.dash-chip, .overlay #challenges.dash-chip { margin: 0; }
/* The Utmaningar chip: magenta, so it stands apart from the other small choices */
#challenges [data-icon] { color: var(--magenta, #ff3fb4); }

/* The timing lab (?takt, takt.js): a small panel under the game box */
.takt-panel { display: grid; justify-items: center; gap: 0.5rem; max-width: 60rem; margin: 0.8rem auto 0; padding: 0.7rem; border: 1.5px solid rgba(94, 240, 255, 0.4); background: rgba(14, 10, 36, 0.72); }
.takt-panel strong { font-style: italic; text-transform: uppercase; color: var(--yellow); }
.takt-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }
.takt-row .dash-chip { min-width: 3.2rem; min-height: 2.75rem; justify-content: center; font-size: 1rem; }
.takt-row output { min-width: 6.5rem; text-align: center; font-size: 1.4rem; font-weight: 900; font-style: italic; color: #fff; font-variant-numeric: tabular-nums; }
.takt-panel p { margin: 0; font-size: 0.85rem; color: var(--text-muted); text-align: center; }
