/* Escape room „Laboratorium druku 3D” (Centrum Nauki, pod kompendium, nad lekcjami wideo). Komponent: kompendium/escape.js.
   Konsola gry zawsze ciemna (styl cyber) w obu motywach; pas tła pod nią w kolorach strony. Prefiks esc-. */

/* ── pas tła na całą szerokość (jak „Lekcje wideo”) ── */
.tl-escape { position: relative; isolation: isolate; margin-top: 5rem; padding: 0 0 4.5rem; }
.tl-escape + .tl-videos { margin-top: 0; }  /* lekcje wideo zaraz pod escape roomem, na samym dole */
@media (max-width: 600px) { .tl-escape { margin-top: 4rem; padding-bottom: 3.5rem; } }
.tl-escape::before { content: ''; position: absolute; z-index: -1; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%);
  background: radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--purple) 16%, var(--bg)), var(--bg) 70%);
  border-top: 1px solid color-mix(in srgb, var(--purple) 24%, transparent); }
.tl-escape > .tl3d-head { transform: translateY(-50%); margin-bottom: -.25rem; }
.tl-escape .tl3d-back { margin-bottom: 0; }

/* ── konsola ── */
.esc { --c1: #00E5FF; --c2: #B14BFF; --ok: #22F59A; --bad: #FF3D6E; --warn: #FFC233; --ink: #E8F4FF; --dim: #8FA3BF;
  --panel: rgba(10, 16, 32, .72); --line: rgba(0, 229, 255, .22);
  position: relative; overflow: hidden; border-radius: 26px; color: var(--ink); font-family: 'Inter', sans-serif;
  background: radial-gradient(120% 90% at 50% -10%, #1A1446 0%, #0A0F22 45%, #050812 100%);
  border: 1px solid rgba(0, 229, 255, .28);
  box-shadow: 0 0 0 1px rgba(177, 75, 255, .12) inset, 0 30px 80px -30px rgba(0, 229, 255, .35), 0 0 60px -20px rgba(177, 75, 255, .5);
  min-height: 560px; isolation: isolate; }
.esc *, .esc *::before, .esc *::after { box-sizing: border-box; }
.esc button { font: inherit; }
/* siatka w perspektywie (podłoga laboratorium) */
.esc-grid { position: absolute; inset: auto -40% -10% -40%; height: 55%; z-index: -2; pointer-events: none; opacity: .55;
  background-image: linear-gradient(rgba(0, 229, 255, .35) 1px, transparent 1px), linear-gradient(90deg, rgba(177, 75, 255, .35) 1px, transparent 1px);
  background-size: 46px 46px; transform: perspective(420px) rotateX(62deg); transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 35%, #000 70%, transparent);
  animation: esc-grid 3.2s linear infinite; }
@keyframes esc-grid { to { background-position: 0 46px, 0 0; } }
.esc-scan { position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px); }
.esc-scan::after { content: ''; position: absolute; left: 0; right: 0; height: 120px; top: -120px;
  background: linear-gradient(180deg, transparent, rgba(0, 229, 255, .07), transparent); animation: esc-sweep 6s linear infinite; }
@keyframes esc-sweep { to { top: 100%; } }
.esc-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
.esc-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
.esc-flash.ok { animation: esc-flash .7s ease-out; background: radial-gradient(70% 60% at 50% 50%, rgba(34, 245, 154, .35), transparent 70%); }
.esc-flash.bad { animation: esc-flash .9s ease-out; background: radial-gradient(80% 70% at 50% 50%, rgba(255, 61, 110, .42), rgba(255, 61, 110, .12) 70%); }
@keyframes esc-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.esc.is-alarm { animation: esc-alarm .9s ease-out; }
@keyframes esc-alarm { 0%, 100% { border-color: rgba(0, 229, 255, .28); } 20%, 60% { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad) inset, 0 0 60px -10px var(--bad); } }
.esc.is-glitch .esc-screen { animation: esc-glitch .55s steps(2, end); }
@keyframes esc-glitch {
  0% { transform: translate(0); filter: none; }
  15% { transform: translate(-6px, 2px) skewX(-4deg); filter: hue-rotate(80deg) saturate(2); }
  30% { transform: translate(5px, -3px); clip-path: inset(10% 0 55% 0); }
  45% { transform: translate(-3px, 1px) skewX(6deg); clip-path: inset(48% 0 12% 0); filter: hue-rotate(-60deg); }
  60% { transform: translate(4px, 0); clip-path: none; }
  80% { transform: translate(-2px, -1px); filter: contrast(1.6); }
  100% { transform: translate(0); filter: none; } }
.esc.is-shake { animation: esc-shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes esc-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }

.esc-screen { position: relative; z-index: 3; padding: 1.6rem 1.7rem 1.7rem; }
.esc-mono { font-family: 'Space Mono', ui-monospace, monospace; }

/* ── nagłówek z efektem glitch ── */
.esc-title { position: relative; margin: 0; font: 700 clamp(1.6rem, 4vw, 2.6rem)/1.05 'Space Grotesk', sans-serif; letter-spacing: -.5px; text-align: center;
  background: linear-gradient(90deg, var(--c1), #fff 45%, var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 30px rgba(0, 229, 255, .25); }
.esc-title[data-text]::before, .esc-title[data-text]::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
  -webkit-background-clip: text; background-clip: text; opacity: .7; }
.esc-title[data-text]::before { color: var(--c1); transform: translate(-2px, 0); clip-path: inset(0 0 60% 0); animation: esc-gl1 3.6s infinite steps(1); -webkit-text-fill-color: var(--c1); }
.esc-title[data-text]::after { color: var(--bad); transform: translate(2px, 0); clip-path: inset(60% 0 0 0); animation: esc-gl2 3.6s infinite steps(1); -webkit-text-fill-color: var(--bad); }
@keyframes esc-gl1 { 0%, 88%, 100% { opacity: 0; } 89% { opacity: .8; transform: translate(-4px, 1px); } 92% { opacity: .8; transform: translate(3px, -1px); clip-path: inset(20% 0 50% 0); } 95% { opacity: 0; } }
@keyframes esc-gl2 { 0%, 89%, 100% { opacity: 0; } 90% { opacity: .7; transform: translate(4px, 0); } 93% { opacity: .7; transform: translate(-3px, 1px); clip-path: inset(55% 0 10% 0); } 96% { opacity: 0; } }
.esc-kick { display: block; text-align: center; font: 700 .78rem 'Space Mono', monospace; letter-spacing: 4px; text-transform: uppercase; color: var(--c1); margin-bottom: .6rem; }
.esc-kick::before { content: '● '; color: var(--bad); animation: esc-blink 1.2s steps(1) infinite; }
@keyframes esc-blink { 50% { opacity: 0; } }

/* ── ekran startowy ── */
.esc-intro { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 1.8rem; align-items: center; margin-top: 1.4rem; }
.esc-story { font-size: 1.02rem; line-height: 1.65; color: #CFE0F5; }
.esc-story p { margin: 0 0 .8rem; }
.esc-story b { color: #fff; }
.esc-term { font: .84rem/1.55 'Space Mono', monospace; color: var(--ok); background: rgba(0, 0, 0, .35); border: 1px solid rgba(34, 245, 154, .25);
  border-radius: 12px; padding: .8rem 1rem; margin: 0 0 1.1rem; min-height: 5.2em; white-space: pre-wrap; }
.esc-term .err { color: var(--bad); }
.esc-term .cur { display: inline-block; width: .55em; height: 1em; background: var(--ok); vertical-align: -2px; animation: esc-blink .9s steps(1) infinite; }
.esc-rules { list-style: none; margin: 0 0 1.3rem; padding: 0; display: grid; gap: .45rem; }
.esc-rules li { display: flex; gap: .6rem; align-items: center; font-size: .92rem; color: #CFE0F5; }
.esc-rules i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(0, 229, 255, .1); color: var(--c1); flex: none; font-size: .8rem; }
.esc-best { font: 700 .8rem 'Space Mono', monospace; color: var(--warn); margin-top: .9rem; }

.esc-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .6rem; border: 0; cursor: pointer;
  padding: 1rem 2rem; border-radius: 14px; font: 700 1.05rem 'Space Grotesk', sans-serif; letter-spacing: .5px; color: #04121A;
  background: linear-gradient(90deg, var(--c1), #7CF3FF 40%, var(--c2)); box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset, 0 10px 34px -8px rgba(0, 229, 255, .7);
  transition: transform .15s ease, box-shadow .2s ease; overflow: hidden; }
.esc-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transform: translateX(-120%); animation: esc-shine 2.8s ease-in-out infinite; }
@keyframes esc-shine { 60%, 100% { transform: translateX(120%); } }
.esc-btn:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset, 0 16px 40px -8px rgba(0, 229, 255, .9); }
.esc-btn:active { transform: translateY(0) scale(.98); }
.esc-btn:focus-visible, .esc-ans:focus-visible, .esc-ghost:focus-visible, .esc-icon:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.esc-btn.pulse { animation: esc-pulse 1.8s ease-in-out infinite; }
@keyframes esc-pulse { 50% { box-shadow: 0 0 0 1px rgba(255,255,255,.25) inset, 0 0 0 10px rgba(0, 229, 255, .12), 0 10px 40px -6px rgba(0, 229, 255, .9); } }
.esc-ghost { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; padding: .7rem 1.1rem; border-radius: 12px; color: var(--ink);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); font-weight: 600; font-size: .92rem; transition: background .2s, border-color .2s; }
.esc-ghost:hover { background: rgba(0, 229, 255, .12); border-color: var(--c1); }

/* ── HUD ── */
.esc-hud { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .7rem .9rem; margin-bottom: 1.2rem;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 16px; }
.esc-locks { display: flex; gap: .4rem; flex-wrap: nowrap; }
.esc-lock { width: 38px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  color: var(--dim); transition: background .3s, border-color .3s, color .3s, box-shadow .3s; position: relative; }
.esc-lock svg { width: 22px; height: 26px; overflow: visible; }
.esc-lock .sh { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 18px 10px; }
.esc-lock.cur { color: var(--c1); border-color: var(--c1); box-shadow: 0 0 18px -4px var(--c1); animation: esc-lockcur 1.6s ease-in-out infinite; }
@keyframes esc-lockcur { 50% { box-shadow: 0 0 26px -2px var(--c1); } }
.esc-lock.open { color: var(--ok); border-color: rgba(34, 245, 154, .55); background: rgba(34, 245, 154, .1); box-shadow: 0 0 18px -6px var(--ok); animation: none; }
.esc-lock.open .sh { transform: translateY(-5px) rotate(-28deg); }
.esc-lock.pop { animation: esc-pop .6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes esc-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.esc-stats { display: flex; align-items: center; gap: 1rem; }
.esc-lives { display: flex; gap: .3rem; }
.esc-life { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--warn); background: rgba(255, 194, 51, .12); border: 1px solid rgba(255, 194, 51, .4); transition: all .35s; }
.esc-life svg { width: 18px; height: 18px; }
.esc-life.last { color: var(--bad); border-color: var(--bad); background: rgba(255, 61, 110, .15); animation: esc-lastlife 1s ease-in-out infinite; }
@keyframes esc-lastlife { 50% { box-shadow: 0 0 16px -2px var(--bad); transform: scale(1.12); } }
.esc-life.lost { color: #4B566B; background: transparent; border-color: rgba(255,255,255,.08); transform: scale(.85); animation: esc-lose .7s ease; }
@keyframes esc-lose { 0% { transform: scale(1.4) rotate(0); color: var(--bad); } 60% { transform: scale(.7) rotate(25deg); } 100% { transform: scale(.85); } }
.esc-time { font: 700 1.05rem 'Space Mono', monospace; color: var(--ink); min-width: 4.2ch; text-align: right; }
.esc-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; color: var(--dim); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
.esc-icon:hover { color: var(--c1); border-color: var(--c1); }

/* ── plansza gry: drukarka + pytanie ── */
.esc-play { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 1.4rem; align-items: stretch; }
.esc-rig { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .6rem; border-radius: 18px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
.esc-rig svg { width: 100%; max-width: 320px; height: auto; overflow: visible; }
.esc-rig-cap { font: 700 .74rem 'Space Mono', monospace; letter-spacing: 1.5px; color: var(--dim); margin-top: .4rem; text-align: center; }
.esc-rig-cap b { color: var(--c1); }
/* elementy drukarki */
.esc-fr { fill: #0E1530; stroke: #3B4A72; stroke-width: 2; }
.esc-glass { fill: rgba(0, 229, 255, .05); stroke: rgba(0, 229, 255, .35); stroke-width: 1.5; }
.esc-rod { stroke: #33415F; stroke-width: 3; stroke-linecap: round; }
.esc-bed { fill: #2A3557; stroke: #4C5C86; stroke-width: 1.5; }
.esc-led { stroke: var(--c1); stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--c1)); }
.esc-screen-txt { font: 700 9px 'Space Mono', monospace; fill: var(--c1); letter-spacing: 1px; }
.esc-screen-tmp { font: 700 9px 'Space Mono', monospace; fill: #FF8A3D; }
.esc-head { transition: transform .5s cubic-bezier(.4, 0, .2, 1); }
.esc-head .nz { fill: #FF8A3D; filter: drop-shadow(0 0 6px #FF8A3D); }
.esc-head.sweep { animation: esc-sweepx .95s ease-in-out; }
@keyframes esc-sweepx { 0% { transform: translate(var(--x0), var(--y)); } 50% { transform: translate(var(--x1), var(--y)); } 100% { transform: translate(var(--x0), var(--y)); } }
.esc-lay { fill: url(#escKeyG); opacity: 0; transform-box: fill-box; transform-origin: left center; transform: scaleX(0); }
.esc-lay.on { opacity: 1; transform: scaleX(1); transition: transform .9s ease-in-out, opacity .1s; filter: drop-shadow(0 0 4px rgba(0, 229, 255, .6)); }
.esc-lay.on.fresh { animation: esc-hot 1.6s ease-out; }
@keyframes esc-hot { 0% { filter: drop-shadow(0 0 10px #FF8A3D) brightness(1.8); } 100% { filter: drop-shadow(0 0 4px rgba(0, 229, 255, .6)); } }
.esc-spag { fill: none; stroke: #FF3D6E; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 600; stroke-dashoffset: 600; opacity: 0; }
.esc-rig.is-err .esc-spag { animation: esc-spag 1.6s ease-out; }
@keyframes esc-spag { 0% { opacity: 1; stroke-dashoffset: 600; } 45% { opacity: 1; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 0; } }
.esc-rig.is-err .esc-led { stroke: var(--bad); filter: drop-shadow(0 0 5px var(--bad)); }
.esc-rig.is-err .esc-screen-txt { fill: var(--bad); }

.esc-q { display: flex; flex-direction: column; padding: 1.2rem 1.3rem; border-radius: 18px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(177, 75, 255, .1) inset; }
.esc-q-meta { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; font: 700 .74rem 'Space Mono', monospace; letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); margin-bottom: .8rem; }
.esc-q-meta b { color: var(--c1); }
.esc-q-text { font: 700 clamp(1.12rem, 2.3vw, 1.4rem)/1.35 'Space Grotesk', sans-serif; color: #fff; margin: 0 0 1.1rem; min-height: 2.7em; }
/* długi kod bez spacji (np. el.classList.toggle("ciemny")) łamie się zamiast wychodzić poza wąski ekran */
.esc-q-text, .esc-ans, .esc-msg { overflow-wrap: anywhere; }
.esc-q-text .cur { display: inline-block; width: .5em; height: .95em; background: var(--c1); margin-left: 2px; vertical-align: -1px; animation: esc-blink .7s steps(1) infinite; }
.esc-answers { display: grid; gap: .6rem; }
.esc-ans { position: relative; display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; cursor: pointer; color: var(--ink);
  padding: .85rem 1rem; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12);
  font-size: .98rem; line-height: 1.35; transition: transform .15s ease, background .2s, border-color .2s, box-shadow .2s, opacity .3s;
  opacity: 0; transform: translateY(8px); }
.esc-ans.in { opacity: 1; transform: none; }
.esc-ans:not(.in) { pointer-events: none; }
.esc-ans .k { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font: 700 .85rem 'Space Mono', monospace;
  color: var(--c1); background: rgba(0, 229, 255, .1); border: 1px solid rgba(0, 229, 255, .3); }
.esc-ans:hover:not(:disabled) { background: rgba(0, 229, 255, .1); border-color: var(--c1); transform: translateX(4px); box-shadow: 0 0 22px -8px var(--c1); }
.esc-ans:disabled { cursor: default; }
.esc-ans.ok { background: rgba(34, 245, 154, .16); border-color: var(--ok); box-shadow: 0 0 26px -6px var(--ok); color: #fff; }
.esc-ans.ok .k { color: #04121A; background: var(--ok); border-color: var(--ok); }
.esc-ans.bad { background: rgba(255, 61, 110, .14); border-color: var(--bad); color: #FFC9D6; animation: esc-shake .45s; }
.esc-ans.bad .k { color: #fff; background: var(--bad); border-color: var(--bad); }
.esc-ans.dim { opacity: .38; }
.esc-msg { margin-top: 1rem; padding: .85rem 1rem; border-radius: 14px; font-size: .93rem; line-height: 1.5; display: none; }
.esc-msg.show { display: block; animation: esc-in .35s ease; }
@keyframes esc-in { from { opacity: 0; transform: translateY(6px); } }
.esc-msg.ok { background: rgba(34, 245, 154, .1); border: 1px solid rgba(34, 245, 154, .4); color: #C8FFE6; }
.esc-msg.bad { background: rgba(255, 61, 110, .1); border: 1px solid rgba(255, 61, 110, .4); color: #FFD3DD; }
.esc-msg b.h { display: block; font: 700 .8rem 'Space Mono', monospace; letter-spacing: 2px; margin-bottom: .25rem; }
.esc-msg.ok b.h { color: var(--ok); } .esc-msg.bad b.h { color: var(--bad); }
.esc-msg-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.esc-next { padding: .8rem 1.4rem; font-size: .98rem; }

/* duży napis na środku (ZAMEK ODBLOKOWANY / BŁĄD DRUKU) */
.esc-banner { position: absolute; left: 50%; top: 46%; z-index: 7; pointer-events: none; transform: translate(-50%, -50%) scale(.6); opacity: 0; white-space: nowrap;
  font: 700 clamp(1.4rem, 4.6vw, 2.6rem) 'Space Grotesk', sans-serif; letter-spacing: 1px; padding: .5rem 1.2rem; border-radius: 14px; }
.esc-banner.ok { color: var(--ok); text-shadow: 0 0 24px var(--ok); background: rgba(5, 20, 14, .65); border: 1px solid rgba(34, 245, 154, .5); }
.esc-banner.bad { color: var(--bad); text-shadow: 0 0 24px var(--bad); background: rgba(30, 5, 12, .7); border: 1px solid rgba(255, 61, 110, .55); }
.esc-banner.show { animation: esc-banner 1.3s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes esc-banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  30% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

/* ── koniec gry ── */
.esc-end { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 1.6rem; align-items: center; margin-top: 1.2rem; }
.esc-door { position: relative; aspect-ratio: 3 / 4; max-width: 300px; width: 100%; margin: 0 auto; border-radius: 16px; overflow: hidden;
  background: radial-gradient(60% 60% at 50% 50%, #fff, #9FF6FF 25%, rgba(0, 229, 255, .3) 55%, transparent 75%), #050812; border: 2px solid #3B4A72; }
.esc-door::before, .esc-door::after { content: ''; position: absolute; top: 0; bottom: 0; width: 50%; z-index: 2;
  background: repeating-linear-gradient(90deg, #121B38 0 12px, #0E1530 12px 24px); border: 1px solid #3B4A72; transition: transform 1.4s cubic-bezier(.7, 0, .3, 1) .9s; }
.esc-door::before { left: 0; } .esc-door::after { right: 0; }
.esc-door.open::before { transform: translateX(-100%); } .esc-door.open::after { transform: translateX(100%); }
.esc-door .rays { position: absolute; inset: -40%; z-index: 1; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.22) 0 6deg, transparent 6deg 18deg); animation: esc-spin 12s linear infinite; }
@keyframes esc-spin { to { transform: rotate(360deg); } }
.esc-door .slot { position: absolute; z-index: 3; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: #0A0F22; border: 2px solid var(--c1); box-shadow: 0 0 20px var(--c1); transition: opacity .4s .9s; }
.esc-door.open .slot { opacity: 0; }
.esc-door .fly { position: absolute; z-index: 4; left: 50%; top: 50%; width: 46%; height: auto; transform-origin: 50% 50%; translate: -50% -50%; margin: 0; opacity: 0; }
@keyframes esc-fly { 0% { opacity: 0; transform: translateY(160px) rotate(-90deg) scale(.6); } 40% { opacity: 1; } 75% { transform: translateY(0) rotate(8deg) scale(1.15); } 100% { opacity: 1; transform: translateY(0) rotate(0) scale(1.1); } }
.esc-door .fly { filter: drop-shadow(0 0 14px #00E5FF) drop-shadow(0 0 30px rgba(177, 75, 255, .8)); }
.esc-door.open .fly { animation: esc-fly 1.1s cubic-bezier(.3, 1.2, .5, 1) forwards, esc-float 3s ease-in-out 1.2s infinite; }
@keyframes esc-float { 0%, 100% { translate: -50% -50%; } 50% { translate: -50% calc(-50% - 8px); } }
.esc-result h3 { margin: .2rem 0 .4rem; font: 700 clamp(1.5rem, 3.6vw, 2.2rem) 'Space Grotesk', sans-serif; color: #fff; }
.esc-result p { color: #CFE0F5; margin: 0 0 1rem; line-height: 1.6; }
.esc-stars { display: flex; gap: .5rem; margin: .2rem 0 1rem; }
.esc-star { width: 46px; height: 46px; color: #2A3557; }
.esc-result p.esc-tip { margin: -.5rem 0 .8rem; font: 700 .78rem 'Space Mono', monospace; letter-spacing: .5px; color: var(--warn); }
.esc-star.on { color: var(--warn); filter: drop-shadow(0 0 10px var(--warn)); animation: esc-star .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.esc-star:nth-child(2).on { animation-delay: .25s; } .esc-star:nth-child(3).on { animation-delay: .5s; }
@keyframes esc-star { 0% { transform: scale(0) rotate(-90deg); } 100% { transform: scale(1) rotate(0); } }
.esc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.2rem; }
.esc-tile { padding: .75rem .6rem; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); text-align: center; }
.esc-tile b { display: block; font: 700 1.25rem 'Space Mono', monospace; color: var(--c1); }
.esc-tile span { font-size: .74rem; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.esc-rank { display: inline-flex; align-items: center; gap: .5rem; font: 700 .82rem 'Space Mono', monospace; letter-spacing: 1.5px; text-transform: uppercase;
  padding: .45rem .9rem; border-radius: 999px; color: #04121A; background: linear-gradient(90deg, var(--warn), #FFE27A); margin-bottom: .6rem; }
.esc-lose-art { display: grid; place-items: center; }
.esc-lose-art svg { width: 100%; max-width: 280px; }
.esc-lose-art .esc-spag { opacity: 1; animation: esc-spagloop 2.4s ease-in-out infinite; }
@keyframes esc-spagloop { 0% { stroke-dashoffset: 600; } 60%, 100% { stroke-dashoffset: 0; } }
.esc-smoke { fill: #8FA3BF; opacity: 0; animation: esc-smoke 2.6s ease-out infinite; }
.esc-smoke:nth-of-type(2) { animation-delay: .8s; } .esc-smoke:nth-of-type(3) { animation-delay: 1.6s; }
@keyframes esc-smoke { 0% { opacity: .5; transform: translateY(0) scale(.6); } 100% { opacity: 0; transform: translateY(-50px) scale(1.6); } }

/* ── laptop 13-15" (niski ekran): cała konsola z pytaniem, wyjaśnieniem i przyciskiem „Dalej” na jednym ekranie ── */
@media (min-width: 861px) and (max-height: 900px) {
  .esc { min-height: 0; }
  .esc-screen { padding: 1rem 1.3rem 1.1rem; }
  .esc-hud { margin-bottom: .75rem; padding: .5rem .75rem; }
  .esc-lock { width: 34px; height: 38px; }
  .esc-play { gap: 1rem; }
  .esc-rig svg { max-width: 250px; }
  .esc-q { padding: .9rem 1.1rem; }
  .esc-q-meta { margin-bottom: .5rem; }
  .esc-q-text { font-size: 1.18rem; margin-bottom: .7rem; min-height: 0; }
  .esc-answers { gap: .4rem; }
  .esc-ans { padding: .55rem .85rem; font-size: .94rem; }
  .esc-ans .k { width: 27px; height: 27px; }
  .esc-msg { margin-top: .6rem; padding: .6rem .85rem; font-size: .88rem; line-height: 1.45; }
  .esc-msg-row { margin-top: .5rem; }
  .esc-next, .esc-msg .esc-ghost { padding: .6rem 1.1rem; font-size: .92rem; }
  .esc-intro { margin-top: .9rem; gap: 1.4rem; }
  .esc-term { margin-bottom: .8rem; padding: .6rem .9rem; }
  .esc-story p { margin-bottom: .55rem; }
  .esc-rules { margin-bottom: .9rem; }
  .esc-btn { padding: .85rem 1.7rem; }
  .esc-end { margin-top: .8rem; }
  .esc-door { max-width: 240px; }
}

/* laptop 14" w przeglądarce (okno ok. 600-720 px wysokości po odjęciu pasków przeglądarki i Windows): jeszcze ciaśniej */
@media (min-width: 861px) and (max-height: 720px) {
  .esc-screen { padding: .7rem 1.1rem .8rem; }
  .esc-hud { margin-bottom: .55rem; padding: .35rem .6rem; }
  .esc-lock { width: 30px; height: 32px; }
  .esc-lock svg { width: 18px; height: 22px; }
  .esc-life { width: 26px; height: 26px; }
  .esc-play { gap: .8rem; }
  .esc-rig svg { max-width: 200px; }
  .esc-q { padding: .65rem .95rem; }
  .esc-q-meta { margin-bottom: .35rem; }
  .esc-q-text { font-size: 1.08rem; margin-bottom: .5rem; }
  .esc-answers { gap: .3rem; }
  .esc-ans { padding: .38rem .8rem; font-size: .9rem; }
  .esc-ans .k { width: 24px; height: 24px; }
  .esc-msg { margin-top: .45rem; padding: .45rem .75rem; font-size: .84rem; line-height: 1.4; }
  .esc-msg-row { margin-top: .4rem; }
  .esc-next, .esc-msg .esc-ghost { padding: .45rem 1rem; font-size: .88rem; }
  .esc-kick { margin-bottom: .35rem; }
  .esc-title { font-size: 2rem; }
  .esc-intro { margin-top: .6rem; gap: 1.2rem; }
  .esc-term { margin-bottom: .6rem; padding: .45rem .8rem; }
  .esc-story { font-size: .94rem; line-height: 1.55; }
  .esc-story p { margin-bottom: .45rem; }
  .esc-rules { gap: .3rem; margin-bottom: .7rem; }
  .esc-rules i { width: 24px; height: 24px; }
  .esc-btn { padding: .7rem 1.5rem; }
  .esc-end { margin-top: .5rem; }
  .esc-door { max-width: 200px; }
  .esc-result h3 { font-size: 1.6rem; margin-bottom: .25rem; }
  .esc-result p { margin-bottom: .6rem; line-height: 1.5; }
  .esc-stars { margin-bottom: .6rem; }
  .esc-star { width: 38px; height: 38px; }
  .esc-tiles { margin-bottom: .8rem; }
  .esc-tile { padding: .5rem .5rem; }
}

/* ── telefon i tablet ── */
@media (max-width: 860px) {
  .esc-intro, .esc-end { grid-template-columns: 1fr; }
  .esc-play { grid-template-columns: 1fr; }
  .esc-rig { flex-direction: row; gap: 1rem; padding: .5rem .8rem; }
  .esc-rig svg { max-width: 150px; }
  .esc-rig-cap { text-align: left; margin: 0; }
  .esc-locks { width: 100%; justify-content: space-between; }
  .esc-lock { width: auto; flex: 1; max-width: 58px; }
  .esc-stats { width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .esc { border-radius: 20px; min-height: 0; }
  .esc-screen { padding: 1.1rem .9rem 1.2rem; }
  .esc-hud { padding: .55rem .6rem; gap: .6rem; }
  .esc-locks { gap: .2rem; width: 100%; justify-content: space-between; }
  .esc-lock { height: 36px; border-radius: 8px; }
  .esc-lock svg { width: 16px; height: 20px; }
  .esc-life { width: 26px; height: 26px; }
  .esc-q { padding: 1rem .9rem; }
  .esc-ans { padding: .75rem .8rem; font-size: .94rem; }
  .esc-tiles { gap: .4rem; }
  .esc-tile b { font-size: 1.05rem; }
  .esc-btn { width: 100%; }
}
/* telefon poziomo (niski ekran do 500 px): układ jak na komputerze, tylko ciaśniej – rysunek obok pytania, pasek w jednym wierszu,
   odpowiedzi w 2 kolumnach; inaczej po starcie pytanie było poniżej ekranu */
@media (max-width: 860px) and (max-height: 500px) and (orientation: landscape) {
  .esc { min-height: 0; border-radius: 18px; }
  .esc-screen { padding: .6rem .8rem .7rem; }
  .esc-hud { flex-wrap: nowrap; gap: .6rem; margin-bottom: .5rem; padding: .35rem .55rem; }
  .esc-locks { width: auto; flex: 1; gap: .25rem; }
  .esc-lock { height: 30px; max-width: 44px; border-radius: 8px; }
  .esc-lock svg { width: 15px; height: 19px; }
  .esc-stats { width: auto; gap: .5rem; }
  .esc-life { width: 24px; height: 24px; }
  .esc-life svg { width: 14px; height: 14px; }
  .esc-time { font-size: .9rem; }
  .esc-icon { width: 30px; height: 30px; }
  .esc-play { grid-template-columns: minmax(0, .55fr) minmax(0, 1.45fr); gap: .6rem; }
  .esc-rig { flex-direction: column; gap: .2rem; padding: .4rem; }
  .esc-rig svg { max-width: 170px; }
  .esc-rig-cap { text-align: center; font-size: .64rem; letter-spacing: 1px; }
  .esc-q { padding: .55rem .75rem; }
  .esc-q-meta { margin-bottom: .3rem; font-size: .64rem; letter-spacing: 1px; }
  .esc-q-text { font-size: 1rem; margin-bottom: .45rem; min-height: 0; }
  .esc-answers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
  .esc-ans { padding: .45rem .6rem; font-size: .86rem; gap: .5rem; }
  .esc-ans .k { width: 24px; height: 24px; font-size: .75rem; }
  .esc-msg { margin-top: .45rem; padding: .45rem .7rem; font-size: .84rem; line-height: 1.4; }
  .esc-msg-row { margin-top: .4rem; }
  .esc-next, .esc-msg .esc-ghost { padding: .45rem 1rem; font-size: .88rem; }
  .esc-btn { width: auto; padding: .7rem 1.4rem; font-size: .95rem; }
  .esc-kick { margin-bottom: .3rem; font-size: .68rem; }
  .esc-title { font-size: 1.6rem; }
  .esc-intro, .esc-end { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-top: .6rem; }
  .esc-story { font-size: .88rem; line-height: 1.5; }
  .esc-story p { margin-bottom: .4rem; }
  .esc-term { margin-bottom: .5rem; padding: .45rem .7rem; min-height: 0; font-size: .76rem; }
  .esc-rules { gap: .25rem; margin-bottom: .6rem; }
  .esc-rules li { font-size: .84rem; }
  .esc-rules i { width: 24px; height: 24px; }
  .esc-door { max-width: 170px; }
  .esc-result h3 { font-size: 1.4rem; }
  .esc-result p { margin-bottom: .5rem; line-height: 1.45; font-size: .9rem; }
  .esc-stars { margin-bottom: .5rem; }
  .esc-star { width: 34px; height: 34px; }
  .esc-tiles { margin-bottom: .6rem; }
  .esc-tile { padding: .45rem .4rem; }
}
/* strony z escape roomem na telefonie poziomo: niższe stałe menu (#nav) – zostaje więcej miejsca na grę */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  #nav { padding-top: .4rem !important; padding-bottom: .4rem !important; }
  #nav .logo-img { width: 36px !important; height: 36px !important; }
}
@media (max-width: 380px) { .esc-rank { font-size: .7rem; letter-spacing: .5px; gap: .35rem; } }
@media (prefers-reduced-motion: reduce) {
  .esc *, .esc *::before, .esc *::after, .esc { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .esc-grid, .esc-scan::after, .esc-title[data-text]::before, .esc-title[data-text]::after { animation: none !important; }
}

/* ── Dyplom: przyciski na ekranie wygranej i okno z imieniem ── */
.esc-end-btns { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.esc-dlg { margin: auto; inset: 0; height: fit-content; border: 0; padding: 0; background: transparent; color: #E8F4FF; max-width: min(480px, calc(100vw - 32px)); width: 100%; }
.esc-dlg::backdrop { background: rgba(5, 8, 18, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.esc-dlg[open] { animation: esc-in .25s ease; }
.esc-dlg-box { position: relative; padding: 1.6rem 1.5rem 1.4rem; border-radius: 22px; font-family: 'Inter', sans-serif;
  background: radial-gradient(120% 90% at 50% -10%, #1A1446 0%, #0A0F22 55%, #050812 100%); border: 1px solid rgba(0, 229, 255, .35);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 50px -15px rgba(177, 75, 255, .6); }
.esc-dlg-box::before { content: ''; position: absolute; top: 0; left: 10%; right: 10%; height: 2px; background: linear-gradient(90deg, transparent, #00E5FF, #B14BFF, transparent); box-shadow: 0 0 12px #00E5FF; }
.esc-dlg-ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; color: #04121A; margin-bottom: .8rem;
  background: linear-gradient(135deg, #FFC233, #FFE27A); box-shadow: 0 0 24px -4px #FFC233; }
.esc-dlg h3 { margin: 0 0 .4rem; font: 700 1.5rem 'Space Grotesk', sans-serif; color: #fff; }
.esc-dlg p { margin: 0 0 1rem; color: #CFE0F5; font-size: .94rem; line-height: 1.55; }
.esc-dlg label { display: block; font: 700 .76rem 'Space Mono', monospace; letter-spacing: 1.5px; text-transform: uppercase; color: #00E5FF; margin-bottom: .4rem; }
.esc-dlg input { width: 100%; box-sizing: border-box; padding: .85rem 1rem; border-radius: 12px; font: 600 1.05rem 'Inter', sans-serif; color: #fff;
  background: rgba(255,255,255,.06); border: 1px solid rgba(0, 229, 255, .35); outline: none; transition: border-color .2s, box-shadow .2s; }
.esc-dlg input:focus { border-color: #00E5FF; box-shadow: 0 0 0 3px rgba(0, 229, 255, .2); }
.esc-dlg input::placeholder { color: #6B7A93; }
.esc-dlg-err { display: block; min-height: 1.2em; margin-top: .35rem; color: #FF7A99; font-size: .84rem; }
.esc-dlg-note { display: flex; gap: .4rem; align-items: center; color: #8FA3BF; font-size: .8rem; margin: .2rem 0 1.1rem; }
.esc-dlg-row { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.esc-dlg .esc-btn, .esc-dlg .esc-ghost { --c1: #00E5FF; --c2: #B14BFF; --ink: #E8F4FF; padding: .8rem 1.4rem; font-size: 1rem; }
.esc-dlg .esc-btn:disabled { opacity: .7; cursor: progress; }  /* strzałka z kółkiem: kursor zawsze widoczny */
@media (max-width: 480px) { .esc-dlg-row { flex-direction: column-reverse; } .esc-dlg-row > * { width: 100%; justify-content: center; } }

/* ── Pełny ekran escape roomu (EscapeVerse, ev-escape.js): przycisk w rogu konsoli, tryb jak F11 albo nakładka (iPhone) ── */
.esc-full-btn { position: absolute; top: .7rem; right: .7rem; z-index: 8; display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
  font: 700 .78rem 'Inter', sans-serif; color: var(--ink); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); transition: background .2s, border-color .2s; }
.esc-full-btn:hover { background: rgba(255,255,255,.16); border-color: var(--c1); }
.esc-full-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.esc.is-full { width: 100%; height: 100%; min-height: 100vh; max-height: 100vh; overflow: hidden; border-radius: 0; border: 0; display: flex; flex-direction: column; justify-content: center; }
.esc.is-full .esc-screen { width: 100%; max-width: 1200px; margin: 0 auto; padding-top: 3.2rem; }
.esc.is-full .esc-full-btn { position: fixed; top: 1rem; right: 1rem; font-size: .9rem; padding: .6rem 1.1rem; }
.esc.esc-pseudo-full { position: fixed; inset: 0; z-index: 9999; }
.esc:fullscreen { background-attachment: fixed; }
@media (max-width: 560px) { .esc-full-btn span { display: none; } .esc-full-btn { padding: .5rem .6rem; } .esc.is-full .esc-full-btn span { display: inline; } }
.esc-full-btn ~ .esc-screen { padding-top: 3.2rem; }
@media (min-width: 861px) and (max-height: 900px) { .esc-full-btn ~ .esc-screen { padding-top: 2.8rem; } }
/* telefon i tablet (ekran dotykowy bez myszy, w każdym ułożeniu) oraz wąskie okno: bez przycisku pełnego ekranu – na dotyku ten tryb nie działa dobrze;
   na komputerze z myszą przycisk zostaje */
@media (max-width: 600px), (hover: none) and (pointer: coarse), (pointer: coarse) and (max-height: 500px) {
  .esc:not(.is-full) .esc-full-btn { display: none; }
  .esc:not(.is-full) .esc-full-btn ~ .esc-screen { padding-top: 1.1rem; }
}
/* pełny ekran: bez poziomego paska (siatka podłogi jest szersza niż ekran) i większa gra na dużych monitorach */
.esc.is-full { overflow-x: hidden; }
@media (min-width: 1500px) and (min-height: 880px) { .esc.is-full .esc-screen { zoom: 1.2; } .esc.is-full .esc-full-btn { top: 1.25rem; right: 1.25rem; font-size: 1.02rem; padding: .7rem 1.3rem; } }
@media (min-width: 1800px) and (min-height: 1000px) { .esc.is-full .esc-screen { zoom: 1.35; } }
/* pełny ekran: pochylona siatka podłogi przypięta do ekranu – inaczej jej obrys (transform) wydłuża przewijanie i pojawia się suwak */
.esc.is-full .esc-grid { position: fixed; }
/* pełny ekran bez suwaka: treść dopasowuje się do ekranu (fitFull w silnikach gry); na wąskim telefonie przewijanie bez paska */
.esc.is-full.fit-scroll { overflow-y: auto; scrollbar-width: none; }
.esc.is-full.fit-scroll::-webkit-scrollbar { display: none; }
.esc.is-full.fit-scroll .esc-grid { display: none; }
