:root {
  --ink: #17131f; --ink2: #221c2c; --ink3: #2e2639;
  --paper: #fff6e8; --tomato: #ff4f2e; --sun: #ffcf3f; --mint: #22c07a;
  --muted: #9a90a8;
  --disp: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hud: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink); color: var(--paper); font-family: var(--disp);
  overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible + .l9-box { outline: 3px solid var(--sun); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------------- shared buttons ---------------- */
.btn {
  border: 0; border-radius: 10px; padding: 11px 18px; font-weight: 650; font-size: 15px; line-height: 1.15;
  font-family: var(--ui); transition: transform .12s, filter .12s, background .15s; touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-go { background: var(--acc, #16b567); color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.btn-go:hover { filter: brightness(1.08); }
.btn-soft { background: #ecebef; color: #45414d; }
.btn-soft:hover { background: #e2e0e7; }
.btn-ghost { background: transparent; color: #3b3845; box-shadow: inset 0 0 0 1.5px #cfcbd6; }
.btn-link { background: none; border: 0; color: #7b7684; text-decoration: underline; font-family: var(--ui); font-size: 13px; padding: 6px; }
.btn-xl { font-size: 17px; padding: 15px 24px; }
.btn-sm { font-size: 13.5px; padding: 8px 13px; border-radius: 8px; }
.btn-reject {
  background: var(--tomato); color: #fff; font-family: var(--disp); font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 0 #b3301a, 0 10px 30px rgba(255,79,46,.35);
}
.btn-reject:hover { filter: brightness(1.07); }
.btn-light { background: var(--paper); color: var(--ink); font-family: var(--disp); font-weight: 750; }
.btn-ghost-d { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 2px #4a405a; font-family: var(--disp); font-weight: 700; }

/* ================= TITLE ================= */
#title { overflow: hidden; background: radial-gradient(120% 90% at 50% 40%, #2a2135 0%, var(--ink) 65%); }
.storm { position: absolute; inset: 0; pointer-events: none; }
.mb {
  position: absolute; width: 210px; padding: 12px 13px 11px; border-radius: 12px; background: #fff; color: #222;
  font-family: var(--ui); box-shadow: 0 18px 40px rgba(0,0,0,.45); transform: translate(-50%, -50%) rotate(var(--rot)) scale(.2);
  opacity: 0; animation: mbIn .6s cubic-bezier(.2,1.4,.4,1) var(--d) forwards, mbFloat var(--f) ease-in-out calc(var(--d) + .6s) infinite alternate;
}
.mb b { display: block; font-size: 13px; }
.mb small { display: block; font-size: 10.5px; color: #777; margin: 3px 0 9px; }
.mb-row { display: flex; gap: 6px; align-items: center; }
.mb-row i { font-style: normal; font-size: 11px; }
.mb-acc { background: var(--c); color: #fff; padding: 5px 9px; border-radius: 6px; font-weight: 700; }
.mb-rej { color: #bbb; font-size: 9px !important; text-decoration: underline; }
@keyframes mbIn { to { opacity: .34; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); } }
@keyframes mbInS { to { opacity: .2; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); } }
@keyframes mbFloat { from { margin-top: 0; } to { margin-top: -14px; } }

.title-core {
  position: absolute; inset: 0 0 150px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 20px; z-index: 2;
}
.title-core::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(820px, 120vw); height: min(620px, 90vh); transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(23,19,31,.94), rgba(23,19,31,.75) 60%, rgba(23,19,31,0)); z-index: -1;
}
.logo-cookie { width: clamp(84px, 13vw, 132px); aspect-ratio: 1; animation: cookieIn .9s cubic-bezier(.2,1.5,.4,1) .15s both; filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)); }
.logo-cookie svg { width: 100%; height: 100%; display: block; }
.logo-cookie .slash circle { stroke-dasharray: 580; stroke-dashoffset: 580; animation: draw .55s ease-out .75s forwards; }
.logo-cookie .slash line { stroke-dasharray: 190; stroke-dashoffset: 190; animation: draw .3s ease-out 1.15s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes cookieIn { from { transform: scale(0) rotate(-200deg); } to { transform: scale(1) rotate(-12deg); } }
.title { margin: 6px 0 4px; line-height: .8; font-weight: 800; letter-spacing: -.04em; font-size: clamp(76px, 17vw, 200px); display: flex; flex-direction: column; align-items: center; }
.title span { display: block; animation: slam .5s cubic-bezier(.2,1.6,.4,1) both; }
.title .t1 { animation-delay: .35s; color: var(--paper); }
.title .t2 { animation-delay: .55s; color: var(--tomato); position: relative; font-size: 1.06em; }
.title .t2::after {
  content: ""; position: absolute; left: -4%; right: -4%; top: 52%; height: .09em; background: var(--sun); transform: rotate(-4deg) scaleX(0);
  transform-origin: left; animation: strike .35s ease-out 1.1s forwards; border-radius: 99px; display: none;
}
@keyframes slam { from { opacity: 0; transform: scale(2.4) rotate(-6deg); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.tagline { max-width: 560px; font-size: clamp(15px, 2.1vw, 19px); line-height: 1.4; color: #d9cfe3; margin: 16px 0 14px; animation: fadeUp .6s ease-out .9s both; }
.tagline b { color: var(--paper); }
.tagline em { color: var(--tomato); font-style: normal; font-weight: 800; }
.rules { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; animation: fadeUp .6s ease-out 1.05s both; }
.rules li { font-family: var(--mono); font-size: 12.5px; padding: 7px 12px; border-radius: 99px; background: rgba(255,246,232,.08); border: 1px solid rgba(255,246,232,.14); color: #e9dff0; }
.rules li span { margin-right: 4px; }
.best { font-family: var(--mono); font-size: 13px; color: var(--sun); margin: 12px 0 0; min-height: 1em; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.gate {
  position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3;
  width: min(760px, calc(100% - 24px)); background: #fff; color: #1d1a22; border-radius: 18px; padding: 16px 16px 16px 22px;
  display: flex; align-items: center; gap: 16px; justify-content: space-between; box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.05);
  animation: gateIn .6s cubic-bezier(.2,1.3,.4,1) 1.2s both; font-family: var(--ui);
}
@keyframes gateIn { from { transform: translate(-50%, 140%); } to { transform: translate(-50%, 0); } }
.gate-text b { display: block; font-size: 16px; margin-bottom: 2px; }
.gate-text span { font-size: 13.5px; color: #6b6675; }
.gate-row { display: flex; gap: 10px; flex-shrink: 0; }
.gate .btn-reject { font-size: 17px; padding: 14px 20px; animation: pulse 1.6s ease-in-out 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 4px 0 #b3301a, 0 10px 40px rgba(255,79,46,.7), 0 0 0 6px rgba(255,79,46,.18); } }
.gate.shake, .shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97) both !important; }
.gate.shake { animation: gshake .45s both !important; }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-8px); } 40%,60% { transform: translateX(8px); } }
@keyframes gshake { 0%,100% { transform: translateX(-50%); } 20%,60% { transform: translateX(calc(-50% - 10px)); } 40%,80% { transform: translateX(calc(-50% + 10px)); } }

/* ================= GAME ================= */
#game.active { display: flex; flex-direction: column; height: 100%; }
.hud {
  height: var(--hud); flex-shrink: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  padding: 0 12px; background: var(--ink); border-bottom: 1px solid #2d2538; position: relative; z-index: 5;
}
.hud-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-lvl { font-family: var(--mono); font-weight: 800; font-size: 20px; color: var(--tomato); flex-shrink: 0; }
.hud-lvl small { color: var(--muted); font-size: 12px; font-weight: 500; }
.hud-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.hud-name b { font-size: 15px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-name small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.hud-c { display: flex; align-items: baseline; gap: 8px; }
.hud-time { font-family: var(--mono); font-weight: 800; font-size: 26px; color: var(--sun); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hud-time.flash { animation: tflash .6s; }
@keyframes tflash { 0%,60% { color: var(--tomato); transform: scale(1.12); } }
.hud-pen { font-family: var(--mono); font-size: 12px; color: #ff9a86; }
.hud-r { display: flex; justify-content: flex-end; gap: 6px; }
.hud-btn { background: var(--ink3); border: 0; border-radius: 9px; height: 36px; min-width: 36px; padding: 0 10px; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; color: var(--paper); }
.hud-btn .lbl { font-size: 13px; font-weight: 650; }
.hud-btn:hover { background: #3b3148; }
.hud-btn.nudge { animation: nudge 1.4s ease-in-out infinite; background: #4a3b1c; }
@keyframes nudge { 50% { box-shadow: 0 0 0 4px rgba(255,207,63,.35); } }
.pips { display: flex; gap: 3px; padding: 0 12px 0; height: 4px; background: var(--ink); flex-shrink: 0; }
.pip { flex: 1; background: #332a3e; border-radius: 2px; transition: background .3s; }
.pip.done { background: var(--tomato); }
.pip.now { background: var(--sun); }

.stage { position: relative; flex: 1; overflow: hidden; background: #fff; isolation: isolate; }
.layer { position: absolute; inset: 0; z-index: 2; font-family: var(--ui); color: #1d1a22; }
.dim { position: absolute; inset: 0; background: rgba(20,14,28,.38); animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------------- fake site ---------------- */
.site { position: absolute; inset: 0; z-index: 1; background: var(--sbg); color: var(--sfg); font-family: var(--ui); overflow: hidden; pointer-events: none; user-select: none; }
.site-nav { display: flex; align-items: center; gap: 18px; padding: 14px clamp(14px, 4vw, 48px); border-bottom: 1px solid color-mix(in srgb, var(--sfg) 10%, transparent); }
.site-logo { font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.site-links { display: flex; gap: 18px; font-size: 14px; opacity: .7; flex: 1; }
.site-links i { font-style: normal; }
.site-btn { background: var(--sbr); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.site-hero { padding: clamp(24px, 6vh, 72px) clamp(14px, 4vw, 48px) 24px; max-width: 900px; }
.site-kicker { font-size: 11.5px; letter-spacing: .12em; font-weight: 700; color: var(--sbr); }
.site-hero h1 { font-size: clamp(28px, 5vw, 60px); line-height: 1.02; letter-spacing: -.03em; margin: 10px 0 12px; font-weight: 800; }
.site-hero p { font-size: clamp(14px, 1.6vw, 18px); opacity: .75; max-width: 560px; margin: 0 0 18px; line-height: 1.45; }
.site-cta { display: inline-block; background: var(--sfg); color: var(--sbg); padding: 11px 18px; border-radius: 99px; font-weight: 700; font-size: 14px; }
.site-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 8px clamp(14px, 4vw, 48px); }
.site-card { background: color-mix(in srgb, var(--sfg) 5%, var(--sbg)); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.site-card small { opacity: .6; }
.site-ph { height: clamp(70px, 14vh, 140px); border-radius: 10px; display: grid; place-items: center; font-size: clamp(30px, 5vw, 54px); background: color-mix(in srgb, var(--sph) 22%, var(--sbg)); margin-bottom: 6px; }
@media (max-width: 640px) {
  .site-links { display: none; }
  .site-nav { justify-content: space-between; }
  .site-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- consent banner base ---------------- */
.cb {
  position: absolute; z-index: 3; background: #fff; color: #1d1a22; border-radius: 16px; padding: 20px 22px;
  box-shadow: 0 30px 80px rgba(10,5,20,.35), 0 0 0 1px rgba(0,0,0,.05); animation: cbIn .4s cubic-bezier(.2,1.25,.4,1) both;
}
@keyframes cbIn { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.cb-sheet { left: 12px; right: 12px; bottom: 12px; max-width: 780px; margin: 0 auto; }
.cb-center { inset: 0; margin: auto; width: min(500px, calc(100% - 24px)); height: fit-content; max-height: calc(100% - 24px); overflow: auto; }
.cb h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; line-height: 1.2; }
.cb-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cb-ico { font-size: 26px; line-height: 1; }
.cb-text { font-size: 14.5px; line-height: 1.5; color: #4d4857; margin: 6px 0 14px; }
.cb-fine { font-size: 12px; color: #9a95a3; margin: 12px 0 0; }
.cb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cb-row.col { flex-direction: column; align-items: stretch; }
.cb-row.end { justify-content: flex-end; }
.muted { color: #8a8494; font-size: 12.5px; }
.cb-list { display: flex; flex-direction: column; gap: 2px; margin: 10px 0 16px; }
.cb-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eee; }
.cb-item b { display: block; font-size: 14.5px; }
.cb-item small { color: #7d7887; font-size: 12.5px; }
.sw { width: 46px; height: 26px; border-radius: 99px; border: 0; background: #cfcbd6; position: relative; flex-shrink: 0; padding: 0; }
.sw i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.sw.on { background: var(--acc, #16b567); }
.sw.on i { left: 23px; }
.sw.locked { opacity: .85; }
.sw.locked::after { content: "🔒"; position: absolute; right: 100%; margin-right: 6px; top: 3px; font-size: 13px; }
.wiggle { animation: shake .4s; }

/* L1 */
.l1 { padding-bottom: 14px; }
.l1-fine { font-size: 9px; color: #e2dcd3; margin: 14px 0 0; line-height: 1.4; }
.l1-reject { background: none; border: 0; padding: 0; font-size: 9px; color: #dcd5cb; font-family: inherit; cursor: default; }
.l1-reject:hover { color: #cfc7bc; }
.l1-reject:focus-visible { color: #222; }

/* L2 */
.l2-slot { display: inline-block; width: 110px; height: 44px; }
.l2-run { position: absolute; left: 0; top: 0; z-index: 6; white-space: nowrap; transition: transform .22s cubic-bezier(.2,1.2,.4,1), background .2s; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.l2-run.tired { background: #fff; color: #222; box-shadow: 0 0 0 3px var(--tomato), 0 8px 20px rgba(0,0,0,.2); animation: pant .7s ease-in-out infinite; }
@keyframes pant { 50% { scale: 1.05; } }
.l2 .btn-go { transition: transform .25s; transform-origin: left center; }

/* L3 */
.l3 { text-align: center; }
.l3-pup { position: relative; width: 96px; height: 96px; margin: 0 auto 6px; display: grid; place-items: center; background: #ffe3ea; border-radius: 50%; }
.l3-face { font-size: 60px; line-height: 1; transition: transform .3s; }
.mood1 .l3-face { transform: rotate(-8deg); }
.mood2 .l3-face { transform: rotate(8deg) translateY(4px); filter: saturate(.7); }
.mood3 .l3-face { transform: translateY(8px); filter: saturate(.4) brightness(.95); }
.mood3 { background: #e3e6f0; }
.tear { position: absolute; width: 9px; height: 13px; background: #57a7ff; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; top: 46px; animation: tear 1s ease-in infinite; }
.tear.t1 { left: 30px; } .tear.t2 { right: 30px; animation-delay: .45s; }
@keyframes tear { from { transform: translateY(0); opacity: 1; } to { transform: translateY(46px); opacity: 0; } }
.l3-cloud { position: absolute; top: -18px; font-size: 30px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.l3-h { margin-top: 4px !important; }
.l3 .cb-row { justify-content: center; }
.l3-poem { font-style: italic; }
.l3-meter { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12px; color: #8a8494; margin-top: 14px; }
.meter { width: 120px; height: 8px; border-radius: 99px; background: #eee; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #ff6f91, #ffb36b); border-radius: 99px; transition: width .6s; }
.btn-hold { position: relative; overflow: hidden; background: #2b2633; color: #fff; padding: 16px 20px; font-size: 16px; touch-action: none; -webkit-touch-callout: none; }
.btn-hold .hold-fill { position: absolute; inset: 0; background: var(--tomato); transform: scaleX(0); transform-origin: left; }
.btn-hold .hold-lbl { position: relative; }
.btn-hold.holding { transform: scale(.98); }

/* L4 */
.xbtn { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #f0eff3; color: #444; font-size: 20px; line-height: 1; display: grid; place-items: center; padding: 0; z-index: 2; }
.xbtn:hover { background: #e4e2e9; }
.l4-banner { z-index: 3; padding-right: 48px; }
.l4-banner .cb-row.end { justify-content: space-between; }
.l4-appbar { position: absolute; top: 0; left: 0; right: 0; z-index: 4; background: #102b28; color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 48px 8px 14px; font-size: 13.5px; animation: slideDown .4s both .1s; }
.l4-appbar span { flex: 1; }
.l4-appbar .xbtn { top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.14); color: #fff; }
@keyframes slideDown { from { transform: translateY(-100%); } }
.l4-notif { position: absolute; z-index: 4; top: 52px; right: 12px; width: min(300px, calc(100% - 24px)); background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 13px; box-shadow: 0 14px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 10px; animation: cbIn .4s both .35s; }
.l4-notif .cb-row { justify-content: flex-end; }
.l4-pop { position: absolute; z-index: 5; background: #fff; border-radius: 16px; padding: 18px 18px 12px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); animation: popIn .35s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } }
.l4-pop h3 { margin: 4px 0 6px; font-size: 17px; }
.l4-pop p { margin: 0 0 6px; font-size: 13px; color: #666; }
.l4-pop-emoji { font-size: 34px; }
.l4-news { left: clamp(12px, 8%, 120px); top: 90px; width: min(300px, calc(100% - 24px)); animation-delay: .5s; border: 3px solid #0fa39a; }
.l4-email { display: flex; gap: 6px; background: #f3f3f5; border-radius: 10px; padding: 5px 5px 5px 10px; align-items: center; justify-content: space-between; font-size: 13px; color: #999; margin: 6px 0 4px; }
.l4-fakebtn { background: #0fa39a; color: #fff; padding: 7px 10px; border-radius: 7px; font-weight: 700; }
.btn-link.small { font-size: 11.5px; color: #9a95a3; }
.l4-spawn { z-index: 7; border: 2px solid #ffcf3f; }
.l4-chat { position: absolute; z-index: 6; right: 12px; bottom: 12px; width: min(290px, calc(100% - 24px)); background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.35); display: flex; flex-direction: column; animation: popIn .4s both .7s; }
.l4-chat-head { position: relative; display: flex; align-items: center; gap: 10px; background: #0fa39a; color: #fff; padding: 10px 76px 10px 12px; }
.l4-av { font-size: 24px; background: rgba(255,255,255,.2); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; }
.l4-who b { display: block; font-size: 14px; } .l4-who small { font-size: 11px; opacity: .85; }
.l4-chat-head .xbtn { top: 50%; transform: translateY(-50%); right: 8px; background: rgba(255,255,255,.2); color: #fff; }
.l4-min { position: absolute; top: 50%; transform: translateY(-50%); right: 44px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 20px; line-height: 1; padding: 0 0 3px; }
.l4-msgs { padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 150px; overflow: auto; }
.l4-msg { margin: 0; background: #eef7f6; padding: 8px 11px; border-radius: 12px 12px 12px 4px; font-size: 13px; align-self: flex-start; }
.l4-chat-in { border-top: 1px solid #eee; padding: 11px 12px; font-size: 13px; color: #aaa; }
.l4-bubble { position: absolute; z-index: 6; left: 12px; top: 50%; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #0fa39a; font-size: 24px; box-shadow: 0 10px 24px rgba(0,0,0,.3); animation: popIn .3s both; }

/* L5 */
.l5 { display: flex; flex-direction: column; width: min(620px, calc(100% - 24px)); height: calc(100% - 24px); max-height: 720px; overflow: hidden; }
.l5-scroll { flex: 1; overflow-y: auto; border: 1px solid #e6e3ea; border-radius: 10px; padding: 6px 16px; background: #fbfaf8; font-family: Georgia, "Times New Roman", serif; font-size: 12.5px; line-height: 1.55; color: #5b5663; overscroll-behavior: contain; }
.l5-scroll h4 { font-family: var(--ui); font-size: 13px; color: #222; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.l5-scroll p { margin: 0 0 9px; text-align: justify; }
.l5-loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 18px; font-family: var(--ui); font-size: 13px; color: #888; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #ddd; border-top-color: #555; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.l5-end { text-align: center; padding: 18px 0 26px; font-family: var(--ui); }
.l5-end p { text-align: center; font-size: 14px; color: #333; }
.l5-foot { margin-top: 12px; justify-content: space-between; }
.l5-read { font-size: 12.5px; color: #8a8494; font-family: var(--mono); }

/* L6 */
.l6 { width: min(400px, calc(100% - 24px)); }
.l6-widget { display: flex; align-items: center; justify-content: space-between; border: 1px solid #d6d6d6; background: #f9f9f9; border-radius: 4px; padding: 14px 12px; margin-bottom: 14px; box-shadow: 0 0 4px rgba(0,0,0,.08); }
.l6-check { display: flex; align-items: center; gap: 12px; background: none; border: 0; font-size: 15px; font-family: var(--ui); padding: 4px; }
.l6-box { width: 28px; height: 28px; border: 2px solid #c1c1c1; border-radius: 3px; background: #fff; position: relative; }
.l6-check.busy .l6-box { border-radius: 50%; border-color: #4a90e2 #e0e0e0 #e0e0e0; animation: spin .6s linear infinite; }
.l6-brand { display: flex; flex-direction: column; align-items: center; font-size: 20px; line-height: 1; }
.l6-brand b { font-size: 11px; color: #555; margin-top: 3px; }
.l6-brand small { font-size: 8.5px; color: #999; margin-top: 2px; }
.l6-head { background: #3867f2; color: #fff; padding: 14px 16px; border-radius: 6px; margin-bottom: 8px; display: flex; flex-direction: column; }
.l6-head small { font-size: 13px; opacity: .92; }
.l6-head b { font-size: 22px; letter-spacing: .01em; margin: 2px 0; }
.l6-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.l6-tile { aspect-ratio: 1; border: 0; background: #eef0f6; font-size: clamp(34px, 9vw, 52px); display: grid; place-items: center; padding: 0; transition: transform .12s; position: relative; border-radius: 3px; }
.l6-tile[aria-pressed="true"] { transform: scale(.84); background: #dce5ff; }
.l6-tile[aria-pressed="true"]::after { content: "✓"; position: absolute; top: -6px; left: -6px; width: 24px; height: 24px; border-radius: 50%; background: #3867f2; color: #fff; font-size: 14px; display: grid; place-items: center; font-weight: 800; }
.l6-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.l6-icons { color: #888; font-size: 17px; letter-spacing: 4px; }
.l6-verify { background: #3867f2; color: #fff; min-width: 96px; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; border-radius: 4px; }

/* L7 */
.l7 { inset: 12px; display: flex; flex-direction: column; padding: 14px 16px 10px; max-width: 1100px; margin: 0 auto; --acc: #7a3cf0; }
.l7-top { display: flex; gap: 12px 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.l7-intro .cb-text { margin: 4px 0 0; }
.l7-count { font-family: var(--mono); color: #7a3cf0; font-size: 17px; }
.l7-wrap { flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; overflow: hidden; }
.l7-grid { display: grid; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.tg { border: 0; padding: 0; background: transparent; position: relative; touch-action: none; cursor: crosshair; }
.tg::before { content: ""; position: absolute; inset: 26% 9%; border-radius: 99px; background: #dcd8e3; transition: background .12s; }
.tg::after { content: ""; position: absolute; top: 50%; left: 14%; width: 30%; aspect-ratio: 1; transform: translateY(-50%); border-radius: 50%; background: #fff; transition: left .12s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.tg.on::before { background: #7a3cf0; }
.tg.on::after { left: 56%; }
.tg.zombie::before { background: #2fd158; box-shadow: 0 0 8px #2fd158; animation: zomb .6s ease-in-out infinite alternate; }
@keyframes zomb { to { background: #7ef59a; } }
.tg:focus-visible { outline: 2px solid var(--tomato); outline-offset: -2px; }
.l7-last { font-size: 12px; color: #8a8494; font-family: var(--mono); padding-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* L8 */
.l8 { inset: 0; margin: auto; width: min(560px, calc(100% - 24px)); height: fit-content; max-height: calc(100% - 24px); overflow: auto; display: flex; flex-direction: column; --acc: #1e7a4f; }
.l8-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; color: #8a8494; margin-bottom: 10px; }
.l8-crumbs .crumb { background: none; border: 0; padding: 2px 0; color: #1e7a4f; text-decoration: underline; font-size: 12.5px; font-family: var(--ui); }
.l8-crumbs b { color: #333; }
.l8-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.l8-chip { border-radius: 9px; padding: 7px 9px; display: flex; flex-direction: column; font-size: 12px; line-height: 1.25; }
.l8-chip small { font-size: 10.5px; opacity: .75; }
.l8-chip.ok { background: #e3f6ea; color: #17613c; }
.l8-chip.bad { background: #fff0e0; color: #9a4b00; }
.l8-body h2 { margin-bottom: 6px; }
.l8-body > .l8-item + .l8-item { margin-top: 6px; }
.l8-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; border: 1px solid #e7e4ec; background: #faf9fb; border-radius: 10px; padding: 11px 14px; font-family: var(--ui); margin-top: 6px; }
.l8-item:hover { background: #f1eff4; }
.l8-item b { display: block; font-size: 14.5px; } .l8-item small { color: #8a8494; font-size: 12.5px; }
.l8-item i { font-style: normal; font-size: 22px; color: #999; }
.l8-list { display: flex; flex-direction: column; margin: 6px 0 12px; }
.l8-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0eef3; font-size: 13.5px; }
.l8-obj { border: 1.5px solid #cfcbd6; background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 12.5px; white-space: nowrap; font-family: var(--ui); }
.l8-obj.on { background: #e3f6ea; border-color: #7cc49b; color: #17613c; }
.l8-mini { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.l8-pill { border: 0; background: #f0eff3; border-radius: 99px; padding: 5px 10px; font-size: 12px; font-family: var(--ui); }
.l8-dead { font-size: 15px; padding: 10px 0; }
.l8-body .cb-row { margin-top: 10px; }
.l8-foot { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid #eee; padding-top: 12px; margin-top: 14px; }

/* L9 */
.l9 { width: min(540px, calc(100% - 24px)); --acc: #c79300; }
.l9.shake { animation: shake .45s both; }
.l9-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.l9-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 12px; border: 1px solid #ece8dc; border-radius: 10px; background: #fffdf5; cursor: pointer; font-size: 14.5px; line-height: 1.4; position: relative; }
.l9-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.l9-box { width: 22px; height: 22px; flex-shrink: 0; border: 2px solid #b9b3a2; border-radius: 5px; background: #fff; display: grid; place-items: center; transition: background .12s; margin-top: 1px; }
.l9-row input:checked + .l9-box { background: #c79300; border-color: #c79300; }
.l9-row input:checked + .l9-box::after { content: "✓"; color: #fff; font-weight: 800; font-size: 15px; }

/* L10 */
.l10 { width: min(520px, calc(100% - 24px)); background: #1b0e0e; color: #f5e6e6; box-shadow: 0 0 0 2px #ff2d2d, 0 30px 80px rgba(255,0,0,.25); --acc: #ff2d2d; }
.l10 .cb-text { color: #d6b8b8; }
.l10.urgent { animation: cbIn .4s both, throb .5s ease-in-out infinite alternate; }
@keyframes throb { to { box-shadow: 0 0 0 4px #ff2d2d, 0 0 60px rgba(255,45,45,.6); } }
.l10-timer { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12.5px; color: #ff8c8c; margin-bottom: 12px; }
.l10-timer b { color: #fff; font-size: 15px; }
.l10-bar { display: block; height: 6px; border-radius: 99px; background: #3b1a1a; overflow: hidden; }
.l10-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff2d2d, #ffb03a); transform-origin: left; }
.l10-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.l10-b { background: #ff2d2d; color: #fff; padding: 12px 6px; font-size: 14px; }
.l10-b:hover { filter: brightness(1.1); }
.l10-track { position: relative; height: 60px; border-radius: 99px; background: #2e1414; margin: 4px 0 14px; overflow: hidden; box-shadow: inset 0 2px 8px rgba(0,0,0,.4); }
.l10-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 34px; background: linear-gradient(90deg, #ff4f2e, #ffcf3f); border-radius: 99px; }
.l10-sl-lbl { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 14px; color: #f6caca; pointer-events: none; letter-spacing: .04em; }
.l10-knob { position: absolute; left: 4px; top: 4px; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #fff; font-size: 24px; touch-action: none; box-shadow: 0 4px 12px rgba(0,0,0,.4); cursor: grab; padding: 0; }
.l10-track.spring .l10-knob, .l10-track.spring .l10-fill { transition: transform .25s cubic-bezier(.3,1.5,.5,1), width .25s cubic-bezier(.3,1.5,.5,1); }
.l10-easy { width: 100%; }
.l10-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.l10-dot { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 99px; background: #3b1a1a; color: #f6caca; }
.l10-dot.done { background: #1f6b45; color: #fff; text-decoration: line-through; }
.l10-mini { position: absolute; z-index: 8; background: #fff; color: #222; border-radius: 12px; padding: 12px 14px; box-shadow: 0 0 0 2px #ff2d2d, 0 20px 50px rgba(0,0,0,.45); animation: popIn .3s cubic-bezier(.2,1.5,.4,1) both; }
.l10-mini p { font-size: 12.5px; color: #666; margin: 4px 0 10px; }
.l10-mb { background: #ff2d2d; color: #fff; flex: 1; }

/* ---------------- overlays ---------------- */
.ov { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; }
.ov-intro { background: rgba(23,19,31,.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .2s; cursor: pointer; }
.intro-card { display: flex; gap: 22px; align-items: center; background: var(--ink); border: 2px solid #3a3048; border-radius: 22px; padding: 24px 28px; max-width: 620px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: cardIn .45s cubic-bezier(.2,1.3,.4,1) both; cursor: default; }
@keyframes cardIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
.intro-num { font-family: var(--mono); font-weight: 800; font-size: 84px; line-height: .9; color: var(--tomato); display: flex; flex-direction: column; letter-spacing: -.05em; }
.intro-num small { font-size: 13px; letter-spacing: .2em; color: var(--muted); font-weight: 500; }
.intro-body { flex: 1; min-width: 0; }
.intro-co { font-family: var(--mono); font-size: 12.5px; color: var(--sun); margin: 0 0 2px; text-transform: uppercase; letter-spacing: .1em; }
.intro-body h2 { margin: 0 0 6px; font-size: clamp(28px, 5vw, 40px); line-height: 1; letter-spacing: -.03em; color: var(--paper); }
.intro-pat { margin: 0 0 16px; color: #cbbfd8; font-size: 15px; line-height: 1.4; }
.intro-go { padding: 11px 18px; font-size: 16px; }
.intro-bar { display: block; height: 3px; border-radius: 99px; background: #2e2639; margin-top: 16px; overflow: hidden; }
.intro-bar i { display: block; height: 100%; background: var(--sun); transform-origin: left; animation: introbar linear forwards; }
@keyframes introbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.ov-win { background: rgba(23,19,31,.45); animation: fadeIn .15s; }
.ov-bad { background: rgba(40,40,30,.82); animation: fadeIn .15s; backdrop-filter: grayscale(1) blur(2px); -webkit-backdrop-filter: grayscale(1) blur(2px); }
.stamp-wrap { position: relative; text-align: center; max-width: 560px; }
.stamp { display: inline-block; font-family: var(--disp); font-weight: 800; font-size: clamp(54px, 12vw, 110px); letter-spacing: -.02em; padding: 4px 26px; border: 8px solid currentColor; border-radius: 16px; transform: rotate(-8deg); animation: stampIn .35s cubic-bezier(.3,1.6,.5,1) both; line-height: 1; }
.stamp-win { color: var(--tomato); background: rgba(23,19,31,.7); text-shadow: 0 0 30px rgba(255,79,46,.4); }
.stamp-bad { color: #9be27a; background: rgba(20,30,10,.6); transform: rotate(6deg); }
@keyframes stampIn { from { transform: scale(2.6) rotate(-20deg); opacity: 0; } }
.stamp-sub { font-family: var(--mono); font-size: 16px; color: var(--paper); margin-top: 20px; animation: fadeUp .3s .2s both; }
.stamp-sub .pen { color: #ff9a86; }
.bad-msg { font-size: clamp(18px, 3vw, 24px); font-weight: 750; color: var(--paper); margin: 22px 0 6px; line-height: 1.25; }
.bad-sub { font-family: var(--mono); font-size: 13px; color: #d8d2c4; margin: 0 0 16px; }
.bad-sub b { color: var(--tomato); }
.crumbs { position: absolute; left: 50%; top: 40%; pointer-events: none; }
.crumbs i { position: absolute; width: 14px; height: 12px; border-radius: 45% 55% 40% 60%; background: #d99a4e; box-shadow: inset -2px -2px 0 #9c6128; animation: crumb .9s cubic-bezier(.1,.7,.3,1) forwards; }
.crumbs i:nth-child(3n) { background: #4a2512; box-shadow: none; width: 9px; height: 8px; }
@keyframes crumb { from { transform: translate(0,0) scale(var(--s)); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s)); opacity: 0; } }
body.shake #game { animation: shake .45s both; }

/* ---------------- toasts ---------------- */
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100% - 24px)); pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); border: 1px solid #3f3450; padding: 11px 16px; border-radius: 12px; font-size: 14.5px; font-family: var(--disp); font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: toastIn .3s cubic-bezier(.2,1.4,.4,1) both; text-align: center; line-height: 1.35; }
.toast.warn { border-color: #ff8a3a; }
.toast.hint { border-color: var(--sun); background: #2a2210; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.95); } }
body[data-screen="game"] .toasts { bottom: auto; top: calc(var(--hud) + 14px); }

/* ================= END ================= */
#end { overflow-y: auto; background: radial-gradient(90% 70% at 80% 10%, #2c2238 0%, var(--ink) 60%); }
.end-wrap { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 5vh, 56px) clamp(16px, 4vw, 40px) 40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 56px); align-items: start; }
.kicker { font-family: var(--mono); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--sun); margin: 0 0 8px; }
.end-h { font-size: clamp(42px, 7vw, 80px); line-height: .9; letter-spacing: -.04em; margin: 0 0 14px; font-weight: 800; animation: slam .5s cubic-bezier(.2,1.6,.4,1) both; }
.end-h span { color: var(--tomato); }
.end-time { font-family: var(--mono); font-weight: 800; font-size: clamp(56px, 10vw, 104px); color: var(--sun); letter-spacing: -.04em; line-height: 1; margin-bottom: 14px; }
.end-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tag { font-family: var(--mono); font-size: 12.5px; padding: 7px 12px; border-radius: 99px; background: rgba(255,246,232,.08); border: 1px solid rgba(255,246,232,.14); }
.splits { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.splits li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; background: rgba(255,246,232,.04); animation: fadeUp .35s both; }
.splits li:nth-child(n) { animation-delay: calc(var(--i, 0) * 40ms); }
.splits li.worst { background: rgba(255,79,46,.14); box-shadow: inset 0 0 0 1.5px rgba(255,79,46,.6); }
.sp-n { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.sp-name { flex: 1; font-weight: 700; font-size: 15px; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sp-name small { font-weight: 500; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.sp-tag { font-family: var(--mono); font-size: 10.5px; font-weight: 800; letter-spacing: .1em; background: var(--tomato); color: #fff; padding: 3px 7px; border-radius: 6px; }
.sp-acc { font-family: var(--mono); font-size: 12px; color: #ff9a86; }
.sp-t { font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--paper); min-width: 60px; text-align: right; }
.end-right { position: sticky; top: 24px; }
.card-frame { border-radius: 16px; overflow: hidden; box-shadow: 0 30px 70px rgba(0,0,0,.5), 0 0 0 1px #3a3048; aspect-ratio: 1200 / 630; background: #221c2c; transform: rotate(-1.5deg); animation: cardIn .6s .2s cubic-bezier(.2,1.3,.4,1) both; }
.card-frame img { width: 100%; height: 100%; display: block; }
.end-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 14px; }
.end-actions .btn { font-size: 16px; padding: 13px 18px; }
.share-lbl { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
#shareText { width: 100%; margin-top: 6px; background: #120f18; color: #e8def0; border: 1px solid #3a3048; border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: none; }

/* ================= responsive ================= */
@media (max-width: 860px) {
  .end-wrap { grid-template-columns: 1fr; }
  .end-right { position: static; order: -1; }
  .end-left { order: 0; }
  .gate { flex-direction: column; align-items: stretch; text-align: center; padding: 16px; }
  .gate-row { flex-direction: column-reverse; }
  .gate-row .btn-go { font-size: 14px; padding: 10px; }
}
@media (max-width: 640px) {
  :root { --hud: 52px; }
  .hud { gap: 6px; padding: 0 8px; grid-template-columns: auto 1fr auto; }
  .hud-c { justify-content: center; }
  .hud-name { display: none; }
  .hud-time { font-size: 21px; }
  .hud-pen { display: none; }
  .hud-btn .lbl { display: none; }
  .hud-btn { height: 34px; min-width: 34px; padding: 0 8px; }
  .hud-lvl { font-size: 18px; }
  .cb { padding: 16px; }
  .cb h2 { font-size: 18px; }
  .cb-text { font-size: 13.5px; }
  .l10-grid { grid-template-columns: repeat(2, 1fr); }
  .l8-status { grid-template-columns: 1fr 1fr 1fr; }
  .l8-chip { padding: 6px 7px; font-size: 11px; }
  .l8-chip small { font-size: 9.5px; }
  .intro-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px; }
  .intro-num { flex-direction: row; align-items: baseline; gap: 10px; font-size: 56px; }
  .title-core { inset: 0 0 190px; }
  .rules li { font-size: 11.5px; }
  .mb { width: 170px; animation-name: mbInS, mbFloat; }
  .title-core::before { background: radial-gradient(closest-side, rgba(23,19,31,.97), rgba(23,19,31,.9) 70%, rgba(23,19,31,0)); height: 110vh; }
  .l7 { inset: 8px; padding: 12px; }
  .l7-top .cb-row { width: 100%; }
  .l4-banner .cb-text { display: none; }
  .l4-chat { width: 210px; }
  .l4-chat-head { padding: 8px 70px 8px 10px; gap: 8px; }
  .l4-av { width: 30px; height: 30px; font-size: 18px; }
  .l4-msgs { padding: 8px; max-height: 96px; }
  .l4-msg { font-size: 12px; }
  .l4-news { top: 70px; }
  .l4-notif { top: 170px; }
}
@media (max-height: 640px) and (min-width: 641px) {
  .title-core { inset: 0 0 110px; }
  .logo-cookie { width: 70px; }
  .title { font-size: clamp(60px, 13vh, 130px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .mb { opacity: .34; transform: translate(-50%, -50%) rotate(var(--rot)); }
}
