/* ==========================================================================
   SZVTECH — training terminal (/learn/)
   ========================================================================== */
:root {
  --bg: #05050a;
  --bg-2: #0a0a14;
  --fg: #f3f1ff;
  --muted: rgba(226, 224, 255, .62);
  --dim: rgba(226, 224, 255, .42);
  --line: rgba(255, 255, 255, .09);
  --a1: #8b5cf6;
  --a2: #22d3ee;
  --a3: #e879f9;
  --ok: #7dffb3;
  --err: #ff7b95;
  --glass: rgba(255, 255, 255, .04);
  --glass-2: rgba(255, 255, 255, .07);
  --glass-b: rgba(255, 255, 255, .12);
  --f-display: 'Syne', 'Inter', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gut: clamp(16px, 2.6vw, 40px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --grad: linear-gradient(100deg, var(--a1), var(--a3) 45%, var(--a2));
  --top-h: 68px;
  --t-fs: 13.5px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); overflow-x: clip; -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: #2a2840 transparent; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 16px; line-height: 1.55;
  overflow-x: clip; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  display: flex; flex-direction: column; height: 100vh; height: 100svh; min-height: 620px;
}
::selection { background: var(--a1); color: #fff; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
kbd, code { font-family: var(--f-mono); }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.muted { color: var(--muted); }
.label { display: inline-flex; align-items: center; gap: .6em; color: var(--muted); }
.label::before { content: ''; width: 22px; height: 1px; background: var(--grad); }
.is-grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; border-radius: 6px; }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 300; padding: 14px 18px; border-radius: 12px; background: #15132a; border: 1px solid var(--glass-b); }

/* ---------- Background layers ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.glow {
  position: fixed; inset: -10%; z-index: 0; pointer-events: none; opacity: .55;
  background:
    radial-gradient(40vmax 34vmax at 18% 22%, color-mix(in srgb, var(--a1) 26%, transparent), transparent 70%),
    radial-gradient(34vmax 30vmax at 86% 78%, color-mix(in srgb, var(--a2) 16%, transparent), transparent 70%),
    radial-gradient(22vmax 22vmax at 70% 12%, color-mix(in srgb, var(--a3) 12%, transparent), transparent 70%);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(2%, -2%, 0) scale(1.06); } }
.vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(130% 95% at 50% 45%, transparent 52%, rgba(2, 2, 6, .72)); }
.grain {
  position: fixed; inset: -120px; z-index: 90; pointer-events: none; opacity: .055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate3d(0,0,0); } 17% { transform: translate3d(-40px, 30px, 0); } 33% { transform: translate3d(50px, -60px, 0); }
  50% { transform: translate3d(-70px, -20px, 0); } 67% { transform: translate3d(30px, 70px, 0); } 83% { transform: translate3d(-20px, -80px, 0); } 100% { transform: translate3d(0,0,0); }
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 160; pointer-events: none; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 200; background: #040408; display: grid; place-items: center; padding: 24px 16px;
  transition: opacity .55s var(--ease), visibility 0s linear .55s;
}
.boot.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.no-boot .boot, html:not(.js) .boot { display: none; }
.boot__in { width: min(640px, 100%); }
.boot__head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.boot__lines { font: 12.5px/1.75 var(--f-mono); color: rgba(226, 224, 255, .78); white-space: pre-wrap; min-height: 14em; }
.boot__lines .ok { color: var(--ok); }
.boot__lines .c2 { color: var(--a2); }
.boot__day { margin-top: 22px; opacity: 0; transform: translateY(6px); transition: opacity .5s var(--ease), transform .6s var(--ease); }
.boot__day.is-on { opacity: 1; transform: none; }
.boot__day .mono { color: var(--dim); font-size: 10.5px; letter-spacing: .18em; }
.boot__day p { margin-top: 6px; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.05rem, 2.6vw, 1.35rem); letter-spacing: -.01em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot__skip { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; color: var(--dim); font-size: 10.5px; letter-spacing: .16em; }

/* ---------- Header ---------- */
.top { position: relative; z-index: 20; flex: none; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--gut); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; letter-spacing: .02em; font-size: 15px; }
.logo__mark { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(from 0deg, var(--a1), var(--a3), var(--a2), var(--a1)); box-shadow: 0 0 18px color-mix(in srgb, var(--a1) 70%, transparent); animation: spin 6s linear infinite; position: relative; flex: none; }
.logo__mark::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.top__mid { position: absolute; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--a2); box-shadow: 0 0 10px var(--a2); animation: pulse 2s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }
.top__right { display: flex; align-items: center; gap: 8px; }
.xpchip { display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(12, 12, 22, .5); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-size: 11px; color: var(--muted); }
.xpchip b { color: var(--fg); font-weight: 500; }
.xpchip__name { color: var(--fg); text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 13px; font-weight: 500; }
.xpchip__bar { width: 54px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.xpchip__bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .8s var(--ease); }
.ibtn { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; background: rgba(12, 12, 22, .5); border: 1px solid var(--line); color: var(--muted); transition: color .25s, border-color .25s, background-color .25s; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.ibtn:hover { color: var(--fg); border-color: var(--glass-b); background: rgba(255,255,255,.06); }
.ibtn--q { font-family: var(--f-mono); font-weight: 700; font-size: 15px; }
.ibtn--txt { font-size: 11px; padding: 0 14px; display: none; }
.is-free .ibtn--txt { display: inline-grid; }
#soundBtn .snd-on { display: none; }
#soundBtn[aria-pressed="true"] .snd-on { display: inline; }
#soundBtn[aria-pressed="true"] .snd-off { display: none; }
#soundBtn[aria-pressed="true"] { color: var(--a2); border-color: color-mix(in srgb, var(--a2) 40%, transparent); }

/* ---------- App / hero ---------- */
.app { position: relative; z-index: 5; flex: 1 1 auto; min-height: 0; width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 var(--gut) var(--gut); display: flex; flex-direction: column; }
.hero { flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 4px 2px 20px; }
.hero__h { font-family: var(--f-display); font-weight: 800; font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1; letter-spacing: -.035em; margin-top: 10px; }
.hero__sub { max-width: 420px; text-align: right; font-size: 14.5px; line-height: 1.5; color: rgba(243, 241, 255, .86); }
.hero__sub .muted { font-size: 13px; }
.is-free .hero { display: none; }

.stage { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; }
.is-free .stage { grid-template-columns: minmax(0, 1fr); }
.is-free.panel-open .stage { grid-template-columns: minmax(0, 1fr) 380px; }

/* ---------- Terminal ---------- */
.term {
  --t-bg: transparent; --t-fg: rgba(236, 234, 255, .88); --t-glow: var(--a1);
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 18, 36, .78), rgba(8, 8, 16, .86));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 40px 120px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.4), 0 0 90px -34px var(--t-glow), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  transition: box-shadow .6s var(--ease), border-color .6s;
}
.term::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, color-mix(in srgb, var(--a1) 60%, transparent), transparent 30%, transparent 70%, color-mix(in srgb, var(--a2) 50%, transparent)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .7; z-index: 3; }
.term__bar { flex: none; position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.025); }
.term__dots { display: flex; gap: 7px; }
.term__dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a3850; }
.term__dots i:nth-child(1) { background: var(--a3); } .term__dots i:nth-child(2) { background: var(--a1); } .term__dots i:nth-child(3) { background: var(--a2); }
.term__title { flex: 1; min-width: 0; text-align: center; color: var(--muted); text-transform: none; font-size: 12px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term__safe { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 10px; letter-spacing: .14em; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); }
.term__safe span { color: var(--ok); font-size: 7px; }

.term__crt { position: relative; flex: 1 1 auto; min-height: 0; background: var(--t-bg); color: var(--t-fg); transition: background-color .5s, color .5s; }
.term__screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 18px 22px 22px;
  font-family: var(--f-mono); font-size: var(--t-fs); line-height: 1.62; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; cursor: text;
}
.term__out .tl { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; min-height: 1.62em; }
.term__out .tl.in { animation: tl-in .3s var(--ease) both; }
@keyframes tl-in { from { opacity: 0; transform: translateY(3px); } }
.tl .c1 { color: #b197ff; } .tl .c2, .c2 { color: var(--a2); } .tl .c3 { color: var(--a3); } .tl .dim, .dim { color: var(--dim); } .tl .mut { color: var(--muted); }
.tl .err { color: var(--err); } .tl .ok, .ok { color: var(--ok); } .tl b { font-weight: 700; color: #fff; }
.tl .dir { color: var(--a2); font-weight: 500; }
.tl .hit { color: #0a0a12; background: var(--a3); border-radius: 2px; padding: 0 1px; }
.tl .grad, .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 500; }
.tl .k { color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); border-radius: 4px; padding: 0 5px; }
.tl.echo { color: var(--t-fg); }
.tl.echo .pr { color: var(--a2); }
.tl.note { color: var(--dim); font-style: italic; }
.tl .tw { color: var(--muted); font-style: normal; }
.tl .tw code { color: var(--a2); }

.term__line { display: flex; flex-wrap: wrap; align-items: baseline; cursor: text; }
.term__line.is-hidden { display: none; }
.term__prompt { color: var(--a2); white-space: pre-wrap; word-break: break-all; }
.term__field { position: relative; flex: 1 1 auto; min-width: 8ch; white-space: pre-wrap; word-break: break-all; color: var(--t-fg); min-height: 1.62em; }
.term__caret { display: inline-block; min-width: .62em; background: var(--a2); color: #05050a; border-radius: 1px; animation: blink 1.05s steps(1) infinite; }
.term__screen:not(.is-focus) .term__caret { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--a2) 70%, transparent); color: inherit; animation: none; }
@keyframes blink { 50% { background: transparent; color: inherit; } }
.term__input { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; border: 0; outline: 0; background: transparent; color: transparent; font-size: 16px; caret-color: transparent; padding: 0; }

/* table-ish output */
.tgrid { display: grid; grid-template-columns: max-content max-content minmax(0, 1fr); gap: 1px 22px; margin: 4px 0 6px; }
.tgrid > span { white-space: pre-wrap; }
.tgrid .h { color: var(--dim); letter-spacing: .08em; font-size: .86em; padding-bottom: 2px; }
.tgrid .w { color: var(--a2); } .tgrid .l { color: #b197ff; } .tgrid .d { color: var(--muted); }

/* mission complete block */
.mdone { margin: 10px 0 8px; padding: 10px 14px 11px; border-left: 2px solid transparent; border-image: var(--grad) 1; background: linear-gradient(90deg, color-mix(in srgb, var(--a1) 12%, transparent), transparent 70%); white-space: normal; animation: mdone .7s var(--ease) both; }
@keyframes mdone { from { opacity: 0; transform: translateX(-10px); clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.mdone__t { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.mdone__t b { letter-spacing: .06em; }
.mdone__xp { color: var(--ok); }
.mdone__msg { color: rgba(236,234,255,.8); margin-top: 2px; }
.mdone__light { margin-top: 6px; font-style: italic; }
.mdone__next { margin-top: 6px; color: var(--dim); }

/* ascii art (tree) */
.t-art { font: inherit; line-height: 1.2; white-space: pre; margin: 8px 0 6px; overflow-x: auto; scrollbar-width: none; }
.t-art .leaf { color: #6ef0a0; } .t-art .leaf2 { color: #3ccf87; } .t-art .trunk { color: #c9a27c; } .t-art .seed { color: var(--a3); text-shadow: 0 0 8px var(--a3); }
.t-art .gr { color: rgba(226,224,255,.3); } .t-art .fruit { color: var(--a3); text-shadow: 0 0 6px var(--a3); }
.tl.wisdom { margin: 2px 0 8px; font-family: var(--f-display); font-weight: 600; font-size: 1.15em; letter-spacing: -.005em; }

/* CMD colors */
.term.is-colored .term__screen, .term.is-colored .term__screen * { color: var(--t-fg) !important; -webkit-text-fill-color: var(--t-fg); }
.term.is-colored .tl .hit { background: var(--t-fg); color: var(--t-bg) !important; -webkit-text-fill-color: var(--t-bg); }
.term.is-colored .term__caret { background: var(--t-fg); color: var(--t-bg) !important; -webkit-text-fill-color: var(--t-bg); }
.term.is-colored .tl .k { background: transparent; border-color: currentColor; }
.term.is-colored .mdone { background: color-mix(in srgb, var(--t-fg) 9%, transparent); border-image: none; border-left-color: var(--t-fg); }
.term.is-colored .tl .dim, .term.is-colored .tl.note, .term.is-colored .tgrid .h, .term.is-colored .t-art .gr, .term.is-colored .mdone__next { opacity: .66; }
.term.is-colored .t-art .seed, .term.is-colored .t-art .fruit { text-shadow: none; }
.term.is-crt .term__screen { text-shadow: 0 0 1px currentColor, 0 0 9px color-mix(in srgb, var(--t-fg) 55%, transparent); }
.term.is-crt .term__crt::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
  animation: flick 4s steps(40) infinite;
}
.term.is-crt .term__crt::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0,0,0,.55)); }
@keyframes flick { 0%, 100% { opacity: .9; } 47% { opacity: .82; } 48% { opacity: 1; } 72% { opacity: .86; } }
.term.is-colored { border-color: color-mix(in srgb, var(--t-fg) 26%, transparent); }

/* matrix */
.matrix { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; transition: opacity .6s; }

/* chips */
.chips { flex: none; position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: rgba(255,255,255,.02); overflow-x: auto; scrollbar-width: none; -webkit-mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.chips::-webkit-scrollbar { display: none; }
.chips__lbl { flex: none; color: var(--dim); font-size: 10px; letter-spacing: .14em; margin-right: 2px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 13px; border-radius: 999px; font: 500 12.5px/1 var(--f-mono); color: var(--fg);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.11); transition: background-color .25s, border-color .25s, transform .25s var(--ease), box-shadow .3s; white-space: nowrap;
}
.chip:hover { background: rgba(255,255,255,.09); border-color: color-mix(in srgb, var(--a2) 50%, transparent); box-shadow: 0 0 22px -8px var(--a2); }
.chip:active { transform: scale(.96); }
.chip--main { border-color: color-mix(in srgb, var(--a1) 60%, transparent); background: linear-gradient(100deg, color-mix(in srgb, var(--a1) 22%, transparent), color-mix(in srgb, var(--a2) 12%, transparent)); }
.chip--main::before { content: '\25B8'; color: var(--a2); font-size: 10px; }
.chip--ghost { color: var(--muted); }
.chip--stop { border-color: color-mix(in srgb, var(--err) 55%, transparent); color: var(--err); }
.chip--ins::before { content: '\270E'; color: var(--a3); font-size: 11px; }

/* ---------- Mission strip (mobile) ---------- */
.mstrip { display: none; }

/* ---------- Panel ---------- */
.panel {
  position: relative; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent;
  padding: 20px 20px 18px; border-radius: 20px; background: linear-gradient(180deg, rgba(18, 16, 32, .66), rgba(8, 8, 16, .74)); border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); box-shadow: 0 30px 90px -30px rgba(0,0,0,.85);
}
.is-free .panel { display: none; }
.is-free.panel-open .panel { display: block; }
.panel__grab, .panel__close, .panel-scrim { display: none; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lvl { display: flex; align-items: center; gap: 12px; }
.lvl__num { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 16px; font-weight: 700; color: #fff; background: linear-gradient(140deg, color-mix(in srgb, var(--a1) 50%, transparent), color-mix(in srgb, var(--a2) 30%, transparent)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 0 26px -6px var(--a1); }
.lvl__num.pop { animation: pop .8s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 30% { transform: scale(1.25) rotate(-6deg); box-shadow: inset 0 0 0 1px #fff, 0 0 40px 4px var(--a2); } 100% { transform: scale(1); } }
.lvl__txt { display: flex; flex-direction: column; gap: 2px; }
.lvl__name { font-family: var(--f-display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; line-height: 1.1; }
.lvl__xp { font-size: 10.5px; color: var(--dim); }
.lvl__xp b { color: var(--fg); font-weight: 500; }
.xpbar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.07); margin: 14px 0 18px; overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; box-shadow: 0 0 12px var(--a2); transition: width 1s var(--ease); }

.mcard { position: relative; padding: 18px 18px 16px; border-radius: 16px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.09); overflow: hidden; }
.mcard::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: var(--grad); opacity: .85; }
.mcard.flash { animation: flash 1s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(125,255,179,.0); } 25% { box-shadow: 0 0 0 1px var(--ok), 0 0 40px -6px var(--ok); } 100% { box-shadow: 0 0 0 0 transparent; } }
.mcard.enter > * { animation: card-in .6s var(--ease) both; }
.mcard.enter > *:nth-child(2) { animation-delay: .04s; } .mcard.enter > *:nth-child(3) { animation-delay: .08s; } .mcard.enter > *:nth-child(4) { animation-delay: .12s; } .mcard.enter > *:nth-child(5) { animation-delay: .16s; }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
.mcard__top { display: flex; justify-content: space-between; color: var(--dim); font-size: 10.5px; letter-spacing: .14em; }
.mcard__top .ok { letter-spacing: .1em; }
.mcard__title { font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 1.1; letter-spacing: -.02em; margin: 8px 0 8px; }
.mcard__why { font-size: 14px; line-height: 1.55; color: rgba(243,241,255,.84); }
.mcard__why code, .mcard__real code, .mlist code { color: var(--a2); font-size: .92em; }
.twin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 12px; }
.twin__col { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 10px 11px; border-radius: 11px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.07); text-align: left; transition: border-color .25s, background-color .25s; }
.twin__col:hover { border-color: color-mix(in srgb, var(--a2) 45%, transparent); background: color-mix(in srgb, var(--a2) 5%, transparent); }
.twin__os { font-size: 9.5px; letter-spacing: .16em; color: var(--dim); display: flex; align-items: center; gap: 6px; }
.twin__os svg { opacity: .8; }
.twin__col code { font-size: 12.5px; color: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.mcard__real { font-size: 12.5px; line-height: 1.55; color: var(--muted); padding-top: 12px; border-top: 1px dashed rgba(255,255,255,.1); }
.mcard__real .mono { display: flex; align-items: center; gap: 7px; font-size: 9.5px; letter-spacing: .16em; color: var(--a3); margin-bottom: 5px; }
.mcard__real .mono::before { content: ''; width: 12px; height: 8px; border-radius: 2px; border: 1.5px solid currentColor; box-shadow: 0 3px 0 -1.5px currentColor; }
.mcard__real b { color: var(--fg); font-weight: 500; }
.mcard__goal { margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--a1) 10%, transparent); border: 1px solid color-mix(in srgb, var(--a1) 30%, transparent); font-size: 14px; }
.mcard__goal span { display: block; font-size: 10px; color: var(--dim); margin-bottom: 4px; }

.psec { margin-top: 22px; }
.psec__h { display: flex; justify-content: space-between; color: var(--dim); font-size: 10.5px; letter-spacing: .16em; font-weight: 400; margin-bottom: 10px; }
.psec__h span { color: var(--muted); }
.mlist { list-style: none; display: grid; gap: 2px; counter-reset: m; }
.mlist button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; text-align: left; font-size: 13.5px; color: var(--muted); transition: background-color .2s, color .2s; }
.mlist button:hover { background: rgba(255,255,255,.05); color: var(--fg); }
.mlist .n { font: 500 10.5px/1 var(--f-mono); color: var(--dim); }
.mlist .st { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); display: grid; place-items: center; }
.mlist .is-done button { color: rgba(243,241,255,.62); }
.mlist .is-done .st { border-color: transparent; background: var(--ok); box-shadow: 0 0 10px -2px var(--ok); }
.mlist .is-done .st::after { content: ''; width: 7px; height: 4px; border: 2px solid #05050a; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.mlist .is-cur button { background: color-mix(in srgb, var(--a1) 14%, transparent); color: #fff; box-shadow: inset 2px 0 0 var(--a1); }
.mlist .is-cur .st { border-color: var(--a2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a2) 15%, transparent); }
.mlist .just .st { animation: pop .8s var(--ease); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.badge { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 12px; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06); text-align: center; }
.badge__i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font: 700 10.5px/1 var(--f-mono); color: var(--dim); border: 1px dashed rgba(255,255,255,.16); }
.badge__n { font-size: 10px; line-height: 1.2; color: var(--dim); }
.badge.is-on .badge__i { color: #fff; border: 0; background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), transparent 45%), linear-gradient(140deg, var(--a1), var(--a3) 55%, var(--a2)); box-shadow: 0 0 20px -4px var(--a1); }
.badge.is-on .badge__n { color: var(--fg); }
.badge.is-new .badge__i { animation: pop 1s var(--ease); }
.panel__foot { margin-top: 20px; color: var(--dim); font-size: 10px; letter-spacing: .08em; text-transform: none; }
.linkbtn { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.linkbtn:hover { color: var(--fg); }

/* ---------- Unlock overlay ---------- */
.unlock { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; pointer-events: none; padding: 16px; }
.unlock__card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 34px 24px; border-radius: 22px; min-width: min(300px, 100%);
  background: rgba(14, 12, 28, .86); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 40px 120px -20px rgba(0,0,0,.9), 0 0 80px -20px var(--a1);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  opacity: 0; transform: scale(.7) translateY(20px); visibility: hidden;
}
.unlock.is-on .unlock__card { visibility: visible; animation: unlock-in .7s var(--ease) forwards; }
.unlock.is-out .unlock__card { visibility: visible; animation: unlock-out .45s ease-in forwards; }
@keyframes unlock-in { 0% { opacity: 0; transform: scale(.6) translateY(24px); } 60% { opacity: 1; transform: scale(1.04); } 100% { opacity: 1; transform: none; } }
@keyframes unlock-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.92) translateY(-12px); } }
.unlock__ring { position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; margin-bottom: 10px; background: linear-gradient(140deg, var(--a1), var(--a3) 55%, var(--a2)); box-shadow: 0 0 50px -6px var(--a1); }
.unlock__ring::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); }
.unlock.is-on .unlock__ring::before { animation: ring 1.2s var(--ease) .15s both; }
@keyframes ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.unlock__ring::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle at 32% 26%, rgba(255,255,255,.4), transparent 50%), #0d0b1c; }
.unlock__icon { position: relative; z-index: 1; font-size: 17px; font-weight: 700; color: #fff; text-transform: none; }
.unlock__kicker { color: var(--a2); font-size: 10.5px; letter-spacing: .2em; }
.unlock__name { font-family: var(--f-display); font-weight: 800; font-size: 26px; letter-spacing: -.02em; line-height: 1.1; }
.unlock__desc { font-size: 13.5px; color: var(--muted); max-width: 28ch; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 140; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 32px); top: 80px;
  padding: 12px 20px 12px 16px; border-radius: 14px; display: flex; align-items: center; gap: 12px; opacity: 0; transform: translateY(-10px); pointer-events: none;
  background: rgba(16, 15, 30, .86); border: 1px solid var(--glass-b); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  font-family: var(--f-mono); font-size: 12.5px; box-shadow: 0 20px 60px -10px rgba(0,0,0,.8), 0 0 40px -10px var(--a1); transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.toast.is-on { opacity: 1; transform: none; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--a2); box-shadow: 0 0 12px var(--a2); flex: none; }

/* ---------- Cheat sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 170; display: grid; place-items: center; padding: 16px; background: rgba(3, 3, 8, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[hidden] { display: none; }
.sheet.is-on .sheet__card { animation: sheet-in .5s var(--ease) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.sheet__card { width: min(820px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; border-radius: 22px; padding: 24px 24px 18px; background: linear-gradient(180deg, rgba(20, 18, 36, .95), rgba(8, 8, 16, .97)); border: 1px solid rgba(255,255,255,.13); box-shadow: 0 40px 120px -20px rgba(0,0,0,.95), 0 0 80px -30px var(--a1); }
.sheet__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.sheet__h { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.03em; margin-top: 8px; line-height: 1.05; }
.sheet__table { overflow-y: auto; scrollbar-width: thin; margin: 0 -6px; padding: 0 6px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px; align-items: baseline; padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13.5px; }
.srow--h { position: sticky; top: 0; background: #100e1f; z-index: 1; padding-top: 4px; font: 400 10px/1.4 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.srow code { font-size: 12.5px; color: var(--a2); word-break: break-word; }
.srow code + code { margin-left: 6px; }
.srow .lx { color: #b197ff; }
.srow span:last-child { color: var(--muted); }
.srow.is-locked { color: var(--dim); }
.srow.is-locked code { color: rgba(226,224,255,.22); filter: blur(3.5px); user-select: none; }
.srow.is-locked span:last-child { color: var(--dim); }
.srow--sub { padding-top: 18px; border-bottom: 0; font: 400 10px/1.4 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--a3); }
.sheet__foot { margin-top: 14px; color: var(--dim); font-size: 10.5px; letter-spacing: .06em; text-transform: none; }
.sheet__theme { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--dim); font-size: 10.5px; letter-spacing: .06em; text-transform: none; }
.sheet__theme kbd, .sheet__foot kbd { color: var(--fg); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--glass-b); background: var(--glass); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-height: 760px) and (min-width: 901px) {
  .hero { padding-bottom: 14px; }
  .hero__h { font-size: 2rem; }
  .hero__sub { font-size: 13px; }
}
@media (max-width: 1100px) and (min-width: 901px) {
  .stage, .is-free.panel-open .stage { grid-template-columns: minmax(0, 1fr) 330px; }
  .top__mid { display: none; }
}

@media (max-width: 900px) {
  :root { --top-h: 58px; --t-fs: 11px; }
  body { height: 100vh; height: 100dvh; min-height: 540px; }
  .top__mid { display: none; }
  .xpchip { padding: 0 12px; height: 34px; }
  .xpchip__bar { display: none; }
  .ibtn { min-width: 34px; height: 34px; }
  .is-free .ibtn--txt { display: none; }
  .hero { display: none; }
  .app { padding-bottom: 12px; }
  .stage, .is-free .stage, .is-free.panel-open .stage { grid-template-columns: minmax(0, 1fr); }

  .mstrip {
    flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 10px; row-gap: 7px;
    margin-bottom: 10px; padding: 10px 14px 11px; border-radius: 14px; text-align: left;
    background: rgba(18, 16, 32, .7); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }
  .mstrip__n { grid-row: 1; grid-column: 1; color: var(--a2); font-size: 11px; }
  .mstrip__t { grid-row: 1; grid-column: 2; }
  .mstrip__open { grid-row: 1; grid-column: 3; }
  .mstrip__t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mstrip__open { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
  .mstrip__bar { grid-row: 2; grid-column: 1 / -1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
  .mstrip__bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .8s var(--ease); }

  .term { border-radius: 16px; }
  .term__bar { height: 38px; padding: 0 12px; gap: 10px; }
  .term__dots i { width: 9px; height: 9px; }
  .term__title { font-size: 11px; }
  .term__safe { display: none; }
  .term__screen { padding: 12px 12px 16px; }
  .tgrid { gap: 1px 12px; grid-template-columns: max-content minmax(0, 1fr); }
  .tgrid .l { display: none; }
  .tgrid .d { grid-column: 2; }
  .tgrid .w .tw2 { display: inline; }
  .chips { padding: 9px 10px; }
  .chip { height: 34px; font-size: 12.5px; }

  .panel-scrim { display: block; position: fixed; inset: 0; z-index: 120; background: rgba(3,3,8,.55); opacity: 0; pointer-events: none; transition: opacity .4s var(--ease); }
  .panel {
    display: block !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 121; max-height: 86dvh; border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(20, 18, 36, .97), rgba(8, 8, 16, .99)); transform: translateY(105%); visibility: hidden;
    transition: transform .55s var(--ease), visibility 0s linear .55s;
  }
  .panel-open .panel { transform: none; visibility: visible; transition: transform .55s var(--ease), visibility 0s; }
  .panel-open .panel-scrim { opacity: 1; pointer-events: auto; }
  .panel__grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.2); margin: 0 auto 12px; }
  .panel__close { display: inline-grid; }
  .badges { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .toast { top: 66px; }
  .srow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; }
  .srow span:last-child { grid-column: 1 / -1; font-size: 12.5px; }
  .srow--h span:last-child { display: none; }
  .sheet__card { padding: 20px 16px 14px; max-height: 88dvh; }
}
@media (max-width: 400px) {
  .xpchip__lv { display: none; }
  .logo { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .grain, .glow, .logo__mark, .live-dot { animation: none !important; }
  .term__caret { animation: none !important; }
  /* the story still plays (boot log, typing, tree, badges) — entrances become gentle fades, no zoom/slide */
  .boot { transition-duration: .45s, 0s !important; }
  .boot__day { transform: none !important; transition: opacity .5s ease !important; }
  .term__out .tl.in { animation: rm-fade .25s ease both !important; }
  .unlock__card { transform: none !important; }
  .unlock.is-on .unlock__card { animation: rm-fade .4s ease forwards !important; }
  .unlock.is-out .unlock__card { animation: rm-fade-out .4s ease forwards !important; }
  .unlock.is-on .unlock__ring::before { animation: none !important; opacity: 0; }
}
@keyframes rm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rm-fade-out { from { opacity: 1; } to { opacity: 0; } }
