:root {
  color-scheme: dark; font-family: Inter, "Noto Sans SC", system-ui, sans-serif;
  --ink: #f4f0df; --muted: #9fb8ae; --gold: #f3c96b; --gold-deep: #b8832f;
  --felt: #0d5a49; --felt-dark: #073b33; --night: #071f1d; --panel: #0b302bdd;
  --danger: #e75645; --safe-top: 0px; --safe-right: 0px; --safe-bottom: 0px; --safe-left: 0px;
  --content-safe-top: 0px; --content-safe-right: 0px; --content-safe-bottom: 0px; --content-safe-left: 0px;
  --app-height: 100dvh; background: var(--night); color: var(--ink);
}
* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; overflow: hidden; }
body { background: radial-gradient(circle at 50% -20%, #196b58, var(--night) 58%); }
button, input { font: inherit; } button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #fff4aa; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
#app-shell { position: relative; width: 100%; height: var(--app-height, 100dvh); min-height: 360px; padding: max(12px, var(--content-safe-top)) max(14px, var(--content-safe-right)) max(12px, var(--content-safe-bottom)) max(14px, var(--content-safe-left)); overflow: hidden; }
#error { position: fixed; z-index: 20; top: max(8px, var(--safe-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: 90vw; min-height: 0; margin: 0; padding: 8px 14px; border-radius: 999px; background: #5c1d1de8; color: #ffe6df; text-align: center; }
#error:empty { display: none; }
.page { height: 100%; max-width: 1180px; margin: 0 auto; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.primary, .secondary, .ghost { min-height: 44px; padding: 11px 20px; border-radius: 12px; border: 1px solid transparent; font-weight: 800; }
.primary { color: #182418; background: linear-gradient(180deg, #ffe69a, var(--gold)); box-shadow: 0 6px 20px #0005, inset 0 1px #fff9; }
.secondary { color: var(--ink); background: #174d43; border-color: #4b8174; }
.ghost { color: var(--muted); background: transparent; border-color: #52766d; }
.jumbo { min-width: 220px; font-size: 17px; }

.launch-page, .center-page { display: grid; place-content: center; justify-items: center; text-align: center; }
.brand-mark { width: 96px; aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 24px; border: 2px solid #f6d984; border-radius: 28px 8px; transform: rotate(45deg); background: linear-gradient(145deg, #1b6b58, #082c28); box-shadow: 0 20px 60px #0007, inset 0 0 20px #f4cb4d22; }
.brand-mark span { transform: rotate(-45deg); color: var(--gold); font: 800 48px serif; }
.launch-page h1 { margin: 0; font-size: clamp(42px, 9vw, 72px); letter-spacing: -.05em; }
.hero-copy { margin: 12px 0 28px; color: var(--muted); line-height: 1.7; }
.dev-connect { width: min(420px, 90vw); margin-top: 18px; color: #78978e; font-size: 12px; }
.dev-connect label { display: grid; gap: 4px; margin-top: 8px; text-align: left; }
input { width: 100%; min-height: 42px; border: 1px solid #4d776d; border-radius: 10px; padding: 8px 11px; background: #061f1dbb; color: var(--ink); }

.page-header { display: flex; align-items: center; gap: 14px; height: 72px; }
.page-header h1 { margin: 0; font-size: 25px; }.status-pill, .room-code { margin-left: auto; padding: 7px 12px; border: 1px solid #407569; border-radius: 999px; color: #b8dbce; background: #0b332de0; font-size: 12px; }
.status-pill::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #55d79a; box-shadow: 0 0 10px #55d79a; }
.lobby-page { display: grid; grid-template-rows: auto 1fr auto; }.lobby-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; align-content: center; }
.mode-card { min-height: 220px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 7px; padding: 22px; border: 1px solid #447468; border-radius: 22px; color: var(--ink); text-align: left; background: linear-gradient(145deg, #124b40dd, #092b27e8); box-shadow: 0 12px 35px #0003; }
.mode-card.quick { border-color: #d2ac56; background: linear-gradient(145deg, #86672b, #174d40 60%); }.mode-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.mode-card strong { font-size: 21px; }.mode-card small { color: #b5cac2; }.mode-icon { margin-bottom: auto; color: var(--gold); font-size: 36px; }
.join-card label { width: 100%; }.join-card .secondary { width: 100%; }.quiet-note { text-align: center; color: #66877e; font-size: 12px; }.legal-links { display: flex; justify-content: center; gap: 18px; }.text-button { border: 0; background: transparent; color: #b9cec8; text-decoration: underline; }.launch-status { min-height: 20px; color: #b9cec8; font-size: 12px; }
.match-orbit { position: relative; width: 150px; height: 150px; margin-bottom: 22px; border: 1px solid #4e8275; border-radius: 50%; animation: breathe 2s ease-in-out infinite; }
.match-orbit span { position: absolute; inset: 40px; display: grid; place-items: center; border-radius: 50%; background: #164f44; color: var(--gold); font: 700 34px serif; }
.match-orbit i { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); }.match-orbit i:nth-child(1){left:69px;top:-6px}.match-orbit i:nth-child(2){right:-6px;top:69px}.match-orbit i:nth-child(3){left:69px;bottom:-6px}.match-orbit i:nth-child(4){left:-6px;top:69px}
@keyframes breathe { 50% { transform: scale(1.04); box-shadow: 0 0 50px #f3c96b26; } }

.room-page { display: grid; grid-template-rows: auto 1fr auto; }.icon-button { width: 42px; height: 42px; border: 1px solid #456f66; border-radius: 50%; color: var(--ink); background: #0b332d; font-size: 30px; }
.room-stage { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: center; }.room-seats { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 12px; }
.room-seat { min-height: 112px; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 15px; border: 1px solid #3e7065; border-radius: 18px; background: #0b332ddd; }.room-seat.empty { opacity: .55; border-style: dashed; }
.avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: #17362f; background: linear-gradient(145deg, #fff0b6, var(--gold)); font-weight: 900; }.room-seat small { display: block; color: var(--muted); }.ready-mark { color: #66e5ac; font-size: 12px; }
.room-rules { display: grid; gap: 12px; padding: 20px; border-radius: 18px; background: #071f1dc9; color: var(--muted); }.room-rules strong { color: var(--gold); font-size: 18px; }.invite-card { max-width: 620px; margin: 0 auto 12px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid #d8ba6c55; border-radius: 12px; background: #05251fcc; }.invite-card small { display: block; margin-top: 3px; color: #b9cec8; }.room-actions { display: flex; justify-content: center; gap: 12px; padding-bottom: 10px; }
.legal-page { max-width: 720px; margin: auto; padding: 32px; line-height: 1.7; }.legal-page h1 { color: #ffe39a; }.legal-back { margin-bottom: 25px; }.danger { border: 1px solid #ef8d82; background: #5b211e; color: white; }

.table-page { position: relative; max-width: none; border-radius: 26px; overflow: hidden; background: radial-gradient(ellipse at center, #16705a 0, var(--felt) 48%, var(--felt-dark) 100%); box-shadow: inset 0 0 80px #001e18aa, 0 20px 50px #0005; }
.table-page::before { content: ""; position: absolute; inset: 0; opacity: .13; pointer-events: none; background-image: repeating-linear-gradient(45deg, transparent 0 12px, #fff 13px 14px); }
.table-topbar { position: absolute; z-index: 3; top: 12px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; }.table-topbar>div:first-child { display: grid; }.table-topbar span { color: #a8c9bd; font-size: 11px; }
.wall-counter { width: 54px; aspect-ratio: 1; display: grid; place-items: center; align-content: center; border: 1px solid #8cb8aa66; border-radius: 50%; background: #082d28cc; }.wall-counter strong { color: var(--gold); font-size: 19px; }
.seat-card { position: absolute; z-index: 2; min-width: 118px; display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 9px 11px; border: 1px solid #90b9ac55; border-radius: 13px; background: #082d28dd; box-shadow: 0 6px 18px #001b1666; transition: border-color .2s, box-shadow .2s; }
.seat-card.current { border-color: var(--gold); box-shadow: 0 0 22px #f3c96b55; }.seat-card.offline { opacity: .65; }.seat-card .avatar { width: 34px; height: 34px; }.seat-card strong,.seat-card small { display: block; }.seat-card small { color: #a6c2b9; font-size: 10px; }.seat-card .meld-row { grid-column: 1/-1; }
.seat-top { top: 11px; left: 50%; transform: translateX(-50%); }.seat-left { left: 12px; top: 42%; }.seat-right { right: 12px; top: 42%; }
.table-center { position: absolute; inset: 18% 17% 28%; }.rivers { width: 100%; height: 100%; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 4px; }
.river { min-height: 0; padding: 6px; border-radius: 10px; text-align: center; background: #063c32a0; }.river-label { color: #8fb8ac; font-size: 9px; }.river-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.turn-focus { position: absolute; z-index: 2; left: 50%; top: 50%; width: 94px; aspect-ratio: 1; display: grid; place-items: center; align-content: center; transform: translate(-50%,-50%); border: 1px solid #c3dfd655; border-radius: 24px; background: #082d28ed; box-shadow: 0 8px 25px #001b16aa; }.turn-focus strong { color: var(--gold); font-size: 12px; }.turn-focus small { color: #a4bdb5; font-size: 9px; }
.countdown { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 3px; border: 3px solid #4f8174; border-top-color: var(--gold); border-radius: 50%; }.countdown.urgent { border-color: #7e382f; border-top-color: #ff7c67; animation: pulse .7s infinite alternate; }.countdown span { font-weight: 900; }
@keyframes pulse { to { transform: scale(1.08); } }
.actions { position: absolute; z-index: 5; left: 50%; bottom: 138px; display: flex; gap: 8px; transform: translateX(-50%); }.action-button { width: 58px; height: 48px; border: 1px solid #bb9862; border-radius: 14px; color: #f8e7bc; background: linear-gradient(#5a4228,#382b20); font-size: 19px; font-weight: 900; box-shadow: 0 6px 12px #001b1677; }.action-HU { width: 68px; color: white; border-color: #ff9b82; background: linear-gradient(#e85d49,#9f2f29); }.action-PASS { color: #b4c7c0; border-color: #55786f; background: #173c35; }.action-button:disabled { opacity: .45; cursor: not-allowed; }
.reaction-picker { position: absolute; z-index: 8; left: 50%; bottom: 194px; width: max-content; max-width: 85%; padding: 10px; transform: translateX(-50%); border: 1px solid #9bbcb2; border-radius: 14px; background: #062a26f2; }.reaction-picker button { margin: 3px; padding: 8px 12px; border: 1px solid #789e93; border-radius: 9px; color: var(--ink); background: #174b41; }
.self-zone { position: absolute; z-index: 4; left: 12px; right: 12px; bottom: 8px; }.self-info { display: flex; align-items: center; gap: 8px; max-width: 180px; margin-bottom: 5px; }.self-info small { display: block; color: #a9c4ba; }.seat-wind { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #172d28; background: var(--gold); font-weight: 900; }.turn-badge { margin-left: auto; color: var(--gold); font-size: 11px; }
.hand { display: flex; justify-content: center; align-items: flex-end; gap: clamp(1px, .4vw, 4px); min-height: 76px; margin: 0; padding: 0; list-style: none; }.hand li { min-width: 0; }.tile { position: relative; width: clamp(27px, 5.2vw, 49px); height: clamp(58px, 10vw, 78px); display: grid; place-items: center; align-content: center; padding: 3px; border: 0; border-radius: 6px 6px 8px 8px; color: #15221e; background: linear-gradient(100deg,#d6cfb5 0 5%,#fffbee 8% 88%,#c7bfa4 92%); box-shadow: 0 4px 0 #9b937e, 0 6px 10px #001b1677; transition: transform .11s ease, filter .11s; }.tile .tile-symbol { font-family: Georgia,"Noto Serif SC",serif; font-size: clamp(17px, 3.3vw, 29px); font-weight: 900; line-height: 1; }.tile .tile-detail { color: #ba3029; font-size: clamp(8px, 1.5vw, 12px); font-weight: 900; }.tile.dots .tile-symbol { color: #176f9a; }.tile.bamboo .tile-symbol,.tile.honor-green .tile-symbol { color: #168056; }.tile.characters .tile-symbol,.tile.honor-red .tile-symbol { color: #c33e32; }.tile.selected { transform: translateY(-13px); filter: drop-shadow(0 0 7px #ffe387); outline: 3px solid var(--gold); }.tile:disabled { filter: grayscale(.35) brightness(.72); cursor: not-allowed; }.tile-mini { width: 22px; height: 31px; border-radius: 3px; box-shadow: 0 2px 0 #948c79; }.tile-mini .tile-symbol { font-size: 13px; }.tile-mini .tile-detail { font-size: 6px; }
.meld-row { display: flex; gap: 2px; min-height: 18px; }.meld-group { display: flex; gap: 1px; }
.ting-panel { width: max-content; max-width: 90%; margin: -28px auto 7px; padding: 6px 10px; border: 1px solid #d8ba6c88; border-radius: 10px; background: #072923ee; color: #ffe9a9; font-size: 11px; box-shadow: 0 4px 18px #001b1688; }.ting-candidates { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-left: 7px; }.ting-item { white-space: nowrap; }.ting-item b { color: white; }
.settlement { position: absolute; z-index: 15; inset: 0; display: grid; place-items: center; padding: 16px; background: #031815d9; backdrop-filter: blur(5px); }.settlement-card { position: relative; width: min(560px, 94vw); max-height: 92%; overflow: auto; padding: 24px; border: 1px solid #c8a756; border-radius: 24px; text-align: center; background: linear-gradient(160deg,#173f36,#081f1c); box-shadow: 0 24px 80px #000b; }.win-burst { width: 66px; height: 66px; display: grid; place-items: center; margin: -8px auto 12px; border-radius: 50%; color: #fff; background: var(--danger); box-shadow: 0 0 0 8px #e7564522,0 0 35px #e75645aa; font: 900 38px serif; }.settlement-card h2 { margin: 4px 0; font-size: 28px; }.fact-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }.fact-chips span { padding: 5px 9px; border-radius: 999px; color: #f8daa0; background: #8c642d55; font-size: 11px; }.score-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin: 16px 0; }.score-item { padding: 9px 4px; border-radius: 10px; background: #061d1b; }.score-item span,.score-item small { display: block; }.score-item .positive { color: #6be0a7; }.settlement-actions { display: flex; justify-content: center; gap: 8px; }

@media (orientation: portrait) {
  .lobby-grid { grid-template-columns: 1fr; align-content: start; overflow: auto; padding-bottom: 10px; }.mode-card { min-height: 128px; }.room-stage { grid-template-columns: 1fr; overflow: auto; }.room-rules { display: none; }
  .table-page { min-height: 520px; }.table-center { inset: 18% 13% 31%; }.seat-left,.seat-right { top: 35%; }.actions { bottom: 150px; }.self-zone { bottom: 14px; }.ting-panel { margin-top: -42px; }
}
@media (max-height: 430px) and (orientation: landscape) {
  #app-shell { padding-top: max(5px,var(--content-safe-top)); padding-bottom: max(5px,var(--content-safe-bottom)); }.page-header { height: 55px; }.lobby-grid { align-content: stretch; }.mode-card { min-height: 0; height: 220px; }.room-seat { min-height: 80px; }.table-page { border-radius: 16px; }.table-topbar { top: 6px; }.seat-card { padding: 5px 7px; }.seat-top { top: 5px; }.seat-left,.seat-right { top: 36%; }.table-center { inset: 18% 19% 31%; }.actions { bottom: 105px; }.self-zone { bottom: 3px; }.self-info { position: absolute; left: 0; bottom: 4px; }.hand { min-height: 57px; }.tile { width: clamp(25px,4vw,40px); height: clamp(47px,8.2vw,62px); }.tile.selected { transform: translateY(-9px); }.ting-panel { margin: -22px auto 4px; }.settlement-card { padding: 13px; }.win-burst { width: 48px; height: 48px; font-size: 28px; }.settlement-card h2 { font-size: 21px; }.score-grid { margin: 8px 0; }
}
@media (max-width: 420px) { .page-header h1 { font-size: 21px; }.room-seats { grid-template-columns: 1fr; }.room-seat { min-height: 78px; }.tile { width: calc((100vw - 38px)/14); }.seat-card { min-width: 94px; }.seat-card .avatar { display: none; }.table-center { inset-left: 8%; inset-right: 8%; }.score-grid { grid-template-columns: repeat(2,1fr); } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.preview-badge { position: fixed; z-index: 40; top: max(6px,var(--safe-top)); left: max(8px,var(--safe-left)); padding: 5px 9px; border: 1px solid #f3c96b99; border-radius: 999px; color: #ffe39a; background: #4d381ed9; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.review-nav { position: fixed; z-index: 35; right: max(8px,var(--safe-right)); bottom: max(7px,var(--safe-bottom)); display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: calc(100vw - 16px); padding: 5px; border: 1px solid #9bbcb266; border-radius: 12px; background: #041e1be8; backdrop-filter: blur(8px); }
.review-nav strong,.review-nav button { padding: 5px 7px; font-size: 10px; }.review-nav strong { color: var(--gold); }.review-nav button { border: 1px solid #55786f; border-radius: 8px; color: #eef8f3; background: #174b41; }
