/* 달 없는 밤 — UI 스타일 (한지·먹·낙관·초롱빛) */
:root {
  --night: #0b0d1a; --night2: #141834; --ink: #1d1a1f; --ink2: #51474a; --ink3: #8a7d74;
  --paper: #f3e9d2; --paper2: #e6d6b6; --crimson: #c2263a; --crimson2: #93182a;
  --lantern: #ffb469; --gold: #ffd66b; --ghost: #dff3ff; --danger: #ff5a6a;
  --serif: 'Gowun Batang', 'Nanum Myeongjo', 'AppleMyungjo', 'Noto Serif KR', 'Noto Serif CJK KR', 'Source Han Serif K', 'Batang', '바탕', 'Apple SD Gothic Neo', serif;
  --brush: 'Nanum Brush Script', 'East Sea Dokdo', var(--serif);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --hanji: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .34 0 0 0 0 .22 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
           url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .16' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .99 0 0 0 0 .97 0 0 0 0 .9 0 0 0 -1.5 .62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); overflow: hidden; overscroll-behavior: none; }
body { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-family: var(--serif); color: var(--paper);
  word-break: keep-all; overflow-wrap: break-word; line-height: 1.5; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#ui [hidden] { display: none !important; }
#ui input { user-select: text; -webkit-user-select: text; }
:where(#ui) button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#ui svg { display: block; }
#ui svg.chibi { overflow: visible; }
/* 첫 로딩 화면(.boot)은 index.html 인라인 스타일에 있다 */
#ui-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
#ui[data-screen=title] #ui-bg, #ui[data-screen=connecting] #ui-bg, #ui[data-screen=lobby] #ui-bg { display: block; }
#ui[data-screen=lobby] #ui-bg { filter: brightness(.62) saturate(.9); }

.screen { position: absolute; inset: 0; display: none; pointer-events: auto; }
.screen.on { display: flex; }
.scr-game.on { pointer-events: none; }

/* ── 공통: 종이, 버튼, 낙관 ───────────────────────── */
.paper { color: var(--ink); background-color: var(--paper); background-image: var(--hanji), radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(120,85,40,.22));
  border-radius: 5px; box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 2px 0 rgba(255,255,255,.35) inset, 0 0 0 1px rgba(90,60,30,.18) inset; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; border: 0; border-radius: 6px; padding: .8em 1.4em; font-weight: 700;
  font-size: 17px; letter-spacing: .02em; min-height: 48px; transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; white-space: nowrap; }
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .42; cursor: default; filter: saturate(.4); }
.btn-primary { color: #fff6e6; background: linear-gradient(180deg, #d23447, var(--crimson) 45%, var(--crimson2)); text-shadow: 0 1px 0 rgba(0,0,0,.3);
  box-shadow: 0 0 0 1px rgba(255,214,107,.25) inset, 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 30px rgba(194,38,58,.35), 0 0 40px rgba(255,140,80,.12); }
.btn-primary:not(:disabled):hover { box-shadow: 0 0 0 1px rgba(255,214,107,.5) inset, 0 1px 0 rgba(255,255,255,.3) inset, 0 12px 36px rgba(194,38,58,.5), 0 0 60px rgba(255,160,90,.25); transform: translateY(-1px); }
.btn-ghost { color: var(--paper); background: rgba(11,13,26,.45); box-shadow: 0 0 0 1px rgba(243,233,210,.32) inset; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn-ghost:not(:disabled):hover { background: rgba(255,180,105,.12); box-shadow: 0 0 0 1px rgba(255,180,105,.7) inset, 0 0 24px rgba(255,180,105,.18); }
.btn-ink { color: var(--paper); background: var(--ink); box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset, 0 6px 16px rgba(0,0,0,.25); }
.btn-ink:not(:disabled):hover { background: #2c262c; }
.btn-line { color: var(--ink); background: transparent; box-shadow: 0 0 0 1.5px rgba(29,26,31,.55) inset; }
.btn-line:not(:disabled):hover { background: rgba(29,26,31,.06); }
.btn-sm { font-size: 15px; min-height: 40px; padding: .5em 1em; }
.btn-text { background: none; border: 0; color: rgba(243,233,210,.75); font-size: 15px; padding: .6em .8em; display: inline-flex; gap: .4em; align-items: center; border-radius: 6px; min-height: 44px; }
.btn-text svg { width: 18px; height: 18px; }
.btn-text:hover { color: var(--lantern); }
.seal { display: inline-grid; place-items: center; color: #fff1ea; background: var(--crimson); border-radius: 7px; font-family: var(--serif); font-weight: 800;
  box-shadow: 0 0 0 2px rgba(255,240,230,.0), inset 0 0 0 2.5px rgba(255,236,226,.85), inset 0 0 12px rgba(80,0,10,.45); line-height: 1; transform: rotate(-7deg);
  -webkit-mask-image: radial-gradient(circle at 30% 30%, #000 60%, rgba(0,0,0,.82) 61%, #000 75%); }
kbd { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .35em; border-radius: 4px; font: 700 .78em/1 ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--paper); background: rgba(243,233,210,.12); box-shadow: 0 0 0 1px rgba(243,233,210,.35) inset, 0 2px 0 rgba(0,0,0,.4); vertical-align: middle; }
.paper kbd { color: var(--ink); background: rgba(29,26,31,.06); box-shadow: 0 0 0 1px rgba(29,26,31,.35) inset, 0 2px 0 rgba(29,26,31,.15); }
.only-touch { display: none !important; }
.is-touch .only-touch { display: revert !important; }
.is-touch .only-desk { display: none !important; }

/* ── 타이틀 ───────────────────────────────────────── */
.scr-title { flex-direction: column; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.logo-txt { white-space: nowrap; }
.title-grid { position: relative; margin: auto; width: min(1180px, 100%); min-height: 100%; display: grid; align-content: center; column-gap: 56px;
  grid-template-columns: 1fr minmax(360px, 420px); grid-template-areas: "hero maker" "menu maker";
  padding: calc(28px + var(--sat)) calc(48px + var(--sar)) calc(40px + var(--sab)) calc(56px + var(--sal)); }
.hero { grid-area: hero; align-self: end; animation: rise 1.2s cubic-bezier(.2,.7,.2,1) both; }
.kicker { margin: 0 0 4px; font-size: 14px; letter-spacing: .28em; color: rgba(255,214,160,.72); }
.logo { position: relative; margin: 0; display: inline-flex; align-items: flex-start; gap: 6px; font-weight: 400; }
.logo-txt { font-family: var(--brush); font-size: clamp(76px, 10.5vw, 136px); line-height: 1.05; color: #fbf3e2; letter-spacing: .01em;
  text-shadow: 0 0 18px rgba(255,180,105,.35), 0 0 60px rgba(255,140,80,.18), 0 4px 0 rgba(0,0,0,.35); }
.no-brush .logo-txt { font-family: var(--serif); font-weight: 800; letter-spacing: .06em; font-size: clamp(56px, 8vw, 104px); }
.logo .seal { width: 54px; height: 54px; font-size: 20px; margin-top: 14px; writing-mode: vertical-rl; letter-spacing: -1px; animation: stampIn .5s .9s cubic-bezier(.3,1.6,.5,1) both; }
.tagline { margin: 6px 0 0; font-size: 18px; color: rgba(243,233,210,.86); line-height: 1.7; text-shadow: 0 2px 10px #000; }
.menu { grid-area: menu; align-self: start; display: flex; flex-direction: column; gap: 12px; width: min(360px, 100%); margin-top: 26px; animation: rise 1.2s .15s cubic-bezier(.2,.7,.2,1) both; }
.menu .btn { width: 100%; }
.btn-hero { font-size: 19px; min-height: 58px; }
.hero .invite { margin-top: 18px; width: min(360px, 100%); }
.has-invite .tagline { display: none; }
.invite { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; background: rgba(255,180,105,.1); box-shadow: 0 0 0 1px rgba(255,180,105,.35) inset; }
.invite .seal { width: 44px; height: 44px; font-size: 13px; flex: none; letter-spacing: .04em; }
.invite p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--paper); }
.invite b { color: var(--gold); letter-spacing: .12em; }
.code-row { display: none; gap: 8px; }
.code-row.on { display: flex; animation: rise .35s both; }
.code-input { flex: 1; min-width: 0; height: 52px; border-radius: 6px; border: 0; padding: 0 14px; font: 700 26px/1 ui-monospace, Menlo, monospace; text-align: center; letter-spacing: .5em; text-indent: .5em;
  text-transform: uppercase; color: var(--ink); background: var(--paper); box-shadow: 0 0 0 2px rgba(255,180,105,.0) inset; outline: none; }
.code-input:focus { box-shadow: 0 0 0 2px var(--lantern) inset, 0 0 24px rgba(255,180,105,.3); }
.code-input::placeholder { color: rgba(29,26,31,.28); letter-spacing: .5em; }
.code-row .btn { width: auto; flex: none; }
.menu-small { display: flex; gap: 4px; margin-left: -10px; flex-wrap: wrap; }
.title-foot { position: absolute; left: 0; right: 0; bottom: calc(10px + var(--sab)); text-align: center; font-size: 12.5px; color: rgba(243,233,210,.42); letter-spacing: .08em; pointer-events: none; }

.maker { grid-area: maker; align-self: center; padding: 22px 24px 20px; position: relative; animation: rise 1.2s .3s cubic-bezier(.2,.7,.2,1) both; }
.maker::before { content: ''; position: absolute; inset: 8px; border: 1px solid rgba(120,85,40,.25); border-radius: 3px; pointer-events: none; }
.maker h2 { margin: 0 0 2px; font-size: 15px; letter-spacing: .2em; color: var(--crimson); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.maker h2::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(194,38,58,.4), transparent); }
.maker-top { display: flex; gap: 14px; align-items: center; }
.preview { position: relative; width: 150px; height: 170px; flex: none; display: grid; place-items: center;
  background: radial-gradient(closest-side, rgba(255,180,105,.32), rgba(255,180,105,0) 75%), radial-gradient(70% 22% at 46% 92%, rgba(60,40,20,.22), transparent); border-radius: 50%; }
.preview .chibi { width: 150px; height: 166px; overflow: visible; }
.chibi .ch-body { animation: bob 2.6s ease-in-out infinite; transform-box: view-box; transform-origin: 56px 130px; }
.chibi .ch-lantern { animation: sway 2.6s ease-in-out infinite; transform-box: view-box; transform-origin: 82px 101px; }
.chibi .ch-eyes { animation: blink 4.5s infinite; transform-box: view-box; transform-origin: 56px 58px; }
.preview.pop .chibi { animation: pop .35s cubic-bezier(.3,1.7,.5,1); }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.field > span { font-size: 13px; color: var(--ink2); letter-spacing: .1em; }
.name-input { width: 100%; height: 46px; border: 0; border-bottom: 2px solid rgba(29,26,31,.7); background: transparent; font: 700 22px/1 var(--serif); color: var(--ink); padding: 4px 2px; outline: none; border-radius: 0; }
.name-input:focus { border-color: var(--crimson); }
.name-input::placeholder { color: rgba(29,26,31,.3); font-weight: 400; }
.dice { align-self: flex-start; margin-top: 8px; background: none; border: 0; color: var(--ink2); font-size: 14px; padding: 6px 0; display: inline-flex; gap: 6px; align-items: center; }
.dice:hover { color: var(--crimson); }
.opt { margin-top: 12px; }
.opt > span { display: block; font-size: 13px; color: var(--ink2); letter-spacing: .1em; margin-bottom: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { flex: 1; min-width: 0; height: 40px; border: 0; border-radius: 6px; font-size: 15px; font-weight: 700; color: var(--ink2); background: rgba(29,26,31,.06); box-shadow: 0 0 0 1px rgba(29,26,31,.18) inset; transition: .15s; }
.chip:hover { background: rgba(29,26,31,.1); }
.chip[aria-pressed=true] { color: #fff6e6; background: var(--ink); box-shadow: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.25) inset, 0 2px 4px rgba(0,0,0,.2); position: relative; transition: transform .15s; }
.sw:hover { transform: scale(1.08); }
.sw[aria-pressed=true]::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--crimson); }

/* ── 연결 중 ─────────────────────────────────────── */
.scr-connecting { align-items: center; justify-content: center; flex-direction: column; gap: 22px; text-align: center; padding: 24px; }
.conn-lantern { width: 64px; height: 64px; color: var(--lantern); filter: drop-shadow(0 0 18px rgba(255,180,105,.8)); animation: sway 2.4s ease-in-out infinite, breathe 2.4s ease-in-out infinite; transform-origin: 50% 0; }
.conn-text { font-size: 20px; margin: 0; text-shadow: 0 2px 12px #000; }
.conn-sub { font-size: 14px; margin: -12px 0 0; color: rgba(243,233,210,.6); }
.dots::after { content: '…'; display: inline-block; width: 1em; text-align: left; animation: dots 1.4s steps(4) infinite; overflow: hidden; vertical-align: bottom; }

/* ── 로비 ───────────────────────────────────────── */
.scr-lobby { flex-direction: column; overflow-y: auto; padding: calc(16px + var(--sat)) calc(32px + var(--sar)) calc(18px + var(--sab)) calc(32px + var(--sal)); }
.lobby-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
.night-label { font-size: 15px; letter-spacing: .25em; color: var(--gold); display: flex; align-items: center; gap: 10px; }
.night-label::before, .night-label::after { content: ''; width: 34px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,214,107,.6)); }
.night-label::after { transform: scaleX(-1); }
.lobby-main { flex: 1; display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: center; width: min(1140px, 100%); margin: 0 auto; padding: 14px 0; }
.code-card { padding: 22px 22px 18px; text-align: center; position: relative; }
.code-card > p { margin: 0; font-size: 13px; letter-spacing: .25em; color: var(--ink2); }
.room-code { display: flex; justify-content: center; gap: 8px; margin: 10px 0 14px; }
.room-code span { width: 50px; height: 62px; display: grid; place-items: center; font: 800 38px/1 var(--serif); color: var(--ink); border-bottom: 3px solid var(--crimson);
  background: rgba(29,26,31,.04); border-radius: 4px 4px 0 0; }
.code-card .btn { width: 100%; margin-top: 8px; }
.code-card .hint { margin: 12px 0 0; font-size: 13px; color: var(--ink2); letter-spacing: 0; line-height: 1.55; }
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.seat { position: relative; aspect-ratio: 3 / 4.1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 10px 8px 14px; min-width: 0;
  background: radial-gradient(80% 55% at 60% 55%, rgba(255,170,90,.2), transparent 70%), linear-gradient(180deg, rgba(20,24,52,.75), rgba(8,9,20,.85));
  box-shadow: 0 0 0 1px rgba(255,214,107,.22) inset, 0 16px 40px rgba(0,0,0,.45); animation: rise .5s both; }
.seat.me { box-shadow: 0 0 0 1.5px rgba(255,180,105,.7) inset, 0 0 30px rgba(255,160,90,.15), 0 16px 40px rgba(0,0,0,.45); }
.seat .chibi { width: 86%; height: auto; flex: 1; min-height: 0; max-height: 210px; }
.seat-name { margin-top: 6px; font-size: 17px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--paper); }
.seat-sub { font-size: 12.5px; color: rgba(243,233,210,.55); min-height: 1.4em; }
.seat .crown { position: absolute; top: 10px; left: 10px; width: 30px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.seat .ready-seal { position: absolute; top: 10px; right: 10px; width: 46px; height: 46px; font-size: 15px; opacity: 0; transform: rotate(-12deg) scale(2.2); transition: none; }
.seat.ready .ready-seal { opacity: 1; transform: rotate(-12deg) scale(1); animation: stampIn .38s cubic-bezier(.3,1.6,.5,1) both; }
.seat.off { filter: grayscale(.8) brightness(.6); }
.seat.empty { justify-content: center; gap: 10px; background: transparent; box-shadow: none; border: 1.5px dashed rgba(243,233,210,.22); color: rgba(243,233,210,.5); font-size: 14px; text-align: center; cursor: pointer; transition: .2s; }
.seat.empty:hover { border-color: rgba(255,180,105,.6); color: var(--lantern); background: rgba(255,180,105,.05); }
.seat.empty .ghost-lantern { width: 38px; height: 38px; opacity: .45; }
.lobby-bottom { flex: none; display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: end; width: min(1140px, 100%); margin: 0 auto; }
.howto-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.howto-mini .goal { grid-column: 1 / -1; margin: 0; font-size: 15px; color: rgba(243,233,210,.9); }
.howto-mini .goal b { color: var(--gold); font-weight: 700; }
.howto-mini .goal small { display: block; font-size: 13px; color: rgba(243,233,210,.55); margin-top: 2px; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: rgba(11,13,26,.55); box-shadow: 0 0 0 1px rgba(243,233,210,.1) inset; }
.tip i { flex: none; width: 30px; height: 30px; color: var(--lantern); display: grid; place-items: center; }
.tip i svg { width: 26px; height: 26px; }
.tip b { display: block; font-size: 14.5px; color: var(--paper); }
.tip span { display: block; font-size: 12.5px; color: rgba(243,233,210,.65); line-height: 1.5; }
.lobby-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 280px; }
.lobby-actions .btn { width: 100%; }
.lobby-status { text-align: center; font-size: 13px; color: rgba(243,233,210,.6); min-height: 1.5em; margin: 0; }
/* 난이도 (순한맛/보통맛/매운맛): host picks, everyone sees it */
.diff { display: flex; flex-direction: column; gap: 3px; }
.diff-seg { display: flex; border-radius: 8px; overflow: hidden; background: rgba(11,13,26,.55); box-shadow: 0 0 0 1px rgba(243,233,210,.22) inset; }
.diff-seg button { flex: 1; min-width: 0; border: 0; background: none; height: 36px; padding: 0 2px; font-size: 14px; font-weight: 700; color: rgba(243,233,210,.55); white-space: nowrap; pointer-events: auto; }
.diff-seg button + button { box-shadow: -1px 0 0 rgba(243,233,210,.16); }
.diff-seg button[aria-pressed=true] { color: var(--paper); background: linear-gradient(180deg, rgba(255,180,105,.2), rgba(255,180,105,.06)); box-shadow: inset 0 -2px 0 var(--lantern); }
.diff-seg button[data-d=mild][aria-pressed=true] { background: linear-gradient(180deg, rgba(255,226,170,.2), rgba(255,226,170,.05)); box-shadow: inset 0 -2px 0 #f3d9a0; }
.diff-seg button[data-d=spicy][aria-pressed=true] { background: linear-gradient(180deg, rgba(194,38,58,.34), rgba(194,38,58,.1)); box-shadow: inset 0 -2px 0 var(--crimson); }
.diff-seg button:disabled { cursor: default; opacity: .5; }
.diff-seg button[aria-pressed=true]:disabled { opacity: 1; }
.diff-note { margin: 0; text-align: center; font-size: 12px; color: rgba(243,233,210,.55); }
.diff-chip { display: inline-block; margin-left: .6em; padding: .1em .6em; border-radius: 99px; font-size: .92em; letter-spacing: .04em; font-weight: 700; vertical-align: .05em;
  color: #fbf3e2; background: rgba(255,180,105,.28); box-shadow: 0 0 0 1px rgba(255,180,105,.55) inset; }
.diff-chip.d-mild { background: rgba(243,217,160,.24); box-shadow: 0 0 0 1px rgba(243,217,160,.6) inset; }
.diff-chip.d-spicy { background: rgba(194,38,58,.55); box-shadow: 0 0 0 1px rgba(255,120,130,.6) inset; }
.res-kicker .diff-chip { letter-spacing: .06em; font-size: 12px; color: var(--ink); background: rgba(255,180,105,.32); box-shadow: 0 0 0 1px rgba(168,116,42,.45) inset; }
.res-kicker .diff-chip.d-mild { background: rgba(214,190,130,.3); }
.res-kicker .diff-chip.d-spicy { color: #fff1ea; background: var(--crimson); box-shadow: none; }
.intro-diff { margin: 6px 0 0; font-size: 15px; } .intro-diff .diff-chip { margin: 0; }
.btn-ready[aria-pressed=true] { background: rgba(255,214,107,.15); box-shadow: 0 0 0 1.5px var(--gold) inset; color: var(--gold); }

/* ── 모달 ───────────────────────────────────────── */
.modals { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.modal-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); pointer-events: auto;
  background: rgba(3,4,10,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s both; }
.modal { position: relative; width: min(480px, 100%); max-height: 100%; overflow-y: auto; padding: 26px 28px 22px; animation: unroll .35s cubic-bezier(.2,.8,.3,1) both; }
.modal.wide { width: min(720px, 100%); }
.modal h3 { margin: 0 0 14px; font-size: 22px; letter-spacing: .06em; display: flex; align-items: center; gap: 10px; }
.modal h3 .seal { width: 30px; height: 30px; font-size: 12px; }
.modal .x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0; background: none; color: var(--ink2); display: grid; place-items: center; border-radius: 50%; }
.modal .x svg { width: 22px; height: 22px; }
.modal .x:hover { background: rgba(29,26,31,.07); color: var(--crimson); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
.set-row { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid rgba(29,26,31,.08); }
.set-row > span:first-child { font-size: 15px; font-weight: 700; }
.set-row output { font-size: 13px; color: var(--ink2); text-align: right; font-variant-numeric: tabular-nums; }
.set-row.seg-row { grid-template-columns: 92px 1fr; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--crimson) var(--p, 50%), rgba(29,26,31,.18) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 2px var(--crimson), 0 2px 6px rgba(0,0,0,.3); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(29,26,31,.18); }
input[type=range]::-moz-range-progress { height: 4px; background: var(--crimson); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--crimson); background: var(--paper); }
.seg { display: flex; border-radius: 6px; box-shadow: 0 0 0 1px rgba(29,26,31,.3) inset; overflow: hidden; }
.seg button { flex: 1; border: 0; background: none; height: 38px; font-size: 14px; color: var(--ink2); padding: 0 4px; }
.seg button + button { box-shadow: -1px 0 0 rgba(29,26,31,.2); }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--paper); font-weight: 700; }
.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; font-size: 14.5px; line-height: 1.65; }
.howto h4 { margin: 0 0 4px; font-size: 15px; color: var(--crimson); letter-spacing: .08em; }
.howto p { margin: 0; color: var(--ink2); }
.howto ul { margin: 0; padding: 0; list-style: none; color: var(--ink2); }
.howto li { display: flex; gap: 8px; align-items: baseline; padding: 1.5px 0; }
.howto li kbd { flex: none; }
.howto .full { grid-column: 1 / -1; }
.pause-list { display: flex; flex-direction: column; gap: 10px; }
.pause-list .btn { width: 100%; }
.pause-note { margin: 12px 0 0; font-size: 13px; color: var(--ink2); text-align: center; }
.err-text { margin: 0; font-size: 16px; color: var(--ink); line-height: 1.6; }

/* ── 토스트 (메뉴 화면) ───────────────────────────── */
.toasts { position: absolute; left: 50%; bottom: calc(26px + var(--sab)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 999px; font-size: 15px; color: var(--ink); background: var(--paper); box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: toastIn .3s cubic-bezier(.3,1.4,.5,1) both; white-space: nowrap; }
.toast.err { background: var(--crimson); color: #fff3ee; }
.toast.out { animation: fadeOut .35s both; }

/* ── 결과 ───────────────────────────────────────── */
.scr-result { align-items: center; justify-content: center; padding: calc(14px + var(--sat)) calc(16px + var(--sar)) calc(14px + var(--sab)) calc(16px + var(--sal));
  background: radial-gradient(80% 80% at 50% 40%, rgba(11,13,26,.55), rgba(3,4,10,.92)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .6s both; }
.res-card { position: relative; width: min(980px, 100%); max-height: 100%; overflow-y: auto; display: grid; grid-template-columns: 340px 1fr; gap: 0; padding: 0; animation: unroll .6s .1s cubic-bezier(.2,.8,.3,1) both; }
.res-left { padding: 26px 24px 22px; border-right: 1px solid rgba(120,85,40,.22); display: flex; flex-direction: column; gap: 14px; position: relative; }
.res-right { padding: 24px 26px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.res-kicker { margin: 0; font-size: 13px; letter-spacing: .25em; color: var(--ink2); }
.res-head { padding-right: 84px; margin: -4px 0 0; font-family: var(--brush); font-weight: 400; font-size: 64px; line-height: 1; color: var(--ink); }
.no-brush .res-head { font-family: var(--serif); font-weight: 800; font-size: 44px; }
.res-card.lose .res-head { color: var(--crimson2); }
.res-meta { display: flex; gap: 16px; font-size: 14px; color: var(--ink2); flex-wrap: wrap; }
.res-meta b { display: block; font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rank { position: absolute; top: 20px; right: 20px; width: 92px; height: 92px; font-size: 52px; flex-direction: column; opacity: 0; }
.rank small { display: block; font-size: 11px; letter-spacing: .1em; margin-top: 2px; font-weight: 700; }
.rank.slam { animation: slam .55s cubic-bezier(.5,0,.6,1.6) forwards; }
.rank-word { font-size: 14px; color: var(--crimson); font-weight: 700; margin-top: -6px; }
.ghost-card { display: flex; gap: 12px; padding: 14px; border-radius: 6px; background: linear-gradient(160deg, #141834, #0b0d1a); color: var(--paper); box-shadow: inset 0 0 0 1px rgba(223,243,255,.15), 0 8px 20px rgba(0,0,0,.25); animation: rise .5s 1.1s both; }
.ghost-card + .ghost-card { animation-delay: 1.3s; }
.ghost-card .gsvg { width: 54px; flex: none; color: var(--ghost); filter: drop-shadow(0 0 10px rgba(223,243,255,.4)); }
.ghost-card small { font-size: 12px; color: rgba(223,243,255,.6); letter-spacing: .12em; }
.ghost-card h4 { margin: 0; font-size: 19px; color: var(--ghost); }
.ghost-card p { margin: 3px 0 0; font-size: 13px; line-height: 1.55; color: rgba(243,233,210,.8); }
.ghost-card .counter { margin-top: 6px; font-size: 13px; color: var(--gold); }
.prows { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 6px; background: rgba(29,26,31,.045); box-shadow: inset 0 0 0 1px rgba(29,26,31,.08); animation: rise .45s both; }
.prow.me { background: rgba(255,180,105,.14); }
.prow .chibi-head { width: 52px; height: 47px; }
.prow-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prow-name { font-size: 17px; font-weight: 700; }
.ptitle { font-size: 12.5px; font-weight: 700; color: #fff4ea; background: var(--crimson); padding: 2px 9px 2px 8px; border-radius: 3px; clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%); padding-right: 14px; }
.pstate { font-size: 12.5px; color: var(--ink3); }
.pstate.ok { color: #2f6b3e; font-weight: 700; }
.pstats { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.pstats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.res-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; align-items: center; position: sticky; bottom: -22px; padding-top: 14px; z-index: 2; margin-bottom: -22px; padding-bottom: 22px;
  background: linear-gradient(rgba(233,218,188,0), rgba(233,218,188,.96) 16px); }
.res-actions .btn { flex: 1; }
.res-wait { flex: 1; text-align: center; font-size: 14px; color: var(--ink2); margin: 0; padding: 12px; }
/* 오늘 밤의 명장면 */
.hl { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px dashed rgba(120,85,40,.3); }
.hl .res-kicker { color: var(--crimson); }
.hl-row { display: flex; align-items: center; gap: 10px; animation: hlIn .6s cubic-bezier(.2,.9,.3,1.2) both; }
.hl-face { flex: none; width: 40px; height: 36px; }
.hl-face .chibi-head { width: 40px; height: 36px; }
.hl-row p { margin: 0; font-size: 17px; line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.res-actions .btn-line { background: var(--paper); }
.hl-row p b { color: var(--crimson); background: linear-gradient(transparent 62%, rgba(194,38,58,.16) 62%); padding: 0 1px; }
.hl-row.me p { font-weight: 700; }
.btn-share { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 10px 4px; min-height: 44px; font-size: 15px; font-weight: 700; color: var(--crimson); }
.btn-share svg { width: 19px; height: 19px; }
.btn-share:hover { color: var(--crimson2); text-decoration: underline; text-underline-offset: 4px; }
.share-modal { width: min(400px, 100%); }
.share-frame { position: relative; margin: 0 auto; width: min(100%, calc((100dvh - 250px) * 9 / 16), 300px); aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; background: #0b0d1a; box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.share-wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--paper); font-size: 14px; text-align: center; padding: 16px; }
.share-wait .conn-lantern { width: 44px; height: 44px; }
.share-img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .4s; -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; pointer-events: auto; }
.share-frame.ready .share-img { opacity: 1; }
.share-note { margin: 10px 0 0; font-size: 13px; color: var(--ink2); text-align: center; }

/* ── 게임 HUD ───────────────────────────────────── */
.hud { position: absolute; inset: 0; pointer-events: none; font-size: 15px; text-shadow: 0 1px 2px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.6); }
.hud-tl { position: absolute; top: calc(16px + var(--sat)); left: calc(18px + var(--sal)); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.tal { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 999px; background: linear-gradient(90deg, rgba(8,9,20,.7), rgba(8,9,20,.25)); }
.tal-ic { width: 20px; height: 33px; filter: drop-shadow(0 0 6px rgba(255,214,107,.45)); transition: transform .2s; }
.tal-n { font: 700 24px/1 var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; min-width: 1ch; display: inline-block; }
.tal-d { font-size: 16px; color: rgba(243,233,210,.6); }
.tal-l { font-size: 12.5px; color: rgba(243,233,210,.6); margin-left: 4px; letter-spacing: .06em; }
.tal.tick .tal-n { animation: tick .6s cubic-bezier(.3,1.8,.5,1); }
.tal.tick .tal-ic { animation: talFly .6s cubic-bezier(.3,1.6,.5,1); }
.tal.tick { animation: talGlow .9s ease-out; }
.tal.done .tal-n, .tal.done .tal-d { color: var(--gold); }
.tal.done { box-shadow: 0 0 0 1px rgba(255,214,107,.5) inset, 0 0 22px rgba(255,214,107,.25); }
.feed { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; max-width: min(360px, 40vw); }
.feed-item { font-size: 14px; padding: 4px 12px 4px 10px; border-left: 2px solid var(--lantern); background: linear-gradient(90deg, rgba(8,9,20,.65), rgba(8,9,20,0)); animation: feedIn .35s cubic-bezier(.2,.9,.3,1.2) both; }
.feed-item.bad { border-color: var(--danger); color: #ffd8dc; }
.feed-item.good { border-color: #9fe0a8; }
.feed-item.gold { border-color: var(--gold); color: #fff0c2; }
.feed-item.out { animation: fadeOut .5s both; }
.hud-tr { position: absolute; top: calc(14px + var(--sat)); right: calc(16px + var(--sar)); display: flex; gap: 10px; align-items: flex-start; }
.mates { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mate { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 12px; border-radius: 999px; background: linear-gradient(270deg, rgba(8,9,20,.72), rgba(8,9,20,.25)); font-size: 14px; transition: opacity .3s; }
.mate .chibi-head { width: 30px; height: 27px; border-radius: 50%; background: rgba(255,180,105,.18); }
.mate-st { font-size: 12px; color: rgba(243,233,210,.6); }
.mate[data-s=hidden] .mate-st { color: #a9c7ff; }
.mate[data-s=downed] { background: linear-gradient(270deg, rgba(120,10,25,.75), rgba(120,10,25,.2)); animation: pulseBad 1.2s infinite; }
.mate[data-s=downed] .mate-st { color: #ffd2d7; font-weight: 700; }
.mate[data-s=downed] .chibi-head { filter: grayscale(1) brightness(.7); }
.mate[data-s=escaped] { opacity: .75; }
.mate[data-s=escaped] .mate-st { color: #9fe0a8; }
.mate.off { opacity: .4; }
.icon-btn { pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(8,9,20,.55); box-shadow: 0 0 0 1px rgba(243,233,210,.2) inset; color: var(--paper); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { box-shadow: 0 0 0 1px var(--lantern) inset; color: var(--lantern); }
.hud-bc { position: absolute; left: 50%; bottom: calc(22px + var(--sab)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; width: 420px; max-width: 60vw; }
.prompt { display: flex; align-items: center; gap: 10px; padding: 7px 18px 7px 8px; border-radius: 999px; background: rgba(8,9,20,.7); box-shadow: 0 0 0 1px rgba(255,214,107,.35) inset, 0 0 26px rgba(255,180,105,.15); font-size: 16px; font-weight: 700; animation: popIn .25s cubic-bezier(.3,1.6,.5,1) both; white-space: nowrap; }
.prompt[hidden] { display: none; }
.prompt.locked kbd { font-size: 13px; background: rgba(194,38,58,.25); color: #ffd8dc; box-shadow: 0 0 0 1px rgba(255,120,130,.55) inset; }
.prompt.locked span:last-child { font-weight: 400; font-size: 14.5px; }
.prompt-key { position: relative; width: 38px; height: 38px; display: grid; place-items: center; }
.prompt-key kbd { font-size: 15px; width: 30px; height: 30px; background: rgba(255,214,107,.16); color: var(--gold); box-shadow: 0 0 0 1px rgba(255,214,107,.6) inset; }
.prompt-key .ring { position: absolute; inset: 0; width: 38px; height: 38px; transform: rotate(-90deg); }
.prompt-key .ring circle { fill: none; stroke-width: 3; }
.prompt-key .ring .bg { stroke: rgba(255,214,107,.18); }
.prompt-key .ring .fg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 107; stroke-dashoffset: 107; }
.prompt-key svg.tic { width: 22px; height: 22px; color: var(--gold); }
.prompt small { font-weight: 400; font-size: 13px; color: rgba(243,233,210,.6); }
.stam { width: 160px; height: 5px; border-radius: 3px; background: rgba(8,9,20,.7); box-shadow: 0 0 0 1px rgba(243,233,210,.15); overflow: hidden; transition: opacity .4s; }
.stam i { display: block; height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, #ffcf8a, var(--lantern)); border-radius: 3px; }
.stam.low i { background: var(--danger); }
.stam.hide { opacity: 0; }
.breath { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 18px 12px; border-radius: 12px; background: rgba(8,9,20,.72); box-shadow: 0 0 0 1px rgba(169,199,255,.3) inset; }
.breath[hidden] { display: none; }
.breath-t { font-size: 14px; color: #cfe0ff; display: flex; gap: 8px; align-items: center; }
.breath-bar { width: 200px; height: 6px; border-radius: 3px; background: rgba(169,199,255,.15); overflow: hidden; }
.breath-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8fb4ff, #dff3ff); transform-origin: left; }
.breath.urgent { box-shadow: 0 0 0 1.5px var(--danger) inset, 0 0 30px rgba(255,90,106,.35); animation: pulseBad .8s infinite; }
.breath.urgent .breath-t { color: #ffd2d7; font-weight: 700; }
.breath.holding .breath-t { color: #fff; }
.hud-bl { position: absolute; left: calc(18px + var(--sal)); bottom: calc(18px + var(--sab)); display: flex; gap: 8px; }
.slot { position: relative; width: 56px; height: 56px; border-radius: 10px; display: grid; place-items: center; background: rgba(8,9,20,.62); box-shadow: 0 0 0 1px rgba(243,233,210,.16) inset; color: rgba(243,233,210,.85); }
.slot svg { width: 26px; height: 26px; }
.slot kbd { position: absolute; left: -5px; top: -6px; font-size: 11px; min-width: 20px; height: 20px; background: rgba(8,9,20,.9); }
.slot .cnt { position: absolute; right: 5px; bottom: 2px; font-size: 13px; font-weight: 700; }
.slot.on { color: var(--lantern); box-shadow: 0 0 0 1px rgba(255,180,105,.55) inset, 0 0 18px rgba(255,180,105,.2); }
.slot.off { color: rgba(243,233,210,.35); }
.slot.empty { opacity: .45; }
.slot.full { color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.5) inset, 0 0 16px rgba(255,255,255,.15); }
.slot .cd { position: absolute; inset: 0; border-radius: 10px; background: conic-gradient(rgba(243,233,210,.2) calc(var(--cd, 0) * 360deg), transparent 0); }
.slot-l { position: absolute; bottom: -19px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: rgba(243,233,210,.55); white-space: nowrap; }
.hud-br { position: absolute; right: calc(18px + var(--sar)); bottom: calc(18px + var(--sab)); display: flex; gap: 6px; }
.emo { pointer-events: auto; height: 34px; padding: 0 10px 0 6px; border: 0; border-radius: 999px; background: rgba(8,9,20,.55); box-shadow: 0 0 0 1px rgba(243,233,210,.15) inset; font-size: 13px; display: flex; align-items: center; gap: 6px; color: rgba(243,233,210,.85); }
.emo kbd { font-size: 10px; min-width: 18px; height: 18px; }
.emo:hover { box-shadow: 0 0 0 1px var(--lantern) inset; }
.anchors { position: absolute; inset: 0; overflow: hidden; }
.anc { position: absolute; left: 0; top: 0; will-change: transform; }
.tag { transform: translate(-50%, -100%); font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(8,9,20,.5); white-space: nowrap; color: var(--paper); }
.tag[data-s=downed] { color: #ffd2d7; background: rgba(120,10,25,.6); }
.tag[data-s=hidden] { opacity: .6; }
.pin { transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; color: var(--gold); animation: pinIn .4s cubic-bezier(.3,1.7,.5,1) both; }
.pin svg { width: 26px; height: 26px; filter: drop-shadow(0 0 8px rgba(255,214,107,.8)); }
.pin span { font-size: 12px; font-weight: 700; white-space: nowrap; }
.pin.shout { color: #ffc6a0; }
.pin::after { content: ''; position: absolute; bottom: -6px; width: 34px; height: 12px; border-radius: 50%; border: 2px solid currentColor; opacity: .7; animation: ripple 1.2s infinite; }
.bubble { transform: translate(-50%, -100%); padding: 4px 12px; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 700; text-shadow: none; white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,.4); animation: popIn .3s cubic-bezier(.3,1.7,.5,1) both; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.edge { transform: translate(-50%, -50%); width: 46px; height: 46px; display: grid; place-items: center; }
.edge .arw { position: absolute; inset: 0; display: grid; place-items: center; }
.edge .arw svg { width: 22px; height: 22px; transform: translateY(-17px); }
.edge .eic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(8,9,20,.75); font-size: 11px; font-weight: 700; }
.edge.down { color: var(--danger); animation: pulseBad 1s infinite; }
.edge.down .eic { box-shadow: 0 0 0 1.5px var(--danger) inset; }
.edge.gate { color: var(--gold); }
.edge.gate .eic { box-shadow: 0 0 0 1.5px var(--gold) inset; }
.edge.gate .eic svg { width: 18px; height: 18px; }
.banner { position: absolute; left: 50%; top: calc(13% + var(--sat)); transform: translateX(-50%); text-align: center; pointer-events: none; white-space: nowrap; }
.banner .b-in { animation: bannerIn 4.2s cubic-bezier(.2,.7,.2,1) both; }
.banner h2 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: .08em; color: var(--paper); text-shadow: 0 0 20px rgba(0,0,0,.9), 0 2px 4px #000; }
.banner p { margin: 4px 0 0; font-size: 15px; color: rgba(243,233,210,.75); }
.banner .gold h2 { color: var(--gold); text-shadow: 0 0 26px rgba(255,214,107,.55), 0 2px 4px #000; }
.banner .night h2 { font-family: var(--brush); font-weight: 400; font-size: 54px; letter-spacing: .04em; }
.no-brush .banner .night h2 { font-family: var(--serif); font-weight: 800; font-size: 38px; }
.banner .b-in::before, .banner .b-in::after { content: ''; display: block; margin: 8px auto; width: 200px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,214,107,.6), transparent); }
.downed-ov { position: absolute; inset: 0; display: none; justify-content: center; pointer-events: none;
  background: radial-gradient(70% 70% at 50% 50%, transparent 40%, rgba(40,60,110,.35)); }
.downed-ov.on { display: flex; animation: fade .8s both; }
.downed-box { position: absolute; top: calc(70px + var(--sat)); text-align: center; max-width: 520px; padding: 0 20px; }
.downed-box h2 { margin: 0; font-size: 26px; color: var(--ghost); letter-spacing: .08em; text-shadow: 0 0 20px rgba(140,180,255,.6), 0 2px 4px #000; }
.downed-box p { margin: 6px 0 0; font-size: 14.5px; color: rgba(223,243,255,.82); line-height: 1.6; }
.downed-box .solo { color: var(--gold); }
.coach { position: absolute; left: calc(18px + var(--sal)); bottom: calc(108px + var(--sab)); max-width: 300px; padding: 12px 16px 12px 14px; display: none; gap: 10px; align-items: flex-start; font-size: 14.5px; text-shadow: none; pointer-events: none; }
.coach.on.sup { display: none; }
.coach.on { display: flex; animation: unroll .4s cubic-bezier(.2,.8,.3,1) both; }
.coach .seal { color: #fff1ea; flex: none; width: 30px; height: 30px; font-size: 13px; }
.coach b { display: block; font-size: 15px; margin-bottom: 2px; }
.coach span { color: var(--ink2); line-height: 1.55; display: block; }
.coach .step { position: absolute; right: 10px; top: 8px; font-size: 11px; color: var(--ink3); }

/* 밤 시작 카드 (결과→다음 밤 전환 막 겸용) */
.intro { position: absolute; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; text-align: center; pointer-events: auto; cursor: pointer;
  padding: calc(20px + var(--sat)) calc(24px + var(--sar)) calc(20px + var(--sab)) calc(24px + var(--sal));
  background: radial-gradient(70% 60% at 50% 50%, rgba(11,13,26,.86), rgba(3,4,10,.97)); text-shadow: 0 2px 12px #000; }
.intro.on { display: flex; animation: fade .25s both; }
.intro.out { animation: introOut .7s ease forwards; pointer-events: none; }
.intro-in { display: flex; flex-direction: column; align-items: center; max-width: 560px; animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
.intro-kick { margin: 0; font-size: 13px; letter-spacing: .32em; color: rgba(255,214,160,.6); }
.intro h2 { margin: 2px 0 0; font-family: var(--brush); font-weight: 400; font-size: clamp(64px, 11vw, 104px); line-height: 1.1; color: #fbf3e2;
  text-shadow: 0 0 22px rgba(255,180,105,.4), 0 0 70px rgba(255,140,80,.2), 0 3px 0 rgba(0,0,0,.5); }
.no-brush .intro h2 { font-family: var(--serif); font-weight: 800; letter-spacing: .08em; font-size: clamp(44px, 8vw, 70px); }
.intro-rule { width: 220px; height: 1px; margin: 12px 0 14px; background: linear-gradient(90deg, transparent, rgba(255,214,107,.7), transparent); }
.intro-goal { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 19px; color: var(--paper); }
.intro-goal b { color: var(--gold); }
.intro-tal { width: 18px; height: 30px; flex: none; filter: drop-shadow(0 0 8px rgba(255,214,107,.6)); }
.intro-tip { margin: 22px 0 0; display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 10px; border-radius: 999px; font-size: 14.5px; color: rgba(243,233,210,.82);
  background: rgba(243,233,210,.06); box-shadow: inset 0 0 0 1px rgba(243,233,210,.12); text-align: left; text-shadow: none; animation: rise .6s .35s both; }
.intro-tip .seal { flex: none; width: 26px; height: 26px; font-size: 12px; }
.intro-skip { margin: 18px 0 0; font-size: 12px; color: rgba(243,233,210,.38); letter-spacing: .06em; animation: fade .5s 1s both; }
/* 늦게 들어온 사람 안내 · 연결 상태 */
.late-note { position: absolute; z-index: 35; left: 50%; top: calc(14px + var(--sat)); transform: translateX(-50%); display: flex; gap: 12px; align-items: center; width: max-content; max-width: calc(100% - 32px);
  padding: 10px 18px 10px 12px; border-radius: 10px; color: var(--ink); background: var(--paper); box-shadow: 0 12px 30px rgba(0,0,0,.5); pointer-events: none; animation: unroll .4s both; }
.late-note .seal { width: 34px; height: 34px; font-size: 15px; flex: none; }
.late-note b { display: block; font-size: 15.5px; }
.late-note span:not(.seal) { display: block; font-size: 13.5px; color: var(--ink2); }
.late-note.in-game { display: none; }
.net-pill { position: absolute; z-index: 70; left: 50%; top: calc(10px + var(--sat)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 16px; min-height: 40px;
  border-radius: 999px; font-size: 14px; color: #ffe3e6; background: rgba(60,8,18,.88); box-shadow: 0 0 0 1px rgba(255,90,106,.5) inset, 0 8px 24px rgba(0,0,0,.5); pointer-events: auto; white-space: nowrap; animation: toastIn .3s both; }
.net-pill .btn-text { min-height: 32px; padding: 0 12px; border-radius: 999px; color: #fff; background: rgba(255,255,255,.12); font-weight: 700; font-size: 13.5px; }
#ui[data-screen=lobby] .net-pill, #ui[data-screen=result] .net-pill { top: calc(64px + var(--sat)); }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: pulseBad 1s infinite; flex: none; }
.net-pill > span { padding-right: 8px; }
.conn-acts { display: flex; gap: 10px; }
.err-sub { margin-top: 8px; font-size: 14px; color: var(--ink2); }
.banner .omen h2 { font-size: 26px; font-weight: 700; letter-spacing: .18em; color: #cfe0ff; text-shadow: 0 0 24px rgba(120,160,255,.55), 0 0 4px rgba(194,38,58,.6), 0 2px 4px #000; }
.banner .omen { animation-duration: 3.6s; }
.banner .omen::before, .banner .omen::after { background: linear-gradient(90deg, transparent, rgba(194,38,58,.7), transparent); }

/* 모바일 터치 컨트롤 */
.touch { position: absolute; inset: 0; display: none; pointer-events: none; }
.is-touch .touch { display: block; }
.joy-zone { position: absolute; left: 0; bottom: 0; width: 46%; height: 72%; pointer-events: auto; touch-action: none; }
.joy { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; left: calc(96px + var(--sal)); top: calc(100% - 92px - var(--sab));
  background: radial-gradient(circle, rgba(8,9,20,.15) 40%, rgba(8,9,20,.45)); box-shadow: 0 0 0 1.5px rgba(243,233,210,.25) inset; transition: opacity .2s; opacity: .55; }
.joy.on { opacity: 1; transition: none; }
.joy.run { box-shadow: 0 0 0 2px var(--lantern) inset, 0 0 26px rgba(255,180,105,.35); }
.joy-run { position: absolute; inset: -2px; border-radius: 50%; border: 2px dashed rgba(255,180,105,.0); }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff6e6, #e6d2ad); box-shadow: 0 4px 14px rgba(0,0,0,.5); will-change: transform; }
.joy.run .joy-knob { background: radial-gradient(circle at 40% 35%, #fff2d6, var(--lantern)); }
.joy-hint { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 4px; font-size: 11.5px; color: rgba(243,233,210,.6); white-space: nowrap; }
.joy.on .joy-hint { opacity: 0; }
.acts { position: absolute; right: calc(18px + var(--sar)); bottom: calc(16px + var(--sab)); width: 230px; height: 200px; pointer-events: none; }
.tb { position: absolute; pointer-events: auto; touch-action: none; border: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: rgba(8,9,20,.6); color: var(--paper); box-shadow: 0 0 0 1.5px rgba(243,233,210,.28) inset, 0 6px 16px rgba(0,0,0,.35); font-size: 11.5px; font-weight: 700; transition: transform .08s, background .15s; }
.tb svg { width: 24px; height: 24px; }
.tb.down { transform: scale(.92); background: rgba(255,180,105,.3); }
.tb-main { right: 0; bottom: 0; width: 92px; height: 92px; font-size: 14px; }
.tb-main svg { width: 32px; height: 32px; }
.tb-main.ready { background: rgba(194,38,58,.78); box-shadow: 0 0 0 2px rgba(255,214,107,.7) inset, 0 0 26px rgba(255,140,80,.35); }
.tb-main.breath { background: rgba(60,90,170,.75); box-shadow: 0 0 0 2px #cfe0ff inset; }
.tb-main.dim { opacity: .6; }
.tb-main .ring { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.tb-main .ring circle { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; }
.tb-s { width: 58px; height: 58px; }
.tb-lantern { right: 104px; bottom: 6px; }
.tb-salt { right: 92px; bottom: 74px; }
.tb-shout { right: 30px; bottom: 108px; }
.tb-exit { right: 104px; bottom: 6px; display: none; }
.tb.on { color: var(--lantern); box-shadow: 0 0 0 1.5px rgba(255,180,105,.7) inset, 0 0 16px rgba(255,180,105,.25); }
.tb.empty { opacity: .4; }
.tb .cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(243,233,210,.22) calc(var(--cd, 0) * 360deg), transparent 0); pointer-events: none; }
.acts.hidden-mode .tb-lantern, .acts.hidden-mode .tb-salt, .acts.hidden-mode .tb-shout { display: none; }
.acts.hidden-mode .tb-exit { display: flex; }
.acts.ghost-mode .tb-lantern, .acts.ghost-mode .tb-salt, .acts.ghost-mode .tb-shout { display: none; }
.acts.gone { display: none; }
.emo-pop { position: absolute; right: 0; top: 52px; display: none; flex-direction: column; gap: 6px; pointer-events: auto; }
.emo-pop.on { display: flex; animation: rise .2s both; }
.emo-pop .emo { height: 40px; font-size: 14px; padding: 0 14px; }
.is-touch .hud-bl, .is-touch .hud-br { display: none; }
.is-touch .hud-bc { bottom: calc(14px + var(--sab)); }
.is-touch .coach { left: 50%; transform: translateX(-50%); top: calc(12px + var(--sat)); bottom: auto; width: max-content; max-width: min(380px, calc(100% - 300px)); padding: 7px 12px 7px 10px; font-size: 12.5px; opacity: .96; }
.is-touch .coach .seal { width: 24px; height: 24px; font-size: 11px; }
.is-touch .coach .step { display: none; }
.is-touch .coach b { font-size: 13px; margin-bottom: 0; }
/* 터치: 손가락 크기(44px+), 길게 누르기·더블탭 확대·당겨서 새로고침 막기 */
.is-touch #ui { touch-action: manipulation; }
.is-touch .seg button { height: 44px; }
.is-touch .btn-sm { min-height: 44px; }
.is-touch .dice { min-height: 44px; }
.is-touch .chip { height: 44px; }
.is-touch .sw::before { content: ''; position: absolute; inset: -8px; }
.is-touch .emo-pop .emo { height: 44px; }
.is-touch .menu-small .btn-text { min-height: 44px; }
.scr-title, .scr-lobby, .res-card, .modal { overscroll-behavior: contain; }
html.is-touch, html.is-touch body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.rotate { position: absolute; inset: 0; z-index: 80; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px; pointer-events: auto; text-align: center; padding: 30px;
  background: radial-gradient(60% 50% at 50% 45%, #1a1733, var(--night)); }
.rotate .phone { width: 64px; height: 104px; border-radius: 12px; border: 3px solid var(--paper); position: relative; animation: rot 2.4s ease-in-out infinite; }
.rotate .phone::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 16px; height: 3px; margin-left: -8px; border-radius: 2px; background: var(--paper); }
.rotate p { margin: 0; font-size: 19px; }
.rotate small { color: rgba(243,233,210,.6); font-size: 14px; }
.rotate .rot-lock { margin-top: -8px; font-size: 12.5px; color: rgba(243,233,210,.42); }
@media (orientation: portrait) { .is-touch #ui[data-screen=game] .rotate, #ui.is-touch[data-screen=game] .rotate { display: flex; } }

/* ── 반응형 ──────────────────────────────────────── */
@media (max-width: 900px) and (orientation: landscape), (max-height: 520px) and (orientation: landscape) {
  .title-grid { column-gap: 22px; grid-template-columns: 1fr 360px; padding: calc(12px + var(--sat)) calc(18px + var(--sar)) calc(12px + var(--sab)) calc(26px + var(--sal)); }
  .kicker { font-size: 11.5px; }
  .logo-txt { font-size: 62px; }
  .no-brush .logo-txt { font-size: 52px; }
  .logo .seal { width: 40px; height: 40px; font-size: 15px; margin-top: 8px; }
  .tagline { display: none; }
  .menu { margin-top: 12px; gap: 8px; width: 300px; }
  .btn-hero { min-height: 48px; font-size: 17px; }
  .btn { min-height: 44px; font-size: 15.5px; }
  .invite { padding: 8px 10px; } .invite .seal { width: 34px; height: 34px; font-size: 11px; } .invite p { font-size: 13px; }
  .maker { padding: 12px 16px 12px; }
  .maker h2 { font-size: 12.5px; }
  .preview { width: 104px; height: 118px; } .preview .chibi { width: 104px; height: 116px; }
  .name-input { height: 38px; font-size: 19px; }
  .opt { margin-top: 6px; } .opt > span { font-size: 11.5px; margin-bottom: 3px; }
  .chip { height: 32px; font-size: 13.5px; }
  .sw { width: 28px; height: 28px; } .swatches { gap: 8px; }
  .dice { margin-top: 2px; font-size: 13px; }
  .title-foot { display: none; }
  .menu-small .btn-text { font-size: 13.5px; min-height: 36px; padding: .3em .6em; }
  .menu-small { flex-wrap: nowrap; }
  .scr-lobby { padding: calc(8px + var(--sat)) calc(16px + var(--sar)) calc(8px + var(--sab)) calc(16px + var(--sal)); }
  .lobby-main { grid-template-columns: 210px 1fr; gap: 14px; padding: 6px 0; }
  .code-card { padding: 12px 12px 10px; }
  .room-code { margin: 4px 0 6px; gap: 5px; } .room-code span { width: 36px; height: 44px; font-size: 28px; }
  .code-card .btn { margin-top: 5px; min-height: 40px; font-size: 14px; }
  .code-card .hint { display: none; }
  .seats { gap: 8px; }
  .seat { aspect-ratio: auto; height: 176px; padding: 6px 6px 8px; }
  .seat .chibi { max-height: 112px; }
  .seat-name { font-size: 14.5px; margin-top: 2px; } .seat-sub { font-size: 11px; }
  .seat .crown { width: 22px; top: 6px; left: 6px; } .seat .ready-seal { width: 34px; height: 34px; font-size: 12px; top: 6px; right: 6px; }
  .lobby-bottom { gap: 14px; grid-template-columns: 1fr 210px; }
  .lobby-actions { width: 210px; gap: 5px; }
  .diff-note { display: none; } .diff-seg button { height: 32px; font-size: 13px; }
  .howto-mini { gap: 6px; } .howto-mini .goal { font-size: 13px; } .howto-mini .goal small { display: none; }
  .tip { padding: 6px 8px; gap: 6px; } .tip i { width: 22px; height: 22px; } .tip i svg { width: 20px; height: 20px; }
  .tip b { font-size: 12.5px; } .tip span { font-size: 11px; line-height: 1.4; }
  .res-card { grid-template-columns: 280px 1fr; }
  .res-left { padding: 16px 16px 14px; gap: 8px; } .res-right { padding: 14px 16px; gap: 8px; }
  .res-head { font-size: 46px; } .no-brush .res-head { font-size: 32px; }
  .rank { width: 66px; height: 66px; font-size: 36px; top: 12px; right: 12px; }
  .res-meta b { font-size: 17px; } .res-meta { font-size: 12px; gap: 12px; }
  .ghost-card { padding: 9px; gap: 8px; } .ghost-card .gsvg { width: 40px; } .ghost-card h4 { font-size: 16px; } .ghost-card p { font-size: 11.5px; }
  .prow { padding: 5px 8px; grid-template-columns: 40px 1fr; gap: 8px; } .prow .chibi-head { width: 40px; height: 36px; } .prow-name { font-size: 15px; }
  .pstats { font-size: 11.5px; gap: 2px 10px; }
  .hl { gap: 2px; padding-bottom: 8px; } .hl-row { gap: 8px; } .hl-row p { font-size: 13.5px; } .hl-face, .hl-face .chibi-head { width: 30px; height: 27px; }
  .btn-share { padding: 4px; min-height: 44px; font-size: 13.5px; }
  .res-actions { bottom: -14px; margin-bottom: -14px; padding-bottom: 14px; }
  .intro h2 { font-size: 64px; } .intro-goal { font-size: 16px; } .intro-tip { margin-top: 14px; font-size: 13px; } .intro-skip { margin-top: 10px; }
  .modal { padding: 16px 20px 14px; } .modal h3 { font-size: 18px; margin-bottom: 8px; }
  .howto { font-size: 12.5px; line-height: 1.5; gap: 8px 18px; }
  .set-row { padding: 3px 0; }
  .banner h2 { font-size: 22px; } .banner .night h2 { font-size: 40px; } .banner p { font-size: 13px; }
  .hud-tl { top: calc(10px + var(--sat)); left: calc(12px + var(--sal)); gap: 6px; }
  .hud-tr { top: calc(10px + var(--sat)); right: calc(12px + var(--sar)); }
  .tal-n { font-size: 20px; } .tal-ic { width: 16px; height: 27px; }
  .feed-item { font-size: 12.5px; }
  .mate { font-size: 12.5px; } .mate .chibi-head { width: 24px; height: 22px; }
  .downed-box { top: calc(52px + var(--sat)); } .downed-box h2 { font-size: 21px; } .downed-box p { font-size: 12.5px; }
}
/* 375 px tall phones (iPhone landscape): seats a bit shorter so the lobby's start button stays on screen */
@media (max-height: 400px) and (orientation: landscape) {
  .seat { height: 152px; } .seat .chibi { max-height: 94px; }
  .lobby-main { padding: 2px 0; }
}
/* phones in landscape: the difficulty row must not push the start button below the fold (that regressed once).
   The seats already say who is still getting ready, so the status line gives way; switches and the code card slim down. */
@media (max-height: 460px) and (orientation: landscape) {
  .scr-lobby.has-diff .lobby-status { display: none; }
  .scr-lobby.has-diff .hm-seg button { height: 32px; }
  .diff-seg button { height: 30px; }
  .room-code span { height: 40px; }
  .code-card .btn { min-height: 36px; }
}
@media (max-height: 370px) and (orientation: landscape) { /* 360 px Android phones */
  .scr-lobby.has-diff .hm-seg button, .diff-seg button { height: 28px; }
  .scr-lobby.has-diff .lobby-actions { gap: 3px; }
}
@media (orientation: portrait) and (max-width: 720px) {
  .title-grid { grid-template-columns: 1fr; grid-template-areas: "hero" "maker" "menu"; align-content: space-between; row-gap: 14px;
    padding: calc(24px + var(--sat)) calc(18px + var(--sar)) calc(18px + var(--sab)) calc(18px + var(--sal)); }
  .hero { text-align: center; align-self: start; padding-top: 1vh; }
  .kicker { letter-spacing: .12em; font-size: 12.5px; }
  .maker-top .dice { font-size: 13px; }
  .chip { font-size: 14px; padding: 0 2px; }
  .swatches { gap: 8px; } .sw { width: 32px; height: 32px; }
  .logo { justify-content: center; } .logo-txt { font-size: clamp(64px, 19vw, 92px); }
  .no-brush .logo-txt { font-size: clamp(44px, 13vw, 64px); }
  .logo .seal { position: absolute; right: -40px; top: 0; width: 40px; height: 40px; font-size: 15px; margin: 0; }
  .tagline { font-size: 15px; }
  .maker { padding: 14px 16px; }
  .preview { width: 112px; height: 128px; } .preview .chibi { width: 112px; height: 124px; }
  .menu { width: auto; margin: 0 calc(-18px - var(--sar)) calc(-18px - var(--sab)) calc(-18px - var(--sal)); position: sticky; bottom: 0; z-index: 3;
    display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 22px calc(18px + var(--sar)) calc(12px + var(--sab)) calc(18px + var(--sal));
    background: linear-gradient(to bottom, rgba(5,6,12,0), rgba(5,6,12,.94) 26px); }
  .menu > .btn-hero, .menu > .code-row { grid-column: 1 / -1; }
  .menu-small { margin: 0; flex-wrap: nowrap; }
  .menu-small .btn-text span { display: none; }
  .menu-small .btn-text { width: 44px; justify-content: center; padding: 0; box-shadow: 0 0 0 1px rgba(243,233,210,.25) inset; }
  .menu-small .btn-text[hidden] { display: none; }
  .has-invite .menu-small .btn-text:first-child { width: auto; padding: 0 10px; font-size: 13px; }
  .hero .invite { margin: 12px auto 0; text-align: left; }
  .invite { padding: 8px 12px; } .invite .seal { width: 36px; height: 36px; font-size: 12px; }
  .title-foot { position: static; padding-bottom: 4px; }
  .lobby-main { grid-template-columns: 1fr; }
  .seats { grid-template-columns: repeat(2, 1fr); }
  .seat { aspect-ratio: auto; height: 190px; }
  /* lobby-bottom dissolves so the sticky footer's containing block is the whole scroller (otherwise it can't rise
     above lobby-bottom's top and the start button sits below the fold at scroll top) */
  .lobby-bottom { display: contents; }
  .howto-mini { grid-template-columns: 1fr; margin-top: 14px; }
  /* pinned footer: bleeds to the screen edges with a solid night backdrop (soft fade on top) so the scrolling
     tips never show through; it stays in flow, so at scroll bottom the last tip sits fully above it */
  .scr-lobby { padding-bottom: 0; } /* the footer carries the bottom inset itself */
  .lobby-actions { width: auto; position: sticky; bottom: 0; z-index: 2;
    margin: 4px calc(-32px - var(--sar)) 0 calc(-32px - var(--sal));
    padding: 26px calc(32px + var(--sar)) calc(14px + var(--sab)) calc(32px + var(--sal));
    background: linear-gradient(to bottom, rgba(5,6,12,0), #05060c 24px); }
  .res-card { grid-template-columns: 1fr; }
  .res-left { border-right: 0; border-bottom: 1px solid rgba(120,85,40,.22); }
  .hl-row p { font-size: 15px; }
  .res-head { font-size: 56px; }
  .res-actions { bottom: -22px; }
  .howto { grid-template-columns: 1fr; }
}

/* ── 애니메이션 ──────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-4px); } }
@keyframes unroll { from { opacity: 0; transform: translateY(10px) scaleY(.92); clip-path: inset(0 0 60% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes stampIn { 0% { opacity: 0; transform: rotate(-12deg) scale(2.4); } 60% { opacity: 1; transform: rotate(-8deg) scale(.92); } 100% { transform: rotate(-7deg) scale(1); } }
@keyframes slam { 0% { opacity: 0; transform: rotate(-24deg) scale(3.2); filter: blur(4px); } 70% { opacity: 1; transform: rotate(-9deg) scale(.9); filter: none; } 100% { opacity: 1; transform: rotate(-9deg) scale(1); } }
@keyframes bob { 50% { transform: translateY(-2.5px); } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes pop { 40% { transform: scale(1.08) rotate(-2deg); } }
@keyframes breathe { 50% { filter: drop-shadow(0 0 30px rgba(255,180,105,1)); } }
@keyframes dots { from { width: 0; } to { width: 1em; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes tick { 0% { transform: scale(1); } 30% { transform: scale(1.7); color: #fff; text-shadow: 0 0 18px var(--gold); } 100% { transform: scale(1); } }
@keyframes talFly { 0% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-8px) rotate(-12deg) scale(1.25); } 100% { transform: none; } }
@keyframes talGlow { 0% { box-shadow: 0 0 0 1px rgba(255,214,107,.9) inset, 0 0 40px rgba(255,214,107,.6); } 100% { box-shadow: 0 0 0 1px rgba(255,214,107,0) inset, 0 0 0 rgba(255,214,107,0); } }
@keyframes feedIn { from { opacity: 0; transform: translateX(-14px); } }
@keyframes pulseBad { 50% { opacity: .65; } }
@keyframes popIn { from { opacity: 0; transform: scale(.85); } }
@keyframes pinIn { from { opacity: 0; transform: translate(-50%, -140%) scale(.6); } }
@keyframes ripple { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
@keyframes bannerIn { 0% { opacity: 0; transform: translateY(8px); letter-spacing: .3em; } 14% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes introOut { to { opacity: 0; visibility: hidden; } }
@keyframes hlIn { from { opacity: 0; transform: translateX(-10px) rotate(-1deg); } }
@keyframes rot { 0%, 20% { transform: rotate(0); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { #ui *, #ui *::before, #ui *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* integration: the jumpscare (WebGL, drawn last) owns the screen for ~1.2 s */
html.jumpscare #ui .scr-game { visibility: hidden; }
