/* fonts: MAIN 신라문화체 Bold (titles, names, menu, big buttons, scores/냥) · SUB 조선100년체 (body and everything else).
   Full Hangul coverage (all 11,172 syllables) so typed nicknames always render. index.html preloads both behind #boot
   (FontFace + progress bar); these @font-face rules are the no-JS / fallback path. */
@font-face { font-family: 'Shilla Culture'; src: url(assets/fonts/shilla-culture-b.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Chosun Centennial'; src: url(assets/fonts/chosun-centennial.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --font-main: 'Shilla Culture', 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --font-sub: 'Chosun Centennial', 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}
h1, h2, h3, .sub-title, .dex-title, .dexd-name, .dc-name, .ym-name, .callout-main, .room-code, .search-time,
.quick-title, .mode, .soon-link, .dex-entry-t, .text-btn, .cta, .throw, .ask-ok, .dexd-actions .cta,
.pl-name, .turn-name, .seat-name, .rank-name, .prof-name, .seat-in .input, .nick-input, .nick-hello,
.wallet-val, #dexHave, #dexCoins, .rank-pts, .rank-n, .rank-tag, .reward-row b, .dc-st.price, .stats dd, .dest-label { font-family: var(--font-main); }

/* boot: font preload screen (shown only while html.booting; the menu waits behind it) */
.boot { display: none; }
html.booting .boot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 24px; background: #0B0A09; color: #F3F0EA; transition: opacity 420ms cubic-bezier(0.32, 0.72, 0, 1); }
html.booting .boot.done { opacity: 0; pointer-events: none; }
html.booting .rise, html.booting .logo-img { animation-play-state: paused !important; }
.boot-logo { width: min(320px, 70vw); height: auto; opacity: 0.92; }
.boot-bar { width: min(240px, 60vw); height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.10); overflow: hidden; }
.boot-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: #E6C07E; transition: width 160ms linear; }
.boot-text { margin: 0; font: 500 13px/1.2 -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif; color: rgba(243, 240, 234, 0.58); font-variant-numeric: tabular-nums; }

/* 대난투윷놀이 — UI
   Calm, neutral overlay on the 3D board: warm near-black surfaces, 1px hairlines, one accent (vermilion) reserved for the
   single primary action on each screen, Pretendard only, spacing 4/8/12/16/24/32, radii 28 › 22 › 16 › 12 › 10.
   The calligraphy logo and the brush callouts are the only expressive elements. */
:root {
  --bg: #0B0A09;
  --text: #F3F0EA;
  --muted: rgba(243, 240, 234, 0.58);
  --faint: rgba(243, 240, 234, 0.36);
  --hair: rgba(255, 255, 255, 0.08);
  --hair-2: rgba(255, 255, 255, 0.16);
  --raise: rgba(255, 255, 255, 0.05);
  --raise-2: rgba(255, 255, 255, 0.10);
  --surface: rgba(18, 17, 15, 0.84);
  --core: #141311;
  --accent: #C94F35;
  --accent-hi: #D45B40;
  --shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.75), 0 2px 10px -6px rgba(0, 0, 0, 0.5);
  --r-shell: 28px; --r-core: 22px; --r-btn: 16px; --r-ctl: 12px; --r-sm: 10px;
  --font: var(--font-sub);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: var(--ease);
  /* logo accents */
  --ink: #F5ECDD; --gold: #E6C07E;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.7); outline-offset: 2px; }
input { font: inherit; }
svg { display: block; }
.hidden { display: none !important; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; touch-action: manipulation; }
.labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.veil { position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0; transition: opacity 900ms var(--ease);
  background: linear-gradient(90deg, rgba(11, 10, 9, 0.94) 0%, rgba(11, 10, 9, 0.82) 30%, rgba(11, 10, 9, 0.2) 58%, rgba(11, 10, 9, 0) 100%); }
body.in-lobby .veil { opacity: 1; }
body.in-dex #stage, body.in-dex .labels { visibility: hidden; }   /* the paper 도감 covers the board */
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

.screen { position: fixed; inset: 0; z-index: 3; }
.panel-screen { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel { width: min(472px, 100%); min-height: 100%; padding: 48px 40px 40px 64px; display: flex; flex-direction: column; gap: 16px; }
/* centred when it fits, scrollable from the top when it doesn't */
.panel > :first-child { margin-top: auto; }
.panel > :last-child { margin-bottom: auto; }

/* entry: a short fade-up, staggered */
.rise { opacity: 0; transform: translateY(12px); animation: rise 700ms var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }

.logo { margin: 0; line-height: 0; }
.logo-img { display: block; width: 360px; max-width: 100%; height: auto; user-select: none; -webkit-user-select: none; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.55)); }

/* sheets: double bezel (a hairline tray holding the plate), only on the few panels that hold forms */
.shell { padding: 6px; border-radius: var(--r-shell); background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--hair), var(--shadow); }
.core { border-radius: var(--r-core); padding: 24px; background: var(--core); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.core-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.chip-tag { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; padding: 4px 8px; border-radius: 6px; color: var(--muted); background: var(--raise); }

.field { margin-bottom: 24px; min-width: 0; }
.label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--faint); margin: 0 0 8px; }
.status { margin: 12px 0 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.status:empty { margin: 0; min-height: 0; }
.inline { display: flex; gap: 8px; align-items: center; }

/* controls */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-ctl); background: var(--raise); }
.seg button { flex: 1; min-height: 44px; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: background 300ms var(--ease), color 300ms var(--ease); }
.seg button:hover:not(.on):not(:disabled) { color: var(--text); }
.seg button.on { background: var(--raise-2); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--hair); }
.input { width: 100%; min-width: 0; min-height: 48px; padding: 12px 14px; border: 0; border-radius: var(--r-ctl); background: var(--raise); color: var(--text); box-shadow: inset 0 0 0 1px var(--hair); outline: none; font-size: 15px; font-weight: 500; transition: box-shadow 300ms var(--ease); }
.input::placeholder { color: var(--faint); }
.input:focus { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34); }
.code-input { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.code-input:placeholder-shown { letter-spacing: 0; font-weight: 500; }

/* buttons: accent = the one primary action; everything else neutral */
.cta { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: 0 20px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap;
  transition: transform 300ms var(--ease), background 300ms var(--ease), opacity 300ms var(--ease); }
.cta:hover:not(:disabled) { background: var(--accent-hi); }
.cta:active:not(:disabled) { transform: scale(0.98); }
.cta:disabled { background: var(--raise); color: var(--faint); cursor: default; }
.ghost { min-height: 44px; padding: 0 16px; border-radius: var(--r-ctl); font-size: 14px; font-weight: 500; color: var(--text); background: var(--raise); box-shadow: inset 0 0 0 1px var(--hair); white-space: nowrap; transition: background 300ms var(--ease), transform 300ms var(--ease); }
.ghost:hover:not(:disabled) { background: var(--raise-2); }
.ghost:active:not(:disabled) { transform: scale(0.98); }
.ghost:disabled { opacity: 0.4; cursor: default; }
.ghost-sm { min-height: 44px; padding: 0 12px; font-size: 13px; }
.ghost-ic { display: inline-flex; align-items: center; gap: 8px; }
.ghost-ic svg { width: 16px; height: 16px; }
.text-btn { min-height: 44px; padding: 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); border-radius: var(--r-sm); transition: color 300ms var(--ease); }
.text-btn:hover { color: var(--text); }
.back { align-self: flex-start; }
.credit { margin: 8px 0 0; font-size: 11px; font-weight: 500; letter-spacing: 0.04em; color: var(--faint); }

/* seats */
.seats { list-style: none; margin: 0; padding: 0; }
.seat { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 12px; padding: 8px 0; }
.seat + .seat { border-top: 1px solid var(--hair); }
.seats.with-team .seat { grid-template-columns: 18px 1fr auto auto; }
/* practice only: no 사람/컴퓨터 column, so the name fills it. #roomSeats is unchanged */
#localSeats .seat { grid-template-columns: 18px minmax(0, 1fr); }
#localSeats.with-team .seat { grid-template-columns: 18px minmax(0, 1fr) auto; }
.puck { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--c, #888); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28); }   /* hairline: 흑편's near-black puck stays visible */
.seat .input { min-height: 44px; padding: 8px 10px; margin-left: -10px; background: transparent; box-shadow: none; }
.seat .input:focus { box-shadow: inset 0 0 0 1px var(--hair-2); }
.seat .seg button { padding: 6px 10px; font-size: 13px; }
.seat-in { display: flex; align-items: center; gap: 6px; min-width: 0; }
.seat-name { font-size: 15px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.seat-name .empty { color: var(--faint); }
.seat-actions { display: flex; gap: 6px; align-items: center; }
.mini { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--raise); color: var(--muted); }
.mini.me { color: var(--text); background: var(--raise-2); }
.mini.heuk { color: #EDE6DC; background: #1F1B18; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }   /* 흑편 */
.mini.baek { color: #1F1B18; background: #EFE8DC; }   /* 백편 */
.mini.off { color: var(--faint); }
.seg.seg-team button { min-width: 44px; padding: 6px 10px; font-size: 13px; }
.seg.seg-team button[data-v="0"].on { background: #1F1B18; color: #EDE6DC; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); } /* 흑, TEAM_COLORS[0] */
.seg.seg-team button[data-v="1"].on { background: #EFE8DC; color: #1F1B18; box-shadow: none; } /* 백, TEAM_COLORS[1] */
.seg.seg-team.locked button { cursor: default; }
.seg.seg-team.locked button:not(.on) { display: none; }

/* dialogs */
.modal, .search { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 24px; background: rgba(8, 7, 6, 0.62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: fade 400ms var(--ease); }
.modal-shell, .search-shell { width: min(380px, 100%); animation: rise 500ms var(--ease) both; }
.modal-core { text-align: center; padding: 32px 24px 24px; }
.modal-core h2 { font-size: 17px; margin: 16px 0 24px; text-wrap: balance; }
.modal-counts { display: flex; justify-content: center; align-items: center; gap: 12px; }
.count { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-ctl); font-weight: 600; font-size: 15px; background: var(--raise); font-variant-numeric: tabular-nums; }
.count-sep { color: var(--faint); }
.win-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.toast { position: fixed; left: 50%; bottom: 112px; transform: translate(-50%, 8px); padding: 12px 16px; border-radius: var(--r-ctl); font-size: 14px; font-weight: 500; color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair), var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); opacity: 0; pointer-events: none; transition: opacity 400ms var(--ease), transform 400ms var(--ease); z-index: 46; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- home ---------------- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nick { display: flex; flex-direction: row; align-items: baseline; justify-content: flex-start; min-width: 0; min-height: 44px; cursor: text; }
.nick-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--faint); }
.nick-hello { flex: none; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; }
.nick-input { width: 4em; max-width: 12.5em; min-width: 0; padding: 2px 0; border: 0; background: none; color: var(--text); font-size: 15px; font-weight: 600; outline: none; }
.nick-input:focus { box-shadow: 0 1px 0 var(--hair-2); }
.home .logo { margin: 24px 0 16px; }
.home-actions { display: flex; flex-direction: column; gap: 8px; }
.quick { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 76px; padding: 0 14px 0 24px; border-radius: 20px; text-align: left; color: #fff; background: var(--accent);
  box-shadow: 0 20px 40px -24px rgba(201, 79, 53, 0.7); transition: transform 300ms var(--ease), background 300ms var(--ease); }
.quick:hover:not(:disabled) { background: var(--accent-hi); }
.quick:active:not(:disabled) { transform: scale(0.98); }
.quick { background: var(--accent) url(assets/ui/btn_pattern.webp) center / cover no-repeat; overflow: hidden; }   /* user's orange lattice, as-is (cover: cropped, never stretched; clipped by the radius) */
.quick:hover:not(:disabled) { background: var(--accent) url(assets/ui/btn_pattern.webp) center / cover no-repeat; filter: brightness(1.06); }
.quick:disabled { background: var(--raise); color: var(--faint); box-shadow: none; cursor: default; }
.quick-text { display: flex; flex-direction: column; gap: 4px; }
.quick-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.72); }
.quick-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.quick-ic { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.16); transition: transform 400ms var(--ease); }
.quick-ic svg { width: 20px; height: 20px; }
.quick:hover:not(:disabled) .quick-ic { transform: translateX(2px); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { min-height: 52px; padding: 0 16px; border-radius: var(--r-btn); font-size: 15px; font-weight: 600; color: var(--text); background: var(--raise); box-shadow: inset 0 0 0 1px var(--hair); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); white-space: nowrap; transition: background 300ms var(--ease), transform 300ms var(--ease); }
.mode:hover { background: var(--raise-2); }
.mode:active { transform: scale(0.98); }
.soon { list-style: none; margin: 16px 0 0; padding: 16px 0 0; border-top: 1px solid var(--hair); display: flex; align-items: center; gap: 20px; font-size: 13px; font-weight: 500; color: var(--faint); }
.soon li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.soon .soon-note { font-size: 11px; letter-spacing: 0.08em; }
.soon-link { min-height: 44px; margin: -12px 0; padding: 0 2px; font-size: 13px; font-weight: 500; color: var(--muted); transition: color 300ms var(--ease); }
.soon-link:hover { color: var(--text); }
.soon .soon-locked { margin-left: auto; gap: 8px; }
/* coin balance next to the nickname */
.home-top-r { display: flex; align-items: center; gap: 12px; flex: none; margin-left: auto; }
.wallet { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; min-height: 44px; }
.wallet-val { padding: 2px 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* ranking / profile */
.rank-core { display: flex; flex-direction: column; gap: 12px; }
.rank-list { list-style: none; margin: 0 -8px; padding: 0; max-height: max(132px, calc(100dvh - 400px)); overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.rank-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 8px; border-radius: var(--r-sm); font-size: 15px; font-weight: 500; }
.rank-list .rank-row + .rank-row { box-shadow: 0 -1px 0 var(--hair); }
.rank-list .rank-row.me, .rank-list .rank-row.me + .rank-row { box-shadow: none; }
.rank-row.me { background: var(--raise-2); }
.rank-n { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.rank-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-pts { font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-pts small, .reward small { font-size: 12px; font-weight: 500; color: var(--faint); margin-left: 2px; }
.rank-me { margin: 0 -8px; background: var(--raise-2); box-shadow: inset 0 0 0 1px var(--hair); }
.rank-me .rank-tag { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); text-align: center; }
.rank-me.empty { grid-template-columns: 1fr; color: var(--muted); font-size: 14px; }
.rank-me:empty { visibility: hidden; }
.rank-empty { padding: 24px 8px; text-align: center; font-size: 14px; color: var(--faint); }
.rank-foot { margin: 0; font-size: 12px; color: var(--faint); }
.prof-name { margin: 0 0 16px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 16px; border-radius: var(--r-ctl); overflow: hidden; background: var(--hair); }
.stats div { padding: 12px 14px; background: var(--core); }
.stats dt { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--faint); }
.stats dd { margin: 4px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* sub screens */
.sub-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.back-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text); background: var(--raise); box-shadow: inset 0 0 0 1px var(--hair); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: background 300ms var(--ease), transform 300ms var(--ease); }
.back-btn:hover { background: var(--raise-2); }
.back-btn:active { transform: scale(0.96); }
.back-btn svg { width: 20px; height: 20px; }
.sub-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

/* searching */
.search-core { text-align: center; padding: 32px 24px 24px; }
.search-core h2 { font-size: 14px; font-weight: 500; color: var(--muted); }
.search-time { margin-top: 8px; font-size: 56px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.search-slots { display: flex; justify-content: center; gap: 12px; margin: 24px 0 8px; }
.search-slots i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--hair-2); transition: background 500ms var(--ease), box-shadow 500ms var(--ease); }
.search-slots i.on { background: var(--text); box-shadow: none; }
.search-count { margin: 0; font-size: 13px; font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.search .ghost { width: 100%; min-height: 48px; }

/* room */
.room-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.room-code { font-size: 64px; font-weight: 300; letter-spacing: 0.12em; line-height: 0.9; color: var(--text); font-variant-numeric: tabular-nums; }
.host-only { margin-top: 24px; }

/* ============ GAME HUD ============ */
#game { pointer-events: none; }
#game .win { pointer-events: auto; }
.hud-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: center; align-items: flex-start; padding: max(12px, env(safe-area-inset-top)) 16px 0; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.players { list-style: none; margin: 0; padding: 4px; display: flex; gap: 2px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair), var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.pl { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px; border-radius: 12px; min-width: 0; transition: background 500ms var(--ease); }
.pl .puck { width: 8px; height: 8px; }
.pl-text { min-width: 0; }
.pl-name { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; transition: color 500ms var(--ease); }
.pl-sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.pips { display: flex; gap: 3px; }
.pip { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.pip.board { background: color-mix(in srgb, var(--c) 55%, rgba(255, 255, 255, 0.2)); }
.pip.done { background: var(--c); }
.pl-tag { font-size: 11px; font-weight: 500; color: var(--faint); }
.pl.active .pl-name { color: var(--text); }
.pl.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--c); }
.round-btn { position: absolute; right: max(16px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: transform 300ms var(--ease), background 300ms var(--ease); }
.round-btn::after { content: ''; position: absolute; inset: -4px; }
.round-btn svg { width: 18px; height: 18px; }
.round-btn:hover { background: rgba(32, 30, 27, 0.92); }
.round-btn:active { transform: scale(0.96); }
.mute-btn { right: calc(max(16px, env(safe-area-inset-right)) + 52px); }
.mute-lobby { position: fixed; z-index: 30; }
#game:not(.hidden) ~ .mute-lobby { display: none; }

.dock { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 0 16px max(16px, env(safe-area-inset-bottom)); pointer-events: none; }
.dock-shell { pointer-events: auto; max-width: 100%; }
.dock-core { display: flex; align-items: center; gap: 16px; padding: 8px 8px 8px 16px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair), var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.turn { display: flex; align-items: center; gap: 12px; min-width: 0; }
.turn .puck { width: 10px; height: 10px; }
.turn-text { min-width: 0; }
.turn-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.turn-name .mini { font-size: 10px; }
.turn-hint { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.bank { display: flex; gap: 6px; }
.bank:empty { display: none; }
.chip { position: relative; min-width: 44px; height: 44px; padding: 0 12px; border-radius: var(--r-ctl); font-weight: 600; font-size: 16px; color: var(--text); background: var(--raise-2); box-shadow: inset 0 0 0 1px var(--hair); animation: fade 400ms var(--ease) both; transition: background 300ms var(--ease), color 300ms var(--ease), transform 300ms var(--ease); }
.chip::after { content: ''; position: absolute; inset: -4px -2px; }
.chip:active { transform: scale(0.96); }
.chip.sel { background: var(--text); color: #12110F; box-shadow: none; }
.throw { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 600; font-size: 16px; white-space: nowrap; transition: transform 300ms var(--ease), background 300ms var(--ease), color 300ms var(--ease); }
.throw::after { content: ''; position: absolute; inset: -4px; }
.throw:hover:not(:disabled) { background: var(--accent-hi); }
.throw:active:not(:disabled) { transform: scale(0.98); }
.throw:disabled { background: var(--raise); color: var(--faint); cursor: default; }

/* skill picker: lives in the dock. Wide screens: a compact row left of the dock, same height. Phones: replaces the dock content. */
.dock-shell { position: relative; display: flex; gap: 8px; }
.skillpick { display: flex; align-items: stretch; gap: 8px; pointer-events: auto; animation: fade 300ms var(--ease) both; }   /* no panel: just the buttons */
.skillpick .skill { background-color: var(--surface); box-shadow: inset 0 0 0 1px var(--hair), var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.skillpick .skill { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 84px; min-height: 44px; padding: 0 16px; border-radius: 20px; white-space: nowrap; transition: background-image 300ms var(--ease), box-shadow 300ms var(--ease), opacity 300ms var(--ease), transform 300ms var(--ease); }
.skillpick .skill:hover:not(:disabled) { background-image: linear-gradient(var(--raise-2), var(--raise-2)); }
.skillpick .skill:active:not(:disabled) { transform: scale(0.98); }
.skillpick .skill:disabled { opacity: 0.32; cursor: default; }
.skillpick .skill.on { background-image: linear-gradient(var(--raise-2), var(--raise-2)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), var(--shadow); }
.skillpick.picking .skill:not(.on) { opacity: 0.32; }
.sk-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--k); }
/* skill icon PNGs (assets/ui/skill_<id>.webp): shown once the file loads, otherwise the colour dot stays */
.sk-icon { display: none; flex: 0 0 auto; box-sizing: content-box; width: 29px; height: 29px; min-width: 29px; aspect-ratio: 1 / 1; background: center / contain no-repeat; filter: brightness(0) invert(1); }   /* drawn black: shown white on the dark buttons (PNGs unchanged) */
.skill.has-ic .sk-icon { display: block; }
.skill.has-ic .sk-dot { display: none; }
.sk-name { font-size: 15px; font-weight: 600; color: var(--text); }
.sk-shield { --k: #4E88D9; } .sk-trap { --k: #D0573E; } .sk-spring { --k: #42A46C; } .sk-summon { --k: #D7A83C; }
.sk-hint { display: none; }
/* name + one-word description under it (sub font, small, muted) */
.sk-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; }
.sk-desc { font-family: var(--font-sub); font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; white-space: nowrap; }

.head-tags { display: flex; gap: 6px; align-items: center; }

/* destination labels: dark plate, hairline, readable on the light board */
.dest-label { position: absolute; left: 0; top: 0; pointer-events: auto; min-height: 26px; padding: 4px 8px; border-radius: var(--r-sm); font-weight: 600; font-size: 12px; color: var(--text); background: rgba(16, 15, 13, 0.92); box-shadow: inset 0 0 0 1px var(--hair-2), 0 12px 24px -12px rgba(0, 0, 0, 0.8); white-space: nowrap; animation: fade 300ms var(--ease) both; }
.dest-label::after { content: ''; position: absolute; inset: -4px; }
@media (pointer: coarse) { .dest-label { min-height: 30px; padding: 6px 10px; } }

/* centre callouts ("메인자막"): traditional scroll behind, near-black ink lettering (brush word images in assets/text/ink or text),
   no outline / no drop shadow, one-line description under the word, all inside the paper. Scroll + text animate together. */
.callout { --w: min(560px, 92vw, 78vh); --ink-c: #1F1B18; --tx: calc(var(--w) * 0.115); --co-h: calc(var(--w) * 0.25);
  position: absolute; left: 50%; top: 27%; transform: translate(-50%, -50%); width: var(--w); aspect-ratio: 1000 / 626; height: calc(var(--w) * 0.626);
  padding: calc(var(--w) * 0.115) calc(var(--w) * 0.15) calc(var(--w) * 0.12); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--w) * 0.012);
  background: url(assets/ui/callout_scroll2.webp) center / 100% 100% no-repeat; pointer-events: none; opacity: 0; z-index: 4; }
/* scroll unrolling: only scaleX animates from the centre (0 → 1, smooth ease-out, no overshoot); height stays 100%, no
   vertical movement. No roll-up on the way out: it just disappears, so it is over 336 ms (the old roll-up) sooner and stops hiding the move. */
.callout.show { transform-origin: center center; animation: callout 1764ms linear forwards; }
@keyframes callout {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0, 1); animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  19% { opacity: 1; transform: translate(-50%, -50%) scale(1, 1); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1, 1); }
}
.callout-main { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; font-size: var(--tx); letter-spacing: -0.05em; line-height: 1.12; color: var(--ink-c); text-shadow: none; -webkit-text-stroke: 0; }
.callout.name { --tx: calc(var(--w) * 0.09); }
.callout-img { position: relative; z-index: 1; display: block; height: var(--co-h); width: auto; max-width: 100%; object-fit: contain; user-select: none; filter: none; }
.callout-sub { position: relative; z-index: 2; max-width: 100%; text-align: center; white-space: normal; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere;
  font-size: max(12px, calc(var(--w) * 0.034)); line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; color: var(--ink-c); text-shadow: none; }
.callout-sub:empty { display: none; }
.callout::before { content: none; }
.callout-img[hidden], .callout-main[hidden] { display: none; }


.win { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 5; background: rgba(8, 7, 6, 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fade 600ms var(--ease); }
.win-shell { width: min(380px, 100%); animation: rise 700ms var(--ease) both; }
.win-core { text-align: center; padding: 40px 24px 24px; }
.win-pucks { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; }
.win-pucks .puck { width: 12px; height: 12px; }
.win-core h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; text-wrap: balance; }
.win-sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.win-sub:empty { display: none; }
/* 빠른 대전 reward breakdown */
.reward { margin: 20px 0 0; padding: 6px 14px; border-radius: var(--r-ctl); background: var(--raise); text-align: left; font-size: 14px; font-weight: 500; }
.reward-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; color: var(--muted); }
.reward-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.reward-sum { border-top: 1px solid var(--hair); margin-top: 4px; padding-top: 4px; }
.reward-sum + .reward-sum { border-top: 0; margin-top: 0; padding-top: 0; }
.reward-sum span { color: var(--text); font-weight: 600; }
.reward-sum b { font-size: 16px; }
.reward-sum b.neg { color: var(--muted); }
.reward-wait { min-height: 32px; display: flex; align-items: center; justify-content: center; color: var(--faint); }

/* ---------------- phones ---------------- */
@media (max-width: 767px) {
  .veil { background: linear-gradient(180deg, rgba(11, 10, 9, 0.82) 0%, rgba(11, 10, 9, 0.1) 13%, rgba(11, 10, 9, 0.2) 18%, rgba(11, 10, 9, 0.88) 34%, rgba(11, 10, 9, 0.97) 52%, rgba(11, 10, 9, 0.97) 100%); }
  .panel { width: 100%; padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); gap: 12px; }
  .panel > :last-child { margin-bottom: 0; }
  .home > :first-child { margin-top: 0; }
  .home-top { padding-right: 52px; }
  .home .logo { margin: auto 0 16px; display: flex; justify-content: center; }
  .home .logo-img { width: min(300px, 78vw); }
  .core { padding: 20px 16px; }
  .room-code { font-size: 52px; }
  .hud-top { padding: max(8px, env(safe-area-inset-top)) 108px 0 8px; }
  .players { width: 100%; justify-content: space-between; padding: 3px; }
  .pl { flex: 1; flex-direction: column; gap: 4px; padding: 6px 2px 8px; border-radius: 12px; }
  .pl-text { text-align: center; }
  .pl-name { font-size: 12px; max-width: 64px; }
  .pl-sub { justify-content: center; margin-top: 3px; }
  .pl-tag { display: none; }
  .pl.active::after { left: 30%; right: 30%; bottom: 3px; }
  .round-btn { top: max(8px, env(safe-area-inset-top)); right: 8px; }
  .mute-btn { right: 60px; }
  .dock { padding: 0 8px max(8px, env(safe-area-inset-bottom)); }
  .dock-shell { width: 100%; }
  .dock-core { flex: 1 1 auto; min-width: 0; }
  .dock-core { gap: 10px; padding: 6px 6px 6px 14px; border-radius: 18px; }
  .turn { flex: 1 1 auto; gap: 10px; }
  .bank { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
  .chip { min-width: 44px; padding: 0 10px; font-size: 15px; }
  .throw { min-height: 48px; padding: 0 18px; font-size: 15px; }
  /* skills take over the dock: same box, dock content hidden underneath (keeps the measured height for the board fit) */
  .skillpick { position: absolute; inset: 0; z-index: 1; gap: 6px; }
  .skillpick .skill { border-radius: 18px; }
  .dock.skilling .dock-core { visibility: hidden; }
  .skillpick .skill { flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 6px; }
  .sk-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
  .skillpick .skill.has-ic { flex-direction: column; gap: 2px; }
  .skill.has-ic .sk-icon { width: 22px; height: 22px; min-width: 22px; }
  .skill.has-ic .sk-name { font-size: 12px; line-height: 1.2; max-width: 100%; }
  .skill.has-ic .sk-txt { align-items: center; max-width: 100%; }
  .sk-desc { font-size: 10px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .skillpick.picking .skill.on .sk-desc { display: none; }
  .skillpick.picking .skill.on.has-ic { flex-direction: row; gap: 6px; }
  .skillpick.picking .skill:not(.on) { display: none; }
  .skillpick.picking .skill.on { flex: none; padding: 0 14px; }
  .skillpick.picking .sk-hint { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; padding: 0 14px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hair); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* short phones */
@media (max-width: 767px) and (max-height: 700px) {
  .home .logo { margin-bottom: 8px; }
  .home .logo-img { width: min(250px, 66vw); }
  .quick { min-height: 68px; }
  .mode { min-height: 48px; }
  .soon { margin-top: 8px; padding-top: 12px; gap: 14px; }
}
/* short landscape phones: one-line player bar, compact dock */
@media (max-height: 500px) and (orientation: landscape) {
  .veil { background: linear-gradient(90deg, rgba(11, 10, 9, 0.95) 0%, rgba(11, 10, 9, 0.86) 48%, rgba(11, 10, 9, 0.25) 75%, rgba(11, 10, 9, 0) 100%); }
  .panel { width: min(520px, 100%); padding: max(8px, env(safe-area-inset-top)) 24px 12px max(24px, env(safe-area-inset-left)); gap: 8px; }
  .home .logo { margin: 4px 0; }
  .home .logo-img { width: 200px; }
  .quick { min-height: 60px; border-radius: 16px; }
  .quick-title { font-size: 21px; }
  .quick-ic { width: 40px; height: 40px; }
  .mode { min-height: 44px; }
  .soon { margin-top: 4px; padding-top: 10px; }
  .credit { display: none; }
  .hud-top { padding: max(6px, env(safe-area-inset-top)) 108px 0 max(10px, env(safe-area-inset-left)); }
  .players { padding: 3px; border-radius: 14px; }
  .pl { flex-direction: row; gap: 6px; padding: 6px 10px; }
  .pl-sub { margin-top: 2px; }
  .pl-name { font-size: 12px; max-width: 70px; }
  .round-btn { top: max(6px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
  .mute-btn { right: calc(max(10px, env(safe-area-inset-right)) + 52px); }
  .dock { padding: 0 8px max(6px, env(safe-area-inset-bottom)); }
  .dock-core { gap: 10px; padding: 4px 4px 4px 12px; border-radius: 16px; }
  .turn-hint { display: none; }
  .chip { min-width: 40px; height: 40px; font-size: 14px; }
  .throw { min-height: 44px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
  .skillpick { gap: 6px; }
  .skillpick .skill { border-radius: 16px; }
  .skillpick.picking .sk-hint { border-radius: 16px; }
  .skill.has-ic .sk-icon { width: 22px; height: 22px; min-width: 22px; }
  .win { padding: 12px; overflow-y: auto; }
  .win-shell.has-reward { width: min(640px, 100%); }
  .has-reward .win-core { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr auto; column-gap: 20px; padding: 20px; text-align: left; }
  .has-reward .win-pucks { grid-column: 1; justify-content: flex-start; margin-bottom: 10px; }
  .has-reward .win-core h2 { grid-column: 1; font-size: 26px; }
  .has-reward .win-sub { grid-column: 1; }
  .has-reward .reward { grid-column: 2; grid-row: 1 / span 4; margin: 0; align-self: center; }
  .has-reward .win-actions { grid-column: 1; grid-row: 4; margin-top: 16px; }
  .rank-list { max-height: max(88px, calc(100dvh - 250px)); }
  .rank-core { gap: 8px; }
  .rank-core .rank-foot { display: none; }
  .stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
  .stats div { padding: 10px 12px; }
  .prof-name { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { .rise { animation-duration: 1ms; animation-delay: 0ms; } }

/* in-game confirm (replaces the browser confirm()): light card, near-black text, one accent */
.ask { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(8, 7, 6, 0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fade 300ms var(--ease); }
.ask.hidden { display: none; }
.ask-card { width: min(340px, 100%); padding: 28px 20px 20px; border-radius: 20px; background: #FAF7F2; color: #1F1B18; text-align: center; box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.55); animation: rise 400ms var(--ease) both; }
.ask-card h2 { margin: 0 0 24px; font-size: 17px; font-weight: 600; line-height: 1.45; letter-spacing: -0.01em; color: #1F1B18; text-wrap: balance; }
.ask-actions { display: flex; gap: 8px; }
.ask-actions button { flex: 1 1 0; min-height: 48px; border-radius: 14px; font-size: 15px; font-weight: 600; transition: background 200ms var(--ease), transform 200ms var(--ease); }
.ask-cancel { background: rgba(31, 27, 24, 0.07); color: #1F1B18; }
.ask-cancel:hover { background: rgba(31, 27, 24, 0.12); }
.ask-ok { background: var(--accent); color: #fff; }
.ask-ok:hover { background: var(--accent-hi); }
.ask-actions button:active { transform: scale(0.98); }

/* ============ 요괴도감 ============
   A sheet of warm paper laid over the board (the only light screen): ink text #1F1B18, cards as double-bezel paper
   plates with soft diffused shadows, each owned 요괴 tinted in its own colour; locked ones are a dark silhouette only.
   Vermilion stays reserved for the one primary action (구매 / 이 요괴로 플레이). */
.dex-screen { --dk: #1F1B18; --dk-2: rgba(31, 27, 24, 0.62); --dk-3: rgba(31, 27, 24, 0.44); --pp: #EFE8DC; --pc: #FBF8F3; --pw: #F5EFE6;
  background: radial-gradient(120% 80% at 85% 0%, #F6F1E8 0%, var(--pp) 55%, #E9E1D3 100%); color: var(--dk); }
.dex-wrap { max-width: 1200px; min-height: 100%; margin: 0 auto; padding: 64px 56px 56px; display: grid; grid-template-columns: minmax(240px, 290px) minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 56px; }
.dex-head { grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 40px; padding-top: 8px; }
.dex-head-l { display: flex; flex-direction: column; align-items: flex-start; }
.dex-back { min-height: 44px; padding: 0 18px; margin-bottom: 40px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--dk); background: rgba(31, 27, 24, 0.07); transition: background 300ms var(--ease), transform 300ms var(--ease); }
.dex-back:hover { background: rgba(31, 27, 24, 0.11); }
.dex-back:active { transform: scale(0.97); }
.dex-screen button:focus-visible { outline-color: var(--dk); }
.dex-eyebrow { padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.2em; color: var(--dk-2); background: rgba(31, 27, 24, 0.07); }
.dex-title { margin: 16px 0 14px; font-size: clamp(48px, 5.6vw, 76px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.95; color: var(--dk); }
.dex-lede { margin: 0; max-width: 17em; font-size: 15px; font-weight: 500; line-height: 1.55; color: var(--dk-2); word-break: keep-all; }
.dex-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 6px; border-radius: 24px; background: rgba(31, 27, 24, 0.04); box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.06); }
.dex-meta div { padding: 14px 16px; border-radius: 18px; background: var(--pc); box-shadow: inset 0 1px 0 #fff, 0 16px 32px -26px rgba(74, 52, 34, 0.45); }
.dex-meta dt { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--dk-3); }
.dex-meta dd { margin: 6px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dex-meta dd small { font-size: 15px; font-weight: 600; color: var(--dk-3); margin-left: 2px; }
.dex-grid { grid-column: 2; grid-row: 1 / span 2; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 18px; align-content: start; }
.dex-foot { grid-column: 2; margin: 28px 0 0; font-size: 12px; font-weight: 500; color: var(--dk-3); }

.dc { opacity: 0; transform: translateY(16px); animation: rise 800ms var(--ease) forwards; animation-delay: calc(var(--i, 0) * 55ms + 120ms); }
.dc-shell { display: block; width: 100%; padding: 6px; border-radius: 28px; text-align: center; background: rgba(31, 27, 24, 0.035); box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.06); transition: transform 500ms var(--ease), box-shadow 500ms var(--ease); }
.dc-shell:hover { transform: translateY(-4px); }
.dc-shell:active { transform: translateY(-1px) scale(0.98); }
.dc-core { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 12px 16px; border-radius: 22px; background: var(--pc); box-shadow: inset 0 1px 0 #fff, 0 22px 40px -28px rgba(74, 52, 34, 0.5); }
.dc-no { align-self: flex-start; padding-left: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--dk-3); font-variant-numeric: tabular-nums; }
.dc-well { display: grid; place-items: center; width: 100%; aspect-ratio: 1 / 0.86; margin-top: -2px; border-radius: 18px; background: color-mix(in srgb, var(--t, #C9B8A6) 22%, var(--pw)); overflow: hidden; }
.dc-well .ym { width: 74%; transition: transform 600ms var(--ease); }
.dc-shell:hover .dc-well .ym { transform: translateY(-3px) scale(1.03); }
.dc-name { margin-top: 4px; font-size: 16px; font-weight: 800; letter-spacing: -0.02em; color: var(--dk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dc-st { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--dk-2); background: rgba(31, 27, 24, 0.06); font-variant-numeric: tabular-nums; }
.dc-st.on { color: var(--pc); background: var(--dk); }
.dc-st.price { color: #9E3520; background: rgba(201, 79, 53, 0.12); }
.dc-st.ach { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 8px; width: 100%; padding: 8px 10px; border-radius: 14px; }
.dc-ach-t { grid-column: 1 / span 2; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-ach-n { font-size: 11px; color: var(--dk-3); }
.dc-bar { display: block; height: 6px; border-radius: 3px; background: rgba(31, 27, 24, 0.1); overflow: hidden; }
.dc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--dk); transform: scaleX(var(--p, 0)); transform-origin: left center; transition: transform 900ms var(--ease); }
.dc-bar.big { height: 8px; border-radius: 4px; }
.dc.locked .dc-well { background: #E4DCCF; }
.dc.locked .dc-name { color: var(--dk-3); letter-spacing: 0.1em; }
.dc.sel .dc-shell { box-shadow: inset 0 0 0 2px var(--dk); }

/* 2D portrait: face PNGs over a soft mochi body (locked: solid dark silhouette, no face, no colour) */
.ym { position: relative; display: inline-block; flex: none; width: 112px; aspect-ratio: 1; vertical-align: middle; }
.ym-body { position: absolute; left: 6%; right: 6%; top: 13%; bottom: 4%; border-radius: 50% 50% 46% 46% / 66% 66% 34% 34%;
  background: radial-gradient(110% 90% at 34% 20%, color-mix(in srgb, var(--t) 62%, #fff) 0%, var(--t) 42%, color-mix(in srgb, var(--t) 82%, #3A2416) 100%);
  box-shadow: 0 12px 20px -14px color-mix(in srgb, var(--t) 70%, #3A2416), inset 0 -6px 12px -6px color-mix(in srgb, var(--t) 70%, #3A2416); }
.ym-l { position: absolute; left: -6%; top: 3%; width: 112%; height: auto; pointer-events: none; user-select: none; }
.ym.locked .ym-body { background: #2E2723; box-shadow: none; }
.ym-xs { width: 24px; } .ym-s { width: 36px; } .ym-xl { width: min(240px, 62%); }
.ym-xs .ym-body, .ym-s .ym-body { box-shadow: none; }
.ym.reveal { animation: ymReveal 1000ms var(--ease) both; }
@keyframes ymReveal { 0% { opacity: 0; transform: scale(0.7) translateY(12px); } 60% { opacity: 1; transform: scale(1.06) translateY(-4px); } 100% { opacity: 1; transform: none; } }
.ym-auto { flex: none; width: 36px; height: 36px; border-radius: 50%; background: conic-gradient(from -45deg, #F43F5E 0 25%, #3B82F6 0 50%, #FBBF24 0 75%, #10B981 0); box-shadow: inset 0 0 0 3px rgba(20, 18, 16, 0.35); }

/* detail sheet */
.dexd { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(31, 27, 24, 0.42); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); animation: fade 400ms var(--ease); color: #1F1B18; }
.dexd-card { --dk: #1F1B18; --dk-2: rgba(31, 27, 24, 0.62); --dk-3: rgba(31, 27, 24, 0.44); position: relative; width: min(780px, 100%); max-height: 100%; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px; border-radius: 32px; background: #E9E1D4; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 40px 80px -40px rgba(20, 14, 10, 0.6); animation: rise 600ms var(--ease) both; }
.dexd-stage { display: grid; place-items: center; min-height: 380px; border-radius: 26px; background: radial-gradient(90% 80% at 50% 38%, color-mix(in srgb, var(--t, #C9B8A6) 34%, #FBF8F3) 0%, color-mix(in srgb, var(--t, #C9B8A6) 24%, #F2EBE0) 100%); }
.dexd-card.locked .dexd-stage { background: radial-gradient(90% 80% at 50% 38%, #EDE6DA 0%, #DED5C6 100%); }
.dexd-body { display: flex; flex-direction: column; align-items: flex-start; padding: 32px 28px 24px; border-radius: 26px; background: #FBF8F3; box-shadow: inset 0 1px 0 #fff; }
.dexd-tag { padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; color: var(--dk-2); background: rgba(31, 27, 24, 0.07); }
.dexd-name { margin: 14px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; color: var(--dk); }
.dexd-card.locked .dexd-name { letter-spacing: 0.08em; color: var(--dk-3); }
.dexd-desc { margin: 12px 0 0; font-size: 15px; font-weight: 500; line-height: 1.55; color: var(--dk-2); word-break: keep-all; }
.dexd-cond { width: 100%; margin-top: 20px; }
.dexd-cond:empty { margin: 0; }
.cond-rows { padding: 6px 16px; border-radius: 16px; background: rgba(31, 27, 24, 0.045); }
.cond-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; font-size: 14px; font-weight: 600; color: var(--dk-2); }
.cond-row + .cond-row { box-shadow: 0 -1px 0 rgba(31, 27, 24, 0.08); }
.cond-row b { font-size: 18px; font-weight: 800; color: var(--dk); font-variant-numeric: tabular-nums; }
.cond-ach { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 16px; background: rgba(31, 27, 24, 0.045); }
.cond-k { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--dk-3); }
.cond-ach b { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.cond-ach p { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--dk-2); }
.cond-prog { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.cond-n { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cond-note { margin: 10px 0 0; font-size: 13px; font-weight: 500; color: var(--dk-3); word-break: keep-all; }
.dexd-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: auto; padding-top: 24px; }
.dexd .ghost { min-height: 48px; color: var(--dk); background: rgba(31, 27, 24, 0.07); box-shadow: none; }
.dexd .ghost:hover:not(:disabled) { background: rgba(31, 27, 24, 0.11); }
.dexd .cta:disabled { background: rgba(31, 27, 24, 0.08); color: var(--dk-3); }

/* main menu entry: a small paper tab with my 요괴 faces */
.soon .dex-li { margin-left: auto; }
.dex-entry { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: -6px 0; padding: 4px 14px 4px 10px; border-radius: 999px; color: #1F1B18; background: #F1EADF; box-shadow: 0 14px 28px -18px rgba(0, 0, 0, 0.6); transition: transform 400ms var(--ease), background 300ms var(--ease); }
.dex-entry:hover { background: #F8F3EA; }
.dex-entry:active { transform: scale(0.97); }
.dex-faces { display: flex; align-items: flex-end; }
.dex-faces .ym + .ym { margin-left: -9px; }
.dex-faces .ym-xs { width: 26px; }
.dex-entry-t { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; }
.dex-entry-n { font-size: 12px; font-weight: 700; color: rgba(31, 27, 24, 0.5); font-variant-numeric: tabular-nums; }

/* 요괴 picker (practice / room / quick match) */
.ypick { display: flex; gap: 8px; margin: 0 -24px; padding: 2px 24px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.ypick::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .ypick { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; } .search-pick .ypick { margin: 0; } }
.yp { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 14px 6px 6px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); background: var(--raise); box-shadow: inset 0 0 0 1px var(--hair); scroll-snap-align: start; white-space: nowrap; transition: background 300ms var(--ease), color 300ms var(--ease), transform 300ms var(--ease); }
.yp:hover:not(.on) { color: var(--text); background: var(--raise-2); }
.yp:active { transform: scale(0.97); }
.yp.on { color: #1F1B18; background: #F1EADF; box-shadow: none; }
.yp-more { padding: 6px 16px; color: var(--faint); background: none; box-shadow: inset 0 0 0 1px var(--hair-2); }
.room-pick { margin: 16px 0 0; }
.search-pick { margin-top: 20px; text-align: left; }
.search-pick .ypick { margin: 0 -24px; }
.seat-name .ym { margin-right: 2px; }
.ask-sub { margin: -14px 0 22px; font-size: 14px; font-weight: 600; color: rgba(31, 27, 24, 0.6); font-variant-numeric: tabular-nums; }
.reward-new b { color: #F1EADF; }

@media (max-width: 900px) {
  .dex-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; padding: 48px 32px 40px; }
  .dex-head { grid-row: 1; position: static; flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
  .dex-meta { flex: none; width: 300px; }
  .dex-grid { grid-column: 1; grid-row: 2; }
  .dex-foot { grid-column: 1; grid-row: 3; }
}
@media (max-width: 767px) {
  .dex-wrap { padding: max(12px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom)); }
  .dex-head { flex-direction: column; align-items: stretch; gap: 20px; margin-bottom: 20px; }
  .dex-back { margin-bottom: 28px; }
  .dex-title { font-size: 46px; margin: 12px 0 10px; }
  .dex-lede { font-size: 14px; }
  .dex-meta { width: auto; border-radius: 22px; }
  .dex-meta div { padding: 12px 14px; border-radius: 16px; }
  .dex-meta dd { font-size: 22px; }
  .dex-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dc-shell { padding: 5px; border-radius: 24px; }
  .dc-core { padding: 10px 8px 12px; border-radius: 19px; gap: 6px; }
  .dc-name { font-size: 15px; }
  .dexd { place-items: end stretch; padding: 0; }
  .dexd-card { grid-template-columns: 1fr; width: 100%; max-height: 92dvh; border-radius: 30px 30px 0 0; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); animation: dexSheet 600ms var(--ease) both; }
  .dexd-stage { min-height: 200px; border-radius: 24px; }
  .dexd-stage .ym-xl { width: 170px; }
  .dexd-body { padding: 22px 20px 18px; border-radius: 24px; }
  .dexd-name { font-size: 28px; }
  .ypick { margin: 0 -16px; padding: 2px 16px; }
  .soon .dex-li { margin-left: auto; }
}
@keyframes dexSheet { from { transform: translateY(40px); opacity: 0; } }
@media (max-height: 500px) and (orientation: landscape) {
  .dex-wrap { padding: 16px 24px; }
  .dexd-stage { min-height: 0; }
}
.dc-st.dc-soon { color: var(--dk-3); background: rgba(31, 27, 24, 0.07); letter-spacing: 0.02em; }

/* 요괴 하사 popup (lobby, once per 요괴) */
.gift-stage { display: grid; place-items: center; }
.gift-stage .ym { width: 110px; }
.gift-core h2 { line-height: 1.55; margin: 14px 0 22px; }

/* 도감 cards: the user's scroll image (assets/ui/dex_card.webp, 350×480, used as-is) is the whole card. The box keeps the
   image's ratio, so 100% 100% never distorts it; the content sits inside the parchment (inside the dark border, a few px
   more on the left), text near-black. */
.dc-shell { aspect-ratio: 350 / 480; padding: 0; border-radius: 0; background: url(assets/ui/dex_card.webp) center / 100% 100% no-repeat; box-shadow: none; }
.dc-core { box-sizing: border-box; height: 100%; justify-content: flex-start; gap: 4px; padding: 13% 12% 12.5% 14%; border-radius: 0; background: none; box-shadow: none; }
.dc-no { padding-left: 2px; color: #1F1B18; opacity: 0.8; }
.dc-well { flex: 1 1 0%; min-height: 0; aspect-ratio: auto; margin-top: 0; border-radius: 12px; background: color-mix(in srgb, var(--t, #C9B8A6) 20%, transparent); }
.dc-well .ym { width: auto; height: 86%; max-width: 86%; aspect-ratio: 1 / 1; }
.dc.locked .dc-well { background: rgba(31, 27, 24, 0.06); }
.dc-name { margin-top: 2px; font-size: 15px; color: #1F1B18; }
.dc.locked .dc-name { color: #1F1B18; opacity: 0.7; }
.dc-st, .dc-st.dc-soon, .dc-ach-n { color: #1F1B18; }
.dc-st { min-height: 22px; font-size: 11px; background: rgba(31, 27, 24, 0.08); }
.dc-st.on { color: #F6EBD9; background: #1F1B18; }
.dc-st.ach { gap: 3px 6px; padding: 5px 8px; border-radius: 10px; }
.dc.sel .dc-shell { box-shadow: none; filter: drop-shadow(0 0 5px rgba(31, 27, 24, 0.55)); }
@media (max-width: 767px) {
  .dc-shell { padding: 0; border-radius: 0; }
  .dc-core { gap: 3px; padding: 13% 12% 12.5% 14%; }
  .dc-name { font-size: 14px; }
}

/* main screen greeting, two big lines in the main font: '{nickname},' / '안녕하시오!' (no nickname: the 아무개 placeholder) */
.greet { position: relative; display: flex; flex-direction: column; min-width: 0; max-width: 100%; margin: 18px 0 0; cursor: text; font-family: var(--font-main); font-size: clamp(28px, 8vw, 40px); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; color: var(--text); }
.greet-l1 { display: flex; align-items: baseline; min-width: 0; max-width: 100%; }
.greet .nick-input { flex: 0 1 auto; width: 3em; min-width: 1em; max-width: calc(100% - 0.5em); padding: 0; border: 0; border-radius: 0; background: none; font: inherit; letter-spacing: inherit; color: inherit; outline: none; text-overflow: ellipsis; }
.greet .nick-input::placeholder { color: inherit; opacity: 1; }
.greet .nick-input:focus { box-shadow: 0 2px 0 var(--hair-2); }
.greet-comma { flex: none; }
.nick-measure { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; pointer-events: none; font: inherit; letter-spacing: inherit; }

/* 상평통보 coin before every '##냥' amount: about the text height, vertically centred, small gap */
.ny { display: inline-flex; align-items: baseline; white-space: nowrap; }   /* baseline = the number's, so inside a sentence it doesn't float above the words around it (the icon is centred on its own) */
.ny-ic { display: inline-block; flex: none; align-self: center; width: 1.12em; height: 1.12em; margin-right: 0.22em; background: url(assets/ui/nyang.webp) center / contain no-repeat; }

/* setup seats: same row height and card height in every mode (개인전 / 2:2 대전 / 한 말 대전) */
.seat-ghost, .seg-ghost { visibility: hidden; pointer-events: none; }
.seat-ghost + .seat-ghost, .seat:not(.seat-ghost) + .seat-ghost { border-top-color: transparent; }
.seg.seg-team.seg-ghost.locked button:not(.on) { display: inline-flex; }
/* bigger-bodied 요괴 (bodyScale, e.g. 거구귀 1.15): only the body grows, the face layers keep their size */
.ym-body { transform: scale(calc(var(--bs, 1) * var(--bsx, 1)), var(--bs, 1)); transform-origin: 50% 72%; }   /* --bsx: narrower body (독각귀) */
.ym.locked .ym-body { transform: none; }
/* glowing 요괴 (glow field, e.g. 야광귀): a soft halo in the body colour, not neon */
.ym-glow .ym-body { box-shadow: 0 0 calc(var(--glow, 0.15) * 120px) calc(var(--glow, 0.15) * 30px) color-mix(in srgb, var(--t) 70%, transparent), inset 0 -6px 12px -6px color-mix(in srgb, var(--t) 70%, #3A2416); }
.ym-xs.ym-glow .ym-body, .ym-s.ym-glow .ym-body { box-shadow: 0 0 6px 1px color-mix(in srgb, var(--t) 60%, transparent); }
/* ✎ nickname button beside the greeting + its popover */
.name-edit { flex: none; position: relative; align-self: flex-start; width: 0.5em; height: 0.5em; margin: 0.06em 0 0 0.12em; padding: 0; border: 0; background: none; cursor: pointer; transition: transform 300ms var(--ease); }
.name-edit img { display: block; width: 100%; height: 100%; pointer-events: none; }
.name-edit::before { content: ''; position: absolute; inset: -14px; }   /* invisible tap area (~44px) */
.name-edit:active { transform: scale(0.9); }
.name-core h2 { margin: 0 0 16px; font-size: 20px; }
.name-pop-input { width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: var(--r-ctl); background: var(--raise); box-shadow: inset 0 0 0 1px var(--hair); color: var(--text); font-family: var(--font-main); font-size: 18px; text-align: center; outline: none; }
.name-pop-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.name-pop-note { margin: 8px 0 18px; font-size: 12px; color: var(--faint); }
.greet .nick-input { max-width: calc(100% - 1.2em); }
/* 만난 요괴 (met in a game, not owned): full info, portrait in black and white */
.ym-gray { filter: grayscale(1); }
.dc.met .dc-name, .dexd-card.met .dexd-name { letter-spacing: normal; opacity: 0.85; }
/* top bar: the circle = that seat's piece body colour (its 요괴); 2:2 · 한 말 대전 add a thin ring in the side colour */
.pl .puck.pl-body { width: 12px; height: 12px; background: var(--b, var(--c)); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.32), inset 0 -2px 3px rgba(0, 0, 0, 0.18); }
.pl .puck.pl-body.sided { box-shadow: 0 0 0 2px var(--c), 0 0 0 3px rgba(255, 255, 255, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.18); }
/* whose turn: a soft glow in their body colour breathes on their entry (~1.2s loop); others stay still */
.pl.active { animation: plPulse 1.2s ease-in-out infinite; }
.pl.active .puck.pl-body { animation: plDot 1.2s ease-in-out infinite; }
@keyframes plPulse {
  0%, 100% { background: color-mix(in srgb, var(--b, var(--c)) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--b, var(--c)) 25%, transparent), 0 0 0 0 transparent; }
  50% { background: color-mix(in srgb, var(--b, var(--c)) 24%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--b, var(--c)) 60%, transparent), 0 0 14px 1px color-mix(in srgb, var(--b, var(--c)) 45%, transparent); }
}
@keyframes plDot { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25) drop-shadow(0 0 4px var(--b, var(--c))); } }
@media (prefers-reduced-motion: reduce) { .pl.active, .pl.active .puck.pl-body { animation: none; } .pl.active { background: color-mix(in srgb, var(--b, var(--c)) 18%, transparent); } }
/* sound: 효과음 (bell) + 배경음악 (note), two buttons */
.round-btn svg { fill: currentColor; }
.music-btn { right: calc(max(16px, env(safe-area-inset-right)) + 104px); }
.music-lobby { right: calc(max(16px, env(safe-area-inset-right)) + 52px); }
@media (max-width: 767px) {
  .music-btn { right: 60px; top: calc(max(8px, env(safe-area-inset-top)) + 52px); }   /* phone: under the 효과음 button, the top bar keeps its width */
  .music-lobby { right: 60px; }
  .home-top { padding-right: 104px; }   /* room for both sound buttons */
}
@media (max-height: 500px) and (orientation: landscape) {
  .hud-top { padding-right: 160px; }
  .music-btn { right: calc(max(10px, env(safe-area-inset-right)) + 104px); top: max(6px, env(safe-area-inset-top)); }
  .music-lobby { right: calc(max(10px, env(safe-area-inset-right)) + 52px); }
}
.round-btn[data-snd] svg { width: 22px; height: 22px; }
/* 금속 재질 2D (금돼지 / 관리자 금속): metal body in the 요괴's OWN colour (--t): bright specular top-left, darker shade below. (It used to be fixed gold, so a blue metal 요괴 showed gold in small icons.) */
.ym-gold .ym-body { background: radial-gradient(60% 50% at 34% 26%, color-mix(in srgb, var(--t) 14%, #FFFFFF) 0%, color-mix(in srgb, var(--t) 55%, #FFFFFF) 22%, transparent 48%), linear-gradient(160deg, color-mix(in srgb, var(--t) 80%, #FFFFFF) 0%, var(--t) 45%, color-mix(in srgb, var(--t) 68%, #000000) 85%, color-mix(in srgb, var(--t) 48%, #000000) 100%); box-shadow: inset 0 -8px 14px -6px color-mix(in srgb, color-mix(in srgb, var(--t) 38%, #000000) 60%, transparent), inset 0 3px 6px rgba(255, 255, 255, 0.5), 0 6px 14px -6px color-mix(in srgb, color-mix(in srgb, var(--t) 50%, #000000) 60%, transparent); }
/* 금돼지 2D: a star glint twinkles on the shoulder */
.ym-gold::after { content: ''; position: absolute; left: 22%; top: 24%; width: 22%; aspect-ratio: 1; background: radial-gradient(circle, #FFFFFF 0 12%, color-mix(in srgb, var(--t) 30%, #FFFFFF) 22%, transparent 55%); clip-path: polygon(50% 0, 57% 43%, 100% 50%, 57% 57%, 50% 100%, 43% 57%, 0 50%, 43% 43%); opacity: 0; transform: scale(0.2); animation: ymGlint 2.6s ease-in-out infinite; pointer-events: none; }
.ym-gold.ym-xs::after, .ym-gold.ym-s::after { animation-duration: 3.4s; }
@keyframes ymGlint { 0%, 62%, 100% { opacity: 0; transform: scale(0.2) rotate(0deg); } 74% { opacity: 1; transform: scale(1) rotate(25deg); } 86% { opacity: 0; transform: scale(0.3) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) { .ym-gold::after { animation: none; } }
/* result: 냥 and 순위 점수 as two labelled blocks; multiplier steps show their running result */
.reward-h { margin: 8px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--faint, var(--muted)); }
.reward-h:first-child { margin-top: 4px; }
.reward-sum + .reward-h { margin-top: 12px; }
.reward .reward-row { min-height: 28px; }
.reward-step { font-size: 13px; }
.reward-step b { color: var(--muted); font-weight: 600; }
.ym-hat { top: -20.41%; }   /* 독각귀 삿갓 v6 pre-render: eye-layer frame shifted up 209/1024 (render_hat.mjs cy 830 roll 0 yaw -1.98) */

/* 감정표현: tap MY tab in the top bar → a 5-slot picker drops from the tab; the pick pops out as a speech bubble hanging from that tab for 3 s.
   Both are anchored at the tab's bottom-centre (translate set from JS) and grow downward from it, with a beak pointing back up at the tab. */
.emotes { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
.emote-bubble { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.emote-bubble .eb { position: absolute; left: 0; top: 12px; translate: -50% 0; padding: 7px; border-radius: 22px; background: #F6EEDF; transform-origin: 50% 0;
  box-shadow: inset 0 0 0 1.5px rgba(31, 27, 24, 0.85), 0 18px 34px -14px rgba(0, 0, 0, 0.8);   /* the same single bubble as the picker */
  animation: emote-pop 220ms var(--ease) both; user-select: none; }
.emote-bubble .eb::before { content: ''; position: absolute; top: -8px; left: 50%; width: 16px; height: 16px; translate: -50% 0; rotate: 45deg; background: #F6EEDF; border-radius: 4px 0 0 0; box-shadow: inset 1.5px 1.5px 0 rgba(31, 27, 24, 0.85); }
.emote-bubble .eb img { display: block; width: 56px; height: 56px; padding: 3px; box-sizing: border-box; object-fit: contain; pointer-events: none; }
.emote-bubble.out .eb { animation: emote-out 260ms var(--ease) forwards; }
@keyframes emote-pop { from { opacity: 0; translate: -50% -10px; } to { opacity: 1; translate: -50% 0; } }
@keyframes emote-out { to { opacity: 0; translate: -50% 6px; } }
.emote-pick { position: fixed; left: 0; top: 0; z-index: 46; display: flex; gap: 2px; padding: 7px; border-radius: 22px;
  translate: -50% 12px; background: #F6EEDF; box-shadow: inset 0 0 0 1.5px rgba(31, 27, 24, 0.85), 0 18px 34px -14px rgba(0, 0, 0, 0.8); }
.emote-pick::before { content: ''; position: absolute; top: -8px; left: calc(50% + var(--tail, 0px)); width: 16px; height: 16px; translate: -50% 0; rotate: 45deg; background: #F6EEDF; border-radius: 4px 0 0 0;
  box-shadow: inset 1.5px 1.5px 0 rgba(31, 27, 24, 0.85); }
.emote-pick.in { animation: emote-box-in 220ms var(--ease) both; }
@keyframes emote-box-in { from { opacity: 0; translate: -50% 0; } to { opacity: 1; translate: -50% 12px; } }   /* just drops down a little: no scaling, nothing sliding in from the side */
.emote-pick.hidden { display: none; }
.emote-btn { position: relative; width: 50px; height: 50px; padding: 5px; border: 0; border-radius: 16px; background: transparent; cursor: pointer;
  transition: background 160ms var(--ease), scale 160ms cubic-bezier(0.34, 1.7, 0.5, 1); -webkit-tap-highlight-color: transparent; }
.emote-pick.in .emote-btn { animation: emote-btn-in 200ms var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms + 60ms); }
@keyframes emote-btn-in { from { opacity: 0; } to { opacity: 1; } }
.emote-btn img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.emote-btn:hover:not(:disabled), .emote-btn:focus-visible { background: rgba(31, 27, 24, 0.08); scale: 1.14; }
.emote-btn:active:not(:disabled) { scale: 0.9; }
.emote-btn:disabled { cursor: default; opacity: 0.4; filter: grayscale(0.6); }
/* cooldown: a draining bar under the slots + seconds left */
.emote-pick.cooling::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, #C9803A calc(var(--cd, 0) * 100%), rgba(31, 27, 24, 0.12) 0); }
.emote-cd { position: absolute; left: 50%; top: 50%; translate: -50% -50%; font: 600 13px/1 var(--font-main); color: #F6EEDF;
  padding: 5px 9px; border-radius: 10px; background: rgba(31, 27, 24, 0.85); pointer-events: none; }
.emote-cd:empty { display: none; }
/* my tab: tappable (no badge) */
.pl-emote { cursor: pointer; }
#winTitle.lost { color: var(--muted); }   /* 내가 진 판: the headline says 패배 in a quieter tone */

.credit .legal { margin-left: 8px; white-space: normal; } .credit .legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ===================== 2026-10-10 overhaul: paper surfaces (warm bone #F7F3EA, ink #1F1B18), crisp 12px radii, 1px hairlines ===================== */
.paper { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.42); --hair: rgba(31, 27, 24, 0.10); --hair-2: rgba(31, 27, 24, 0.18); --raise: rgba(31, 27, 24, 0.05); --raise-2: rgba(31, 27, 24, 0.09); --surface: #EFE8DC; color: var(--text); }
/* ---- main screen ---- */
.home-screen { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; overscroll-behavior-x: none; padding: max(12px, env(safe-area-inset-top)) 16px 0; }
.hb { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hb-me, .hb-wallet, .hb-gear { --text: #1F1B18; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 8px; border-radius: 12px; background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.10); }
.hb-me { max-width: 52%; }
.hb-name { font-family: var(--font-main); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-face .ym-xs { width: 28px; }
.hb-r { display: flex; align-items: center; gap: 8px; }
.hb-wallet { padding: 0 14px; }
.hb-wallet .wallet-val { font-size: 15px; color: #1F1B18; }
.hb-gear { width: 44px; padding: 0; justify-content: center; }
.hb-gear svg { width: 22px; height: 22px; }
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 4px 0; pointer-events: none; }
.hero .logo-img { width: min(210px, 52vw); }
.hero .greet { margin: 4px 0 0; cursor: default; font-size: clamp(34px, 10vw, 52px); line-height: 1.08; color: #FBF7F0; text-shadow: 0 2px 18px rgba(20, 16, 12, 0.55); }
.greet-l1, .greet-l2 { display: block; }
#greetName { display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.home-bottom { --text: #1F1B18; margin: auto -16px 0; padding: 16px 16px max(12px, env(safe-area-inset-bottom)); background: #EFE8DC; border-radius: 16px 16px 0 0; box-shadow: 0 -1px 0 rgba(31, 27, 24, 0.10); color: #1F1B18; }
.play { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pb { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-height: 80px; padding: 0 18px; border-radius: 12px; text-align: left; background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.12); transition: transform 200ms var(--ease), filter 200ms var(--ease); }
.pb:active:not(:disabled) { transform: scale(0.98); }
.pb-main { background: var(--accent) url(assets/ui/btn_pattern.webp) center / cover no-repeat; color: #fff; box-shadow: none; }
.pb-main:hover:not(:disabled) { filter: brightness(1.06); }
.pb:disabled { opacity: 0.45; cursor: default; }
.pb-k { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; opacity: 0.75; }
.pb-t { font-family: var(--font-main); font-size: 22px; line-height: 1.05; letter-spacing: -0.01em; }
.menu { display: grid; grid-template-columns: repeat(4, 1fr); margin: 12px 0 0; border-top: 1px solid rgba(31, 27, 24, 0.10); padding-top: 8px; }
.mi { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 64px; padding: 4px 0; border-radius: 12px; color: #1F1B18; font-size: 13px; font-weight: 600; }
.mi:hover { background: rgba(31, 27, 24, 0.05); }
.mi svg.mi-ic { width: 24px; height: 24px; color: #1F1B18; }
.mi .dex-faces { height: 24px; align-items: center; }
.mi .dex-faces .ym-xs { width: 22px; }
.mi-t { line-height: 1; }
.mi-n { font-size: 11px; color: rgba(31, 27, 24, 0.55); font-variant-numeric: tabular-nums; margin-top: -2px; }
.mi:has(.mi-n:not(:empty)) .mi-t::after { content: none; }
.home-bottom .credit { margin: 8px 0 0; text-align: center; color: rgba(31, 27, 24, 0.5); }
.home-bottom .credit a { color: rgba(31, 27, 24, 0.62); }
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .home-screen { width: 460px; padding: 28px 0 28px 48px; }
  .home-bottom { margin: auto 0 0; border-radius: 16px; padding: 20px; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.10); }
  .hero .logo-img { width: 260px; }
}
@media (max-height: 640px) { .hero .logo-img { width: 150px; } .pb { min-height: 66px; } .mi { min-height: 54px; } }
/* ---- settings ---- */
.set-card { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); width: min(400px, 100%); padding: 8px 20px 20px; border-radius: 16px; background: #EFE8DC; color: #1F1B18; animation: rise 400ms var(--ease) both; }
.set-head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.set-head h2 { color: #1F1B18; font-family: var(--font-main); font-size: 20px; }
.set-x { width: 44px; height: 44px; margin-right: -10px; display: grid; place-items: center; color: #1F1B18; border-radius: 12px; }
.set-x svg { width: 20px; height: 20px; }
.set-sec { padding: 14px 0; border-top: 1px solid rgba(31, 27, 24, 0.10); display: flex; flex-direction: column; gap: 10px; }
.set-l { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: rgba(31, 27, 24, 0.6); }
.set-row { display: flex; gap: 8px; }
.set-in { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 0; border-radius: 10px; background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.14); font-family: var(--font-main); font-size: 18px; outline: none; }
.set-in:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.set-btn { min-height: 48px; padding: 0 18px; border-radius: 10px; background: #1F1B18; color: #F7F3EA; font-weight: 600; }
.set-note { margin: 0; font-size: 12px; color: rgba(31, 27, 24, 0.55); }
.set-vol { display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 600; }
.set-vol b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: rgba(31, 27, 24, 0.7); }
.set-vol input { width: 100%; accent-color: var(--accent); height: 28px; }
.muted-all .set-vol { opacity: 0.45; }
.set-mute { min-height: 48px; border-radius: 10px; background: #EFE8DC; color: #1F1B18; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.14); }
.set-mute[aria-pressed="true"] { background: #1F1B18; color: #F7F3EA; box-shadow: none; }
/* ---- room ---- */
.room-screen { display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.rm { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.42); --raise: rgba(31, 27, 24, 0.05); --raise-2: rgba(31, 27, 24, 0.09); --hair: rgba(31, 27, 24, 0.10); width: min(440px, 100%); padding: 16px; border-radius: 16px; background: #EFE8DC; color: #1F1B18; display: flex; flex-direction: column; gap: 14px; }
.rm-top { display: flex; align-items: center; gap: 12px; }
.rm-top .back-btn { background: #EFE8DC; backdrop-filter: none; }
.rm-code { display: flex; flex-direction: column; flex: 1; }
.rm-k { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: rgba(31, 27, 24, 0.55); }
.rm-code b { font-family: var(--font-main); font-size: 28px; letter-spacing: 0.12em; line-height: 1.1; }
.rm-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; background: #EFE8DC; color: #1F1B18; font-weight: 600; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.12); }
.rm-link svg { width: 18px; height: 18px; }
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 12px; background: rgba(31, 27, 24, 0.07); }
.tabs button { min-height: 44px; border-radius: 9px; font-size: 15px; font-weight: 600; color: rgba(31, 27, 24, 0.6); }
.tabs button.on { background: #EFE8DC; color: #1F1B18; box-shadow: 0 1px 2px rgba(31, 27, 24, 0.08); }
.tabs.locked button:not(.on) { opacity: 0.5; }
.tabs button:disabled { cursor: default; }
.tabs-sm { width: 160px; }
.rm-side { display: flex; align-items: center; justify-content: space-between; }
.rm-sub { margin: -4px 0 0; font-size: 13px; color: rgba(31, 27, 24, 0.62); }
.rm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rm-p { display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid rgba(31, 27, 24, 0.08); }
.rm-p .ym-xs { width: 30px; }
.rm-n { flex: 1; min-width: 0; font-family: var(--font-main); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-empty .rm-n { font-family: var(--font); font-size: 14px; color: rgba(31, 27, 24, 0.45); }
.rm-dot { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(31, 27, 24, 0.18); }
.rm .mini { background: rgba(31, 27, 24, 0.07); color: rgba(31, 27, 24, 0.7); }
.rm .mini.heuk { background: #1F1B18; color: #EDE6DC; }
.rm .mini.baek { background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.18); }
.rm-foot .status { text-align: center; color: rgba(31, 27, 24, 0.6); }
/* ---- in-game HUD: paper bars, timer ring by the throw button ---- */
#game .hud-top, #game .dock { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.40); --hair: rgba(31, 27, 24, 0.10); --raise: rgba(31, 27, 24, 0.06); --raise-2: rgba(31, 27, 24, 0.10); --surface: #EFE8DC; }
#game .players, #game .dock-core { backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 14px; }
#game .round-btn { color: #1F1B18; background: #EFE8DC; backdrop-filter: none; }
#game .round-btn:hover { background: #EFE8DC; }
#game .throw:disabled { background: rgba(31, 27, 24, 0.08); color: rgba(31, 27, 24, 0.4); }
#game #gameSettings { right: calc(max(16px, env(safe-area-inset-right)) + 52px); }
.timer { position: relative; flex: none; width: 52px; height: 52px; display: grid; place-items: center; color: #1F1B18; }
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.tm-bg { stroke: rgba(31, 27, 24, 0.10); fill: #EFE8DC !important; }
.tm-fg { stroke: rgba(31, 27, 24, 0.55); stroke-linecap: round; stroke-dasharray: 100; transition: stroke 200ms; }
.timer b { position: relative; font-family: var(--font-main); font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.mine .tm-fg { stroke: var(--accent); }
.timer.low b { color: var(--accent); animation: tmPulse 1s ease-in-out infinite; }
@keyframes tmPulse { 50% { transform: scale(1.18); } }
.set-card, .rm, .set-card *, .rm * { box-sizing: border-box; }
.set-card { max-width: calc(100vw - 32px); }

/* 장신구 flat layer (admin renders it on save): same frame as the box, 1.5× tall, bottom-aligned, drawn over the face */
.ym-acc { position: absolute; left: 0; bottom: 0; width: 100%; height: 150%; pointer-events: none; user-select: none; -webkit-user-select: none; }
.ym.ym-hasacc { transform: translateY(6%) scale(0.8); transform-origin: 50% 100%; }
.ym.ym-card > :not(.ym-acc) { visibility: hidden; }
.ym.ym-card > .ym-acc { left: -15%; width: 130%; height: 195%; }
@media (prefers-reduced-motion: reduce) { .modal, .search, .modal-shell, .search-shell, .set-card { animation: none; } }
.set-card { width: min(400px, calc(100vw - 48px)); max-width: none; justify-self: center; }
.set-sec[hidden] { display: none; }
#game .throw.mine:disabled { background: var(--accent); color: #fff; opacity: 0.9; }
#game .throw { transition: transform 200ms var(--ease); }   /* colour flips instantly when it becomes my turn */

/* loading screen v2: full-screen cover image slot (#bootCover, set src + remove hidden), logo, progress bar at the bottom */
html.booting .boot { background: #1F1B18; justify-content: center; }
.boot-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; pointer-events: none; user-select: none; }
.boot-cover:not([hidden]) ~ .boot-logo { display: none; }
.boot-logo { position: relative; }
.boot-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 24px calc(28px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(31, 27, 24, 0.72), rgba(31, 27, 24, 0)); }
.boot-foot .boot-bar { width: min(320px, 72vw); height: 6px; border-radius: 3px; background: rgba(247, 243, 234, 0.18); }
.boot-foot .boot-fill { background: #C94F35; }
.boot-foot .boot-text { color: rgba(247, 243, 234, 0.82); font-family: 'Chosun Centennial', -apple-system, 'Apple SD Gothic Neo', sans-serif; font-size: 13px; }
/* user icons (SVG as-is) in the existing icon slots */
.hb-gear .ic-img { width: 22px; height: 22px; }
.round-btn .ic-img { width: 18px; height: 18px; }
.mi img.mi-ic { width: 24px; height: 24px; }
/* key art: full-screen cover behind the main screen and menus (the 3D board shows in games) */
.home-key { position: fixed; inset: 0; z-index: 0; background: #1F1B18 url(assets/key_v1.webp) center / cover no-repeat; display: none; }
body.in-lobby .home-key { display: block; }
body.in-lobby #stage { visibility: hidden; }   /* menus sit on the key art; the board shows only in games */
#openDex .mi-n { display: none; }   /* main screen: no count under 요괴도감 */
body.in-lobby:has(#lobby:not(.hidden)) .veil { background: linear-gradient(to bottom, rgba(31, 27, 24, 0.5), rgba(31, 27, 24, 0) 42%); }   /* main screen: key art as-is, a light top shade only for the title */

/* loading screen: the wordmark at the top centre over the key art */
.boot-cover:not([hidden]) ~ .boot-logo { display: block; position: absolute; top: calc(max(28px, env(safe-area-inset-top)) + 4vh); left: 50%; transform: translateX(-50%); width: min(300px, 72vw); filter: drop-shadow(0 6px 20px rgba(31, 27, 24, 0.55)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* main screen: my 요괴 idling over the key art. Cheap: transforms only on one small layer, paused while hidden / booting */
.hy { position: relative; flex: 1 1 auto; align-self: center; display: flex; align-items: flex-end; justify-content: center; width: min(240px, 58vw); min-height: 150px; margin: 0 auto 10px; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hy-sh { position: absolute; left: 22%; right: 22%; bottom: 2px; height: 16px; border-radius: 50%; background: radial-gradient(closest-side, rgba(31, 27, 24, 0.45), rgba(31, 27, 24, 0)); animation: hy-sh 7.2s ease-in-out infinite; }
.hy-mv { position: relative; display: block; width: min(190px, 46vw); animation: hy-mv 7.2s ease-in-out infinite; transform-origin: 50% 100%; will-change: transform; }
.hy-sq { display: block; animation: hy-sq 1.2s ease-in-out infinite; transform-origin: 50% 100%; }
.hy-sq .ym { width: 100%; }
.hy-sq .ym.ym-hasacc { transform: none; }
.hy.tap .hy-mv { animation: hy-tap 0.85s cubic-bezier(0.3, 0.7, 0.3, 1) both; }
.hy.tap .hy-sh { animation: hy-tapsh 0.85s ease-out both; }
/* breathing squash & stretch */
@keyframes hy-sq { 0%, 100% { transform: scale(1, 1); } 45% { transform: scale(1.05, 0.95); } 70% { transform: scale(0.98, 1.03); } }
/* the loop: bounce · look left · look right · hop · spin · blink-squint · settle */
@keyframes hy-mv {
  0% { transform: none; }
  6% { transform: translateY(-10px) scale(0.97, 1.04); } 11% { transform: translateY(0) scale(1.06, 0.93); } 15% { transform: none; }
  22%, 30% { transform: translateX(-10px) rotate(-7deg); }
  36%, 44% { transform: translateX(10px) rotate(7deg); }
  50% { transform: none; }
  54% { transform: scale(1.1, 0.88); } 60% { transform: translateY(-46px) scale(0.94, 1.08); } 66% { transform: translateY(0) scale(1.12, 0.86); } 70% { transform: none; }
  76% { transform: translateY(-20px) rotate(180deg) scale(0.96, 1.04); } 81% { transform: translateY(0) rotate(360deg); } 84% { transform: rotate(360deg) scale(1.08, 0.92); } 87% { transform: rotate(360deg); }
  92% { transform: rotate(360deg) scale(1.02, 0.9); } 93.5% { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}
@keyframes hy-sh { 0%, 15%, 50%, 70%, 87%, 100% { transform: scale(1); opacity: 1; } 6%, 76% { transform: scale(0.85); } 60% { transform: scale(0.6); opacity: 0.55; } 22%, 30% { transform: translateX(-10px); } 36%, 44% { transform: translateX(10px); } }
@keyframes hy-tap { 0% { transform: scale(1.12, 0.86); } 35% { transform: translateY(-60px) rotate(200deg) scale(0.95, 1.06); } 70% { transform: translateY(0) rotate(360deg) scale(1.14, 0.84); } 100% { transform: rotate(360deg); } }
@keyframes hy-tapsh { 35% { transform: scale(0.5); opacity: 0.5; } 100% { transform: scale(1); opacity: 1; } }
html.booting .hy *, body:not(.in-lobby) .hy *, #lobby.hidden .hy * { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .hy-mv, .hy-sq, .hy-sh { animation: none; } }
@media (min-width: 900px) { .hy { width: 260px; } .hy-mv { width: 200px; } }
#lobby .greet { display: none; }   /* main screen: no greeting (my 요괴 is the hero) */
/* Main screen keeps the animated 3D hero over the selected lobby background. */
body.in-lobby #stage { visibility: visible; }
body.in-lobby .home-key { display: none; }
body.in-lobby:has(#lobby:not(.hidden)) .veil { background: none; }
.hy-mv, .hy-sh { visibility: hidden; }
.hy { min-height: 0; }
/* loading screen v3: user's darkened key art as-is, no overlays/shades, all text white with no shadow */
.boot-foot { background: none; }
.boot-cover:not([hidden]) ~ .boot-logo { filter: brightness(0) invert(1); opacity: 1; }
.boot-foot .boot-text { color: #fff; text-shadow: none; }
.boot-cover:not([hidden]) ~ .boot-logo { filter: none; width: min(78vw, 520px); top: calc(max(12px, env(safe-area-inset-top)) + 1vh); }

/* Keep the web lobby in a centered 9:16 mobile frame (up to 990px wide); game view remains full-screen. */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  body.in-lobby #stage,
  body.in-lobby .labels,
  body.in-lobby .veil,
  body.in-lobby .grain,
  body.in-lobby #lobby {
    left: 50%; right: auto; width: min(990px, 56.25dvh); height: 100dvh;
    transform: translateX(-50%);
  }
  body.in-lobby #lobby { padding: max(12px, env(safe-area-inset-top)) 16px 0; }
  body.in-lobby .home-bottom {
    margin: auto -16px 0; padding: 16px 16px max(12px, env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }
  body.in-lobby .hero .logo-img { width: min(210px, 52vw); }
}
/* loading screen: wordmark sits lower on the key art */
.boot-cover:not([hidden]) ~ .boot-logo { top: calc(max(12px, env(safe-area-inset-top)) + 12vh); }
/* loading screen: progress bar just below the vertical centre */
.boot-cover:not([hidden]) ~ .boot-foot { top: 68vh; bottom: auto; padding: 0 24px; }
/* main screen: two nav items (설정 lives in the gear, 호패 behind the name chip); every text/icon block sits with equal space above and below */
.menu { grid-template-columns: repeat(2, 1fr); }
.hb-wallet { cursor: pointer; }
.hb-wallet:active { transform: scale(0.97); }
.home-bottom { padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
.pb { min-height: 0; padding: 18px; gap: 6px; justify-content: flex-start; }
.pb-k, .pb-t { line-height: 1; }
.menu { margin-top: 16px; padding-top: 12px; }
.mi { min-height: 0; padding: 8px 0; gap: 8px; }
.mi-t, .mi-n { line-height: 1; }
.mi-n { margin-top: 0; }
.home-bottom .credit { margin: 12px 0 0; line-height: 1; }
/* game dock: one fixed height in every state (timer shown/hidden, 윷 bank empty/full, hint on/off): the tallest content is the 52px timer + a few px of slack */
.dock-core { box-sizing: border-box; height: 72px; }
@media (max-width: 767px) { .dock-core { height: 68px; } }
@media (max-height: 500px) and (orientation: landscape) { .dock-core { height: 64px; } }
/* game dock follows the team on turn (2:2 / 한 말 대전): 백편 = white bar + dark text, 흑편 = near-black bar + white text */
#game .dock[data-team="1"] { --surface: #EFE8DC; --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.40); --hair: rgba(31, 27, 24, 0.14); --raise: rgba(31, 27, 24, 0.06); --raise-2: rgba(31, 27, 24, 0.10); color: #1F1B18; }
#game .dock[data-team="0"] { --surface: #1F1B18; --text: #FFFFFF; --muted: rgba(255, 255, 255, 0.70); --faint: rgba(255, 255, 255, 0.45); --hair: rgba(255, 255, 255, 0.16); --raise: rgba(255, 255, 255, 0.10); --raise-2: rgba(255, 255, 255, 0.16); color: #FFFFFF; }
/* the picked 윷 result: always readable. Light bar (백편 / 개인전): mid grey with black text; dark 흑편 bar: dark grey with white text */
#game .dock .chip.sel { background: #AFA692; color: #1F1B18; box-shadow: inset 0 0 0 2px rgba(31, 27, 24, 0.65); }
#game .dock[data-team="0"] .chip.sel { background: #77706A; color: #FFFFFF; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); }
#game .dock[data-team="0"] .timer { color: #FFFFFF; }
#game .dock[data-team="0"] .tm-bg { fill: transparent !important; stroke: rgba(255, 255, 255, 0.18); }
#game .dock[data-team="0"] .tm-fg { stroke: rgba(255, 255, 255, 0.75); }
#game .dock[data-team="0"] .timer.mine .tm-fg { stroke: var(--accent); }
#game .dock[data-team="0"] .timer.low b { color: var(--accent); }
#game .dock[data-team="0"] .throw:disabled { background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.5); }
#game .dock[data-team="0"] .throw.mine:disabled { background: var(--accent); color: #fff; }
#game .dock[data-team="1"] .mini.baek { box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.28); }
#game .dock-core { transition: background-color 200ms var(--ease), color 200ms var(--ease); }
/* game top bar: always the near-black bar; the player on turn is lit up bright, everyone else stays dim */
#game .hud-top { --surface: #1F1B18; --text: #FFFFFF; --muted: rgba(255, 255, 255, 0.46); --faint: rgba(255, 255, 255, 0.34); --hair: rgba(255, 255, 255, 0.14); --raise: rgba(255, 255, 255, 0.10); --raise-2: rgba(255, 255, 255, 0.16); }
#game .players { background: #1F1B18; }
#game .pl:not(.active) .puck.pl-body { opacity: 0.55; }
#game .pl:not(.active) .pip { opacity: 0.7; }
#game .pl.active { border-radius: 0; background: transparent; box-shadow: none; animation: none; }
#game .pl.active .pl-name { color: #FFFFFF; font-weight: 700; animation: plGlow 1.1s ease-in-out infinite; }
#game .pl.active .pl-tag { color: rgba(255, 255, 255, 0.8); }
#game .pl.active::after { content: none; }
/* on turn: no box and no lines; the name stays bright white and twinkles softly */
@keyframes plGlow { 0%, 100% { text-shadow: 0 0 0 rgba(255, 255, 255, 0); } 50% { text-shadow: 0 0 10px rgba(255, 255, 255, 0.85); } }
@media (prefers-reduced-motion: reduce) { #game .pl.active .pl-name { animation: none; } }
/* full-bleed square bars: top player bar edge to edge; dock edge to edge with 설정 / 나가기 attached to its top-left corner */
#game .hud-top { padding: 0 !important; }
#game .players { width: 100%; box-sizing: border-box; border-radius: 0; padding: env(safe-area-inset-top, 0px) 0 0; gap: 0; justify-content: stretch; box-shadow: none; }
#game .pl { flex: 1 1 0; justify-content: center; border-radius: 0; }
#game .dock { padding: 0; }
#game .dock-shell { width: 100%; max-width: none; }
#game .dock-core { flex: 1 1 auto; width: 100%; min-width: 0; border-radius: 0; box-shadow: none; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 16px; height: calc(72px + env(safe-area-inset-bottom, 0px)); }
.dock-tools { position: absolute; left: 8px; bottom: calc(100% + 8px); display: flex; gap: 8px; pointer-events: auto; }
#game .dock-tools .round-btn { position: static; width: 44px; height: 44px; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--hair); backdrop-filter: none; -webkit-backdrop-filter: none; }
#game .dock-tools .round-btn::after { display: none; }   /* these buttons are position: static, so the 44px hit-area pseudo-element stretched over the whole toolbar and the quit button swallowed taps meant for 설정 */
#game .dock:not([data-team="0"]) .sk-icon { filter: brightness(0); }   /* white bar (백편 and 개인전): 요술 icons stay black; only the dark 흑편 bar keeps them white */
@media (max-width: 767px) { #game .dock-core { padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px)) 14px; height: calc(68px + env(safe-area-inset-bottom, 0px)); } }
@media (max-height: 500px) and (orientation: landscape) { #game .dock-core { padding: 4px 10px calc(4px + env(safe-area-inset-bottom, 0px)) 12px; height: calc(64px + env(safe-area-inset-bottom, 0px)); } }
/* 나가기 icon: the supplied logout glyph, painted in the dock's text colour (mask) so it works on the white and the black bar */
.ic-mask { display: block; width: 24px; height: 24px; background-color: currentColor; -webkit-mask: url(assets/ui/icon_quit_v1.svg) center / contain no-repeat; mask: url(assets/ui/icon_quit_v1.svg) center / contain no-repeat; }
/* 연습 / 친구 / 순위 / 호패: same light sheet as the main screen's menu box (cream #F7F3EA, 16px corners, 16px padding, white controls with hairlines) */
#practice, #friends, #ranking, #profile { --sheet: #EFE8DC; }
#practice .shell, #friends .shell, #ranking .shell, #profile .shell { padding: 0; background: none; box-shadow: none; border-radius: 0; }
#practice .core, #friends .core, #ranking .core, #profile .core {
  --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.42); --hair: rgba(31, 27, 24, 0.10); --hair-2: rgba(31, 27, 24, 0.22); --raise: rgba(31, 27, 24, 0.05); --raise-2: rgba(31, 27, 24, 0.09);
  padding: 16px; border-radius: 16px; background: var(--sheet); color: #1F1B18; box-shadow: none; }
#practice .core .input, #friends .core .input { background: #EFE8DC; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.12); }
#practice .core .input:focus, #friends .core .input:focus { box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.45); }
#practice .core .seg, #friends .core .seg, #ranking .core .seg { background: rgba(31, 27, 24, 0.07); }
#practice .core .seg button.on, #friends .core .seg button.on, #ranking .core .seg button.on { background: #EFE8DC; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.12); }
#practice .core .ghost, #friends .core .ghost, #profile .core .ghost { background: #EFE8DC; }
#practice .core .cta:disabled, #friends .core .cta:disabled { background: rgba(31, 27, 24, 0.08); color: rgba(31, 27, 24, 0.4); }
#practice .back-btn, #friends .back-btn, #ranking .back-btn, #profile .back-btn { border-radius: 12px; background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.10); backdrop-filter: none; -webkit-backdrop-filter: none; }
#practice .sub-title, #friends .sub-title, #ranking .sub-title, #profile .sub-title { color: #FBF7F0; text-shadow: 0 2px 18px rgba(20, 16, 12, 0.55); }
@media (max-width: 767px) {   /* phones: a bottom sheet flush with the screen edges, like the main menu box */
  #practice .panel, #friends .panel, #ranking .panel, #profile .panel { padding-bottom: 0; }
  #practice .shell, #friends .shell, #ranking .shell, #profile .shell { margin: 0 -16px; }
  #practice .core, #friends .core, #ranking .core, #profile .core { border-radius: 16px 16px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
}
#practice .core .seg.seg-team button[data-v="0"].on, #friends .core .seg.seg-team button[data-v="0"].on { background: #1F1B18; color: #EDE6DC; box-shadow: none; }
#practice .core .seg.seg-team button[data-v="1"].on, #friends .core .seg.seg-team button[data-v="1"].on { background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.18); }
#practice .core .seat .puck, #friends .core .seat .puck { box-shadow: 0 0 0 1px rgba(31, 27, 24, 0.28); }
/* white (백편) dots on light surfaces get a solid dark ring so they read clearly */
#practice .core .seat .puck, #friends .core .seat .puck, #game .dock:not([data-team="0"]) .puck, .win-pucks .puck { box-shadow: 0 0 0 1.5px #1F1B18; }
/* main screen nav: 요괴도감 · 순위 · 설정 (the gear moved here from the top bar) */
.menu { grid-template-columns: repeat(3, 1fr); }
/* turn timer: floats at the dock's top-right (same row as 설정 / 나가기), always a solid light disc with dark ink so it reads on the board */
.dock-timer { position: absolute; right: 8px; bottom: calc(100% + 8px); pointer-events: auto; }
#game .dock-timer .timer { width: 48px; height: 48px; color: #1F1B18; filter: drop-shadow(0 2px 6px rgba(20, 16, 12, 0.35)); }
#game .dock[data-team] .dock-timer .tm-bg { fill: #EFE8DC !important; stroke: rgba(31, 27, 24, 0.12); }
#game .dock[data-team] .dock-timer .tm-fg { stroke: rgba(31, 27, 24, 0.55); }
#game .dock[data-team] .dock-timer .timer.mine .tm-fg { stroke: var(--accent); }
#game .dock[data-team] .dock-timer .timer.low b { color: var(--accent); }
#game .dock[data-team] .dock-timer .timer, #game .dock .dock-timer .timer b { color: #1F1B18; }
#game .dock[data-team] .dock-timer .timer.low b { color: var(--accent); }
/* text callouts ("잡았다!"): the trailing "!" is padded for on the left so the word itself sits on the centre line */
.callout-main.has-bang { padding-left: 0.3em; }
.callout-img { transform: translateX(var(--ox, 0%)); }
/* top bar: bigger names and pips */
#game .pl-name { font-size: 16px; max-width: none; }
#game .pips { gap: 4px; }
#game .pip { width: 8px; height: 8px; }
@media (max-width: 767px) { #game .pl-name { font-size: 15px; max-width: 100%; } }
@media (max-height: 500px) and (orientation: landscape) { #game .pl-name { font-size: 14px; } #game .pip { width: 7px; height: 7px; } }
/* turn timer 1.5x (48 → 72px) */
#game .dock-timer .timer { width: 72px; height: 72px; }
#game .dock-timer .timer b { font-size: 33px; }
#game .dock-timer .timer circle { stroke-width: 3.5; }
/* timer ring: flat (butt) line ends; the track under the shrinking line is a solid ring of exactly the same width */
#game .dock-timer .timer circle { stroke-width: 3.5; }
#game .dock-timer .tm-fg { stroke-linecap: butt; }
#game .dock[data-team] .dock-timer .tm-bg { stroke: #D3C9B8; stroke-width: 3.5; }
/* © line + legal links live at the bottom of the settings card now (not on the main screen) */
.set-card .credit { display: block; margin: 0; padding: 14px 0 0; border-top: 1px solid rgba(31, 27, 24, 0.10); text-align: center; line-height: 1.5; color: rgba(31, 27, 24, 0.5); }
.set-card .credit[hidden] { display: none; }
.set-card .credit a { color: rgba(31, 27, 24, 0.62); }
.set-card .credit .legal { display: block; margin: 2px 0 0; }
/* nickname warning popover (profanity): dark bubble above the field with a tail pointing at it */
.set-name-row { position: relative; }
.name-warn { position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 3; padding: 10px 14px; border-radius: 12px; background: #1F1B18; color: #FFFFFF; font-size: 13px; font-weight: 600; line-height: 1.45; text-align: center; box-shadow: 0 8px 24px rgba(20, 16, 12, 0.35); }
.name-warn[hidden] { display: none; }
.name-warn::after { content: ''; position: absolute; left: 28px; top: -6px; width: 12px; height: 12px; background: #1F1B18; transform: rotate(45deg); border-radius: 2px; }
.name-warn.pop { animation: namePop 260ms var(--ease) both; }
@keyframes namePop { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .name-warn.pop { animation: none; } }
.name-warn { white-space: nowrap; padding: 10px 12px; }
/* 요괴도감 grid: three columns on phones */
@media (max-width: 767px) {
  .dex-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dc-name { font-size: 13px; }
  .dc-st { min-height: 20px; padding: 0 7px; font-size: 10px; }
  .dc-st.ach { padding: 4px 6px; }
  .dc-ach-n { font-size: 10px; }
}
/* 요괴도감 lede: one line (the font scales down with the screen width so it never wraps) */
.dex-lede { max-width: none; white-space: nowrap; font-size: clamp(11px, 3.3vw, 15px); }
/* 3D renders in the 요괴도감 */
.dx3 { position: relative; display: inline-block; flex: none; aspect-ratio: 1; vertical-align: middle; }
.dx3 img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.dx3.ym-gray img { filter: grayscale(1); }
.dc-well { container-type: size; }   /* so the picture can be sized from the well (width AND height), never clipped */
.dc-well .dx3 { width: min(84cqw, 100cqh); height: auto; max-width: none; transition: transform 600ms var(--ease); }
.dc-shell:hover .dc-well .dx3 { transform: translateY(-3px) scale(1.03); }
.dexd-stage .dx3.ym-xl { width: min(300px, 74%); }
.dx3.reveal { animation: ymReveal 1000ms var(--ease) both; }
@media (max-width: 767px) { .dexd-stage .dx3.ym-xl { width: 210px; } }
.dx3-light img { filter: drop-shadow(1.2px 0 0 rgba(120, 114, 106, 0.55)) drop-shadow(-1.2px 0 0 rgba(120, 114, 106, 0.55)) drop-shadow(0 1.2px 0 rgba(120, 114, 106, 0.55)) drop-shadow(0 -1.2px 0 rgba(120, 114, 106, 0.55)); }
.dx3-light.ym-gray img { filter: grayscale(1) drop-shadow(1.2px 0 0 rgba(120, 114, 106, 0.55)) drop-shadow(-1.2px 0 0 rgba(120, 114, 106, 0.55)) drop-shadow(0 1.2px 0 rgba(120, 114, 106, 0.55)) drop-shadow(0 -1.2px 0 rgba(120, 114, 106, 0.55)); }
/* 요괴 유대: wins together */
.dexd-bond { margin: 10px 0 0; padding: 6px 12px; border-radius: 999px; background: rgba(31, 27, 24, 0.07); font-size: 13px; font-weight: 600; color: var(--dk-2); }
.dexd-bond b { font-family: var(--font-main); font-size: 16px; color: var(--dk); }
/* no scrollbars anywhere (scrolling itself still works: touch, wheel, keys) */
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar, html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; background: transparent; }
/* 2:2 / 한 말 대전: top bar cells are told apart by team: 흑편 = darker cell with a black chip, 백편 = lighter cell with a white chip */
#game .pl.team-0 { background: rgba(0, 0, 0, 0.42); }
#game .pl.team-1 { background: rgba(255, 255, 255, 0.16); }
#game .pl.team-0 .pl-tag, #game .pl.team-1 .pl-tag { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; line-height: 1.4; letter-spacing: 0; }
#game .pl.team-0 .pl-tag { background: #000000; color: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
#game .pl.team-1 .pl-tag { background: #FFFFFF; color: #1F1B18; }
#game .pl.active.team-0 .pl-tag, #game .pl.active.team-1 .pl-tag { color: inherit; }
#game .pl.active.team-1 .pl-tag { color: #1F1B18; } #game .pl.active.team-0 .pl-tag { color: #FFFFFF; }
/* top bar: the player on turn gets the arrow_drop_down icon under their cell, turned 180 deg so it points up at them, bobbing up and down.
   (icon_arrow_drop_tight.svg = the supplied icon with its viewBox cropped to the triangle) */
#game .pl.active::after { content: ''; display: block; position: absolute; left: 50%; right: auto; bottom: -15px; width: 18px; height: 9px; transform: translateX(-50%) rotate(180deg); background: #FFFFFF; -webkit-mask: url(assets/ui/icon_arrow_drop_tight.svg) center / 100% 100% no-repeat; mask: url(assets/ui/icon_arrow_drop_tight.svg) center / 100% 100% no-repeat; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45)); pointer-events: none; animation: turnArrowBob 900ms ease-in-out infinite; }
@keyframes turnArrowBob { 0%, 100% { transform: translateX(-50%) translateY(0) rotate(180deg); } 50% { transform: translateX(-50%) translateY(-3px) rotate(180deg); } }
@media (prefers-reduced-motion: reduce) { #game .pl.active::after { animation: none; } }
/* 2:2 team cells, clearer: 백편 = a real white cell with dark ink, 흑편 = near-black cell with white ink */
#game .pl.team-1 { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.5); background: #F3EFE7; }
#game .pl.team-0 { background: #050505; }
#game .pl.team-1 .pl-name { color: rgba(31, 27, 24, 0.55); }
#game .pl.team-1.active .pl-name { color: #1F1B18; animation: none; text-shadow: none; }
#game .pl.team-1 .pip { background: rgba(31, 27, 24, 0.16); }
#game .pl.team-1 .pip.board { background: color-mix(in srgb, var(--c) 60%, rgba(31, 27, 24, 0.18)); }
#game .pl.team-1 .pip.done { background: var(--c); }
#game .pl.team-1 .puck.pl-body { opacity: 1; }
#game .pl.team-1 .pl-tag { background: #1F1B18; color: #FFFFFF; box-shadow: none; }
#game .pl.team-1.active .pl-tag { color: #FFFFFF; }
/* 첫 차례 족자: the sub line under the name a bit bigger too */
.callout.name .callout-sub { font-size: max(14px, calc(var(--w) * 0.044)); }
/* 연습 seats: no input, just "ID · 요괴 이름" (computers: 요괴이름(ai)) */
.seat-who { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 15px; color: var(--text); }
.seat-who b { font-family: var(--font-main); font-weight: 400; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-who .seat-yk { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
/* 게임 방법 sheet (opened from the ? icon in the lobby's top bar) */
.menu { grid-template-columns: repeat(3, 1fr); }
.howto-card { max-height: min(86dvh, 720px); display: flex; flex-direction: column; }
.howto-body { overflow-y: auto; padding: 4px 0 4px; display: flex; flex-direction: column; gap: 14px; }
.howto-body h3 { margin: 0 0 4px; font-family: var(--font-main); font-weight: 400; font-size: 17px; color: #1F1B18; }
.howto-body p { margin: 0; font-size: 14px; line-height: 1.6; color: rgba(31, 27, 24, 0.78); word-break: keep-all; }
.howto-body p + ul, .howto-body ul + p { margin-top: 6px; }
.howto-body ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.7; color: rgba(31, 27, 24, 0.78); }
.howto-body b { color: #1F1B18; }
/* 방 보기 / 착귀꾼 가이드: two pills floating just above the bottom sheet, at its right edge */
.home-bottom { position: relative; }
.fab-row { position: absolute; right: 16px; top: -54px; z-index: 3; display: flex; gap: 8px; }
.fab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 10px; border-radius: 12px; background: #EFE8DC; color: #1F1B18; font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.10), 0 4px 14px rgba(0, 0, 0, 0.35); }
.fab-ic { display: block; width: 22px; height: 22px; background-color: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.fab:active { transform: scale(0.96); }
.fab-dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent, #C94F35); box-shadow: 0 0 0 2px #EFE8DC; }
.fab-dot[hidden] { display: none; }
.notice-date { margin: 0 0 4px !important; font-size: 12px !important; color: rgba(31, 27, 24, 0.5) !important; }
.notice-empty { padding: 28px 0; text-align: center; }
.howto-body .howto-intro { font-family: var(--font-main); font-size: 17px; line-height: 1.5; color: #1F1B18; padding-bottom: 4px; }
.howto-body .howto-outro { margin-top: 2px; font-family: var(--font-main); font-size: 16px; color: #1F1B18; text-align: right; }
/* 착귀꾼 길잡이: big greeting, topic buttons that unfold their details */
.howto-body .howto-intro { font-size: 22px; line-height: 1.5; padding: 4px 2px 10px; }
.howto-body .howto-outro { font-size: 19px; padding-top: 6px; }
.howto-body { gap: 8px; }
.how-item { border-radius: 14px; background: rgba(31, 27, 24, 0.05); box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.08); overflow: hidden; }
.how-q { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px; font-family: var(--font-main); font-size: 19px; color: #1F1B18; text-align: left; }
.how-chev { flex: none; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform 220ms var(--ease); opacity: 0.6; }
.how-item.open .how-chev { transform: rotate(225deg) translate(-2px, -2px); }
.how-item.open { background: #FFFFFF22; background: rgba(255, 255, 255, 0.55); }
.how-a { display: none; padding: 0 16px 16px; }
.how-item.open .how-a { display: block; animation: fade 240ms var(--ease) both; }
.how-a p { font-size: 16px; line-height: 1.65; }
.how-a ul { font-size: 16px; line-height: 1.75; }
.how-item, .how-q { flex: none; }
.howto-body > * { flex: none; }
/* 길잡이 topic buttons: folded = our main orange, unfolded = light card */
.how-item { background: var(--accent); box-shadow: none; }
.how-q { color: #FFFFFF; }
.how-chev { opacity: 0.9; }
.how-item.open { background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.1); }
.how-item.open .how-q { color: #1F1B18; }
.how-item.open .how-chev { opacity: 0.6; }
/* wide screens: turn info on the left, 윷 던지기 pinned to the right edge of the full-width dock */
#game .dock-core .turn { flex: 1 1 auto; min-width: 0; }
#game .dock-core .bank { flex: 0 1 auto; }
#game .dock-core .throw { flex: none; margin-left: auto; }
/* 호패: the stats grid on the light sheet (it was drawn with the old dark --core, so dark cells with dark text) */
#profile .stats { background: rgba(31, 27, 24, 0.14); box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.12); }
#profile .stats div { background: #EFE8DC; }
#profile .stats dt { color: rgba(31, 27, 24, 0.55); }
#profile .stats dd { color: #1F1B18; }
#profile .prof-name { color: #1F1B18; }
/* loading screen: PC (wide) / mobile (tall) key art under an 85% black shade; the logo and the progress stay above it, bright */
.boot-shade { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); pointer-events: none; }
.boot-cover:not([hidden]) ~ .boot-logo, .boot-foot { z-index: 2; }
/* 친구 tab: 4th nav slot + screen */
.menu { grid-template-columns: repeat(4, 1fr); }
.mi { position: relative; }
.mi-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 10px; height: 10px; border-radius: 50%; background: var(--accent, #C94F35); box-shadow: 0 0 0 2px #EFE8DC; }
.mi-dot[hidden] { display: none; }
.flame { width: 18px; height: 18px; flex: none; color: #4FB6E8; }
.buddy-core { display: flex; flex-direction: column; gap: 14px; }
.bd-me { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bd-code .label { margin-bottom: 4px; }
.bd-code b { display: block; font-family: var(--font-main); font-weight: 400; font-size: 30px; letter-spacing: 0.14em; line-height: 1.1; color: #1F1B18; }
.bd-btns { display: flex; align-items: center; gap: 8px; }
.bd-invite { width: auto; min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.bd-add { display: flex; gap: 8px; }
.bd-add .input { flex: 1; text-transform: uppercase; letter-spacing: 0.12em; }
.bd-flames { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; color: rgba(31, 27, 24, 0.7); }
.bd-flames b { font-family: var(--font-main); font-weight: 400; font-size: 18px; color: #1F1B18; }
.bd-flames span { margin-right: 6px; }
.bd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: min(46dvh, 360px); overflow-y: auto; }
.bd-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid rgba(31, 27, 24, 0.1); }
.bd-av { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-family: var(--font-main); font-size: 18px; color: #1F1B18; }
.bd-n { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bd-n b { font-family: var(--font-main); font-weight: 400; font-size: 17px; color: #1F1B18; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-n small { font-size: 12px; color: rgba(31, 27, 24, 0.55); }
.bd-send { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 12px; background: #1F1B18; color: #FFFFFF; font-size: 13px; font-weight: 700; white-space: nowrap; }
.bd-send .flame { color: #7FD6FF; }
.bd-send:disabled { background: rgba(31, 27, 24, 0.1); color: rgba(31, 27, 24, 0.45); cursor: default; }
.bd-send:disabled .flame { color: rgba(31, 27, 24, 0.3); }
.bd-send.sent-fx::after { content: ''; position: absolute; left: 14px; top: 8px; width: 18px; height: 18px; background: #7FD6FF; -webkit-mask: url(assets/ui/icon_flame.svg) center / contain no-repeat; mask: url(assets/ui/icon_flame.svg) center / contain no-repeat; animation: flameUp 900ms ease-out forwards; pointer-events: none; }
@keyframes flameUp { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-42px) scale(1.7); } }
.bd-x { flex: none; width: 32px; height: 32px; border-radius: 10px; font-size: 20px; line-height: 1; color: rgba(31, 27, 24, 0.4); }
.bd-x:hover { background: rgba(31, 27, 24, 0.06); color: #1F1B18; }
.bd-empty { padding: 18px 0 6px; text-align: center; font-size: 14px; line-height: 1.6; color: rgba(31, 27, 24, 0.6); }
#buddies .core { --text: #1F1B18; }
/* 친구: the same light sheet as 연습 / 친구와 겨루기 / 순위 / 호패 */
#buddies { --sheet: #EFE8DC; }
#buddies .shell { padding: 0; background: none; box-shadow: none; border-radius: 0; }
#buddies .core { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.42); --hair: rgba(31, 27, 24, 0.10); --hair-2: rgba(31, 27, 24, 0.22); --raise: rgba(31, 27, 24, 0.05); --raise-2: rgba(31, 27, 24, 0.09); padding: 16px; border-radius: 16px; background: var(--sheet); color: #1F1B18; box-shadow: none; }
#buddies .core .input { background: #EFE8DC; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.14); }
#buddies .core .input:focus { box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.45); }
#buddies .core .ghost { background: #EFE8DC; }
#buddies .back-btn { border-radius: 12px; background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.10); backdrop-filter: none; -webkit-backdrop-filter: none; }
#buddies .sub-title { color: #FBF7F0; text-shadow: 0 2px 18px rgba(20, 16, 12, 0.55); }
@media (max-width: 767px) {
  #buddies .panel { padding-bottom: 0; }
  #buddies .shell { margin: 0 -16px; }
  #buddies .core { border-radius: 16px 16px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
}
@media (min-width: 768px) {   /* web: 순위 / 패거리 / 호패 / 연습 / 친구와 겨루기 open in the middle of the screen, not at the left edge */
  #ranking .panel, #buddies .panel, #profile .panel, #practice .panel, #friends .panel { margin-inline: auto; padding: 48px 24px 40px; }
}
/* 무작위 대전 '상대를 찾는 중': the same cream sheet as the settings card / 연습 / 친구 / 순위 (it used to be the old dark glass box) */
#search .shell { padding: 0; background: none; box-shadow: none; border-radius: 0; }
#search .core { --text: #1F1B18; --muted: rgba(31, 27, 24, 0.62); --faint: rgba(31, 27, 24, 0.5); --hair: rgba(31, 27, 24, 0.10); --hair-2: rgba(31, 27, 24, 0.22); --raise: rgba(31, 27, 24, 0.05); --raise-2: rgba(31, 27, 24, 0.09); padding: 28px 24px 24px; border-radius: 16px; background: #EFE8DC; color: #1F1B18; box-shadow: none; }
#search .search-core h2 { font-family: var(--font-main); font-size: 20px; font-weight: 400; color: #1F1B18; }
#search .search-time { color: #1F1B18; }
#search .search-count { color: rgba(31, 27, 24, 0.55); }
#search .ghost { background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.14); }
#search .win-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
/* 패거리 방 + 초대 */
.bd-room { min-height: 48px; }
.bd-invites { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bd-invites:empty { display: none; }
.bd-inv { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--accent, #C94F35); color: #FFFFFF; }
.bd-inv-t { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.bd-inv-t b { font-family: var(--font-main); font-weight: 400; font-size: 16px; }
.bd-inv-t code { margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.22); font-family: var(--font-main); letter-spacing: 0.08em; }
.bd-join { flex: none; min-height: 36px; padding: 0 12px; border-radius: 10px; background: #FFFFFF; color: #1F1B18; font-size: 13px; font-weight: 700; }
.bd-inv .bd-x { color: rgba(255, 255, 255, 0.75); }
.bd-inv .bd-x:hover { background: rgba(0, 0, 0, 0.18); color: #FFFFFF; }
.rm-call { width: 100%; min-height: 44px; }
.bd-pick-sub { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: rgba(31, 27, 24, 0.62); }
.bd-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(31, 27, 24, 0.1); }
.bd-pick-row b { flex: 1; min-width: 0; font-family: var(--font-main); font-weight: 400; font-size: 17px; color: #1F1B18; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-send.call { min-height: 36px; }

/* 도깨비불 count next to the 냥 box + invite popover */
.fl-ic { display: inline-block; width: 18px; height: 20px; background: url(assets/ui/flame.webp) center / contain no-repeat; }
.hb-flames { gap: 6px; padding: 0 12px; cursor: pointer; }
.hb-flames:active { transform: scale(0.97); }
.inv-pop { position: fixed; z-index: 60; left: 50%; top: 50%; width: min(360px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 16px; background: #EFE8DC; color: #1F1B18; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(31, 27, 24, 0.12); transform: translate(-50%, -46%) scale(0.92); opacity: 0; transition: transform 260ms cubic-bezier(.2, .9, .3, 1.1), opacity 200ms; }
.inv-pop[hidden] { display: none; }
.inv-pop.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.inv-pop-t { margin: 0; font-size: 16px; text-align: center; line-height: 1.4; }
.inv-pop-t b { font-family: var(--font-main); font-weight: 400; font-size: 18px; }
.inv-pop-s { margin: 4px 0 14px; text-align: center; font-size: 13px; color: rgba(31, 27, 24, 0.62); }
.inv-pop-s code { padding: 1px 6px; border-radius: 6px; background: rgba(31, 27, 24, 0.1); font-family: var(--font-main); letter-spacing: 0.08em; color: #1F1B18; }
.inv-pop-btns { display: flex; gap: 8px; }
.inv-pop-btns button { flex: 1; min-height: 44px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.inv-no { background: rgba(31, 27, 24, 0.1); color: #1F1B18; }
.inv-yes { background: var(--accent, #C94F35); color: #FFFFFF; }
/* top-right chips: icon + number share one centered line (the font's tall ascent used to push the text up) */
.hb-wallet .wallet-val { display: flex; align-items: center; line-height: 1; padding: 0; height: 100%; }
.hb-wallet .ny { line-height: 1; }
.hb-wallet .ny-ic { margin-top: 0; }

/* 설정 / 나가기: bottom left, just above the bottom bar (the top bar is free for the 감정표현 picker). 요술 buttons: a row floating above the bottom bar (the bar stays visible) */
#game .hud-top .dock-tools { flex-direction: column; position: fixed; left: max(8px, env(safe-area-inset-left)); right: auto; top: auto; bottom: calc(68px + 8px + env(safe-area-inset-bottom, 0px)); z-index: 3; }
#game:has(.dock.skilling) .dock-tools { visibility: hidden; }   /* the 요술 row takes that strip while a skill is being picked */
#game .hud-top .dock-tools .round-btn { background: #EFE8DC; color: #1F1B18; box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.14), var(--shadow); }
#game .skillpick { --sk: 96px; position: absolute; inset: auto auto calc(100% + 8px) 50%; transform: translateX(-50%); width: auto; height: auto; z-index: 2; gap: 8px; justify-content: center; }
#game .dock.skilling .dock-core { visibility: visible; }
/* 요술 boxes: squares (web 96px; phone: four fit left of the timer ring), a bit bigger type and icon */
#game .skillpick .skill { flex: 0 0 var(--sk); width: var(--sk); height: var(--sk); min-width: 0; min-height: 0; padding: 0 4px; }
#game .skill.has-ic .sk-icon { width: 36px; height: 36px; min-width: 36px; }
#game .skill.has-ic .sk-name { font-size: 19px; }
#game .skill .sk-desc { font-size: 14px; }
#game .skillpick.picking .sk-hint { align-self: stretch; }
@media (max-width: 767px) {
  #game .skillpick { --sk: calc((100vw - 8px - 88px - 18px) / 4); left: 8px; right: auto; transform: none; gap: 6px; justify-content: flex-start; }
  #game .skill.has-ic .sk-icon { width: 24px; height: 24px; min-width: 24px; }
  #game .skill.has-ic .sk-name { font-size: 16px; line-height: 1.1; }
  #game .skill .sk-desc { font-size: 12.5px; line-height: 1.1; }
}   /* phone: the row stops short of the turn timer ring on the right */
/* top player bar: no turn arrow any more; everyone who is not on turn is clearly dimmed, the one on turn stays bright */
#game .pl.active::after { content: none !important; animation: none; }
#game .pl { transition: opacity 200ms var(--ease); }
#game .pl:not(.active) { opacity: 0.35; }
#game .pl.team-1:not(.active) { background: #2A2723; --text: #FFFFFF; --muted: rgba(255, 255, 255, 0.6); opacity: 0.5; }   /* a waiting 백편 cell turns dark too (not a light grey block) */
#game .pl.team-1:not(.active) .pl-name { color: rgba(255, 255, 255, 0.85); }
#game .pl.team-1:not(.active) .pl-tag { color: rgba(255, 255, 255, 0.7); }
/* top bar: each player's piece colour gets a clear round outline (and the piece dots too) so neighbours read apart */
#game .pl .puck.pl-body { width: 14px; height: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92), inset 0 -2px 3px rgba(0, 0, 0, 0.18); }
#game .pl .puck.pl-body.sided { box-shadow: 0 0 0 2px var(--c), 0 0 0 3.5px rgba(255, 255, 255, 0.92), inset 0 -2px 3px rgba(0, 0, 0, 0.18); }
#game .pl.team-1.active .puck.pl-body { box-shadow: 0 0 0 2px #1F1B18, inset 0 -2px 3px rgba(0, 0, 0, 0.18); }
#game .pl.team-1.active .puck.pl-body.sided { box-shadow: 0 0 0 2px var(--c), 0 0 0 3.5px #1F1B18, inset 0 -2px 3px rgba(0, 0, 0, 0.18); }
#game .pl .pip { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75); }
#game .pl.team-1.active .pip { box-shadow: 0 0 0 1px rgba(31, 27, 24, 0.7); }
#game .pips { gap: 5px; }
/* turn timer ring: bottom right above the dock (web: 1.5x bigger) */
#game .hud-top .dock-timer { position: fixed; left: auto; top: auto; transform: none; right: 8px; bottom: calc(68px + 8px + env(safe-area-inset-bottom, 0px)); z-index: 3; }   /* bottom right, just above the dock (not under the top bar: it covered the 족자 callout) */
@media (min-width: 768px) {
  #game .hud-top .dock-timer { bottom: calc(72px + 8px + env(safe-area-inset-bottom, 0px)); }   /* web: same spot, only bigger */
  #game .hud-top .dock-timer .timer { width: 108px; height: 108px; }
  #game .hud-top .dock-timer .timer b { font-size: 50px; }
}
/* top bar piece dots: a piece still in play (waiting or on the board) is filled with its 요괴 colour by default; a finished piece is an empty ring */
#game .pl .pip, #game .pl .pip.board, #game .pl.team-1 .pip, #game .pl.team-1 .pip.board { background: var(--b, var(--c)); }
#game .pl .pip.done, #game .pl.team-1 .pip.done { background: transparent; }
/* 요술 boxes: opaque fill, bolder type, thin hairline (no thick outline, no drop shadow) */
#game .skillpick .skill { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: inset 0 0 0 1px var(--hair); }   /* thin hairline only, no drop shadow */
#game .skillpick .skill .sk-name { font-weight: 800; }
#game .skillpick .skill:disabled { opacity: 0.55; }
#game .skillpick.picking .skill:not(.on) { opacity: 0.55; }
/* the timer now lives in the top header, so the old `.dock[data-team] .dock-timer ...` look rules no longer reach it: same ring look, restated */
#game .hud-top .dock-timer .tm-bg { fill: #EFE8DC !important; stroke: #D3C9B8; stroke-width: 3.5; }
#game .hud-top .dock-timer .tm-fg { stroke: rgba(31, 27, 24, 0.55); stroke-width: 3.5; stroke-linecap: butt; }
#game .hud-top .dock-timer .timer.mine .tm-fg { stroke: var(--accent); }
#game .hud-top .dock-timer .timer, #game .hud-top .dock-timer .timer b { color: #1F1B18; }
#game .hud-top .dock-timer .timer.low b { color: var(--accent); }
@media (min-width: 768px) { #game .skillpick .skill { flex: 0 0 168px; width: 168px; } }   /* web: the 요술 boxes are wide rather than square */
/* 연습 개인전: tap a computer row to leave the seat out */
#localSeats .seat-tog { cursor: pointer; }
#localSeats .seat-tog:active { background: rgba(31, 27, 24, 0.05); }
#localSeats .seat-off .puck { opacity: 0.35; }
#localSeats .seat-off .seat-offt { text-decoration: line-through; text-decoration-color: #D6342C; text-decoration-thickness: 2px; color: rgba(31, 27, 24, 0.5); }   /* a left-out seat keeps its 요괴 name, struck through in red */
#localSeats .seat-tog .seat-yk { margin-left: 8px; font-size: 11px; font-weight: 500; color: rgba(31, 27, 24, 0.45); }
/* 방 로비 개인전: the host taps an empty seat to leave it out */
#roomSeats .rm-tog { cursor: pointer; }
#roomSeats .rm-n.strike { text-decoration: line-through; text-decoration-color: #D6342C; text-decoration-thickness: 2px; color: rgba(31, 27, 24, 0.5); }
#roomSeats .rm-hint { margin-left: auto; font-size: 11px; color: rgba(31, 27, 24, 0.45); }
/* 설정: 구글 계정 연동 */
#gSec { margin-top: 14px; }
#gSec .g-btn { display: block; width: 100%; margin-top: 8px; min-height: 44px; color-scheme: light; }
#gSec .g-btn iframe { color-scheme: light; }   /* the page is color-scheme: dark; Google's light iframe would otherwise get an opaque white box behind the pill */
#gSec .g-done { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: rgba(31, 27, 24, 0.06); box-shadow: inset 0 0 0 1px rgba(31, 27, 24, 0.12); }
#gSec .g-done[hidden], #gSec .g-btn[hidden] { display: none; }
#gSec .g-done svg { width: 20px; height: 20px; flex: none; }
#gSec .g-done b { font-size: 15px; font-weight: 700; color: #1F1B18; }
#gSec .g-done .g-ok { margin-left: auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #2E9E5B; color: #fff; font-style: normal; font-size: 13px; font-weight: 800; }

/* 요술 row = an upper layer ON the bottom bar (it used to float above the bar and covered the pieces). The bar's own content hides while it shows. */
#game .skillpick { position: absolute; inset: 0; left: 0; right: 0; bottom: 0; top: 0; transform: none; width: auto; height: auto; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px env(safe-area-inset-bottom, 0px); box-sizing: border-box; background: var(--surface); }
#game .dock.skilling .dock-core { visibility: hidden; }
#game .skillpick .skill { flex: 0 0 auto; width: 60px; height: 60px; min-width: 0; padding: 0 2px; }
@media (max-width: 767px) { #game .skillpick { left: 0; right: 0; justify-content: space-evenly; gap: 6px; } }
@media (min-width: 768px) {
  #game .skillpick .skill { width: 168px; height: 60px; flex: 0 0 168px; }
  #game .skillpick .skill.has-ic { flex-direction: row; gap: 10px; justify-content: center; }
  #game .skill.has-ic .sk-icon { width: 30px; height: 30px; min-width: 30px; }
  #game .skill.has-ic .sk-txt { align-items: flex-start; }
  #game .skill.has-ic .sk-name { font-size: 17px; }
  #game .skill .sk-desc { font-size: 12px; }
}
/* 요술 row: not separate boxes, the whole bar split into four equal cells edge to edge */
#game .skillpick { gap: 0; padding: 0 0 env(safe-area-inset-bottom, 0px); justify-content: stretch; align-items: stretch; }
#game .skillpick .skill { flex: 1 1 0; width: auto; height: auto; min-width: 0; border-radius: 0; box-shadow: none; background-color: transparent; padding: 0 4px; }
#game .skillpick .skill + .skill { box-shadow: inset 1px 0 0 var(--hair); }
#game .skillpick .skill:hover:not(:disabled) { background-image: linear-gradient(var(--raise-2), var(--raise-2)); }
#game .skillpick.picking .skill.on { flex: none; padding: 0 18px; }
#game .skillpick.picking .sk-hint { border-radius: 0; box-shadow: none; background: transparent; flex: 1 1 auto; }
@media (min-width: 768px) { #game .skillpick .skill { width: auto; flex: 1 1 0; } #game .skillpick.picking .skill.on { flex: none; } }

/* 도감 scroll smoothness: 170+ cards would otherwise all be painted/composited at once. Off-screen cards are skipped, the
   fixed full-screen grain (mix-blend-mode) is not blended over the scrolling sheet, and the page behind is paper so an
   unpainted tile never flashes the dark app background. */
.dc { content-visibility: auto; contain-intrinsic-size: auto 280px; }
body.in-dex .grain { display: none; }
html:has(body.in-dex), body.in-dex { background: #EFE8DC; }
.dex-screen { background-color: #EFE8DC; overscroll-behavior: contain; }

/* a game, not a document: no text selection / long-press callout / tap highlight (typing fields stay selectable) */
html, body, body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; }

/* 도감 first entry: only the first rows play the rise-in; the other 160 cards just appear (fewer simultaneous animations / layers while scrolling) */
.dc:nth-child(n+13) { opacity: 1; transform: none; animation: none; }
.dex-screen { contain: strict; transform: translateZ(0); }

/* 도감 on phones: the browser's address bar slides away while scrolling and the viewport grows for a moment; the sheet is sized to the
   LARGE viewport so the strip that appears at the bottom is already covered by paper (was a black band). Extra bottom padding keeps the last row reachable. */
@supports (height: 100lvh) {
  .dex-screen { bottom: auto; height: 100lvh; }
  .dex-wrap { padding-bottom: calc(max(28px, env(safe-area-inset-bottom)) + 96px); }
}

.dc.locked .dc-name { letter-spacing: -0.02em; }
.dexd-card.locked .dexd-name { letter-spacing: -0.04em; }

/* locked 요괴 with a render: its real outline filled with the dark ink (the photo's alpha as a mask) and a big '?' in the main font */
.dx3-sil { container-type: inline-size; }
.dx3-sil::before { content: ''; position: absolute; inset: 0; background: #2E2723; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.dx3-sil::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 46.5cqw/1 var(--font-main); color: #EFE8DC; }

/* 진행 중인 대전: a strip under the top bar of the main screen while a game is still running behind it */
.live-game { position: fixed; z-index: 6; left: 16px; right: 16px; top: calc(max(12px, env(safe-area-inset-top, 0px)) + 64px); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 14px; background: #EFE8DC; color: #1F1B18; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.live-game[hidden] { display: none; }
.live-t { font-size: 15px; font-weight: 700; min-width: 0; }
.live-go { flex: none; min-height: 40px; padding: 0 18px; border-radius: 10px; background: var(--accent, #C94F35); color: #FFFFFF; font-size: 15px; font-weight: 700; }

#netPing { white-space: pre-line; }
