:root {
  --ink: #e9efe8;
  --muted: #9caeaa;
  --gold: #d3aa55;
  --gold-soft: #f1d695;
  --deep: #071411;
  --panel: #10241f;
  --table: #163c33;
  --line: rgba(222, 238, 229, .12);
  --red: #d86154;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 40% 10%, #19352e 0, var(--deep) 45%, #050c0a 100%); font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif; overflow-x: hidden; }
button { font: inherit; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .13; pointer-events: none; }
.ambient-a { width: 360px; height: 360px; background: #b38b3d; top: -100px; right: -60px; }
.ambient-b { width: 420px; height: 420px; background: #277d67; left: -160px; bottom: -160px; }
.app-shell { min-height: 100vh; position: relative; z-index: 1; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 4vw; border-bottom: 1px solid var(--line); background: rgba(5, 17, 14, .55); backdrop-filter: blur(18px); }
.lobby-link { height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.03); text-decoration: none; font-size: 12px; font-weight: 700; transition: color .2s, border-color .2s, background .2s; }
.lobby-link:hover { color: var(--gold-soft); border-color: rgba(211,170,85,.45); background: rgba(211,170,85,.08); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(211,170,85,.45); color: var(--gold-soft); font-family: serif; font-size: 24px; transform: rotate(3deg); }
.brand h1 { margin: 0; font-family: serif; font-size: 21px; letter-spacing: .18em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 8px; letter-spacing: .28em; }
.round-meta { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.round-meta span:first-child { color: var(--gold-soft); }
.icon-button, .ghost-button { color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 8px; cursor: pointer; }
.icon-button { width: 40px; height: 40px; font-size: 18px; }
.start-screen { min-height: calc(100vh - 82px); display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(40px, 8vw, 120px); align-items: center; width: min(1120px, 90vw); margin: auto; padding: 70px 0; }
.eyebrow { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .25em; }
.hero-copy h2 { font-family: "Noto Serif SC", SimSun, serif; font-weight: 400; font-size: clamp(42px, 5vw, 72px); line-height: 1.18; margin: 22px 0; letter-spacing: .05em; }
.hero-copy h2 em { color: var(--gold-soft); font-style: normal; }
.hero-description { color: var(--muted); max-width: 500px; line-height: 1.9; }
.setup-card { padding: 34px; background: linear-gradient(145deg, rgba(25,58,49,.92), rgba(10,28,23,.95)); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 25px 70px rgba(0,0,0,.35); }
.setup-card h3 { margin: 0 0 28px; font-size: 21px; }
.setup-card label { display: block; margin: 20px 0 10px; color: var(--muted); font-size: 12px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 10px; background: rgba(0,0,0,.2); }
.segmented button { padding: 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.segmented button.active { color: #172019; background: var(--gold-soft); font-weight: 700; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { text-align: left; min-height: 112px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: rgba(255,255,255,.025); cursor: pointer; }
.mode-card.active { border-color: rgba(211,170,85,.7); background: rgba(211,170,85,.08); }
.mode-icon { display: block; color: var(--gold); font-size: 20px; margin-bottom: 10px; }
.mode-card strong, .mode-card small { display: block; }
.mode-card small { color: var(--muted); line-height: 1.5; margin-top: 5px; font-size: 10px; }
.primary-button { width: 100%; margin-top: 25px; padding: 15px 20px; border: 0; border-radius: 9px; color: #172019; background: linear-gradient(90deg, #e5c77e, #caa04b); font-weight: 800; cursor: pointer; display: flex; justify-content: space-between; }
.scope-note { text-align: center; color: #6f847e; font-size: 10px; margin: 14px 0 0; }

.game-screen { height: calc(100vh - 82px); min-height: 590px; display: grid; grid-template-columns: 1fr 300px; grid-template-rows: minmax(0, 1fr) 132px; overflow: hidden; }
.table-wrap { padding: 18px 28px 0; min-width: 0; min-height: 0; perspective: 1150px; perspective-origin: 50% 46%; overflow: hidden; }
.table { height: 100%; min-height: 0; border: 10px solid #10231f; border-bottom-width: 18px; border-radius: 34px 34px 8px 8px; position: relative; overflow: hidden; transform-style: preserve-3d; background: radial-gradient(ellipse at 50% 45%, #285c55 0%, #1d4641 43%, #122f2d 100%); box-shadow: inset 0 0 100px rgba(0,0,0,.33), 0 22px 0 #07130f, 0 35px 60px rgba(0,0,0,.48); }
.table::before { content: ""; position: absolute; inset: 0; opacity: .28; background-image: linear-gradient(30deg, transparent 48%, rgba(255,255,255,.035) 49%, transparent 51%), linear-gradient(150deg, transparent 48%, rgba(255,255,255,.025) 49%, transparent 51%); background-size: 190px 190px; pointer-events: none; }
.table::after { content: ""; position: absolute; inset: 22px; border: 1px solid rgba(226,240,232,.07); border-radius: 18px; pointer-events: none; }
.tile-walls { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.wall { position: absolute; display: flex; gap: 1px; transform-style: preserve-3d; }
.wall-top { top: 23px; left: 50%; transform: translateX(-50%) perspective(400px) rotateX(-12deg); }
.wall-bottom { bottom: 18px; left: 50%; transform: translateX(-50%) perspective(400px) rotateX(12deg); }
.wall-left { left: 28px; top: 50%; transform: translateY(-50%) rotate(90deg) perspective(400px) rotateX(-10deg); }
.wall-right { right: 28px; top: 50%; transform: translateY(-50%) rotate(90deg) perspective(400px) rotateX(10deg); }
.wall-piece { width: 18px; height: 29px; border: 1px solid #d7b15f; border-radius: 2px; background: linear-gradient(90deg,#f0bc50 0 72%,#bc7921 73%); box-shadow: 0 3px 0 #8b531c, 0 5px 4px rgba(0,0,0,.4); }
.opponent { position: absolute; z-index: 2; text-align: center; }
.opponent.top { top: 64px; left: 50%; transform: translateX(-50%) scale(.88); }
.opponent.left { left: 45px; top: 47%; transform: translateY(-50%) rotate(90deg) scale(.82); }
.opponent.right { right: 45px; top: 47%; transform: translateY(-50%) rotate(-90deg) scale(.82); }
.opponent-info { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; color: var(--muted); background: rgba(5,19,15,.75); border-radius: 20px; font-size: 10px; }
.opponent-info b { color: var(--ink); }
.opponent-info em { font-style: normal; }
.riichi-state { padding: 2px 7px; border-radius: 999px; color: #fff6d2; background: #b53d32; box-shadow: 0 0 14px rgba(221,73,57,.65); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.opponent-riichi .opponent-info { border: 1px solid rgba(234,84,67,.62); box-shadow: 0 0 0 3px rgba(202,55,44,.1),0 0 22px rgba(224,62,48,.25); }
.concealed-hand { display: flex; margin-top: 8px; justify-content: center; }
.back-tile { width: 17px; height: 27px; margin-left: -2px; border-radius: 2px; border: 1px solid #b47b2b; background: linear-gradient(90deg,#e9ad3f 0 72%,#a8641e 73%); box-shadow: 0 3px 0 #754719, 0 5px 4px rgba(0,0,0,.34); }
.table-center { position: absolute; left: 50%; top: 44%; transform: translate(-50%,-50%) perspective(420px) rotateX(8deg); display: grid; place-items: center; z-index: 2; }
.center-mark { width: 88px; height: 88px; display: grid; place-items: center; border: 3px solid #0a1816; background: linear-gradient(145deg,#102825,#071411); transform: rotate(45deg); box-shadow: 6px 7px 0 #07100e, 10px 12px 20px rgba(0,0,0,.35), inset 0 0 0 1px rgba(211,170,85,.36); }
.center-mark > * { transform: rotate(-45deg); grid-area: 1/1; }
.center-mark b { color: var(--gold-soft); font-family: serif; font-size: 18px; margin-top: -20px; }
.center-mark span { color: var(--muted); font-size: 10px; margin-top: 24px; }
.dora-panel { position: absolute; left: 3%; top: 3%; z-index: 6; min-width: 58px; padding: 7px 8px 5px; color: var(--muted); font-size: 9px; text-align: center; border: 1px solid rgba(222,238,229,.12); border-radius: 8px; background: rgba(5,19,15,.78); box-shadow: 0 6px 18px rgba(0,0,0,.24); }
.mini-tile { margin: 5px auto; }
.coach-panel { grid-column: 2; grid-row: 1/3; padding: 25px 22px; border-left: 1px solid var(--line); background: rgba(8,24,20,.88); }
.coach-heading { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.coach-heading small { color: var(--gold); letter-spacing: .18em; font-size: 9px; }
.coach-heading h3 { margin: 7px 0 0; font-size: 17px; }
.ai-dot { display: inline-block; width: 6px; height: 6px; background: #6fd4aa; box-shadow: 0 0 8px #6fd4aa; border-radius: 50%; margin-right: 7px; }
.ghost-button { padding: 6px 9px; font-size: 10px; }
.coach-lead { color: var(--muted); line-height: 1.7; font-size: 12px; }
.recommendation { padding: 13px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 40px 1fr; gap: 10px; }
.recommendation .tile { width: 38px; height: 52px; font-size: 15px; cursor: default; }
.rec-title { display: flex; justify-content: space-between; font-size: 11px; }
.rec-title b { color: var(--gold-soft); }
.rec-stats { display: flex; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.rec-bar { height: 3px; background: rgba(255,255,255,.08); margin-top: 8px; }
.rec-bar span { display: block; height: 100%; background: var(--gold); }
.player-zone { grid-column: 1; padding: 7px 32px 12px; background: linear-gradient(180deg, rgba(9,25,21,.92), #071510); border-top: 1px solid var(--line); position: relative; }
.player-status { display: flex; align-items: center; gap: 9px; position: absolute; left: 30px; top: 20px; }
.avatar { width: 35px; height: 35px; border: 1px solid rgba(211,170,85,.4); display: grid; place-items: center; color: var(--gold-soft); border-radius: 50%; font-size: 11px; }
.player-status strong, .player-status span { display: block; font-size: 10px; }
.player-status span { color: var(--muted); margin-top: 2px; }
.player-status .riichi-badge { color: #fff; background: var(--red); padding: 2px 6px; border-radius: 2px; margin-left: 5px; }
.message-bar { text-align: center; color: var(--muted); font-size: 11px; min-height: 22px; }
.hand { min-height: 70px; display: flex; justify-content: center; align-items: flex-end; gap: 3px; padding-top: 5px; overflow-x: auto; perspective: 700px; transform-style: preserve-3d; }
.tile { width: clamp(36px, 4.1vw, 50px); height: clamp(52px, 5.8vw, 69px); border: 1px solid #c7c5b7; border-radius: 5px; position: relative; display: grid; place-items: center; color: #17231e; background: linear-gradient(135deg, #fffef5 0 70%, #ddd9c8 100%); box-shadow: 0 5px 0 #bd8d3e, 0 8px 0 #71471f, 0 11px 13px rgba(0,0,0,.3); font-family: "Noto Serif SC", SimSun, serif; font-weight: 800; font-size: clamp(14px, 1.6vw, 20px); cursor: pointer; transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .16s ease, filter .16s ease; flex: 0 0 auto; }
.tile:hover { transform: translateY(-12px) rotateX(-4deg); filter: brightness(1.05); box-shadow: 0 5px 0 #d0a654, 0 8px 0 #71471f, 0 17px 18px rgba(0,0,0,.34); }
.tile.suit-m { color: #b84135; }
.tile.suit-p { color: #28628a; }
.tile.suit-s { color: #287256; }
.tile.suit-z { color: #242c29; }
.tile.red { color: #d9473d; }
.tile.recommended::after { content: "AI"; position: absolute; top: -9px; right: -5px; font: 700 7px sans-serif; color: #172019; background: var(--gold-soft); padding: 2px 3px; border-radius: 3px; }
.tile.drawn { margin-left: 8px; }
.tile.tile-arrive { animation: tile-arrive .24s cubic-bezier(.2,.75,.2,1) both; }
.hand .tile.drawn { animation: draw-in .34s cubic-bezier(.18,.8,.2,1) both; }
.hand-lock .tile { pointer-events: none; }
@keyframes tile-arrive { from { opacity: 0; transform: translateY(-8px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes draw-in { from { opacity: 0; transform: translate(70px,-70px) rotate(8deg) scale(.75); } to { opacity: 1; transform: none; } }
@keyframes discard-in { from { opacity: .68; transform: translateY(18px) scale(1.05); } to { opacity: 1; transform: none; } }
.action-dock { position: absolute; right: 28px; top: -104px; z-index: 18; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding: 10px; border: 1px solid rgba(238,204,126,.35); border-radius: 14px; background: linear-gradient(145deg,rgba(5,22,18,.94),rgba(2,11,9,.96)); box-shadow: 0 14px 38px rgba(0,0,0,.52),inset 0 1px 0 rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.action-dock:not(:has(.action-button:not(.hidden))) { display: none; }
.action-row { display: flex; justify-content: flex-end; align-items: stretch; gap: 8px; }
.action-button { min-width: 84px; height: 58px; padding: 8px 14px 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #f5ead0; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: linear-gradient(180deg,#29453d,#132a24); box-shadow: 0 5px 0 #081a15,0 9px 18px rgba(0,0,0,.34); cursor: pointer; font-size: 20px; font-weight: 900; line-height: 1; text-shadow: 0 2px 5px rgba(0,0,0,.45); animation: action-pop .28s cubic-bezier(.15,.85,.2,1) both; transition: transform .15s ease,filter .15s ease,box-shadow .15s ease; }
.action-button::after { content: attr(data-action-en); margin-top: 5px; font: 700 8px/1 sans-serif; letter-spacing: .16em; opacity: .72; }
.action-button:hover { transform: translateY(-4px); filter: brightness(1.13); box-shadow: 0 6px 0 #081a15,0 14px 22px rgba(0,0,0,.42); }
.action-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #081a15,0 5px 10px rgba(0,0,0,.34); }
.action-button.win { color: #192219; border-color: #ffe7a5; background: linear-gradient(180deg,#ffe39a,#d2a83e); box-shadow: 0 5px 0 #7a5819,0 0 22px rgba(242,197,88,.32); }
.action-button.riichi-action { color: #fff8e5; border-color: #ff8a76; background: linear-gradient(180deg,#d64a3e,#8d211d); box-shadow: 0 5px 0 #4e1210,0 0 24px rgba(224,55,46,.45); }
.action-button.pon-action { color: #e9fbff; border-color: #68cfe0; background: linear-gradient(180deg,#218ba2,#145267); box-shadow: 0 5px 0 #092e39,0 0 20px rgba(45,174,203,.32); }
.action-button.kan-action { color: #f7efff; border-color: #bb91eb; background: linear-gradient(180deg,#7650a5,#422d68); box-shadow: 0 5px 0 #241638,0 0 20px rgba(143,91,197,.34); }
.action-button.skip-action { min-width: 68px; color: #aebdb7; background: linear-gradient(180deg,#25342f,#17231f); box-shadow: 0 5px 0 #09120f; font-size: 14px; }
.call-choices { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin: 0; }
.call-choices.hidden { display: none; }
.chi-choice { width: auto; min-width: 146px; height: 48px; padding: 7px 12px; color: #fff4d6; border-color: #e6a65e; background: linear-gradient(180deg,#ad6b2e,#704019); box-shadow: 0 5px 0 #3c210b,0 0 20px rgba(205,128,47,.3); font-size: 13px; }
@keyframes action-pop { from { opacity: 0; transform: translateY(18px) scale(.82); } to { opacity: 1; transform: none; } }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(2,8,6,.78); backdrop-filter: blur(8px); }
.modal-card { width: min(430px, 90vw); padding: 40px; border: 1px solid rgba(211,170,85,.35); border-radius: 18px; background: linear-gradient(145deg,#173a30,#0a1d18); box-shadow: 0 30px 100px #000; text-align: center; }
.modal-card h2 { margin: 15px 0 10px; color: var(--gold-soft); font-family: serif; font-size: 38px; }
.modal-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.result-stats { display: flex; justify-content: center; gap: 25px; margin: 25px 0 0; }
.result-stats div { font-size: 11px; color: var(--muted); }
.result-stats b { display: block; margin-top: 5px; color: var(--ink); font-size: 18px; }

@media (max-width: 850px) {
  .start-screen { grid-template-columns: 1fr; }
  .game-screen { grid-template-columns: 1fr; }
  .coach-panel { grid-column: 1; grid-row: auto; max-height: 220px; overflow-y: auto; border-left: 0; border-top: 1px solid var(--line); }
  .player-zone { grid-column: 1; }
  .table-wrap { padding: 12px 10px 0; }
  .game-screen { height: auto; min-height: calc(100vh - 82px); grid-template-rows: auto; overflow: visible; }
  .table { min-height: 430px; }
  .player-status { position: static; margin-bottom: 4px; }
  .round-meta .honba { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 15px; }
  .lobby-link { width: 40px; padding: 0; }
  .lobby-link span { display: none; }
  .start-screen { padding: 35px 0; }
  .setup-card { padding: 22px; }
  .hero-copy h2 { font-size: 38px; }
  .opponent.left { left: 8px; }
  .opponent.right { right: 8px; }
  .wall-left { left: 10px; }
  .wall-right { right: 10px; }
  .player-zone { padding: 10px 8px 18px; }
  .hand { gap: 1px; justify-content: flex-start; }
  .tile { width: 31px; height: 46px; font-size: 13px; }
}

/* Win announcement and score movement */
.table-callout { position: absolute; inset: 0; z-index: 12; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, rgba(9,24,20,.18), rgba(3,11,9,.72)); pointer-events: none; animation: callout-fade 1.05s ease both; }
.table-callout::before, .table-callout::after { content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 1px; background: linear-gradient(90deg,transparent,var(--gold-soft),transparent); animation: callout-line .7s ease both; }
.table-callout strong { color: #fff2c7; font-family: "Noto Serif SC", SimSun, serif; font-size: clamp(52px,8vw,94px); letter-spacing: .2em; text-indent: .2em; text-shadow: 0 0 22px rgba(236,194,105,.8), 0 6px 20px #000; animation: callout-title .55s cubic-bezier(.15,.8,.2,1) both; }
.action-callout { background: radial-gradient(circle,rgba(69,42,10,.12),rgba(3,11,9,.55)); }
.action-callout strong { font-size: clamp(42px,6vw,74px); }
.riichi-callout { background: linear-gradient(90deg,transparent 0 8%,rgba(103,15,14,.88) 24% 76%,transparent 92%),radial-gradient(circle,transparent,rgba(3,8,7,.75)); }
.riichi-callout strong { color: #fff8dd; text-shadow: 0 0 12px #fff,0 0 32px #e33127,0 6px 20px #000; animation: riichi-strike .55s cubic-bezier(.12,.8,.2,1) both; }
.riichi-callout::before,.riichi-callout::after { background: linear-gradient(90deg,transparent,#ff594b,#fff7c9,#ff594b,transparent); height: 2px; box-shadow: 0 0 12px #ef3f34; }
@keyframes riichi-strike { 0% { opacity: 0; transform: scale(2.1) skewX(-12deg); filter: blur(8px); } 55% { opacity: 1; transform: scale(.92); filter: none; } 100% { transform: scale(1); } }
.table-callout span { margin-top: 12px; color: var(--ink); font-size: 16px; letter-spacing: .18em; }
@keyframes callout-title { from { opacity: 0; transform: scale(1.7); filter: blur(6px); } to { opacity: 1; transform: scale(1); filter: none; } }
@keyframes callout-line { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
@keyframes callout-fade { 0%,75% { opacity: 1; } 100% { opacity: 0; } }
.table.win-freeze .seat-river,.table.win-freeze .tile-walls,.table.win-freeze .table-center { transition: filter .35s ease,opacity .35s ease; filter: brightness(.42) saturate(.7); opacity: .62; }
.win-callout { overflow: hidden; animation: win-stage-in .38s ease-out both; transition: opacity .38s ease,filter .38s ease,transform .38s ease; }
.win-callout::before { inset: 0; left: 0; right: 0; top: 0; height: auto; background: repeating-linear-gradient(110deg,transparent 0 34px,rgba(255,255,255,.035) 35px 36px); animation: win-speed-lines .8s ease-out both; }
.win-callout::after { left: 8%; right: 8%; top: 50%; height: 2px; background: linear-gradient(90deg,transparent,#fff3bc,transparent); box-shadow: 0 0 18px rgba(242,205,123,.85); animation: callout-line .65s ease both; }
.win-callout strong { font-size: clamp(66px,9vw,112px); letter-spacing: .18em; color: #fff3bd; text-shadow: 0 0 8px #fff,0 0 28px rgba(234,192,95,.9),0 9px 30px #000; animation: win-method-strike .72s cubic-bezier(.12,.82,.18,1) both; }
.win-callout span { padding: 7px 16px; border-radius: 999px; color: #fff7db; background: rgba(2,10,8,.72); font-size: clamp(14px,1.6vw,19px); font-weight: 800; text-shadow: 0 2px 8px #000; animation: win-name-in .5s .32s ease both; }
.winner-emblem { width: 112px; height: 112px; margin: 0 auto 12px; display: grid; place-items: center; border: 2px solid #fff0b7; border-radius: 50%; background: radial-gradient(circle,#f4d88c 0 34%,#9b7029 36% 42%,#10231d 44%); box-shadow: 0 0 0 9px rgba(246,210,117,.1),0 0 42px rgba(244,198,86,.72); animation: winner-emblem-in .72s cubic-bezier(.12,.82,.18,1) both; }
.winner-emblem b,.winner-emblem small { grid-area: 1/1; }
.winner-emblem b { color: #172019; font-family: "Noto Serif SC",serif; font-size: 42px; transform: translateY(-7px); }
.winner-emblem small { align-self: end; margin-bottom: 13px; color: #fff6d8; font-size: 12px; font-weight: 900; text-shadow: 0 2px 7px #000; }
.win-seat-top .winner-emblem { --winner-from-x: 0px; --winner-from-y: -90px; }
.win-seat-bottom .winner-emblem { --winner-from-x: 0px; --winner-from-y: 90px; }
.win-seat-left .winner-emblem { --winner-from-x: -120px; --winner-from-y: 0px; }
.win-seat-right .winner-emblem { --winner-from-x: 120px; --winner-from-y: 0px; }
.win-ron { background: radial-gradient(circle at 50% 50%,rgba(161,38,29,.78),rgba(14,8,7,.9) 58%,rgba(2,7,6,.96)); }
.win-tsumo { background: radial-gradient(circle at 50% 50%,rgba(32,121,104,.72),rgba(7,24,20,.92) 58%,rgba(2,7,6,.96)); }
.win-draw { background: radial-gradient(circle,rgba(87,93,80,.4),rgba(2,7,6,.94)); }
.win-seat-top { background-position: center top; }
.win-seat-bottom { background-position: center bottom; }
.win-seat-left { background-position: left center; }
.win-seat-right { background-position: right center; }
.win-callout-leaving { opacity: 0; filter: blur(5px); transform: scale(1.035); }
.opponent.winning-seat-focus { z-index: 14; }
.opponent.winning-seat-focus .opponent-info { color: #fff9df; border: 2px solid #f1d080; background: rgba(77,47,12,.92); box-shadow: 0 0 0 6px rgba(241,208,128,.12),0 0 34px rgba(244,196,88,.75); animation: winner-seat-pulse .7s ease-in-out infinite alternate; }
.player-zone.winning-seat-focus { z-index: 13; box-shadow: inset 0 3px 0 #efd17d,0 -12px 35px rgba(234,184,74,.35); animation: winner-zone-pulse .7s ease-in-out infinite alternate; }
.modal.result-reveal { animation: result-modal-in .5s cubic-bezier(.16,.82,.2,1) both; }
@keyframes win-stage-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes win-speed-lines { from { opacity: 0; transform: translateX(-80px); } to { opacity: 1; transform: none; } }
@keyframes win-method-strike { 0% { opacity: 0; transform: scale(2.4) rotate(-3deg); filter: blur(10px); } 55% { opacity: 1; transform: scale(.9); filter: none; } 100% { transform: scale(1); } }
@keyframes win-name-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes winner-emblem-in { 0% { opacity: 0; transform: translate(var(--winner-from-x,0),var(--winner-from-y,40px)) scale(.35) rotate(-18deg); } 62% { opacity: 1; transform: translate(0,0) scale(1.12) rotate(3deg); } 100% { transform: none; } }
@keyframes winner-seat-pulse { to { transform: scale(1.08); filter: brightness(1.2); } }
@keyframes winner-zone-pulse { to { filter: brightness(1.16); } }
@keyframes result-modal-in { from { opacity: 0; transform: scale(1.07); } to { opacity: 1; transform: none; } }

.settlement-card { width: min(620px,94vw); min-height: 550px; padding: 34px 42px 30px; position: relative; overflow: hidden; text-align: left; }
.settlement-glow { position: absolute; width: 340px; height: 340px; left: -100px; top: -150px; border-radius: 50%; background: rgba(218,175,83,.16); filter: blur(50px); pointer-events: none; }
.settlement-phase { position: relative; z-index: 1; animation: phase-in .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes phase-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.win-heading { display: flex; align-items: center; gap: 16px; margin: 13px 0 18px; }
.result-point-hero { margin-left: auto; color: #ffe39a; font-family: "Noto Serif SC",serif; font-size: clamp(22px,3vw,34px); text-shadow: 0 0 18px rgba(236,194,105,.42); white-space: nowrap; }
.result-reason { margin: 10px 0 4px; color: var(--gold-soft); font-size: 11px; letter-spacing: .06em; }
.winner-seat { flex: 0 0 auto; width: 54px; height: 54px; display: grid; place-items: center; color: #172019; background: var(--gold-soft); border-radius: 50%; font-weight: 900; box-shadow: 0 0 0 5px rgba(241,214,149,.1), 0 8px 20px rgba(0,0,0,.28); }
.settlement-card .win-heading h2 { margin: 0; font-size: 31px; }
.win-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.settlement-hand { display: flex; align-items: flex-end; justify-content: center; min-height: 71px; gap: 2px; padding: 13px 8px 16px; border-radius: 10px; background: rgba(0,0,0,.2); overflow-x: auto; }
.settlement-hand .tile { width: 32px; height: 45px; padding: 0; animation: result-tile-in .35s cubic-bezier(.2,.8,.2,1) both; }
.settlement-hand .tile.winning-tile { margin-left: 7px; box-shadow: 0 4px 0 #b68439, 0 0 0 2px var(--gold-soft), 0 0 16px rgba(241,214,149,.58); }
.settlement-melds { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0; }
.settlement-melds > span { color: var(--muted); font-size: 9px; letter-spacing: .15em; }
@keyframes result-tile-in { from { opacity: 0; transform: translateY(-18px) rotate(3deg); } to { opacity: 1; transform: none; } }
.human-payment-notice { margin: 14px 0 0; padding: 11px 14px; border-radius: 8px; text-align: center; font-weight: 800; font-size: 13px; }
.human-payment-notice.pay { color: #ffc1b8; background: rgba(191,67,55,.17); border: 1px solid rgba(216,97,83,.28); }
.human-payment-notice.gain { color: #b9f2d7; background: rgba(57,150,111,.16); border: 1px solid rgba(91,194,148,.25); }
.human-payment-notice.neutral { color: var(--muted); background: rgba(255,255,255,.04); }
.settlement-card #resultText { text-align: center; margin: 12px 0 3px; color: var(--gold-soft); font-weight: 800; }
.yaku-heading { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; color: var(--ink); }
.yaku-heading strong { font-size: 13px; letter-spacing: .12em; }
.yaku-heading span { color: var(--gold-soft); font-size: 11px; }
.settlement-card .yaku-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; max-height: 128px; margin-top: 10px; }
.settlement-card .result-stats { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.settlement-next { position: relative; z-index: 2; margin-top: 19px; }

.score-phase > h2 { margin: 12px 0 18px; font-size: 30px; color: var(--gold-soft); font-family: "Noto Serif SC", SimSun, serif; text-align: center; }
.score-transfers { display: grid; gap: 8px; margin-bottom: 18px; }
.score-transfer { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0,0,0,.15); overflow: hidden; font-size: 11px; }
.score-transfer .from { text-align: right; color: #e08a7f; }
.score-transfer .to { color: #83d6ad; }
.score-transfer strong { color: var(--gold-soft); }
.score-transfer::after { content: ""; position: absolute; width: 8px; height: 8px; left: 30%; top: calc(50% - 4px); border-radius: 50%; background: var(--gold-soft); box-shadow: 0 0 10px var(--gold-soft); animation: score-orb 1s cubic-bezier(.4,0,.2,1) both; animation-delay: var(--delay,0ms); }
@keyframes score-orb { 0% { left: 30%; opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { left: 68%; opacity: 0; } }
.score-comparison { display: grid; gap: 7px; }
.score-row { display: grid; grid-template-columns: 34px 72px 1fr 78px; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px; background: rgba(255,255,255,.035); opacity: 0; animation: score-row-in .35s ease forwards; animation-delay: var(--delay,0ms); }
@keyframes score-row-in { to { opacity: 1; transform: none; } from { opacity: 0; transform: translateX(-12px); } }
.score-row.winner { background: rgba(211,170,85,.12); box-shadow: inset 3px 0 0 var(--gold); }
.score-rank { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: rgba(0,0,0,.2); font-size: 10px; }
.score-row.winner .score-rank { color: #172019; background: var(--gold-soft); }
.score-name { font-size: 12px; }
.score-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.score-bar i { display: block; height: 100%; width: var(--width); background: linear-gradient(90deg,#3f8b71,var(--gold)); animation: score-bar-grow .8s cubic-bezier(.2,.8,.2,1) both; transform-origin: left; }
@keyframes score-bar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.score-numbers { text-align: right; }
.score-numbers b { display: block; color: var(--ink); font-size: 13px; }
.score-numbers span { font-size: 10px; }
.score-numbers .positive { color: #65c99a; }
.score-numbers .negative { color: #df8075; }

@media (max-width: 560px) {
  .settlement-card { padding: 26px 18px 20px; min-height: 520px; }
  .settlement-card .yaku-list { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 30px 62px 1fr 68px; }
}

/* Standard tile artwork and four-seat rivers */
.match-select { grid-template-columns: repeat(3, 1fr); }
.tile { padding: 3px; line-height: 1; overflow: visible; }
.tile-svg { display: block; width: 94%; height: 94%; }
.tile-face-image { display: block; width: 100%; height: 100%; object-fit: fill; border-radius: 3px; pointer-events: none; user-select: none; }
.man-face { height: 92%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #252b29; font-family: "Noto Serif SC", SimSun, serif; }
.man-face b { font-size: 1.18em; font-weight: 800; }
.man-face i { color: #b73d35; font-size: .72em; font-style: normal; font-weight: 900; margin-top: 2px; }
.honor-face { font-family: "Noto Serif SC", SimSun, serif; font-size: 1.45em; font-weight: 900; color: #202725; }
.honor-face.green-honor { color: #247451; }
.honor-face.red-honor { color: #bd3d35; }
.honor-face.white-honor { width: 58%; height: 68%; font-size: 0; border: 3px double #47738b; border-radius: 2px; }
.tile.compact { width: 27px; height: 38px; padding: 2px; border-radius: 3px; box-shadow: 0 3px 0 #b68439, 0 5px 0 #69431f, 0 6px 8px rgba(0,0,0,.3); font-size: 11px; }
.tile.compact:hover { transform: none; filter: none; }
.tile.compact .honor-face { font-size: 17px; }
.tile.compact .man-face b { font-size: 13px; }
.tile.compact .man-face i { font-size: 8px; }
.rivers { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.seat-river { position: absolute; display: grid; grid-template-columns: repeat(6, 27px); grid-auto-rows: 38px; gap: 2px; transform-style: preserve-3d; }
.river-bottom { left: 50%; bottom: 58px; transform: translateX(-50%) perspective(500px) rotateX(12deg); }
.river-top { left: 50%; top: 115px; transform: translateX(-50%) rotate(180deg) perspective(500px) rotateX(10deg); }
.river-left { left: 118px; top: 47%; transform: translateY(-50%) rotate(90deg) perspective(500px) rotateX(10deg); }
.river-right { right: 118px; top: 47%; transform: translateY(-50%) rotate(-90deg) perspective(500px) rotateX(10deg); }
.seat-river .latest-discard { box-shadow: 0 3px 0 #b68439, 0 0 0 2px var(--gold-soft), 0 0 13px rgba(241,214,149,.7); }
.seat-river .discard-enter { animation: discard-in .22s cubic-bezier(.2,.75,.25,1) both; }
.seat-river .riichi-discard { transform: rotate(90deg); margin: 0 6px; box-shadow: 0 3px 0 #b68439,0 0 0 2px #ec594a,0 0 14px rgba(236,72,58,.55); }
.melds-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.seat-melds { position: absolute; display: flex; gap: 8px; align-items: flex-end; }
.melds-bottom { left: 24px; bottom: 24px; }
.melds-top { right: 24px; top: 92px; transform: rotate(180deg); }
.melds-left { left: 76px; bottom: 64px; transform-origin: left bottom; transform: rotate(90deg); }
.melds-right { right: 76px; top: 64px; transform-origin: right top; transform: rotate(-90deg); }
.meld-group { display: flex; align-items: flex-end; padding: 3px 4px; border-radius: 5px; background: rgba(3,12,9,.58); box-shadow: 0 5px 12px rgba(0,0,0,.28); animation: meld-open .36s cubic-bezier(.15,.8,.2,1) both; }
.meld-tile-slot { width: 22px; height: 31px; display: grid; place-items: end center; flex: 0 0 auto; }
.meld-group .tile.compact { width: 22px; height: 31px; margin: 0; }
.meld-tile-slot.called-tile-slot { width: 33px; }
.meld-tile-slot.called-tile-slot .tile { transform: rotate(90deg); transform-origin: center; }
.settlement-meld .meld-tile-slot { width: 27px; height: 38px; }
.settlement-meld .meld-tile-slot.called-tile-slot { width: 40px; }
.settlement-meld .tile.compact { width: 27px; height: 38px; }
.settlement-meld { animation: none; background: rgba(0,0,0,.18); }
@keyframes meld-open { from { opacity: 0; transform: translateY(18px) scale(.86); } to { opacity: 1; transform: none; } }
.yaku-list { margin: 18px 0 6px; max-height: 210px; overflow-y: auto; border-top: 1px solid var(--line); }
.yaku-list > div { display: flex; justify-content: space-between; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 12px; }
.yaku-list b { color: var(--gold-soft); }
.modal-card { max-height: 90vh; overflow-y: auto; }
.result-stats { flex-wrap: wrap; }

@media (max-width: 850px) {
  .river-left { left: 76px; }
  .river-right { right: 76px; }
  .river-top { top: 105px; }
  .melds-left { left: 42px; }
  .melds-right { right: 42px; }
  .action-dock { right: 10px; top: -96px; padding: 8px; }
  .action-button { min-width: 76px; height: 54px; font-size: 18px; }
}

@media (max-width: 560px) {
  .game-screen { min-height: calc(100svh - 64px); }
  .topbar { height: 64px; padding: 0 8px; position: relative; }
  .topbar .brand { position: absolute; left: 50%; transform: translateX(-50%); gap: 7px; white-space: nowrap; }
  .topbar .brand-mark { width: 38px; height: 38px; font-size: 20px; }
  .topbar .brand h1 { font-size: 18px; letter-spacing: .1em; }
  .topbar .brand p { display: none; }
  .topbar .round-meta { display: none; }
  .topbar .icon-button { margin-left: auto; width: 38px; height: 38px; }
  .table-wrap { padding: 6px 5px 0; }
  .table { height: min(112vw, 520px); min-height: 405px; border-width: 6px 6px 12px; border-radius: 22px 22px 7px 7px; }
  .table::after { inset: 2.5%; }
  .dora-panel { left: 2.5%; top: 2.5%; min-width: 50px; padding: 5px 5px 3px; font-size: 8px; }
  .dora-panel .mini-tile { margin: 3px auto 0; }
  .table-center { top: 45%; }
  .center-mark { width: clamp(58px,18vw,72px); height: clamp(58px,18vw,72px); }
  .center-mark b { font-size: 14px; margin-top: -15px; }
  .center-mark span { font-size: 9px; margin-top: 19px; }
  .opponent.top { top: 7%; max-width: 62%; }
  .opponent.left { left: 1.5%; top: 49%; }
  .opponent.right { right: 1.5%; top: 49%; }
  .opponent-info { padding: 3px 6px; gap: 4px; font-size: 8px; }
  .concealed-hand { margin-top: 5px; }
  .back-tile { width: clamp(12px,3.5vw,15px); height: clamp(20px,5.4vw,24px); }
  .wall-top { top: 2.5%; }
  .wall-bottom { bottom: 2.5%; }
  .wall-left { left: 2.5%; }
  .wall-right { right: 2.5%; }
  .wall-piece { width: clamp(12px,3.5vw,16px); height: clamp(20px,5.6vw,26px); }
  .tile.compact { width: clamp(17px,5vw,21px); height: clamp(25px,7.1vw,30px); padding: 1px; }
  .seat-river { grid-template-columns: repeat(6, clamp(17px,5vw,21px)); grid-auto-rows: clamp(25px,7.1vw,30px); gap: 1px; }
  .river-left { left: 12%; top: 49%; }
  .river-right { right: 12%; top: 49%; }
  .river-bottom { bottom: 12%; }
  .river-top { top: 22%; }
  .melds-bottom { left: 2.5%; bottom: 3%; }
  .melds-top { right: 2.5%; top: 16%; }
  .melds-left { left: 6%; bottom: 12%; }
  .melds-right { right: 6%; top: 12%; }
  .meld-group { gap: 0; padding: 2px; }
  .meld-tile-slot { width: 18px; height: 26px; }
  .meld-group .tile.compact { width: 18px; height: 26px; }
  .meld-tile-slot.called-tile-slot { width: 27px; }
  .player-zone { padding: 7px 5px max(12px,env(safe-area-inset-bottom)); }
  .player-status { display: none; }
  .message-bar { min-height: 18px; font-size: 10px; }
  .hand { min-height: 54px; gap: 1px; justify-content: center; padding-top: 2px; overflow: visible; }
  .hand .tile { width: clamp(24px,6.45vw,29px); height: clamp(36px,9.35vw,43px); padding: 2px; font-size: 11px; border-radius: 3px; box-shadow: 0 3px 0 #bd8d3e,0 5px 0 #71471f,0 7px 8px rgba(0,0,0,.3); }
  .hand .tile.drawn { margin-left: 3px; }
  .win-heading { flex-wrap: wrap; }
  .result-point-hero { width: 100%; margin-left: 0; text-align: center; }
  .action-dock { right: 50%; top: -132px; width: calc(100vw - 16px); max-width: 430px; transform: translateX(50%); align-items: stretch; }
  .action-row { flex-wrap: wrap; justify-content: center; }
  .call-choices { justify-content: center; }
  .action-button { min-width: 68px; height: 50px; padding: 6px 10px; font-size: 17px; }
  .chi-choice { min-width: 136px; }
}
