/* Devět bran k pochopení pohybu – vzhled. Tma, teplé světlo lampy, zašlé zlato, patkové písmo. */

:root {
  --bg: #070605;
  --panel: #12100d;
  --panel-2: #1a1611;
  --ink: #e8dcc4;
  --muted: #a39580;
  --gold: #c9a45c;
  --gold-bright: #e6c67e;
  --gold-dim: #7d6535;
  --danger: #c4694f;
  --ok: #9fbf7a;
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif;
  --hand: "Segoe Print", "Bradley Hand", "Segoe Script", cursive;
  /* číslice ve stejné výšce (Georgia má „starobylé“ číslice různé výšky) */
  --digits: "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif;
  --radius: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  animation: fade-in 0.8s ease both;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Vstup ---------- */

#enter { display: grid; place-items: center; background: #000; }

.enter-wrap { text-align: center; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 18px; }

.enter-btn {
  background: none;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 12px 36px;
  font-size: 22px;
  letter-spacing: 0.18em;
  color: var(--gold-bright);
  transition: border-color 0.3s, box-shadow 0.3s;
  animation: glow-box 4s ease-in-out infinite;
}

.enter-btn:hover { border-color: var(--gold-bright); }

@keyframes glow-box {
  0%, 100% { box-shadow: 0 0 0 rgba(201, 164, 92, 0); }
  50% { box-shadow: 0 0 26px rgba(201, 164, 92, 0.22); }
}

.enter-note { margin: 0; max-width: 420px; color: var(--muted); font-size: 15px; font-style: italic; }

.title-sound { position: absolute; top: 12px; right: 16px; }

/* ---------- Úvod ---------- */

#intro { background: #000; cursor: pointer; }

.tunnel { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.intro-line {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  width: min(90vw, 760px);
  margin: 0;
  text-align: center;
  font-size: clamp(18px, 2.6vw, 28px);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.9);
  text-wrap: balance;
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}

.intro-line.on { opacity: 1; }

.skip {
  position: absolute;
  right: 16px;
  bottom: 16px;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 15px;
  opacity: 0.7;
}

.skip:hover { color: var(--gold-bright); opacity: 1; }

/* ---------- Titulní obrazovka ---------- */

#title {
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 85%, rgba(201, 164, 92, 0.16), rgba(0, 0, 0, 0) 55%),
    var(--bg);
}

.title-wrap { text-align: center; padding: 16px; }

.game-title {
  margin: 0;
  font-weight: normal;
  font-size: clamp(36px, 7vw, 84px);
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-wrap: balance;          /* dlouhý název zalomit do vyvážených řádků */
  background: linear-gradient(180deg, #f1dca4 0%, var(--gold) 55%, #6e5528 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(201, 164, 92, 0.25));
  animation: glow 6s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(201, 164, 92, 0.2)); }
  50% { filter: drop-shadow(0 0 30px rgba(201, 164, 92, 0.38)); }
}

.game-subtitle {
  margin: 12px 0 40px;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.04em;
}

.menu { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.menu button, #btn-again {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 6px 4px;
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--ink);
  transition: color 0.2s, border-color 0.2s;
}

.menu button:hover, #btn-again:hover { color: var(--gold-bright); border-bottom-color: var(--gold-dim); }

.version { position: absolute; bottom: 12px; width: 100%; text-align: center; margin: 0; font-size: 13px; color: #5d5446; }

/* ---------- Výběr sekce ---------- */

#track { display: grid; place-items: center; overflow-y: auto; background: var(--bg); }

.track-wrap { width: min(100%, 760px); padding: 24px 16px; text-align: center; }

.track-wrap h2 { font-weight: normal; font-size: 32px; letter-spacing: 0.06em; color: var(--gold-bright); margin: 0 0 24px; }

.team-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; margin-bottom: 28px; }
.team { display: inline-flex; flex-direction: column; gap: 6px; text-align: left; color: var(--muted); }
.team.code input { width: min(80vw, 200px); font-family: var(--digits); letter-spacing: 0.08em; }
.team.code small { display: block; max-width: 260px; font-size: 12px; line-height: 1.25; }

.team small { color: #6f6555; }

.team input {
  width: min(80vw, 320px);
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
}

.tracks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }

.track-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: left;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.track-card:hover, .track-card:focus-visible {
  border-color: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(201, 164, 92, 0.15);
}

.track-card h3 { margin: 0 0 8px; font-weight: normal; font-size: 22px; color: var(--gold-bright); }
.track-card p { margin: 0; color: var(--muted); font-size: 15px; }

.link { background: none; border: 0; color: var(--muted); }
.link:hover { color: var(--gold-bright); }

/* Odkaz pro vyučující (?mistnost=…): upozornění na titulní obrazovce, jediný svět v nabídce */
.shortcut-note { max-width: 520px; margin: 24px auto 0; padding: 10px 14px; border: 1px dashed var(--gold-dim); border-radius: var(--radius); color: var(--gold-bright); font-size: 15px; line-height: 1.45; }
.tracks.single { grid-template-columns: minmax(0, 380px); justify-content: center; }
.track-all { display: block; margin: 10px auto 0; font-size: 14px; }

/* ---------- Místnost ---------- */

#room {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto auto;
  background: #000;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: linear-gradient(180deg, rgba(18, 16, 13, 0.95), rgba(7, 6, 5, 0.9));
  border-bottom: 1px solid #2a2219;
}

.hud-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gate-num { color: var(--gold); letter-spacing: 0.1em; font-size: 15px; }

.hud-actions { display: flex; gap: 6px; flex-shrink: 0; }

.hud-btn {
  background: none;
  border: 1px solid #3a3024;
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}

.hud-btn:hover { color: var(--gold-bright); border-color: var(--gold-dim); }
.hud-btn[aria-pressed="true"] { color: var(--gold-bright); border-color: var(--gold-dim); }
.hud-btn.pulse { animation: pulse 1.2s ease 3; }

@keyframes pulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(230, 198, 126, 0.35); color: var(--gold-bright); }
}

/* Nápověda k tlačítkům vpravo nahoře: panel se šipkou pod lištou, tlačítka se rozsvítí. */
.hud-actions.coach .hud-btn {
  color: var(--gold-bright);
  border-color: var(--gold);
  animation: coach-glow 1.6s ease-in-out infinite;
}
@keyframes coach-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 10px 2px var(--gold-dim); }
}
.hud-help {
  position: fixed;
  z-index: 46;
  width: min(380px, calc(100vw - 16px));
  padding: 14px 16px 14px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.7), 0 0 18px rgba(0, 0, 0, 0.4);
  font-size: 15px;
  line-height: 1.4;
}
.hud-help::before {
  content: '';
  position: absolute;
  top: -9px;
  left: calc(var(--arrow-x, 50%) - 9px);
  width: 16px;
  height: 16px;
  background: var(--panel);
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
  transform: rotate(45deg);
}
.hud-help h3 { margin: 0 0 8px; font-size: 16px; color: var(--gold-bright); font-weight: normal; letter-spacing: 0.03em; }
.hud-help dl { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; }
.hud-help dt { color: var(--gold-bright); white-space: nowrap; }
.hud-help dd { margin: 0; color: var(--ink); }
.hud-help p { margin: 0 0 10px; color: var(--muted); font-style: italic; }
.hud-help .btn { display: block; margin-left: auto; }
@media (max-width: 520px) {
  .hud-help dl { grid-template-columns: 1fr; gap: 0 0; }
  .hud-help dd { margin-bottom: 6px; }
}

.stage { position: relative; min-height: 0; display: grid; place-items: center; container-type: size; overflow: hidden; }

/* Otočení v místnosti: nový pohled vjede ze strany; přiblížení / oddálení.
   „backwards“ (ne „both“): po skončení animace nesmí zůstat transformace – jinak by se vrstvy
   (otevřený šuplík, brána) vztahovaly k bloku nulové výšky a zmizely. */
.scene-layers { position: absolute; inset: 0; pointer-events: none; }
.scene.enter-left .scene-bg, .scene.enter-left .scene-layers { animation: from-left 0.55s ease backwards; }
.scene.enter-right .scene-bg, .scene.enter-right .scene-layers { animation: from-right 0.55s ease backwards; }
.scene.enter-in .scene-bg, .scene.enter-in .scene-layers { animation: zoom-in 0.5s ease backwards; }
.scene.enter-back .scene-bg, .scene.enter-back .scene-layers { animation: zoom-out 0.5s ease backwards; }

@keyframes from-left { from { transform: translateX(-7%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes from-right { from { transform: translateX(7%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes zoom-in { from { transform: scale(1.12); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes zoom-out { from { transform: scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }

.scene-nav button {
  position: absolute;
  z-index: 3;
  border: 1px solid rgba(201, 164, 92, 0.35);
  border-radius: var(--radius);
  background: rgba(7, 6, 5, 0.5);
  color: var(--gold-bright);
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
}

.scene-nav button:hover, .scene-nav button:focus-visible { opacity: 1; border-color: var(--gold); background: rgba(7, 6, 5, 0.75); }
.nav-left, .nav-right { top: 50%; width: 42px; height: 68px; margin-top: -34px; font-size: 34px; line-height: 1; padding: 0 0 4px; }
.nav-left { left: 8px; }
.nav-right { right: 8px; }
.nav-back { left: 50%; bottom: 10px; transform: translateX(-50%); padding: 6px 18px; font-size: 15px; letter-spacing: 0.06em; }

.scene {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100cqw, 100cqh * 16 / 9);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.scene-bg, .scene-layers img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Vrstva, která se objeví změnou stavu: prolnutí, nebo vysunutí (šuplík). */
.scene-layers img.anim-fade { animation: fade-in 0.6s ease both; }
.scene-layers img.anim-slide { animation: slide-open 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

@keyframes slide-open {
  from { transform: translateY(-4.5%); opacity: 0.2; }
  to { transform: none; opacity: 1; }
}

.scene-dark { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scene-dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* Bouřka: blesk (místnost s oknem) a probliknutí světel (bez oken, sklep). Měkké – nejvýš dvě změny
   jasu za sekundu, --blesk = síla podle vzdálenosti; při „omezit pohyb“ vypnuté (viz konec souboru). */
.scene-storm { position: absolute; inset: 0; pointer-events: none; opacity: 0; --blesk: 1; }
.scene-storm.blesk { background: rgb(214, 226, 255); animation: blesk 0.9s ease-out both; }
.scene-storm.probliknuti { background: #000; animation: probliknuti 0.75s linear both; }
@keyframes blesk {
  0% { opacity: 0; } 7% { opacity: calc(0.28 * var(--blesk)); } 18% { opacity: calc(0.06 * var(--blesk)); }
  30% { opacity: calc(0.2 * var(--blesk)); } 100% { opacity: 0; }
}
@keyframes probliknuti {
  0% { opacity: 0; } 8% { opacity: calc(0.55 * var(--blesk)); } 20% { opacity: calc(0.1 * var(--blesk)); }
  34% { opacity: calc(0.45 * var(--blesk)); } 50%, 100% { opacity: 0; }
}
/* přiblížení scény k předmětu (např. před měřením metrem) */
.scene.zooming { transition: transform 0.65s cubic-bezier(0.45, 0, 0.2, 1); }

.hotspots { position: absolute; inset: 0; }

/* Chodba „z vlastních očí“ (js/chodba.js): obraz se kreslí na plátno, kliknutí vlevo / vpravo otočí,
   uprostřed krok; objekt na zdi před hráčem má klikací plochu, jinak plátno dostává kliknutí. */
.scene-corridor { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
.scene-corridor[hidden] { display: none; }

/* 3D chodba (js/chodba3d.js): plátno, zaměřovač, puška, výzvy, nabíjení skoku, dotykové ovládání */
.scene-3d { position: absolute; inset: 0; overflow: hidden; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; }
.scene-3d[hidden] { display: none; }
.scene.world3d .hotspots, .scene.world3d .scene-nav { pointer-events: none; }
.w3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.w3d-cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; }
.w3d-cross::before, .w3d-cross::after { content: ''; position: absolute; background: rgba(255, 96, 76, 0.9); box-shadow: 0 0 3px #000; }
.w3d-cross::before { left: 10px; top: 0; width: 2px; height: 22px; }
.w3d-cross::after { top: 10px; left: 0; width: 22px; height: 2px; }
.w3d-gun { position: absolute; right: 2%; bottom: -3%; width: 30%; max-width: 360px; pointer-events: none; filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6)); }
.w3d-recoil { animation: w3d-recoil 0.18s ease-out; }
@keyframes w3d-recoil { 30% { transform: translate(2%, 4%); } }
.w3d-lives { position: absolute; left: 12px; top: 8px; color: #e0473a; font-size: 22px; letter-spacing: 2px; text-shadow: 0 0 4px #000; pointer-events: none; }
.w3d-pack { position: absolute; right: 12px; top: 10px; padding: 4px 10px; background: rgba(20, 18, 12, 0.75); border: 1px solid rgba(230, 198, 126, 0.5); border-radius: 4px; color: #e6c67e; font-size: 14px; pointer-events: none; }
.w3d-prompt { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); max-width: 92%; padding: 6px 14px; background: rgba(15, 13, 10, 0.8); border: 1px solid rgba(230, 198, 126, 0.45); border-radius: 4px; color: #f2e6c2; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.w3d-prompt[hidden] { display: none; }
.w3d-charge { position: absolute; left: 50%; bottom: 23%; transform: translateX(-50%); width: min(340px, 60%); height: 14px; background: rgba(10, 10, 10, 0.7); border: 1px solid rgba(230, 198, 126, 0.6); border-radius: 3px; pointer-events: none; }
.w3d-charge[hidden] { display: none; }
.w3d-charge-bar { width: 0; height: 100%; background: linear-gradient(90deg, #6fae5a, #e6c67e, #e0603a); }
.w3d-charge-text { position: absolute; left: -40px; right: -40px; top: -22px; text-align: center; color: #f2e6c2; font-size: 13px; text-shadow: 0 0 4px #000; white-space: nowrap; }
.w3d-hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: 86%; padding: 4px 10px; background: rgba(15, 13, 10, 0.72); border-radius: 4px; color: #d8cba8; font-size: 13px; text-align: center; pointer-events: none; }
.w3d-hint[hidden] { display: none; }
.w3d-banner { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); width: min(560px, 84%); padding: 6px 14px 8px; background: rgba(42, 12, 9, 0.84); border: 1px solid rgba(255, 128, 98, 0.75); border-radius: 6px; color: #fbe9dc; text-align: center; pointer-events: none; }
.w3d-banner[hidden], .w3d-banner-hint[hidden] { display: none; }
.w3d-banner-title { color: #ff9c7c; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
.w3d-banner-text { margin-top: 2px; font-size: 17px; }
.w3d-banner-hint { margin-top: 2px; color: #ffe48a; font-size: 13px; }
.w3d-banner-bar { height: 5px; margin-top: 6px; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, 0.15); }
.w3d-banner-fill { width: 0; height: 100%; background: #ff7a5a; }
.w3d-toast { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); max-width: 90%; padding: 6px 14px; border: 1px solid rgba(230, 198, 126, 0.5); border-radius: 4px; background: rgba(15, 13, 10, 0.86); color: #f2e6c2; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.w3d-toast[hidden] { display: none; }
.w3d-banner-on .w3d-toast { top: 146px; }
.w3d-toast-ok { border-color: #6fbf5a; color: #c9f2b8; }
.w3d-toast-bad { border-color: #ff7a50; color: #ffc9a8; }
.w3d-flash { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(160, 0, 0, 0) 40%, rgba(170, 10, 0, 0.75) 100%); pointer-events: none; }
.w3d-hurt { animation: w3d-hurt 0.7s ease-out; }
@keyframes w3d-hurt { from { opacity: 1; } to { opacity: 0; } }
.w3d-fade { position: absolute; inset: 0; opacity: 0; background: #000; transition: opacity 0.6s; pointer-events: none; }
.w3d-fade.w3d-dark { opacity: 1; }
.w3d-touch { position: absolute; inset: 0; pointer-events: none; }
.w3d-touch[hidden] { display: none; }
.w3d-movezone { position: absolute; left: 0; bottom: 0; width: 45%; height: 78%; pointer-events: auto; touch-action: none; }
.w3d-stick { position: absolute; left: 14px; bottom: 14px; width: 120px; height: 120px; border: 2px solid rgba(230, 198, 126, 0.35); border-radius: 50%; background: rgba(230, 198, 126, 0.08); pointer-events: none; }
.w3d-stick-live { border-color: rgba(230, 198, 126, 0.7); background: rgba(230, 198, 126, 0.16); }
.w3d-knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(230, 198, 126, 0.5); }
.w3d-btn { position: absolute; width: 74px; height: 50px; padding: 0; border: 1px solid rgba(230, 198, 126, 0.6); border-radius: 10px; background: rgba(20, 18, 12, 0.72); color: #f2e6c2; font-size: 14px; pointer-events: auto; touch-action: none; }
.w3d-btn[hidden] { display: none; }
.w3d-b-jump { right: 14px; bottom: 14px; }
.w3d-b-crouch { right: 96px; bottom: 14px; }
.w3d-b-action { right: 14px; bottom: 72px; }
.w3d-b-fire { right: 96px; bottom: 72px; background: rgba(110, 22, 12, 0.78); }
@media (prefers-reduced-motion: reduce) { .w3d-recoil, .w3d-hurt { animation: none; } .w3d-fade { transition: none; } }
.scene.corridor .hotspots { pointer-events: none; }
.scene.corridor .hotspot { pointer-events: auto; cursor: pointer; }
.scene.corridor .hotspot:hover { outline: 1px dashed rgba(230, 198, 126, 0.45); }
.nav-forward, .nav-backward { bottom: 10px; width: 56px; height: 36px; font-size: 18px; line-height: 1; padding: 0; }
.nav-forward { left: 10px; }
.nav-backward { left: 72px; }

.hotspot {
  position: absolute;
  background: none;
  border: 0;
  padding: 0;
  border-radius: 6px;
}

.hotspot:focus-visible { outline: 1px dashed var(--gold); }

.scene.show-hotspots .hotspot { outline: 1px dashed rgba(230, 198, 126, 0.55); background: rgba(230, 198, 126, 0.06); }

.tooltip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  padding: 3px 10px;
  background: rgba(7, 6, 5, 0.85);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gold-bright);
  white-space: nowrap;
  pointer-events: none;
}

.message {
  height: 5.6em;           /* pevná výška – místnost při delší zprávě neposkočí */
  overflow-y: auto;
  padding: 10px 16px;
  background: var(--panel);
  border-top: 1px solid #2a2219;
  font-size: 16px;
  color: var(--ink);
}

.message p { margin: 0; max-width: 980px; margin-inline: auto; text-align: center; animation: fade-in 0.5s ease both; }
.message p + p { margin-top: 4px; }
.message .muted { color: var(--muted); font-style: italic; }
.message .go { margin-left: 12px; padding: 2px 12px; vertical-align: baseline; }
.message .why { margin-left: 8px; padding: 0 9px; font-size: 13px; line-height: 1.5; vertical-align: baseline; border-radius: 10px; }
.message .why-text { color: var(--muted); font-style: italic; }
.message .nudge { font-style: italic; color: var(--ink); }
.message .nudge::before { content: 'Vzkaz od D.: '; color: var(--gold); font-style: normal; letter-spacing: 0.02em; }
.message .aside { color: var(--muted); font-style: italic; }

.inventory {
  display: flex;
  gap: 8px;
  padding: 8px 16px 10px;
  background: #0b0907;
  border-top: 1px solid #2a2219;
  overflow-x: auto;
  min-height: 82px;
}

/* Předměty uprostřed (okrajové „auto“ místo justify-content: center – při přetečení jde pořád posouvat). */
.inventory > :first-child { margin-left: auto; }
.inventory > :last-child { margin-right: auto; }

.inventory .empty { color: #5d5446; font-style: italic; font-size: 14px; align-self: center; }

.slot {
  flex: 0 0 auto;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--panel);
  border: 1px solid #2f271d;
  border-radius: var(--radius);
  padding: 4px 2px 3px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.slot img { width: 40px; height: 40px; }
.slot span { font-size: 11px; color: var(--muted); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot:hover { border-color: var(--gold-dim); }
.slot.selected { border-color: var(--gold-bright); box-shadow: 0 0 12px rgba(230, 198, 126, 0.35); }
.slot.selected span { color: var(--gold-bright); }
.slot.new { animation: pulse 1s ease 2; }

.cursor-item {
  position: fixed;
  width: 40px;
  height: 40px;
  pointer-events: none;
  z-index: 50;
  transform: translate(10px, 10px);
  opacity: 0.9;
}

.cursor-item img { width: 100%; height: 100%; }

/* ---------- Modální okna ---------- */

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); animation: fade-in 0.3s ease both; }

.modal-box {
  position: relative;
  width: min(100%, 760px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: rise 0.35s ease both;
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.modal-box h2 { margin: 0 0 12px; font-weight: normal; font-size: 22px; color: var(--gold-bright); letter-spacing: 0.04em; padding-right: 32px; }

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  padding: 4px 8px;
}

.modal-close:hover { color: var(--gold-bright); }

.closeup img { display: block; width: 100%; max-height: 62dvh; object-fit: contain; border: 1px solid #2f271d; }
.closeup figcaption { margin-top: 8px; color: var(--muted); font-style: italic; font-size: 15px; }

.paper {
  margin: 8px auto;
  width: min(100%, 360px);
  padding: 36px 28px;
  background: linear-gradient(160deg, #e2d6b6, #c4b48c);
  color: #3a2c1c;
  font-family: var(--hand);
  font-size: 30px;
  text-align: center;
  transform: rotate(-2deg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  white-space: pre-line;
}

.paper.long { width: min(100%, 460px); font-size: 21px; line-height: 1.55; text-align: left; padding: 30px 32px; }

/* Deník docenta D.: linkovaná stránka, mapa bran */
.paper.diary { width: min(100%, 540px); padding: 24px 30px 20px; transform: rotate(-0.8deg); font-size: 19px; line-height: 32px; background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 31px, rgba(90, 60, 30, 0.18) 31px 32px), linear-gradient(160deg, #e6dabb, #cbbb93); }
.diary-num { font-family: var(--serif); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: #7a6a4a; }
.diary-title { font-size: 25px; color: #5a3a22; }
.diary-text { white-space: pre-line; }
.diary-sign { text-align: right; color: #7a2e1e; font-size: 22px; }
.diary-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.map-intro { margin: 0 0 8px; color: var(--ink); text-align: center; }
.map-legend { margin: 8px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.map-svg { display: block; width: min(100%, 640px); height: auto; margin: 0 auto; }
.map-svg text { font-family: var(--serif); fill: var(--ink); }
.map-svg .world { fill: var(--gold); font-size: 15px; letter-spacing: 0.08em; }
.map-svg .label { font-size: 13px; }
.map-svg .small { font-size: 11px; fill: var(--muted); }
.map-svg .building { fill: rgba(230, 198, 126, 0.04); stroke: var(--gold-dim); stroke-width: 1.5; }
.map-svg .link-line { stroke: var(--gold-dim); stroke-width: 1.5; opacity: 0.7; }
.map-svg .node { fill: #15110c; stroke: var(--gold-dim); stroke-width: 2; }
.map-svg .node.lit { fill: var(--gold); stroke: var(--gold-bright); filter: drop-shadow(0 0 8px rgba(230, 198, 126, 0.6)); cursor: pointer; }
.map-svg .node.lit:hover, .map-svg .node.lit:focus { stroke: #fff; outline: none; }
.map-svg .node.unknown { stroke-dasharray: 5 4; }
.map-svg .node.passage { stroke-width: 1.5; }
.map-svg .label.dim { fill: var(--muted); }
.map-svg .num { font-size: 14px; fill: var(--gold-bright); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map-svg .lit + .num { fill: #1a1308; }
.map-svg .num.tight { font-size: 10.5px; letter-spacing: -0.02em; }
.notes-sub { margin: 18px 0 6px; color: var(--gold); font-weight: normal; font-size: 17px; }
.diary-list { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.diary-list .link { padding: 2px 0; }
.paper.type {
  width: min(100%, 420px);
  font-family: "Courier New", Courier, monospace;
  font-size: 17px;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  padding: 26px 28px;
  background: linear-gradient(180deg, #ece6d6, #d9d1bd);
  transform: rotate(1deg);
}

/* Obrazovka počítače, která „píše sama“ (closeup s font: "terminal"). */
.paper.terminal {
  width: min(100%, 520px);
  min-height: 180px;
  font-family: "Courier New", Courier, monospace;
  font-size: 19px;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
  padding: 26px 28px;
  color: #7dffb0;
  background: radial-gradient(ellipse at 50% 45%, #0d2418, #030806 75%);
  border: 2px solid #1d3b2a;
  border-radius: 14px;
  text-shadow: 0 0 6px rgba(125, 255, 176, 0.55);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 10px 30px rgba(0, 0, 0, 0.6);
  transform: none;
}
.paper.terminal .term-caret { display: inline-block; width: 0.6em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Výpadek jističe: místnost na chvíli plynule zhasne (bez prudkého blikání). */
.scene.fx-blackout::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #000;
  pointer-events: none;
  animation: blackout 2.6s ease both;
}
@keyframes blackout {
  0% { opacity: 0; }
  18% { opacity: 0.97; }
  60% { opacity: 0.97; }
  100% { opacity: 0; }
}

/* Lekačka: obrázek přes celou obrazovku vyletí k hráči a otřese se. Jedno objevení, žádné
   opakované blikání (kvůli lidem citlivým na světlo). */
.scare {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  overflow: hidden;
  cursor: none;
}
.scare img { width: 100%; height: 100%; object-fit: cover; transform: scale(0.3); }
.scare.go img {
  animation:
    scare-rush var(--rush, 0.12s) cubic-bezier(0.2, 0.9, 0.3, 1.15) forwards,
    scare-shake 0.08s linear var(--rush, 0.12s) infinite;
}
.scare.out { animation: scare-out 0.2s ease forwards; }
@keyframes scare-rush {
  from { transform: scale(0.3); filter: brightness(1.8) contrast(1.3); }
  to { transform: scale(1.08); filter: none; }
}
@keyframes scare-shake {
  0% { transform: scale(1.08) translate(0, 0); }
  25% { transform: scale(1.09) translate(-1.1%, 0.7%); }
  50% { transform: scale(1.08) translate(0.9%, -0.8%); }
  75% { transform: scale(1.09) translate(-0.6%, -0.5%); }
  100% { transform: scale(1.08) translate(0, 0); }
}
@keyframes scare-out { to { opacity: 0; } }

/* ---------- Kniha ---------- */

.modal-box.book-box { width: min(100%, 1000px); padding: 16px 18px 14px; background: linear-gradient(180deg, #24180e, #170f08); }

.book-title { margin: 0 0 10px; padding-right: 36px; color: var(--gold); font-style: italic; letter-spacing: 0.05em; }

.book { display: grid; grid-template-columns: 1fr 1fr; perspective: 1600px; }
.book.single { grid-template-columns: 1fr; }
.book.single .page.right { display: none; }

.page {
  position: relative;
  min-height: min(64dvh, 580px);
  padding: 26px 30px 40px;
  background: linear-gradient(180deg, #e8dcbc, #dccfaa);
  color: #2e2416;
  font-size: 16px;
  line-height: 1.55;
  overflow: hidden;
}

.page.left { border-radius: 4px 0 0 4px; box-shadow: inset -22px 0 26px -16px rgba(70, 45, 20, 0.55); }
.page.right { border-radius: 0 4px 4px 0; box-shadow: inset 22px 0 26px -16px rgba(70, 45, 20, 0.55); }
.book.single .page.left { border-radius: 4px; box-shadow: inset 0 0 30px rgba(70, 45, 20, 0.35); }
.page.blank { background: linear-gradient(180deg, #ddd0ac, #d2c49e); }

.page h3 { margin: 0 0 12px; font-weight: normal; font-size: 21px; color: #3a2a18; letter-spacing: 0.02em; }
.page p { margin: 0 0 10px; white-space: pre-line; }
.page .formula { margin: 12px 0 14px; text-align: center; font-size: 18px; font-style: italic; color: #2a1d0f; }
.page sub { font-size: 0.7em; }
.page .margin-note { margin-top: 16px; font-family: var(--hand); font-size: 17px; color: #7a2e1e; transform: rotate(-2deg); }
.page img { display: block; width: 100%; max-height: 210px; object-fit: contain; margin: 4px 0 10px; }
.page .toc div { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
/* tabulky v knize (normy přezkoušení) */
.page.has-table { overflow-y: auto; }
.page h3 + p { margin-bottom: 6px; }
.page .book-table { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 13px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.page .book-table caption { text-align: left; font-weight: bold; font-size: 13px; color: #3a2a18; padding: 2px 0; }
.page .book-table th, .page .book-table td { border: 1px solid #b4a27a; padding: 2px 3px; text-align: center; }
.page .book-table thead th { background: rgba(120, 90, 50, 0.14); font-weight: normal; font-size: 11.5px; white-space: pre-line; }
.page .book-table tbody th { background: rgba(120, 90, 50, 0.1); }
.page .toc .dots { flex: 1; border-bottom: 2px dotted #8d7a58; transform: translateY(-4px); }
.page .num { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 13px; color: #7d6a4a; }

.page.title-page { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.page.title-page h3 { font-size: 30px; letter-spacing: 0.12em; }
.page.title-page .margin-note { margin-top: 40px; }

.book.turn-next .page { animation: page-next 0.4s ease both; transform-origin: left center; }
.book.turn-prev .page { animation: page-prev 0.4s ease both; transform-origin: right center; }

@keyframes page-next { from { opacity: 0.2; transform: rotateY(-12deg) translateX(2%); } to { opacity: 1; transform: none; } }
@keyframes page-prev { from { opacity: 0.2; transform: rotateY(12deg) translateX(-2%); } to { opacity: 1; transform: none; } }

.book-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.book-nav .btn:disabled { opacity: 0.35; cursor: default; }
.book-counter { color: var(--muted); font-size: 14px; }

.notes { margin: 0; padding-left: 20px; }
.notes li { margin-bottom: 6px; }
.notes-empty { color: var(--muted); font-style: italic; }

.modal-menu { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.modal-menu button, .btn {
  background: none;
  border: 1px solid #3a3024;
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--ink);
  transition: color 0.2s, border-color 0.2s;
}

.modal-menu button:hover, .btn:hover { color: var(--gold-bright); border-color: var(--gold-dim); }
.modal-menu .danger:hover { color: var(--danger); border-color: var(--danger); }

/* ---------- Zámek brány ---------- */

.lock .question { margin: 0 0 16px; font-size: 17px; }

.lock-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 14px;
  padding: 10px 16px;
  width: min(100%, 300px);
  background: #0a0806;
  border: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  font-family: var(--digits);
  font-size: 34px;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  font-variant-numeric: lining-nums tabular-nums;
  min-height: 64px;
}

.lock-display .unit { font-size: 18px; color: var(--muted); letter-spacing: 0; }
.lock-display .caret { width: 2px; height: 30px; background: var(--gold); animation: blink 1s steps(1) infinite; align-self: center; }

@keyframes blink { 50% { opacity: 0; } }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 300px); margin: 0 auto; }

.key {
  font-family: var(--digits);
  padding: 12px 0;
  font-size: 22px;
  background: linear-gradient(180deg, #8a6f3a, #5a4626);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: #1a1208;
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, 0.35), 0 2px 0 #2a2010;
  transition: transform 0.05s, filter 0.2s;
}

.key:hover { filter: brightness(1.12); }
.key:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 240, 200, 0.25); }
.key.wide { font-size: 17px; }
.key.ok { background: linear-gradient(180deg, #c9a45c, #8a6f3a); }

.choices { display: flex; flex-direction: column; gap: 10px; }

.choice {
  text-align: left;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid #3a3024;
  border-radius: var(--radius);
  transition: border-color 0.2s, color 0.2s;
}

.choice:hover { border-color: var(--gold); color: var(--gold-bright); }

.feedback { min-height: 1.5em; margin: 14px 0 0; text-align: center; }
.feedback.bad { color: var(--danger); }
.feedback.good { color: var(--ok); }

.shake { animation: shake 0.4s ease; }

@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.hints { margin-top: 16px; border-top: 1px solid #2a2219; padding-top: 12px; }
.hints ol { margin: 0 0 10px; padding-left: 20px; color: var(--muted); font-style: italic; }
.hints li { margin-bottom: 4px; }

/* ---------- Závěr, chyba ---------- */

#finish, #fatal {
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 30%, rgba(201, 164, 92, 0.14), rgba(0, 0, 0, 0) 60%), var(--bg);
}

.finish-wrap, .fatal-wrap { width: min(100%, 640px); padding: 24px 16px; text-align: center; }

.finish-wrap h2, .fatal-wrap h2 { font-weight: normal; font-size: clamp(28px, 5vw, 42px); color: var(--gold-bright); letter-spacing: 0.05em; margin: 0 0 16px; }

.finish-text { color: var(--ink); font-size: 18px; margin: 0 0 28px; }

.stats { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 6px 24px; margin: 0 0 24px; text-align: left; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; color: var(--gold-bright); font-family: var(--digits); font-variant-numeric: lining-nums tabular-nums; }

.photo-hint { color: var(--muted); font-style: italic; font-size: 15px; margin: 0 0 24px; }

/* Diplom: rámeček, tým, hvězdičky a odznaky (k vyfocení) */
.diploma { position: relative; padding: 28px 22px 26px; border: 1px solid var(--gold-dim); outline: 1px solid rgba(230, 198, 126, 0.25); outline-offset: 5px; background: linear-gradient(180deg, rgba(230, 198, 126, 0.05), rgba(0, 0, 0, 0)); }
.diploma-kicker { margin: 0 0 6px; color: var(--muted); font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; }
.diploma h2 { margin-bottom: 8px; }
.diploma-team { margin: 0 0 2px; font-size: clamp(22px, 4vw, 30px); color: var(--ink); letter-spacing: 0.04em; }
.diploma-sub { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.stars { font-size: 34px; line-height: 1.1; letter-spacing: 0.12em; color: var(--gold-bright); text-shadow: 0 0 14px rgba(230, 198, 126, 0.35); }
.stars-why { margin: 2px 0 14px; color: var(--muted); font-size: 14px; font-style: italic; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 18px; }
.badges[hidden] { display: none; }
.badge { display: inline-flex; flex-direction: column; align-items: center; min-width: 120px; padding: 6px 12px; border: 1px solid var(--gold-dim); border-radius: 8px; background: rgba(230, 198, 126, 0.07); }
.badge b { font-weight: normal; color: var(--gold-bright); font-size: 15px; }
.badge b::before { content: '★ '; }
.badge small { color: var(--muted); font-size: 11.5px; line-height: 1.25; max-width: 170px; text-align: center; }
.diploma .finish-text { margin-bottom: 18px; font-size: 16px; }

.fatal-wrap p { color: var(--muted); white-space: pre-line; }

/* ---------- Svět GSPORT: neonové barvy místo zlata ---------- */

body[data-world="gsport"] {
  --gold: #3fe0ff;
  --gold-bright: #9ff3ff;
  --gold-dim: #1d7a92;
  --panel: #0c1016;
  --panel-2: #111824;
  --ink: #e4f2f7;
  --muted: #8aa3b0;
}

body[data-world="gsport"] .key {
  background: linear-gradient(180deg, #16334a, #0d1b28);
  border-color: #3fe0ff;
  color: #c9f6ff;
  box-shadow: inset 0 1px 0 rgba(160, 240, 255, 0.25), 0 2px 0 #071018;
}

body[data-world="gsport"] .key.ok { background: linear-gradient(180deg, #ff4fd8, #a3238a); color: #fff; border-color: #ff8fe6; }
body[data-world="gsport"] .lock-display { border-color: #3fe0ff; color: #9ff3ff; text-shadow: 0 0 10px rgba(63, 224, 255, 0.6); }
body[data-world="gsport"] .modal-box { box-shadow: 0 0 40px rgba(63, 224, 255, 0.12), 0 20px 60px rgba(0, 0, 0, 0.7); }

/* Karty světů na výběrové obrazovce */
.track-wrap-card { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.track-wrap-card .track-card { flex: 1; }
.track-saved { margin-top: 8px !important; color: var(--gold-bright) !important; font-style: italic; }
.track-again { font-size: 13px; align-self: center; }
.track-wrap-card.world-gsport .track-card { border-color: #1d7a92; background: linear-gradient(180deg, #111824, #0c1016); }
.track-wrap-card.world-gsport .track-card:hover { border-color: #3fe0ff; box-shadow: 0 0 24px rgba(63, 224, 255, 0.25); }
.track-wrap-card.world-gsport h3 { color: #9ff3ff; text-shadow: 0 0 10px rgba(63, 224, 255, 0.5); }

/* ---------- Aktivity: reflex test, dřepy ---------- */

.modal-box.activity-box { width: min(100%, 680px); }
.modal-box.squat-box { width: min(100%, 900px); }
.activity-box .muted { color: var(--muted); }
.activity-box .small { font-size: 13px; }
.activity-next { display: block; margin: 14px auto 0; }

.reflex-pad {
  display: block;
  width: min(70vw, 240px);
  aspect-ratio: 1;
  margin: 10px auto;
  border-radius: 50%;
  border: 3px solid #2a3a48;
  background: radial-gradient(circle at 40% 35%, #1a2a38, #0a1018);
  color: var(--ink);
  font-size: 22px;
  letter-spacing: 0.06em;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.08s, border-color 0.08s;
}

.reflex-pad.wait { background: radial-gradient(circle at 40% 35%, #4a1820, #200a0e); border-color: #803040; color: #f0b0b8; }
.reflex-pad.go { background: radial-gradient(circle at 40% 35%, #7dffb0, #1f9c58); border-color: #b8ffd4; color: #052a14; font-weight: bold; box-shadow: 0 0 40px rgba(125, 255, 176, 0.6); }
.reflex-pad.early { background: radial-gradient(circle at 40% 35%, #ff9a5a, #8a3410); color: #2a0c00; }
.reflex-pad.done { border-color: #3fe0ff; color: #9ff3ff; }
.reflex-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 0; list-style-position: inside; color: var(--gold-bright); }

.squat-choice { text-align: center; }
.squat-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.btn.primary { border-color: var(--gold); color: var(--gold-bright); }
.squat-stage { position: relative; background: #000; border: 1px solid #1d3a48; border-radius: 6px; overflow: hidden; }
.squat-stage canvas { display: block; width: 100%; height: auto; max-height: 56dvh; object-fit: contain; }
.squat-counter {
  position: absolute;
  left: 12px;
  top: 6px;
  font-size: clamp(32px, 7vw, 60px);
  font-family: var(--digits);
  color: #3fe0ff;
  text-shadow: 0 0 14px rgba(63, 224, 255, 0.7);
  pointer-events: none;
}
.squat-counter.bump { animation: bump 0.35s ease; }
@keyframes bump { 50% { transform: scale(1.25); color: #9ff3ff; } }
.squat-manual { text-align: center; }
.squat-manual .btn { margin: 0 6px; }
.squat-clock { font-family: var(--digits); font-size: 42px; color: var(--gold-bright); margin: 6px 0 12px; }

/* Zkouška stability (předklon volně a u zdi) */
.lean-safety { border-left: 3px solid var(--gold-bright); padding: 6px 10px; text-align: left; background: rgba(255, 210, 138, 0.06); }
.lean-step { font-weight: bold; color: var(--gold-bright); margin: 8px 0; }
.lean-table { margin: 10px auto; border-collapse: collapse; }
.lean-table th, .lean-table td { padding: 4px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); text-align: center; }
.lean-table th { color: var(--muted); font-weight: normal; }
/* Goblet dřep (tělocvična) */
.goblet-rules { margin: 4px 0 8px; padding-left: 20px; text-align: left; font-size: 14px; }
.goblet-loads { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: center; margin: 6px 0; font-size: 14px; }
.goblet-loads p { width: 100%; margin: 0; }
.goblet-loads input { accent-color: var(--gold); }
.goblet-clock { position: absolute; top: 10px; right: 12px; font-family: var(--digits); font-size: 28px; color: #ffd28a; text-shadow: 0 0 8px rgba(0, 0, 0, 0.8); }
.goblet-log { margin: 4px auto; padding-left: 20px; max-width: 520px; text-align: left; font-size: 14px; color: var(--danger); }
.gsim-checks { list-style: none; padding-left: 0; }
/* Kliky na decimální váze, hod */
.pushup-weights { display: flex; flex-wrap: wrap; gap: 6px; }
.pushup-weights .btn { padding: 6px 10px; }
.throw-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px 16px; align-items: end; margin-top: 8px; }
@media (max-width: 700px) { .throw-controls { grid-template-columns: 1fr; } }
.throw-controls input:disabled { opacity: 0.45; }

/* Měření metrem tahem */
.modal-box.tape-box { width: min(100%, 760px); }
.tape-stage { position: relative; width: 100%; border-radius: 6px; overflow: hidden; background-repeat: no-repeat; touch-action: none; cursor: grab; }
.tape-stage.dragging { cursor: grabbing; }
.tape-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Balení batohu */
.modal-box.pack-box { width: min(100%, 860px); }
.pack-wrap { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 700px) { .pack-wrap { grid-template-columns: 1fr; } }
.pack-svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.pushup-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 340; border-radius: 8px; background: #2b2e2a; }
.gsim-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 440; border-radius: 8px; background: #2b2e2a; }
.throw-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 320; border-radius: 8px; background: #23251e; }
.stretcher-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 340; border-radius: 8px; background: #0d1410; touch-action: none; user-select: none; -webkit-user-select: none; }
.helmet-canvas { display: block; width: 100%; height: auto; aspect-ratio: 420 / 340; border-radius: 8px; background: #0b1018; touch-action: none; user-select: none; -webkit-user-select: none; }
.stretcher-canvas:focus-visible, .helmet-canvas:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.figurine-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 380; border-radius: 8px; background: #2a2a25; touch-action: none; user-select: none; -webkit-user-select: none; }
/* Pěchotní srub: páka na loket, vychýlení a hod přes bok, pád vzad */
.armlock-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 320; border-radius: 8px; background: #4e4d47; touch-action: none; user-select: none; -webkit-user-select: none; }
.balance-canvas, .fall-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 340; border-radius: 8px; background: #2f5d7a; touch-action: none; user-select: none; -webkit-user-select: none; }
.fall-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.fall-toggles[hidden] { display: none; }
.fall-toggle[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-bright); background: rgba(201, 162, 39, 0.14); }
.pack-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 440; border-radius: 8px; background: #23251e; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.pack-tray { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.pack-item { padding: 6px 10px; border: 1px solid #6b6250; border-radius: 6px; background: #2a2a20; color: var(--ink); cursor: grab; touch-action: none; font-size: 14px; user-select: none; -webkit-user-select: none; }
.pack-item.selected { border-color: var(--gold-bright); box-shadow: 0 0 0 2px rgba(255, 210, 138, 0.35); }
.pack-item.packed { opacity: 0.45; }
.pack-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -120%); padding: 6px 10px; border: 1px solid var(--gold-bright); border-radius: 6px; background: #2a2a20; color: var(--gold-bright); font-size: 14px; }
.pack-readout { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin: 10px 0 4px; font-size: 14px; }
@media (max-width: 700px) { .pack-readout { grid-template-columns: 1fr; } }
.pack-readout div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding: 2px 0; }
.pack-readout span { color: var(--muted); }
.pack-readout strong { color: var(--gold-bright); font-weight: normal; font-family: var(--digits); }
/* Basketbalový automat (aréna) */
.modal-box.basket-box { width: min(100%, 860px); }
.basket-canvas { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 58vh; object-fit: contain; border-radius: 8px; background: #0b0714; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.basket-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.basket-readout { flex: 1 1 220px; font-family: var(--digits); color: var(--gold-bright); font-size: 17px; }
.basket-btn { padding: 6px 12px; font-size: 15px; }
.basket-feedback { min-height: 2.6em; margin: 10px 0 0; }
.basket-hint { margin: 4px 0 0; color: #7dd3e8; }
.basket-hint:empty { display: none; }
.basket-after { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.basket-after p { margin: 0; }
.basket-win { color: var(--ok); }
.basket-lose { color: var(--danger); }

/* Odstřelovací puška (střelnice na kótě 680) */
.modal-box.sniper-box { width: min(100%, 1000px); }
.sniper-canvas { display: block; width: min(100%, calc(56vh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto; border-radius: 8px; background: #050607; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.sniper-canvas:active { cursor: grabbing; }
.sniper-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; }
.sniper-btn { padding: 7px 12px; font-size: 15px; }
.sniper-btn[aria-pressed="true"] { color: #17120a; background: var(--gold-bright); border-color: var(--gold-bright); }
.sniper-zoom { min-width: 42px; font-weight: bold; }
.sniper-fire { min-width: 112px; }
.sniper-posinfo { margin: 8px 0 0; font-size: 14px; color: var(--muted); text-align: center; }
.sniper-task { margin: 8px 0 0; }
.sniper-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sniper-range[hidden] { display: none; }
.sniper-input { width: 96px; margin-left: 8px; padding: 6px 8px; font: inherit; background: #0f1418; color: var(--ink); border: 1px solid var(--gold-dim); border-radius: 4px; }
.sniper-spot { min-height: 2.4em; margin: 8px 0 0; color: #cfe3b6; }
.sniper-spot strong { color: var(--gold-bright); font-weight: normal; }
.sniper-after { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.sniper-after p { margin: 0; flex: 1 1 320px; color: var(--ok); }
/* Výklad („video“): animace s titulky a hlasem */
.modal-box.vyklad-box { width: min(100%, 1000px); }
.vyklad-subtitle { margin: -4px 0 8px; }
.vyklad-canvas { display: block; width: min(100%, calc(58vh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto; border-radius: 8px; background: #0b1220; }
/* telefon na výšku: výklad se kreslí na výšku (scéna nahoře, graf a čísla pod ní) */
.vyklad-canvas.vyklad-tall { width: min(100%, calc(60vh * 480 / 660)); aspect-ratio: 480 / 660; }
@media (max-width: 640px) { .vyklad-sub { font-size: 16px; min-height: 4.4em; margin-top: 8px; } .vyklad-btn { padding: 6px 10px; } }
.vyklad-sub { min-height: 3em; max-width: 880px; margin: 10px auto 0; font-size: 18px; line-height: 1.45; text-align: center; color: var(--ink); }
.vyklad-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }
.vyklad-btn { padding: 6px 12px; font-size: 15px; }
.vyklad-btn[aria-pressed="true"] { color: #17120a; background: var(--gold-bright); border-color: var(--gold-bright); }
.vyklad-play { min-width: 118px; }
.vyklad-count { min-width: 56px; text-align: center; color: var(--muted); font-family: var(--digits); }
.vyklad-note { margin: 6px 0 0; text-align: center; }
.message .why.video { color: var(--gold-bright); border-color: var(--gold); }
.book-video { margin: 14px 0 4px; text-align: center; }
/* tmavé tlačítko – na světlé stránce knihy by světlý text bez pozadí zanikl */
.book-video .btn { font-size: 15px; padding: 6px 14px; background: #2a2117; color: var(--gold-bright); border-color: var(--gold-dim); }
.book-video .btn:hover { background: #3a2d1d; color: #fff1c8; }
/* Skládání kostry (bludiště) */
.modal-box.skel-box { width: min(100%, 760px); }
.skel-wrap { display: flex; gap: 16px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.skel-fig { position: relative; height: min(62vh, 560px); aspect-ratio: 1 / 2; background: radial-gradient(ellipse at 50% 45%, #2b2a22, #15140f 75%); border-radius: 8px; flex: none; }
.skel-base, .skel-bone { position: absolute; display: block; pointer-events: none; user-select: none; -webkit-user-select: none; }
.skel-base { inset: 0; width: 100%; height: 100%; }
.skel-bone { animation: fade-in 0.5s ease both; }
.skel-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.skel-lines line { stroke: var(--gold-bright); stroke-width: 0.5; stroke-dasharray: 1.5 1.2; opacity: 0.8; }
.skel-slot { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 2px solid var(--gold-bright); background: rgba(20, 18, 12, 0.85); color: var(--gold-bright); font: bold 20px var(--serif); cursor: pointer; padding: 0; }
.skel-slot:hover, .skel-slot:focus-visible { background: var(--gold-dim); color: #fff; }
.skel-side { display: flex; flex-direction: column; gap: 8px; min-width: 190px; max-width: 260px; }
.skel-label { margin: 0; color: var(--muted); }
.skel-pick { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid #6b6250; border-radius: 6px; background: #2a2a20; color: var(--ink); cursor: pointer; font-size: 15px; text-align: left; }
.skel-pick img { width: 44px; height: 44px; flex: none; }
.skel-pick.selected { border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: 0 0 0 2px rgba(255, 210, 138, 0.35); }
.skel-missing { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.skel-feedback { min-height: 2.6em; margin-top: 10px; }
.lift-side { display: flex; flex-direction: column; gap: 8px; }
.lift-posture.selected { border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: 0 0 0 2px rgba(255, 210, 138, 0.25); }
.lift-canvas { display: block; width: 100%; height: auto; aspect-ratio: 600 / 420; border-radius: 8px; background: #23251e; touch-action: none; user-select: none; -webkit-user-select: none; }
.lift-canvas:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.stance-slider { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink); }
.stance-slider input { width: 100%; accent-color: var(--gold); }
.stance-push { display: flex; flex-wrap: wrap; gap: 6px; }
.stance-results { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.stance-results .ok { color: var(--ok); }
.stance-results .bad { color: var(--danger); }
/* Výskok: zadání dosahu */
.jump-reach { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.jump-field { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.jump-field input { width: 90px; padding: 6px 8px; font: inherit; background: #0f1418; color: var(--ink); border: 1px solid var(--gold-dim); border-radius: 4px; }

/* Neonové terče */
.modal-box.targets-box { width: min(100%, 920px); }
.targets-arena { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 60dvh; margin: 0 auto; overflow: hidden; border-radius: 8px; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse at 50% 120%, rgba(255, 79, 216, 0.18), transparent 60%), linear-gradient(rgba(63, 224, 255, 0.07) 1px, transparent 1px) 0 0 / 40px 40px, linear-gradient(90deg, rgba(63, 224, 255, 0.07) 1px, transparent 1px) 0 0 / 40px 40px, #05070c;
  border: 1px solid #1d3a48; cursor: crosshair; }
.targets-overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; background: rgba(3, 5, 9, 0.8); }
.targets-overlay[hidden] { display: none; }
.targets-overlay h3 { margin: 0; color: var(--gold-bright); }
.neon-target { position: absolute; border-radius: 50%; pointer-events: none; --c: #3fe0ff;
  border: 3px solid var(--c); box-shadow: 0 0 10px var(--c), 0 0 24px var(--c), inset 0 0 12px var(--c);
  background: radial-gradient(circle, var(--c) 0 14%, transparent 15% 34%, color-mix(in srgb, var(--c) 45%, transparent) 35% 42%, transparent 43%); }
.neon-target.appear-0 { animation: t-zoom 0.18s ease-out; }
.neon-target.appear-1 { animation: t-fade 0.22s ease-out; }
.neon-target.appear-2 { animation: t-spin 0.25s ease-out; }
.neon-target.hit { animation: t-hit 0.25s ease-out forwards; }
@keyframes t-zoom { from { transform: scale(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes t-fade { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
@keyframes t-spin { from { transform: scale(1.6) rotate(90deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes t-hit { to { transform: scale(1.8); opacity: 0; } }
.target-miss { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; color: #ff6b6b; font-size: 18px; line-height: 18px; text-align: center; animation: t-fade 0.2s reverse forwards; }
.target-miss::before { content: '×'; }
.tape-reading { font-family: var(--digits); font-size: 34px; color: var(--gold-bright); text-align: center; margin: 8px 0 0; min-height: 1.2em; }

/* ---------- Kalkulačka (plovoucí okno nad hrou i nad zámkem) ---------- */

.calc {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 45;
  width: 236px;
  padding: 0 10px 10px;
  background: linear-gradient(180deg, #2c2e31, #1a1b1d);
  border: 1px solid #4a4d50;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  font-family: var(--digits);
  animation: rise 0.25s ease both;
}

.calc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px 4px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.06em;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.calc-close { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; padding: 0 4px; }
.calc-close:hover { color: var(--gold-bright); }

.calc-screen {
  background: linear-gradient(180deg, #b3c2a0, #97a785);
  border: 2px solid #111;
  border-radius: 4px;
  padding: 4px 8px 6px;
  color: #1d2418;
  text-align: right;
  font-family: "Courier New", Courier, monospace;
  height: 66px;               /* pevná výška – tlačítka pod displejem nikdy neposkočí */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.calc-last { min-height: 16px; font-size: 12px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; }
.calc-main { font-size: 22px; font-weight: bold; line-height: 1.2; white-space: nowrap; overflow: hidden; direction: rtl; }
.calc-main.long { font-size: 16px; }
.calc-main.xlong { font-size: 12px; }

.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }

.calc-key {
  padding: 8px 0;
  font-size: 17px;
  background: linear-gradient(180deg, #e2e2da, #bdbdb4);
  border: 1px solid #77776f;
  border-radius: 5px;
  color: #1a1a18;
  box-shadow: 0 2px 0 #55554f;
}

.calc-key:active { transform: translateY(2px); box-shadow: none; }
.calc-key.fn { background: linear-gradient(180deg, #6a6d70, #4c4f52); color: #f0f0ea; border-color: #2c2e30; }
.calc-key.op { background: linear-gradient(180deg, #e0a050, #b9772c); color: #1a1208; border-color: #7a4c18; }
.calc-key.eq { grid-column: 1 / -1; background: linear-gradient(180deg, #e0a050, #b9772c); color: #1a1208; border-color: #7a4c18; font-weight: bold; }

.calc-transfer {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 7px 6px;
  background: none;
  border: 1px solid var(--gold-dim);
  border-radius: 5px;
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 14px;
}

.calc-transfer:hover { border-color: var(--gold-bright); }

/* tlačítko „Kalkulačka“ v zámku brány */
.lock .calc-open { display: block; margin: 12px auto 0; }

@media (max-width: 600px), (max-height: 600px) {
  .calc { width: 206px; top: 44px; right: 8px; }
  .calc-key { padding: 6px 0; font-size: 15px; }
}

/* ---------- Oznámení ---------- */

.toast {
  position: fixed;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 8px 16px;
  background: rgba(18, 16, 13, 0.95);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  color: var(--gold-bright);
  font-size: 15px;
  animation: rise 0.3s ease both;
  pointer-events: none;
}

/* ---------- Úzké displeje ---------- */

@media (max-width: 600px) {
  html, body { font-size: 16px; }
  .hud { padding: 6px 10px; gap: 8px; }
  .hud-btn { padding: 4px 7px; font-size: 13px; }
  .gate-num { display: none; }
  .message { font-size: 15px; padding: 8px 12px; height: 7em; }
  .inventory { padding: 6px 10px 8px; }
}

/* Nízké okno (telefon na šířku, malé okno): zpráva i inventář zůstávají pod místností, jen menší. */
@media (max-height: 600px) {
  .hud { padding: 4px 10px; }
  .hud-btn { padding: 2px 8px; font-size: 13px; }
  .message { height: 3.6em; font-size: 14px; padding: 6px 12px; }
  .inventory { min-height: 0; padding: 4px 10px 6px; }
  .slot { width: 54px; }
  .slot img { width: 30px; height: 30px; }
  .toast { top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .scene-storm { display: none; }
}
/* Noční cvičiště: mapa se svahem (nosítka a přilba kreslí na plátno – .stretcher-canvas, .helmet-canvas) */
.slope-map { border-radius: 8px; }
.slope-route { fill: none; stroke-width: 3; opacity: 0.55; pointer-events: none; }
.slope-route.selected { opacity: 1; stroke-width: 5; }
.slope-route-hit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; }
.slope-task { margin-top: 10px; }
.slope-task .question { margin: 6px 0 8px; }
.slope-options { display: flex; flex-direction: column; gap: 6px; }
.slope-options .btn { text-align: left; }
/* Fotografická laboratoř: stroboskopická fotografie */
.strobo-photo { border-radius: 6px; }
.strobo-cursor { cursor: grab; }
.strobo-table { grid-template-columns: 1fr; }
