/* 趣味麻将 · 样式 */
:root {
  --S: 640px; --tw: 52px; --mtw: 38px; --rtw: 30px; --otw: 22px; --board-top: 48px; --myH: 90px;
  --cal: 'Ma Shan Zheng', 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
  --ui: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Noto Sans SC', sans-serif;
  --app-w: 100vw; --app-h: 100vh;
  --gold: #f3c969; --gold2: #d9a441; --ink: #1d2433; --red: #c3262b; --paper: #fbf5e6;
  --felt1: #1f7a57; --felt2: #0f4a35; --felt3: #0a2f22; --rim: #5a3418;
  --back1: #2ea57a; --back2: #1a7553; --back3: #0f4e37;
  --glass: rgba(8, 22, 17, .62); --line: rgba(255, 220, 150, .22); --text: #f7f1e1; --muted: rgba(247, 241, 225, .65);
}
body.theme-blue { --felt1: #22608f; --felt2: #123b5c; --felt3: #0a2238; }
body.theme-red { --felt1: #8a2a35; --felt2: #561821; --felt3: #330c12; }
body.theme-dark { --felt1: #3a3f4a; --felt2: #22252c; --felt3: #121418; }
body.theme-purple { --felt1: #5b3b8c; --felt2: #352258; --felt3: #1d1233; }
body.back-blue { --back1: #3d7be0; --back2: #2557a8; --back3: #173b75; }
body.back-orange { --back1: #f0913a; --back2: #c2661c; --back3: #8a4410; }
body.back-pink { --back1: #ec6f9b; --back2: #c04471; --back3: #87284b; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--ui); color: var(--text); background: var(--felt3);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, var(--felt1) 0%, var(--felt2) 55%, var(--felt3) 100%); }
.screen::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px), radial-gradient(rgba(0,0,0,.25) 1px, transparent 1px);
  background-size: 5px 5px, 7px 7px; background-position: 0 0, 2px 3px; }
.screen.active { display: flex; animation: screenIn .35s ease; }
@keyframes screenIn { from { transform: scale(1.012); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ───────── 牌 ───────── */
.tile {
  --w: var(--tw); position: relative; flex: none; width: var(--w); height: calc(var(--w) * 1.34);
  border-radius: calc(var(--w) * .13);
  background: linear-gradient(172deg, #fffef9 0%, #f8f1df 62%, #ebe0c4 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 3px rgba(150, 120, 60, .18),
    0 calc(var(--w) * .085) 0 var(--back2), 0 calc(var(--w) * .085 + 1px) 0 var(--back3),
    0 calc(var(--w) * .12) calc(var(--w) * .16) rgba(0, 0, 0, .42);
  margin-bottom: calc(var(--w) * .09);
}
.tile .face { position: absolute; inset: 7% 8% 5%; }
.tile .face svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tile.back {
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 3px, transparent 3px 7px), linear-gradient(160deg, var(--back1), var(--back2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 0 0 1px rgba(0,0,0,.08), 0 calc(var(--w) * .085) 0 #e6d9b8, 0 calc(var(--w) * .085 + 1px) 0 #b8a67c, 0 calc(var(--w) * .12) calc(var(--w) * .16) rgba(0,0,0,.42);
}
.tile.back.stand { height: calc(var(--w) * 1.25); }
.tile.mini { --w: 15px !important; margin-bottom: 2px; box-shadow: 0 1.5px 0 var(--back2), 0 2px 3px rgba(0,0,0,.35); border-radius: 3px; }
.tile.md { --w: var(--mtw); }
.tile.wild::after {
  content: '搭'; position: absolute; right: -3px; top: -4px; width: calc(var(--w) * .36); height: calc(var(--w) * .36); min-width: 10px; min-height: 10px;
  border-radius: 50%; background: radial-gradient(#ffe48a, #e0a320); color: #7a3d00; font-size: max(8px, calc(var(--w) * .22));
  font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); font-family: var(--ui);
}
.tile.wild { background: linear-gradient(172deg, #fffbe3 0%, #fbeab0 70%, #f0d58a 100%); }
.tile.mini.wild::after { display: none; }
.tile-row { display: flex; gap: 2px; align-items: flex-end; flex-wrap: wrap; }

/* ───────── 主页 ───────── */
#screen-home { align-items: center; justify-content: center; }
.home-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.home-deco .tile { position: absolute; opacity: .85; animation: floaty linear infinite; }
@keyframes floaty { from { transform: translateY(calc(var(--app-h) * 1.1)) rotate(0deg); } to { transform: translateY(calc(var(--app-h) * -.3)) rotate(var(--rot, 180deg)); } }
.home-main { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; padding: 20px; width: min(760px, 100%); }
.logo { display: flex; align-items: center; gap: 14px; }
.logo h1 { margin: 0; font-family: var(--cal); font-weight: 400; font-size: clamp(56px, calc(var(--app-w) * .11), 110px); line-height: 1;
  background: linear-gradient(180deg, #fff4c2 0%, var(--gold) 45%, #b9791f 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)) drop-shadow(0 0 24px rgba(243, 201, 105, .35)); letter-spacing: .04em; }
.seal { font-family: var(--cal); font-size: clamp(30px, calc(var(--app-w) * .06), 52px); color: #fff3e0; background: var(--red); border-radius: 10px; padding: 2px 12px 6px;
  transform: rotate(-8deg); box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), 0 6px 14px rgba(0,0,0,.4); animation: sealIn .8s cubic-bezier(.3,1.6,.5,1) both .2s; }
@keyframes sealIn { from { transform: rotate(-30deg) scale(2.4); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
.tagline { margin: 10px 0 30px; color: var(--muted); letter-spacing: .4em; font-size: 15px; }
.home-menu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; }
.menu-btn { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left;
  padding: 18px 20px; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(0,0,0,.18));
  box-shadow: 0 10px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.15); transition: transform .18s, box-shadow .18s, background .18s; overflow: hidden; }
.menu-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%); transform: translateX(-100%); transition: transform .6s; }
.menu-btn:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.2); }
.menu-btn:hover::after { transform: translateX(100%); }
.menu-btn i { grid-row: span 2; font-style: normal; font-size: 34px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.menu-btn b { font-size: 20px; letter-spacing: .08em; }
.menu-btn small { color: var(--muted); font-size: 13px; margin-top: 3px; }
.menu-btn.primary { background: linear-gradient(160deg, #e9b94e, #b9781e); color: #3a1f00; border-color: #ffe39a; }
.menu-btn.primary small { color: rgba(58, 31, 0, .7); }
.home-stats { margin-top: 20px; color: var(--muted); font-size: 13px; min-height: 18px; text-align: center; }
.home-foot { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.link { background: none; border: 1px solid transparent; color: var(--muted); padding: 6px 12px; border-radius: 20px; font-size: 14px; }
.link:hover { color: var(--text); border-color: var(--line); }
#btn-resume { color: var(--gold); border-color: var(--line); }

/* ───────── 通用 ───────── */
.btn { border: 0; border-radius: 12px; padding: 11px 22px; font-size: 15px; font-weight: 600; letter-spacing: .05em; transition: transform .12s, filter .12s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: linear-gradient(180deg, #f2c55c, #c98a24); color: #3a1f00; box-shadow: 0 4px 0 #8a5a12, 0 8px 18px rgba(0,0,0,.3); }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--text); border: 1px solid var(--line); }
.btn.red { background: linear-gradient(180deg, #e2554d, #a8251f); color: #fff; box-shadow: 0 4px 0 #6d140f; }
.btn.small { padding: 7px 14px; font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; background: rgba(255,255,255,.12); font-size: 11px; margin-left: 6px; font-weight: 500; white-space: nowrap; }
.pill.gold { background: var(--gold); color: #3a1f00; }

.sc-head { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.2); }
.sc-head h2 { margin: 0; font-family: var(--cal); font-weight: 400; font-size: 30px; color: var(--gold); }
.back-btn { background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; font-size: 15px; }
.sc-body { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 18px clamp(14px, calc(var(--app-w) * .04), 48px) 30px; }
.sc-foot { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: rgba(0,0,0,.3); flex-wrap: wrap; }
.sec-title { margin: 6px 0 12px; font-size: 15px; color: var(--gold); letter-spacing: .1em; font-weight: 600; }

/* 规则 */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 22px; }
.preset { text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid var(--line); transition: all .15s; }
.preset b { display: block; font-size: 16px; margin-bottom: 4px; }
.preset small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.preset.on, .preset:hover { background: rgba(243, 201, 105, .18); border-color: var(--gold); }
.rule-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.rule-group { background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px 6px; }
.rule-group h4 { margin: 0 0 8px; color: var(--gold); font-size: 14px; letter-spacing: .1em; }
.rule-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed rgba(255,255,255,.08); }
.rule-item:first-of-type { border-top: 0; }
.rule-item label { font-size: 14px; }
.rule-item label small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.seg button { border: 1px solid var(--line); background: rgba(255,255,255,.05); border-radius: 8px; padding: 5px 10px; font-size: 13px; }
.seg button.on { background: var(--gold); color: #3a1f00; border-color: var(--gold); font-weight: 700; }
.switch { position: relative; width: 46px; height: 26px; flex: none; border-radius: 20px; background: rgba(255,255,255,.18); border: 0; transition: background .2s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch.on { background: #2fb574; }
.switch.on::after { transform: translateX(20px); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.08); font-size: 16px; }
.stepper b { min-width: 30px; text-align: center; }
.rule-summary { flex: 1; color: var(--muted); font-size: 13px; min-width: 200px; }
.rule-form.readonly { pointer-events: none; opacity: .85; }

/* ───────── 牌桌 ───────── */
#screen-game { background: radial-gradient(ellipse at 50% 45%, var(--felt1) 0%, var(--felt2) 58%, var(--felt3) 100%); }
.game-top { position: absolute; top: 0; left: 0; right: 0; height: 48px; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 0 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }
.game-top .spacer { flex: 1; }
.game-info { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-info b { color: var(--text); font-weight: 600; }
.icon-btn { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.25); font-size: 15px; transition: background .15s; }
.icon-btn span { font-size: 12px; }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn.on { background: var(--gold); color: #3a1f00; border-color: var(--gold); }
body.w1100 .icon-btn span { display: none; }
body.w760 .icon-btn { padding: 0 8px; }
body.w760 .game-info .pill { display: none; }

#board { position: absolute; left: 50%; top: var(--board-top); width: var(--S); height: var(--S); transform: translateX(-50%); }
#board::before { content: ''; position: absolute; inset: 3%; border-radius: 6%; border: 1px solid rgba(255,230,170,.08); box-shadow: inset 0 0 80px rgba(0,0,0,.25); pointer-events: none; }
.layer { position: absolute; inset: 0; pointer-events: none; transform-origin: 50% 50%; }
.river { position: absolute; top: calc(50% + var(--S) * .152); left: 50%; transform: translateX(-50%); width: calc(var(--rtw) * 6 + 10px);
  display: flex; flex-wrap: wrap; gap: 0 2px; align-content: flex-start; }
.river.wide { width: calc(var(--rtw) * 10 + 18px); }
.river .tile { --w: var(--rtw); margin-bottom: calc(var(--rtw) * .1); }
.river .tile.last { box-shadow: 0 0 0 2px #ffd75e, 0 0 14px 3px rgba(255, 210, 80, .85), 0 calc(var(--w) * .085) 0 var(--back2); animation: lastPulse 1.2s ease-in-out infinite; z-index: 2; }
.river .tile.last::before { content: ''; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #ffd75e; }
@keyframes lastPulse { 50% { box-shadow: 0 0 0 2px #ffd75e, 0 0 22px 6px rgba(255, 210, 80, .5), 0 calc(var(--w) * .085) 0 var(--back2); } }
.opp-row { position: absolute; bottom: calc(var(--S) * .01); left: 50%; transform: translateX(-50%); display: flex; align-items: flex-end; gap: calc(var(--otw) * .5); white-space: nowrap; }
.opp-row .tile { --w: var(--otw); }
.opp-hand, .opp-melds { display: flex; gap: 1px; align-items: flex-end; }
.opp-melds { gap: calc(var(--otw) * .25); }
.opp-hand .drawn { margin-left: calc(var(--otw) * .45); }
.meld { position: relative; display: flex; gap: 1px; align-items: flex-end; }
.meld .tile.stack { position: absolute; left: calc(var(--w) + 1px); bottom: calc(var(--w) * .5); }
.meld .tile.claimed { filter: brightness(.9) sepia(.25); }

.center { position: absolute; left: 50%; top: 50%; width: calc(var(--S) * .27); height: calc(var(--S) * .27); transform: translate(-50%, -50%);
  border-radius: 16%; background: radial-gradient(circle at 50% 35%, #24493a, #0c2219); box-shadow: inset 0 0 0 2px rgba(255,215,130,.22), inset 0 0 30px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.45); }
.c-side { position: absolute; display: flex; align-items: center; justify-content: center; font-family: var(--cal); font-size: calc(var(--S) * .036); color: rgba(255, 240, 200, .42); transition: color .3s; }
.c-side span { position: relative; z-index: 1; }
.c-side.c-bottom { left: 22%; right: 22%; bottom: 2%; height: 22%; }
.c-side.c-top { left: 22%; right: 22%; top: 2%; height: 22%; }
.c-side.c-top span { transform: rotate(180deg); }
.c-side.c-left { top: 22%; bottom: 22%; left: 2%; width: 22%; }
.c-side.c-left span { transform: rotate(90deg); }
.c-side.c-right { top: 22%; bottom: 22%; right: 2%; width: 22%; }
.c-side.c-right span { transform: rotate(-90deg); }
.c-side.dealer span { color: rgba(255, 140, 120, .75); }
.c-side.active span { color: #ffe08a; text-shadow: 0 0 12px rgba(255, 210, 90, .9); }
.c-side.active::after { content: ''; position: absolute; border-radius: 6px; background: linear-gradient(90deg, transparent, #ffd25a, transparent); animation: sideGlow 1.2s ease-in-out infinite; }
.c-side.c-bottom.active::after { left: 0; right: 0; bottom: 6%; height: 3px; }
.c-side.c-top.active::after { left: 0; right: 0; top: 6%; height: 3px; }
.c-side.c-left.active::after { top: 0; bottom: 0; left: 6%; width: 3px; background: linear-gradient(180deg, transparent, #ffd25a, transparent); }
.c-side.c-right.active::after { top: 0; bottom: 0; right: 6%; width: 3px; background: linear-gradient(180deg, transparent, #ffd25a, transparent); }
@keyframes sideGlow { 50% { opacity: .35; } }
.c-mid { position: absolute; inset: 24%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.c-round { font-size: calc(var(--S) * .0165); color: var(--muted); white-space: nowrap; }
.c-wall b { display: block; font-size: calc(var(--S) * .05); line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; text-align: center; }
.c-wall small { display: block; text-align: center; font-size: calc(var(--S) * .015); color: var(--muted); }
.c-timer { font-size: calc(var(--S) * .028); font-weight: 800; color: #9fe6c0; min-height: 1em; font-variant-numeric: tabular-nums; }
.c-timer.urgent { color: #ff7266; animation: urgent .5s ease-in-out infinite alternate; }
@keyframes urgent { to { transform: scale(1.25); } }
.c-wild { position: absolute; left: 100%; top: 0; margin-left: 8px; display: flex; gap: 6px; }
.c-ind { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.c-ind .tile { --w: calc(var(--S) * .036); }
.c-ind small { font-size: 10px; color: var(--gold); }

.badge { position: absolute; z-index: 5; display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 28px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(4px); font-size: 12px; max-width: 200px; transition: box-shadow .3s, border-color .3s; }
.badge.pos-bottom { right: 0; bottom: 12%; }
.badge.pos-right { right: 0; top: 0; }
.badge.pos-top { left: 0; top: 0; }
.badge.pos-left { left: 0; bottom: 12%; }
body.wide-table .badge.pos-bottom { right: -190px; bottom: 6%; }
body.wide-table .badge.pos-right { right: -190px; top: 38%; }
body.wide-table .badge.pos-top { left: -190px; top: 4%; }
body.wide-table .badge.pos-left { left: -190px; top: 38%; bottom: auto; }
body.wide-table .badge { font-size: 14px; padding: 6px 14px 6px 6px; min-width: 150px; }
.badge.turn { border-color: #ffd25a; box-shadow: 0 0 0 2px rgba(255, 210, 90, .55), 0 0 22px rgba(255, 200, 80, .55); }
.avatar { position: relative; flex: none; width: 2.6em; height: 2.6em; border-radius: 50%; display: grid; place-items: center; font-size: 1.25em;
  background: radial-gradient(circle at 40% 30%, #fffaf0, #e8d39a); box-shadow: inset 0 -2px 4px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.35); }
.avatar.big { width: 64px; height: 64px; font-size: 34px; }
.dealer-mark { position: absolute; right: -5px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-style: normal; font-size: 10px;
  font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.dealer-mark.sm { position: static; display: inline-grid; width: 16px; height: 16px; font-size: 9px; }
.b-info { min-width: 0; }
.b-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-score { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.b-score .wind { font-family: var(--cal); color: #fff; margin-right: 6px; font-weight: 400; }
.tag { font-style: normal; font-size: 9px; padding: 1px 4px; border-radius: 4px; margin-left: 4px; vertical-align: 1px; background: rgba(255,255,255,.18); font-weight: 600; }
.tag.auto { background: #3d7be0; }
.tag.off { background: #a8251f; }
.b-flowers { display: flex; flex-wrap: wrap; gap: 1px; max-width: 64px; }
.b-flowers .tile.mini { --w: 11px !important; height: 15px; }
.b-flowers .tile.mini .face { inset: 4%; }
.bubble { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) scale(.6); opacity: 0; pointer-events: none; background: #fffaf0; color: var(--ink);
  padding: 6px 12px; border-radius: 14px; font-size: 14px; white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,.35); transition: all .25s cubic-bezier(.3,1.5,.5,1); z-index: 30; }
.bubble::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #fffaf0; }
.badge.pos-right .bubble, .badge.pos-top .bubble { bottom: auto; top: calc(100% + 8px); }
.badge.pos-right .bubble::after, .badge.pos-top .bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #fffaf0; }
.bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }

/* 我的手牌 */
#my-area { position: absolute; left: 0; right: 0; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 10; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#my-hand { position: relative; pointer-events: auto; }
.my-row { display: flex; align-items: flex-end; gap: calc(var(--tw) * .3); }
.my-melds { display: flex; gap: calc(var(--mtw) * .22); align-items: flex-end; }
.my-melds .tile { --w: var(--mtw); }
.my-flowers { display: flex; flex-direction: column; flex-wrap: wrap-reverse; gap: 1px; max-height: calc(var(--tw) * 1.4); }
.my-flowers .tile.mini { --w: calc(var(--tw) * .36) !important; }
.my-hand { display: flex; gap: 2px; align-items: flex-end; }
.my-drawn { margin-left: calc(var(--tw) * .28); }
.tile.mine { transition: transform .16s cubic-bezier(.3,1.4,.5,1), box-shadow .16s, filter .16s; touch-action: none; }
.my-hand.can .tile.mine, .my-drawn .tile.mine.playable { cursor: pointer; }
.tile.mine.playable:hover { transform: translateY(-9%); }
.tile.mine.selected { transform: translateY(-24%); box-shadow: 0 0 0 2px #ffd75e, 0 0 18px rgba(255, 210, 90, .7), 0 calc(var(--w) * .085) 0 var(--back2), 0 14px 18px rgba(0,0,0,.45); }
.tile.mine.hint::before { content: '荐'; position: absolute; left: 50%; top: -24px; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: #0d3a26; background: #8ff0bd; padding: 2px 6px; border-radius: 8px; animation: bob 1s ease-in-out infinite; white-space: nowrap; }
.tile.mine.hint { box-shadow: 0 0 0 2px #59e09a, 0 0 16px rgba(89, 224, 154, .7), 0 calc(var(--w) * .085) 0 var(--back2), 0 calc(var(--w) * .12) calc(var(--w) * .16) rgba(0,0,0,.42); }
.tile.mine.will-drop { filter: drop-shadow(0 0 10px #ffd75e); }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
.tenpai-chip { position: absolute; left: 0; bottom: calc(100% + 10px); display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 12px; background: var(--glass); border: 1px solid #59e09a; font-size: 12px; white-space: nowrap; }
.tenpai-chip b { color: #8ff0bd; font-family: var(--cal); font-size: 18px; font-weight: 400; }
.tenpai-chip.dim { border-color: var(--line); color: var(--muted); }
.tenpai-chip .w { position: relative; display: inline-flex; }
.tenpai-chip .w i, .tip-waits i { position: absolute; right: -6px; bottom: -4px; font-style: normal; font-size: 10px; background: #c3262b; color: #fff; border-radius: 8px; padding: 0 4px; font-weight: 700; }
.tenpai-chip .tile.mini { --w: 20px !important; }

#action-bar { pointer-events: auto; display: none; align-items: flex-end; gap: 10px; margin-bottom: 14px; padding: 8px 12px; border-radius: 22px; background: rgba(0,0,0,.35); backdrop-filter: blur(4px); }
#action-bar.show { display: flex; animation: barIn .25s cubic-bezier(.3,1.5,.5,1); }
@keyframes barIn { from { transform: translateY(16px) scale(.9); opacity: 0; } }
.act-tip { padding: 4px 12px; color: var(--muted); font-size: 13px; }
.claim-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-right: 4px; }
.claim-tile .tile { --w: calc(var(--tw) * .8); animation: lastPulse 1.2s infinite; }
.claim-tile small { font-size: 11px; color: var(--muted); }
.act-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: clamp(52px, calc(var(--tw) * 1.25), 76px); height: clamp(52px, calc(var(--tw) * 1.25), 76px);
  padding: 4px 8px; border-radius: 50%; border: 3px solid rgba(255,255,255,.75); font-family: var(--cal); font-size: clamp(22px, calc(var(--tw) * .55), 34px); color: #fff;
  text-shadow: 0 2px 2px rgba(0,0,0,.4); box-shadow: 0 5px 0 rgba(0,0,0,.35), 0 10px 20px rgba(0,0,0,.35); transition: transform .12s; }
.act-btn:has(.mini-row), .act-btn:has(.tile.mini) { border-radius: 18px; }
.act-btn:hover { transform: translateY(-3px) scale(1.05); }
.act-btn:active { transform: translateY(2px); }
.act-btn span { line-height: 1; }
.act-btn .mini-row { display: flex; gap: 1px; }
.act-btn .tile.mini.hl { box-shadow: 0 0 0 2px #ffd75e; }
.act-hu { background: radial-gradient(circle at 50% 30%, #ff8a5c, #d1281f 60%, #8f120d); border-color: #ffd75e; animation: huGlow 1s ease-in-out infinite; }
@keyframes huGlow { 50% { box-shadow: 0 5px 0 rgba(0,0,0,.35), 0 0 30px 8px rgba(255, 120, 60, .7); } }
.act-pong { background: radial-gradient(circle at 50% 30%, #6aa8ff, #2557a8 65%, #163870); }
.act-kong { background: radial-gradient(circle at 50% 30%, #c38bff, #6c37b8 65%, #45207a); }
.act-chi { background: radial-gradient(circle at 50% 30%, #6fe0a5, #1f8a55 65%, #135a37); }
.act-pass { background: radial-gradient(circle at 50% 30%, #9aa3ad, #5b636d 65%, #3a4048); }
.act-btn.recommend::after { content: '推荐'; position: absolute; top: -12px; right: -10px; font-family: var(--ui); font-size: 10px; font-weight: 800; color: #0d3a26; background: #8ff0bd; padding: 2px 6px; border-radius: 8px; text-shadow: none; animation: bob2 1s ease-in-out infinite; }
@keyframes bob2 { 50% { transform: translateY(-3px); } }

/* 提示 / 教练 */
.tooltip { position: fixed; z-index: 200; pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; padding: 8px 12px; border-radius: 12px;
  background: rgba(10, 22, 18, .92); border: 1px solid var(--line); font-size: 13px; box-shadow: 0 10px 24px rgba(0,0,0,.4); max-width: 280px; text-align: center; }
.tooltip.show { opacity: 1; transform: none; }
.tooltip small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.tip-waits { display: flex; gap: 8px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.tip-waits span { position: relative; display: inline-flex; }
.tip-waits .tile.mini { --w: 22px !important; }
.coach { position: absolute; z-index: 15; right: 10px; top: 56px; width: 270px; max-height: calc(var(--app-h) - var(--myH) - 120px); overflow-y: auto; display: none; padding: 10px 12px; border-radius: 16px;
  background: rgba(8, 22, 17, .78); border: 1px solid var(--line); backdrop-filter: blur(6px); font-size: 13px; line-height: 1.55; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.coach.show { display: block; }
body.wide-table .coach { max-height: calc(var(--app-h) * .31); }
.coach-head { display: flex; justify-content: space-between; align-items: center; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.coach-x { background: none; border: 0; font-size: 18px; color: var(--muted); }
.coach-advice { background: rgba(89, 224, 154, .1); border-left: 3px solid #59e09a; padding: 4px 10px; border-radius: 6px; }
.coach-advice p, .coach-log p { margin: 4px 0; }
.coach-log { margin-top: 8px; color: var(--muted); font-size: 12px; }
.coach-log b { color: var(--text); }
.coach-log .tn { color: var(--gold); }
body.w900 .coach { right: 6px; left: auto; top: 52px; width: min(250px, calc(var(--app-w) * .6)); font-size: 12px; }
body.w900 .coach-log { display: none; }

/* 吃碰杠胡 弹字 */
.call-pop { position: absolute; z-index: 40; transform: translate(-50%, -50%); pointer-events: none; }
.call-pop span { display: block; font-family: var(--cal); font-size: calc(var(--S) * .12); line-height: 1; white-space: nowrap;
  background: linear-gradient(180deg, #fff7d1, #f3c969 50%, #c27c18); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a2b00) drop-shadow(0 0 16px rgba(255, 200, 80, .8)); animation: callIn 1.4s cubic-bezier(.2, 1.6, .4, 1) forwards; }
.call-pop::before { content: ''; position: absolute; left: 50%; top: 50%; width: calc(var(--S) * .16); height: calc(var(--S) * .16); border-radius: 50%; transform: translate(-50%, -50%) scale(.2);
  border: 4px solid rgba(255, 215, 110, .9); animation: ring .7s ease-out forwards; }
.call-pop.c-hu span { font-size: calc(var(--S) * .18); background: linear-gradient(180deg, #fff1c8, #ff8a4c 45%, #c3262b); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 4px 0 #4a0b06) drop-shadow(0 0 26px rgba(255, 110, 60, .9)); }
.call-pop.flower span { font-size: calc(var(--S) * .06); }
@keyframes callIn { 0% { transform: scale(2.6) rotate(-14deg); opacity: 0; } 18% { transform: scale(.92) rotate(3deg); opacity: 1; } 28% { transform: scale(1.06) rotate(0); } 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.1) translateY(-14px); opacity: 0; } }
@keyframes ring { to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } }
.banner { position: absolute; z-index: 60; left: 0; right: 0; top: 40%; display: flex; justify-content: center; pointer-events: none; }
.banner-in { display: flex; flex-direction: column; align-items: center; padding: 10px 80px; background: linear-gradient(90deg, transparent, rgba(120, 20, 15, .88) 20%, rgba(150, 28, 20, .92) 50%, rgba(120, 20, 15, .88) 80%, transparent);
  border-top: 2px solid rgba(255, 210, 110, .7); border-bottom: 2px solid rgba(255, 210, 110, .7); animation: bannerIn 1.6s ease forwards; }
.banner-in b { font-family: var(--cal); font-size: 44px; font-weight: 400; color: #ffe7a6; letter-spacing: .2em; text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.banner-in small { color: #ffe7c4; font-size: 14px; letter-spacing: .1em; }
@keyframes bannerIn { 0% { transform: scaleX(0); opacity: 0; } 15% { transform: scaleX(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }

/* 弹窗 */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { position: relative; width: min(760px, 100%); max-height: calc(var(--app-h) - 28px); overflow-y: auto; padding: 22px clamp(14px, calc(var(--app-w) * .03), 30px);
  background: linear-gradient(180deg, #fbf4e2, #efe2c2); color: var(--ink); border-radius: 20px; border: 2px solid #d9b26a;
  box-shadow: 0 30px 60px rgba(0,0,0,.5), inset 0 0 0 5px rgba(255,255,255,.5), inset 0 0 0 6px rgba(190, 140, 60, .35); animation: modalIn .4s cubic-bezier(.3,1.4,.5,1); }
@keyframes modalIn { from { transform: translateY(30px) scale(.94); opacity: 0; } }
.modal h2 { margin: 0 0 12px; }
.modal .btn.ghost { color: var(--ink); background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.15); }
.modal-wrap.peek { background: transparent; backdrop-filter: none; pointer-events: none; }
.modal-wrap.peek .modal { display: none; }
.peek-back { position: fixed; z-index: 120; left: 50%; top: 60px; transform: translateX(-50%); }
.modal-x { position: absolute; right: 12px; top: 10px; background: none; border: 0; font-size: 26px; color: #8a6d3b; }
.res-title { font-family: var(--cal); font-weight: 400; font-size: 46px; text-align: center; margin: 0 0 6px !important; color: #7b5a2a; letter-spacing: .1em; }
.res-title.win { color: var(--red); text-shadow: 0 3px 0 rgba(195, 38, 43, .2); animation: titlePop .6s cubic-bezier(.3,1.8,.5,1); }
.res-title.lose { color: #4b5563; }
.res-title.draw { color: #6b7280; }
@keyframes titlePop { from { transform: scale(2); opacity: 0; } }
.res-sub { text-align: center; color: #6b5a3a; }
.res-win { margin: 10px 0 14px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.55); border: 1px solid rgba(190,140,60,.35); }
.res-who { display: flex; align-items: center; gap: 6px; font-size: 16px; margin-bottom: 10px; }
.res-hand { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.res-hand .tile { --w: min(var(--mtw), 34px); }
.res-hand .win-tile { margin-left: 8px; }
.res-hand .win-tile .tile { box-shadow: 0 0 0 2px var(--red), 0 0 12px rgba(195, 38, 43, .55), 0 3px 0 var(--back2); }
.res-fans { display: flex; flex-wrap: wrap; gap: 6px; }
.fan { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 20px; background: #fff; border: 1px solid #e0c48a; font-size: 13px; animation: fanIn .35s cubic-bezier(.3,1.6,.5,1) both; }
.fan b { color: var(--red); }
@keyframes fanIn { from { transform: scale(.4); opacity: 0; } }
.res-total { margin-top: 10px; font-size: 15px; }
.res-total b { color: var(--red); font-size: 20px; }
.res-scores { margin: 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid rgba(190,140,60,.35); }
.res-row { display: grid; grid-template-columns: 1fr 90px 90px; padding: 8px 14px; background: rgba(255,255,255,.4); align-items: center; }
.res-row:nth-child(2n) { background: rgba(255,255,255,.2); }
.res-row.me { background: rgba(243, 201, 105, .35); font-weight: 700; }
.res-row .res-kong { margin-left: 8px; font-size: 12px; font-weight: 400; color: #7a5a1c; }
.res-row .delta { text-align: right; font-weight: 700; color: #6b7280; }
.res-row .delta.up { color: #15803d; }
.res-row .delta.down { color: var(--red); }
.res-row .score { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.res-actions { display: flex; justify-content: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.res-wait { text-align: center; color: #6b5a3a; font-size: 13px; margin-top: 8px; min-height: 1em; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 12px; border-radius: 16px; background: rgba(255,255,255,.55); border: 1px solid #e0c48a; min-width: 120px; animation: podIn .5s cubic-bezier(.3,1.5,.5,1) both; }
.pod.pod-0 { order: 2; padding-top: 26px; background: linear-gradient(180deg, #fff3c4, #f7da84); border-color: #e3b448; transform: translateY(-10px); }
.pod.pod-1 { order: 1; } .pod.pod-2 { order: 3; } .pod.pod-3 { order: 4; }
.pod.me { box-shadow: 0 0 0 3px var(--red); }
.pod .medal { font-size: 34px; }
.pod-score { font-size: 22px; font-weight: 800; color: var(--red); }
.pod small { color: #6b5a3a; }
@keyframes podIn { from { transform: translateY(40px); opacity: 0; } }

/* 设置等弹窗内表单 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid rgba(0,0,0,.08); }
.set-row:first-of-type { border-top: 0; }
.set-row input[type=range] { width: 180px; accent-color: var(--red); }
.modal .seg button { border-color: rgba(0,0,0,.2); background: rgba(255,255,255,.6); color: var(--ink); }
.modal .seg button.on { background: var(--red); color: #fff; border-color: var(--red); }
.modal .switch { background: rgba(0,0,0,.2); }
.modal .switch.on { background: #2fb574; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2) !important; padding: 0 !important; }
.swatch.on { outline: 3px solid var(--red); outline-offset: 2px; }
.fan-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fan-table td, .fan-table th { padding: 7px 8px; border-bottom: 1px solid rgba(0,0,0,.08); text-align: left; vertical-align: top; }
.fan-table th { color: #7b5a2a; }
.fan-table td b { color: var(--red); white-space: nowrap; }
.fan-table .tile-row .tile { --w: 18px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-list .btn { width: 100%; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat { background: rgba(255,255,255,.55); border-radius: 12px; padding: 12px; text-align: center; border: 1px solid #e0c48a; }
.stat b { display: block; font-size: 26px; color: var(--red); }
.stat small { color: #6b5a3a; }

/* 聊天 */
.chat-pop { position: absolute; z-index: 30; right: 10px; top: 52px; width: 300px; display: none; padding: 10px; border-radius: 16px; background: rgba(8, 22, 17, .9); border: 1px solid var(--line); }
.chat-pop.show { display: block; animation: barIn .25s ease; }
.chat-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-quick button { border: 1px solid var(--line); background: rgba(255,255,255,.08); border-radius: 14px; padding: 5px 10px; font-size: 13px; }
.chat-emoji button { font-size: 20px; padding: 2px 6px; }
.chat-log { max-height: 140px; overflow-y: auto; font-size: 12px; color: var(--muted); margin: 8px 0; }
.chat-log b { color: var(--gold); }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-width: 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); padding: 7px 10px; }

/* 联机 */
.online-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto; }
.card { background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.card h3 { margin: 0 0 12px; color: var(--gold); font-size: 17px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field input { border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); padding: 11px 14px; font-size: 16px; outline: none; }
.field input:focus { border-color: var(--gold); }
.code-input { text-transform: uppercase; letter-spacing: .5em; font-size: 24px !important; text-align: center; font-weight: 700; }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; background: rgba(255,255,255,.1); font-size: 22px; }
.avatar-pick button.on { border-color: var(--gold); background: rgba(243, 201, 105, .25); }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px dashed var(--line); text-align: center; }
.seat.filled { border-style: solid; background: rgba(255,255,255,.1); }
.seat.me { border-color: var(--gold); }
.seat small { color: var(--muted); font-size: 12px; }
.room-code { font-size: 40px; font-weight: 800; letter-spacing: .3em; color: var(--gold); font-family: ui-monospace, monospace; }
.share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.share input { flex: 1; min-width: 200px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); padding: 8px 10px; font-size: 13px; }
.net-status { margin-left: auto; font-size: 13px; color: var(--muted); }
.net-status.ok::before { content: '● '; color: #2fb574; }
.net-status.bad::before { content: '● '; color: #e2554d; }
.room-chat { height: 160px; overflow-y: auto; font-size: 13px; background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.room-chat p { margin: 3px 0; }
.room-chat b { color: var(--gold); }
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.room-item b { font-family: ui-monospace, monospace; letter-spacing: .15em; color: var(--gold); }
.room-item span { flex: 1; color: var(--muted); font-size: 13px; }
.hint-text { color: var(--muted); font-size: 13px; line-height: 1.6; }
.hint-text code { background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 6px; color: var(--gold); }

/* 学习 */
.learn-wrap { position: relative; z-index: 1; flex: 1; display: flex; min-height: 0; }
.learn-nav { width: 240px; flex: none; overflow-y: auto; padding: 14px 10px; border-right: 1px solid var(--line); background: rgba(0,0,0,.18); }
.learn-nav h5 { margin: 14px 8px 6px; color: var(--gold); font-size: 12px; letter-spacing: .15em; }
.learn-nav button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; border: 0; background: none; font-size: 14px; }
.learn-nav button:hover { background: rgba(255,255,255,.07); }
.learn-nav button.on { background: rgba(243, 201, 105, .2); color: var(--gold); }
.learn-nav button .ck { margin-left: auto; color: #2fb574; font-size: 12px; }
.learn-content { flex: 1; overflow-y: auto; padding: 22px clamp(14px, calc(var(--app-w) * .04), 54px) 60px; line-height: 1.8; font-size: 15px; }
.learn-content h2 { font-family: var(--cal); font-weight: 400; font-size: 36px; color: var(--gold); margin: 0 0 10px; }
.learn-content h3 { color: var(--gold); margin: 22px 0 8px; font-size: 18px; }
.learn-content p { margin: 8px 0; max-width: 820px; }
.learn-content .tile { --w: clamp(26px, calc(var(--app-w) * .036), 44px); }
.learn-content .tile-row { margin: 8px 0; gap: 3px; }
.learn-content .tile-row.sm .tile { --w: 26px; }
.learn-content .tile-row .gap { width: 14px; }
.lesson-box { background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 16px; padding: 12px 18px; margin: 12px 0; max-width: 860px; }
.lesson-box.tip { border-color: #59e09a; background: rgba(89, 224, 154, .08); }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; max-width: 900px; }
.lesson-grid .lesson-box { margin: 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; max-width: 860px; }
.tile-label { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px; font-size: 12px; color: var(--muted); }
.quiz { max-width: 860px; }
.quiz-q { font-size: 17px; margin-bottom: 10px; }
.quiz-opts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.quiz-opts button { border: 2px solid var(--line); background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px; transition: all .15s; }
.quiz-opts button.txt { padding: 10px 18px; font-size: 15px; }
.quiz-opts button.on { border-color: var(--gold); background: rgba(243, 201, 105, .2); transform: translateY(-3px); }
.quiz-opts button.right { border-color: #2fb574; background: rgba(47, 181, 116, .25); }
.quiz-opts button.wrong { border-color: #e2554d; background: rgba(226, 85, 77, .25); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.quiz-fb { min-height: 28px; margin: 10px 0; font-weight: 600; }
.quiz-fb.ok { color: #6fe0a5; }
.quiz-fb.bad { color: #ff8a80; }
.quiz-score { color: var(--gold); font-weight: 700; }
.hand-pick .tile { cursor: pointer; transition: transform .15s; }
.hand-pick .tile:hover { transform: translateY(-8%); }
.hand-pick .tile.on { transform: translateY(-20%); box-shadow: 0 0 0 2px #ffd75e, 0 0 14px rgba(255, 210, 90, .7); }
.hand-pick .tile.right { box-shadow: 0 0 0 3px #2fb574; transform: translateY(-20%); }
.hand-pick .tile.wrong { box-shadow: 0 0 0 3px #e2554d; }
body.w760 .learn-wrap { flex-direction: column; }
body.w760 .learn-nav { width: auto; display: flex; overflow-x: auto; overflow-y: hidden; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); flex: none; }
body.w760 .learn-nav h5 { display: none; }
body.w760 .learn-nav button { width: auto; white-space: nowrap; }
body.w760 .home-menu { grid-template-columns: 1fr; }
body.w760 .menu-btn { padding: 14px 16px; }
body.w760 .rule-form { grid-template-columns: 1fr; }

.toast-root { position: fixed; z-index: 300; left: 50%; top: 64px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 14px; background: rgba(10, 22, 18, .94); border: 1px solid var(--line); font-size: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.4); animation: toastIn 2.6s ease forwards; }
.toast.err { border-color: #e2554d; }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(-10px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#fx { position: fixed; inset: 0; width: var(--app-w); height: var(--app-h); pointer-events: none; z-index: 150; }

.float-delta { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); font-size: 22px; font-weight: 900; pointer-events: none; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 10px rgba(0,0,0,.4); animation: floatUp 2.3s ease-out forwards; z-index: 40; }
.float-delta.up { color: #7dffb5; }
.float-delta.down { color: #ff8a80; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -40px); } }

.icon-btn.off { opacity: .6; }

/* ───────── 牌墙 & 仪式感开局 ───────── */
.walls { position: absolute; inset: 0; pointer-events: none; }
.wall-side { position: absolute; inset: 0; transform-origin: 50% 50%; }
.wall-row { position: absolute; top: calc(50% + var(--S) * .178); left: 50%; transform: translateX(-50%); display: flex; gap: 1px; }
.ws { display: block; width: var(--wt); height: calc(var(--wt) * 1.32); border-radius: calc(var(--wt) * .16);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 2px, transparent 2px 5px), linear-gradient(160deg, var(--back1), var(--back2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 calc(var(--wt) * .14) 0 #e6d9b8, 0 calc(var(--wt) * .3) 0 var(--back2), 0 calc(var(--wt) * .44) 0 #e6d9b8, 0 calc(var(--wt) * .5) calc(var(--wt) * .3) rgba(0,0,0,.45);
  transition: opacity .25s, transform .25s; }
.ws.h1 { transform: translateY(calc(var(--wt) * .3)); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 calc(var(--wt) * .14) 0 #e6d9b8, 0 calc(var(--wt) * .2) calc(var(--wt) * .2) rgba(0,0,0,.4); }
.ws.h0 { opacity: 0; }
.ws.hl { outline: 2px solid #ffd75e; outline-offset: 1px; box-shadow: 0 0 12px 3px rgba(255, 210, 80, .9); animation: lastPulse 0.8s infinite; }
.walls.building .ws { animation: wsIn .32s cubic-bezier(.3,1.5,.5,1) both; animation-delay: calc(var(--d) * 28ms); }
@keyframes wsIn { from { transform: translateY(-140%) scale(.4); opacity: 0; } }
body.with-wall .river { top: calc(50% + var(--S) * .232); width: calc(var(--S) * .035 * 8 + 16px); }
body.with-wall .river .tile { --w: calc(var(--S) * .035); }
body.with-wall .center { width: calc(var(--S) * .25); height: calc(var(--S) * .25); }
.cer-stage { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.cer-fx { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.cer-fx .cer-t { position: absolute; left: 0; top: 0; margin: calc(var(--w) * -.67) 0 0 calc(var(--w) * -.5); }
.cer-caption { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 26px;
  border-radius: 30px; background: rgba(0,0,0,.45); backdrop-filter: blur(3px); white-space: nowrap; z-index: 2; }
.cer-caption:empty { display: none; }
.cer-caption b { font-family: var(--cal); font-weight: 400; font-size: calc(var(--S) * .055); color: #ffe7a6; letter-spacing: .25em; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.cer-caption small { color: var(--text); font-size: max(12px, calc(var(--S) * .02)); }
.cer-skip { position: absolute; right: 2%; bottom: 14%; pointer-events: auto; border: 1px solid var(--line); background: rgba(0,0,0,.45); color: var(--text); border-radius: 20px; padding: 6px 14px; font-size: 13px; }
.cer-skip:hover { background: rgba(255,255,255,.15); }
body.ceremony .center .c-side.active::after { display: none; }
.dice-wrap { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: flex; gap: calc(var(--S) * .03); }
.die { width: calc(var(--S) * .075); height: calc(var(--S) * .075); border-radius: 18%; background: linear-gradient(145deg, #ffffff, #e7e0cf);
  box-shadow: inset 0 -3px 5px rgba(0,0,0,.18), inset 0 2px 2px #fff, 0 8px 16px rgba(0,0,0,.45); }
.die-face { width: 100%; height: 100%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 16%; }
.die-face i { display: block; margin: 12%; border-radius: 50%; }
.die-face i.pip { background: radial-gradient(circle at 35% 35%, #444, #111); }
.die-face i.pip.red { background: radial-gradient(circle at 35% 35%, #ff6b6b, #b3161c); }
.cer-fly { position: fixed; z-index: 140; display: flex; gap: 1px; pointer-events: none; transform: translate(-50%, -50%); }

.link.on { color: var(--gold); border-color: var(--gold); }

/* 真实开局：牌墙状态、3D 骰子、掷骰按钮 */
.ws.brk { box-shadow: 0 0 0 2px #ffd75e, 0 0 14px 4px rgba(255, 210, 80, .85) !important; animation: lastPulse .7s ease-in-out infinite; }
.ws.next { box-shadow: inset 0 0 0 1px rgba(255, 225, 140, .9), 0 calc(var(--wt) * .14) 0 #e6d9b8, 0 calc(var(--wt) * .3) 0 var(--back2), 0 calc(var(--wt) * .44) 0 #e6d9b8; }
.ws.lift { transform: translateY(-60%) scale(1.15); opacity: .2; transition: transform .12s, opacity .2s; }
.walls.building .ws { animation: wsRise .5s cubic-bezier(.25,1.5,.5,1) both; animation-delay: calc(var(--d) * 32ms); }
@keyframes wsRise { 0% { transform: translateY(-220%) rotate(-12deg) scale(.5); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.cer-caption.pop { animation: capPop .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes capPop { from { transform: translateX(-50%) scale(.8); opacity: 0; } }
.cer-fx .cer-t { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 calc(var(--w) * .085) 0 #e6d9b8, 0 6px 10px rgba(0,0,0,.35); }
.dice3d { position: absolute; left: 0; top: 0; width: 0; height: 0; perspective: 700px; }
.die-w { position: absolute; left: calc(var(--D) / -2); top: calc(var(--D) / -2); width: var(--D); height: var(--D); perspective: 600px; }
.cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.cube .f { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 15%; border-radius: 16%;
  background: radial-gradient(circle at 30% 25%, #ffffff, #f1ebdc 60%, #ddd3bb); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), inset 0 -4px 8px rgba(0,0,0,.12); backface-visibility: hidden; }
.cube .f i { display: block; margin: 14%; border-radius: 50%; }
.cube .f i.pip { background: radial-gradient(circle at 35% 30%, #4a4a4a, #0d0d0d); box-shadow: inset 0 1px 1px rgba(255,255,255,.25); }
.cube .f i.pip.red { background: radial-gradient(circle at 35% 30%, #ff7a7a, #b3161c); }
.cube .f1 { transform: translateZ(calc(var(--D) / 2)); }
.cube .f6 { transform: rotateY(180deg) translateZ(calc(var(--D) / 2)); }
.cube .f2 { transform: rotateY(90deg) translateZ(calc(var(--D) / 2)); }
.cube .f5 { transform: rotateY(-90deg) translateZ(calc(var(--D) / 2)); }
.cube .f3 { transform: rotateX(90deg) translateZ(calc(var(--D) / 2)); }
.cube .f4 { transform: rotateX(-90deg) translateZ(calc(var(--D) / 2)); }
.dice-shadow { position: absolute; left: 0; top: calc(var(--S) * .045); width: calc(var(--S) * .2); height: calc(var(--S) * .05); border-radius: 50%; background: radial-gradient(rgba(0,0,0,.55), transparent 70%); transform: translate(-50%,-50%); opacity: 0; }
.cer-roll { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: auto; z-index: 3; }
.roll-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: calc(var(--S) * .2); height: calc(var(--S) * .2); min-width: 110px; min-height: 110px; border-radius: 50%;
  border: 3px solid #fff0c2; background: radial-gradient(circle at 50% 30%, #ffdf7e, #e0a128 55%, #9c6311); color: #4a2400; box-shadow: 0 8px 0 #6b4108, 0 0 0 0 rgba(255, 215, 110, .7), 0 18px 30px rgba(0,0,0,.45);
  animation: rollPulse 1.4s ease-in-out infinite; transition: transform .12s; }
.roll-btn:hover { transform: translateY(-3px) scale(1.04); }
.roll-btn:active { transform: translateY(3px); }
.roll-btn:disabled { animation: none; opacity: .7; }
.roll-btn b { font-family: var(--cal); font-weight: 400; font-size: calc(var(--S) * .042); letter-spacing: .1em; }
.roll-btn .mini-dice { font-size: calc(var(--S) * .045); line-height: 1; letter-spacing: 4px; }
.roll-btn .mini-dice i { font-style: normal; display: inline-block; animation: diceWiggle 1.4s ease-in-out infinite; }
.roll-btn .mini-dice i + i { animation-delay: .2s; }
@keyframes rollPulse { 50% { box-shadow: 0 8px 0 #6b4108, 0 0 0 14px rgba(255, 215, 110, 0), 0 18px 30px rgba(0,0,0,.45); } }
@keyframes diceWiggle { 0%, 70%, 100% { transform: none; } 80% { transform: rotate(-18deg); } 90% { transform: rotate(14deg); } }
.act-roll { background: radial-gradient(circle at 50% 30%, #ffdf7e, #e0a128 60%, #9c6311); color: #4a2400; text-shadow: none; }
body.ceremony #action-bar { display: none !important; }
.seat .btn.small { margin-top: 4px; }
.seat.ai { border-style: solid; border-color: rgba(120, 180, 255, .35); }

/* ───────── 账号 ───────── */
.account-chip { position: absolute; z-index: 5; top: 14px; right: 16px; }
.acct-btn { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 30px; border: 1px solid var(--line); background: rgba(0,0,0,.3); font-size: 14px; backdrop-filter: blur(4px); }
.acct-btn.guest { padding: 9px 18px; background: linear-gradient(180deg, #f2c55c, #c98a24); color: #3a1f00; border-color: #ffe39a; font-weight: 700; box-shadow: 0 4px 0 #8a5a12, 0 8px 16px rgba(0,0,0,.3); }
.acct-btn i { font-style: normal; color: var(--muted); font-size: 11px; }
.avatar.sm { width: 30px; height: 30px; font-size: 17px; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); display: none; flex-direction: column; min-width: 150px; padding: 6px; border-radius: 14px; background: rgba(10, 24, 18, .96); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.acct-menu.show { display: flex; animation: barIn .2s ease; }
.acct-menu button { text-align: left; padding: 9px 12px; border: 0; border-radius: 10px; background: none; font-size: 14px; }
.acct-menu button:hover { background: rgba(255,255,255,.1); }
.auth-modal .modal { width: min(460px, 100%); }
.auth-tabs { display: flex; gap: 4px; margin: -4px 0 14px; border-bottom: 1px solid rgba(0,0,0,.1); }
.auth-tabs button { flex: 1; padding: 10px 6px; border: 0; background: none; font-size: 16px; color: #8a7350; border-bottom: 3px solid transparent; font-weight: 600; }
.auth-tabs button.on { color: var(--red); border-bottom-color: var(--red); }
.af-form { display: flex; flex-direction: column; gap: 8px; }
.af { display: flex; flex-direction: column; gap: 4px; }
.af label { font-size: 13px; color: #6b5a3a; font-weight: 600; }
.af-row { display: flex; gap: 8px; align-items: center; }
.af input, .modal .af-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid #d8c49a; background: #fffdf6; font-size: 15px; color: var(--ink); outline: none; }
.af input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(195, 38, 43, .12); }
.af-err { color: var(--red); font-size: 12px; min-height: 0; }
.af-err:empty { display: none; }
.af-global { color: var(--red); font-size: 13px; text-align: center; }
.af-global:empty { display: none; }
.af-warn { background: #fff1d6; border: 1px solid #f0c674; color: #8a5a12; padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.af-warn.dev { background: #e8f6ee; border-color: #8fd3ad; color: #1f6b44; }
.af-tip { font-size: 13px; color: #6b5a3a; margin: 0; }
.af-foot { text-align: center; font-size: 13px; color: #6b5a3a; margin: 4px 0 0; }
.af-foot a { color: var(--red); }
.captcha { flex: none; width: 140px; height: 44px; cursor: pointer; border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: 12px; color: #8a7350; background: #f4efe6; }
.captcha svg { display: block; }
.btn.wide { width: 100%; padding: 12px; font-size: 16px; margin-top: 4px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #6b5a3a; }
.seg.chan { justify-content: stretch; }
.seg.chan button { flex: 1; padding: 9px; font-size: 14px; }
.seg.chan button:disabled { opacity: .45; cursor: not-allowed; }
.name-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(135deg, #fff4d4, #fde7b0); border: 1px solid #f0c674; }
.name-card > div { flex: 1; }
.name-card small { display: block; font-size: 11px; color: #8a6d3b; }
.name-card b { font-size: 18px; color: var(--red); font-family: var(--cal); font-weight: 400; letter-spacing: .05em; }
.prof-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.prof-head b { display: block; font-size: 20px; }
.prof-head small { color: #6b5a3a; }
.avatar-pick.light button { background: rgba(0,0,0,.05); }
.avatar-pick.light button.on { border-color: var(--red); background: rgba(195, 38, 43, .1); }

/* 历史对局 */
.hist-stats { max-width: 900px; margin: 0 auto 16px; }
.hist-stats .stat { background: rgba(0,0,0,.22); border-color: var(--line); }
.hist-stats .stat b { color: var(--gold); }
.hist-stats .stat small { color: var(--muted); }
.hist-login { max-width: 900px; margin: 0 auto 16px; text-align: center; }
.hist-list { display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin: 0 auto; }
.hist-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px; background: rgba(0,0,0,.22); border: 1px solid var(--line); transition: background .15s; }
.hist-item:hover { background: rgba(255,255,255,.07); }
.hist-medal { font-size: 30px; flex: none; }
.hist-main { flex: 1; min-width: 0; }
.hist-main > b { display: block; font-size: 15px; }
.hist-main > small { display: block; color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.hist-players { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; }
.hist-players span.me { color: var(--gold); font-weight: 700; }
.hist-players i { font-style: normal; font-size: 9px; background: rgba(255,255,255,.15); padding: 0 4px; border-radius: 4px; margin-left: 3px; }
.hist-players em { font-style: normal; color: var(--muted); }
.hist-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.hist-side > b { font-size: 22px; }
.hist-side > b.up { color: #6fe0a5; } .hist-side > b.down { color: #ff8a80; }
.hist-side small { color: var(--muted); font-size: 12px; }
body.w640 .hist-item { flex-wrap: wrap; }
body.w640 .hist-side { flex-direction: row; align-items: center; width: 100%; justify-content: flex-end; }

/* 复盘 */
body.replay #btn-hint, body.replay #btn-undo, body.replay #btn-reveal, body.replay #btn-auto, body.replay #btn-chat, body.replay #btn-menu, body.replay #action-bar, body.replay .coach { display: none !important; }
#replay-panel { display: none; }
body.replay #replay-panel { display: flex; flex-direction: column; gap: 8px; position: absolute; z-index: 25; right: 10px; top: 56px; width: 300px; max-height: calc(var(--app-h) - 70px); overflow-y: auto; padding: 12px; border-radius: 16px;
  background: rgba(8, 22, 17, .9); border: 1px solid var(--line); backdrop-filter: blur(6px); box-shadow: 0 12px 30px rgba(0,0,0,.4); font-size: 13px; }
.rp-head { display: flex; align-items: center; gap: 8px; }
.rp-head b { color: var(--gold); font-size: 15px; }
.rp-head span { flex: 1; color: var(--muted); font-size: 12px; }
.rp-x { border: 0; background: none; font-size: 22px; color: var(--muted); }
.rp-hand { display: flex; align-items: center; justify-content: space-between; }
.rp-hand button, .rp-ctrl button { border: 1px solid var(--line); background: rgba(255,255,255,.08); border-radius: 10px; min-width: 36px; height: 34px; font-size: 15px; }
.rp-hand button:disabled { opacity: .35; }
.rp-ctrl { display: flex; gap: 6px; justify-content: center; }
.rp-ctrl .main { min-width: 52px; background: var(--gold); color: #3a1f00; border-color: var(--gold); font-size: 18px; }
.rp-ctrl .spd { font-size: 12px; font-weight: 700; }
.rp-slider { width: 100%; accent-color: var(--gold); }
.rp-step { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.06); line-height: 1.6; }
.rp-step .tn { color: var(--gold); }
.rp-step .hu { color: #ff8a6a; }
.rp-note { margin-top: 4px; }
.rp-hint { margin-top: 4px; color: #9fe6c0; font-size: 12px; }
.rp-res { margin-top: 4px; color: var(--gold); font-weight: 700; }
.g { font-weight: 800; padding: 0 5px; border-radius: 5px; font-size: 12px; }
.g.best { color: #0d3a26; background: #8ff0bd; } .g.ok { color: #4a3000; background: #ffd77a; } .g.miss { color: #fff; background: #e2554d; }
.rp-sum small { color: var(--muted); display: block; margin-top: 4px; }
.rp-bars { display: flex; height: 18px; border-radius: 9px; overflow: hidden; margin-top: 6px; font-size: 11px; font-weight: 800; }
.rp-bars span { display: grid; place-items: center; min-width: 0; overflow: hidden; }
.rp-bars .best { background: #59e09a; color: #0d3a26; } .rp-bars .ok { background: #f2c55c; color: #4a3000; } .rp-bars .miss { background: #e2554d; color: #fff; }
.rp-list { display: flex; flex-direction: column; gap: 4px; }
.rp-list > b { color: var(--gold); margin-bottom: 2px; }
.rp-list button { text-align: left; border: 1px solid transparent; background: rgba(255,255,255,.05); border-radius: 8px; padding: 6px 8px; font-size: 12px; line-height: 1.5; }
.rp-list button:hover, .rp-list button.on { border-color: var(--gold); }
body.w900.replay #replay-panel { top: auto; bottom: calc(var(--myH) + 8px); right: 6px; left: 6px; width: auto; max-height: calc(var(--app-h) * .38); }
#replay-panel { overflow-x: hidden; }

/* ═════════ 手机端（横屏） ═════════ */
/* 手机竖着拿时整页旋转成横屏 */
html.rotated, html.rotated body { overflow: hidden; background: var(--felt3); }
body.rotated { position: fixed; top: 0; left: 0; width: var(--app-w); height: var(--app-h); transform-origin: 0 0; transform: rotate(90deg) translateY(-100%); }
body.mobile { -webkit-text-size-adjust: 100%; }
body.mobile button { touch-action: manipulation; }

/* 牌桌：工具栏竖放在右侧，牌桌往上顶满 */
body.mobile .game-top { top: 0; bottom: 0; left: auto; right: 0; width: 46px; height: auto; flex-direction: column; justify-content: flex-start; gap: 5px; padding: max(6px, env(safe-area-inset-top)) 4px 6px;
  background: linear-gradient(270deg, rgba(0,0,0,.5), rgba(0,0,0,.15)); }
body.mobile .game-top .spacer, body.mobile .game-info { display: none; }
body.mobile .icon-btn { width: 38px; height: 34px; padding: 0; justify-content: center; font-size: 16px; flex: none; }
body.mobile .icon-btn span { display: none; }
body.mobile #btn-undo, body.mobile #btn-reveal, body.mobile #btn-fans, body.mobile #btn-chat { display: none; }
body.mobile #btn-full { display: flex; }
#btn-full { display: none; }
body.mobile #board { left: calc(50% - 23px); }
body.mobile #my-area { right: 46px; bottom: max(3px, env(safe-area-inset-bottom)); }
body.mobile #action-bar { margin-bottom: 8px; padding: 6px 10px; gap: 8px; }
body.mobile .act-btn { min-width: 58px; height: 58px; font-size: 26px; }
body.mobile .act-btn:has(.mini-row), body.mobile .act-btn:has(.tile.mini) { height: auto; padding: 6px 8px; }
body.mobile .act-tip { font-size: 12px; padding: 2px 8px; }
body.mobile .badge { font-size: 11px; gap: 5px; padding: 3px 9px 3px 3px; }
body.mobile.wide-table .badge { min-width: 0; max-width: 140px; font-size: 12px; padding: 4px 10px 4px 4px; }
body.mobile.wide-table .badge.pos-bottom { right: -150px; bottom: 4%; }
body.mobile.wide-table .badge.pos-right { right: -150px; top: 36%; }
body.mobile.wide-table .badge.pos-top { left: -150px; top: 2%; }
body.mobile.wide-table .badge.pos-left { left: -150px; top: 36%; }
body.mobile .avatar { width: 2.3em; height: 2.3em; }
body.mobile .b-flowers { display: none; }
body.mobile .tenpai-chip { font-size: 11px; padding: 3px 8px; bottom: calc(100% + 4px); }
body.mobile .tenpai-chip .tile.mini { --w: 16px !important; }
body.mobile .tile.mine.hint::before { top: -18px; font-size: 10px; }
body.mobile .tile.mine.selected { transform: translateY(-18%); }
body.mobile .coach { top: 6px; left: 6px; right: auto; width: 210px; font-size: 11px; padding: 7px 9px; max-height: calc(var(--app-h) * .45); }
body.mobile .coach-log { display: none; }
body.mobile .tooltip { font-size: 12px; padding: 6px 9px; }
body.mobile .call-pop span { font-size: calc(var(--S) * .14); }
body.mobile .cer-caption b { font-size: calc(var(--S) * .065); }
body.mobile .cer-skip { bottom: 4%; }
body.mobile .chat-pop { right: 52px; top: 6px; width: 260px; max-height: calc(var(--app-h) - 12px); overflow-y: auto; }
body.mobile.replay #replay-panel { top: 6px; bottom: auto; right: 52px; left: auto; width: 250px; max-height: calc(var(--app-h) - 12px); font-size: 12px; }
body.mobile .banner-in b { font-size: 32px; }
body.mobile .peek-back { top: 10px; }

/* 弹窗紧凑 */
body.mobile .modal-wrap { padding: 6px; }
body.mobile .modal { padding: 14px 16px; border-radius: 14px; max-height: calc(var(--app-h) - 12px); }
body.mobile .modal h2 { font-size: 20px; margin-bottom: 8px; }
body.mobile .res-title { font-size: 30px; }
body.mobile .res-win { padding: 8px; margin: 6px 0 8px; }
body.mobile .res-hand .tile { --w: 26px; }
body.mobile .res-row { padding: 5px 12px; font-size: 13px; }
body.mobile .pod { min-width: 96px; padding: 8px; }
body.mobile .avatar.big { width: 46px; height: 46px; font-size: 24px; }
body.mobile .auth-modal .modal { width: min(560px, 100%); }
body.mobile .af-form { gap: 5px; }
body.mobile .af input { padding: 8px 10px; font-size: 16px; }
body.mobile .set-row { padding: 6px 0; font-size: 13px; }

/* 其他页面 */
body.mobile.short .sc-head { padding: 6px 12px; }
body.mobile.short .sc-head h2 { font-size: 22px; }
body.mobile.short .sc-body { padding: 10px 14px 20px; }
body.mobile.short .sc-foot { padding: 6px 12px; }
body.mobile.short .home-main { padding: 8px 16px; width: min(860px, 100%); }
body.mobile.short .logo h1 { font-size: clamp(36px, calc(var(--app-h) * .14), 70px); }
body.mobile.short .seal { font-size: 26px; }
body.mobile.short .tagline { margin: 4px 0 10px; font-size: 12px; }
body.mobile.short .home-menu { grid-template-columns: repeat(4, 1fr); gap: 8px; }
body.mobile.short .menu-btn { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 10px 6px; row-gap: 2px; }
body.mobile.short .menu-btn i { grid-row: auto; font-size: 26px; }
body.mobile.short .menu-btn b { font-size: 15px; }
body.mobile.short .menu-btn small { font-size: 11px; }
body.mobile.short .home-stats { margin-top: 6px; }
body.mobile.short .home-foot { margin-top: 4px; }
body.mobile.short .link { padding: 4px 8px; font-size: 12px; }
body.mobile.short .account-chip { top: 8px; right: 10px; }
body.mobile .learn-nav { width: 180px; }
body.mobile.short .learn-content h2 { font-size: 26px; }

/* 主页：设备模式选择 */
.device-pick { display: flex; gap: 6px; margin: 0 0 14px; padding: 4px; border-radius: 30px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.device-pick button { border: 0; background: none; padding: 7px 16px; border-radius: 24px; font-size: 14px; color: var(--muted); }
.device-pick button.on { background: var(--gold); color: #3a1f00; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
body.mobile.short .device-pick { margin: 0 0 8px; }
body.mobile.short .device-pick button { padding: 5px 12px; font-size: 12px; }
/* 手机横屏：结算框左右两栏，一屏放下 */
body.mobile.short .result-modal .modal.result { width: min(880px, 100%); display: grid; grid-template-columns: 1.45fr 1fr; column-gap: 14px; align-items: start; grid-auto-flow: row dense; padding: 10px 14px; }
body.mobile.short .modal.result .res-title, body.mobile.short .modal.result .res-sub { grid-column: 1 / -1; font-size: 24px; margin: 0 0 4px !important; }
body.mobile.short .modal.result .res-sub { font-size: 13px; }
body.mobile.short .modal.result .res-win { grid-column: 1; margin: 0 0 6px; }
body.mobile.short .modal.result .res-scores, body.mobile.short .modal.result .res-actions, body.mobile.short .modal.result .res-wait { grid-column: 2; }
body.mobile.short .modal.result .res-scores { margin: 0; }
body.mobile.short .modal.result .res-row { grid-template-columns: 1fr 52px 56px; padding: 5px 10px; }
body.mobile.short .modal.result .res-actions { margin-top: 8px; gap: 8px; }
body.mobile.short .modal.result .res-actions .btn { padding: 9px 14px; font-size: 14px; }
body.mobile.short .res-hand { gap: 5px; margin-bottom: 6px; }
body.mobile.short .res-hand .tile { --w: 22px; }
body.mobile.short .fan { font-size: 11px; padding: 2px 7px; }
body.mobile.short .res-total { font-size: 13px; margin-top: 6px; }
body.mobile.short .res-total b { font-size: 16px; }
body.mobile.short .res-who { font-size: 14px; margin-bottom: 6px; }
body.mobile.short .modal.final .podium { margin: 6px 0; gap: 8px; }
body.mobile.short .pod .medal { font-size: 24px; }
body.mobile.short .pod-score { font-size: 17px; }
/* 手机横屏：登录注册表单两栏 */
body.mobile.short .auth-modal .modal { width: min(720px, 100%); padding-top: 8px; }
body.mobile.short .auth-tabs { margin-bottom: 8px; }
body.mobile.short .auth-tabs button { padding: 6px; font-size: 15px; }
body.mobile.short .auth .af-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; align-items: start; }
body.mobile.short .auth .af-form > :not(.af) { grid-column: 1 / -1; }
body.mobile.short .auth .af-form .chk { grid-column: auto; align-self: end; padding-bottom: 10px; }
body.mobile.short .name-card { padding: 6px 10px; }
body.mobile.short .name-card .avatar { width: 34px; height: 34px; }
body.mobile.short .af-warn { padding: 5px 10px; font-size: 12px; }
.cer-toggle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; width: 100%; margin: 4px 0 12px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 15px; text-align: left; }
.cer-toggle b { color: var(--muted); }
.cer-toggle small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.cer-toggle.on { border-color: var(--gold); background: rgba(243, 201, 105, .16); }
.cer-toggle.on b { color: var(--gold); }
.cer-toggle.static { cursor: default; }
/* 下载安卓 App（左下角） */
.app-dl { position: absolute; z-index: 6; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 16px;
  background: rgba(0,0,0,.35); border: 1px solid var(--line); color: var(--text); text-decoration: none; backdrop-filter: blur(4px); box-shadow: 0 8px 20px rgba(0,0,0,.3); animation: barIn .4s ease .5s both; }
.app-dl img { width: 40px; height: 40px; border-radius: 10px; }
.app-dl b { display: block; font-size: 14px; color: var(--gold); }
.app-dl small { display: block; font-size: 11px; color: var(--muted); }
.app-dl:active { transform: scale(.97); }
body.mobile.short .app-dl { left: 10px; bottom: 8px; padding: 4px 10px 4px 4px; }
body.mobile.short .app-dl img { width: 30px; height: 30px; }
body.in-app #btn-full { display: none !important; }
body.mobile .cer-caption { top: 7%; padding: 5px 18px; }
body.mobile .roll-btn { min-width: 92px; min-height: 92px; }
