:root {
  --ink: #202622;
  --ink-soft: #414a44;
  --muted: #717a74;
  --line: #dce2dc;
  --line-strong: #cbd4cd;
  --surface: #ffffff;
  --surface-soft: #f7f9f6;
  --canvas: #eef2ed;
  --green: #176b52;
  --green-dark: #0f533e;
  --green-soft: #e7f2ed;
  --red: #bd3b43;
  --red-soft: #fff1f1;
  --gold: #a87513;
  --gold-soft: #fff5d9;
  --shadow: 0 8px 28px rgba(28, 47, 36, .08);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
html { overscroll-behavior-y: contain; }
body { min-width: 320px; background: var(--canvas); }
button, input { font: inherit; letter-spacing: 0; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(23, 107, 82, .2); outline-offset: 2px; }
[hidden] { display: none !important; }

.boot { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--green); }
.boot img { width: 68px; height: 68px; filter: drop-shadow(0 10px 18px rgba(23,107,82,.16)); }
.boot strong { font-size: 20px; }

.auth-shell { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); background: var(--surface); }
.auth-brand { position: relative; min-height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(34px, 6vw, 80px); overflow: hidden; background: #155d49; color: #fff; }
.brand-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; }
.brand-lockup img { width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.27); border-radius: 8px; }
.auth-brand-content { position: relative; z-index: 1; margin: auto 0; }
.brand-tiles { display: flex; gap: 8px; margin-bottom: 32px; }
.brand-tiles span { width: 52px; height: 64px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.28); border-bottom-width: 4px; border-radius: 7px; background: #fff; color: var(--ink); box-shadow: 0 10px 22px rgba(0,0,0,.12); font-size: 28px; font-weight: 800; }
.brand-tiles span:last-child { color: var(--gold); font-size: 17px; }
.brand-kicker { margin: 0 0 8px !important; color: #d1e7dd !important; font-size: 13px !important; font-weight: 700; }
.auth-brand h1 { margin: 0 0 18px; font-size: 68px; line-height: 1.06; }
.auth-brand-content > p:last-child { max-width: 520px; margin: 0; color: rgba(255,255,255,.76); font-size: 17px; line-height: 1.75; }
.auth-brand-foot { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.6); font-size: 12px; }
.auth-panel { display: grid; place-items: center; padding: 42px clamp(28px, 6vw, 84px); }
.auth-form { width: min(410px, 100%); }
.auth-form h2 { margin: 0 0 8px; font-size: 30px; }
.auth-subtitle { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.auth-tabs button { height: 46px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { border-color: var(--green); color: var(--green); font-weight: 800; }
.field { display: grid; gap: 8px; margin-bottom: 17px; }
.field-label { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
input { width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:hover { border-color: #aebbb2; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,82,.08); outline: 0; }
input::placeholder { color: #a1a8a3; }
.avatar-select-trigger { width: 100%; min-height: 70px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 13px; margin: 9px 0 20px; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.avatar-select-trigger:hover { border-color: #9db9aa; box-shadow: 0 4px 14px rgba(28,47,36,.07); }
.avatar-select-trigger .selected-avatar { width: 48px; height: 48px; font-size: 27px; }
.avatar-select-trigger strong, .avatar-select-trigger small { display: block; }
.avatar-select-trigger strong { font-size: 14px; }
.avatar-select-trigger small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.avatar-select-chevron { color: #97a19a; font-size: 24px; }
.avatar-sheet { width: min(620px, calc(100vw - 28px)); overflow: hidden; }
.avatar-sheet .sheet-body { display: flex; max-height: calc(100svh - 30px); flex-direction: column; overflow: hidden; }
.avatar-sheet .sheet-body h2 { flex: 0 0 auto; }
.avatar-category-tabs { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); margin-bottom: 14px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #edf1ee; }
.avatar-category-tabs button { min-height: 38px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 750; }
.avatar-category-tabs button[aria-selected="true"] { background: var(--surface); color: var(--green); box-shadow: 0 2px 7px rgba(31,61,46,.12); }
.avatar-options-scroll { min-height: 0; padding: 2px 5px 2px 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.avatar-option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.avatar-option { aspect-ratio: 1; min-width: 0; display: grid; place-items: center; border: 1px solid var(--avatar-border, var(--line)); border-radius: 7px; background: var(--avatar-bg, var(--surface-soft)); color: var(--avatar-ink, var(--ink)); cursor: pointer; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Segoe UI Emoji", sans-serif; font-size: 30px; transition: transform .15s, border-color .15s, box-shadow .15s; }
.avatar-option:hover { border-color: #9db9aa; transform: translateY(-1px); }
.avatar-option[aria-pressed="true"] { border-color: var(--green); box-shadow: 0 0 0 2px rgba(23,107,82,.2); }
.avatar-tone-jade { --avatar-bg: #dff3e8; --avatar-ink: #11644b; --avatar-border: #acd9c5; }
.avatar-tone-mint { --avatar-bg: #daf3f1; --avatar-ink: #176c68; --avatar-border: #aad9d5; }
.avatar-tone-sky { --avatar-bg: #e3f1fb; --avatar-ink: #1e5f87; --avatar-border: #b5d7ed; }
.avatar-tone-indigo { --avatar-bg: #e5e9f7; --avatar-ink: #3f518c; --avatar-border: #bec8e5; }
.avatar-tone-rose { --avatar-bg: #fde7ec; --avatar-ink: #a7354b; --avatar-border: #efb5c1; }
.avatar-tone-coral { --avatar-bg: #ffebe1; --avatar-ink: #a74624; --avatar-border: #edc0aa; }
.avatar-tone-amber { --avatar-bg: #fff2cf; --avatar-ink: #8a6110; --avatar-border: #e5cf91; }
.avatar-tone-violet { --avatar-bg: #eee8fb; --avatar-ink: #6847a2; --avatar-border: #d0c2ea; }
.auth-submit { min-height: 50px !important; margin-top: 4px; }
.auth-links { display: flex; justify-content: space-between; gap: 14px; margin-top: 19px; }
.text-button { padding: 4px 0; border: 0; background: transparent; color: var(--green); cursor: pointer; font-size: 13px; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 750; transition: background .15s, border-color .15s, transform .15s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { background: var(--green); color: #fff; box-shadow: 0 5px 13px rgba(23,107,82,.15); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: #7eaa98; background: #fff; color: var(--green); }
.button.secondary:hover { background: var(--green-soft); }
.button.ghost { border-color: var(--line-strong); background: #fff; color: var(--ink); }
.button.ghost:hover { border-color: #aebbb2; background: var(--surface-soft); }
.button.danger { border-color: #e2afb2; background: var(--red-soft); color: #a82f36; }
.button.block { width: 100%; }

.app-shell { min-height: 100svh; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
.app-header { position: sticky; z-index: 20; top: 0; height: calc(66px + env(safe-area-inset-top, 0px)); display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: env(safe-area-inset-top, 0px) max(18px, calc((100vw - 960px) / 2)) 10px; border-bottom: 1px solid rgba(203,212,205,.9); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.app-header .brand-lockup { color: var(--ink); font-size: 17px; }
.app-header .brand-lockup img { width: 39px; height: 39px; border-color: var(--line); }
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-user { max-width: 190px; display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--ink-soft); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.header-avatar { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--avatar-border, transparent); border-radius: 50%; background: var(--avatar-bg, var(--green-soft)); color: var(--avatar-ink, var(--ink)); font-size: 17px; }
.icon-button { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 19px; transition: background .15s, border-color .15s; }
.icon-button:hover { border-color: #aebbb2; background: var(--surface-soft); }
.page { width: min(960px, 100%); margin: 0 auto; padding: 30px 20px 40px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.page-heading h1 { margin: 0; font-size: 29px; }
.page-heading p:not(.kicker) { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.kicker { margin: 0 0 6px; color: var(--green); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.refresh-button { color: var(--green); font-size: 22px; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-panel { min-width: 0; display: grid; grid-template-columns: 48px 1fr; align-items: start; gap: 4px 14px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 3px 14px rgba(28,47,36,.04); }
.action-symbol { grid-row: 1 / span 2; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 400; }
.action-symbol.join { background: var(--gold-soft); color: var(--gold); font-size: 22px; font-weight: 800; }
.action-panel h2 { margin: 2px 0 6px; font-size: 18px; }
.action-panel p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.action-panel > .button, .action-panel > .join-row { grid-column: 1 / -1; margin-top: 15px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join-row input { font-family: Consolas, "SFMono-Regular", monospace; font-size: 18px; font-weight: 800; letter-spacing: 0; text-align: center; }
.room-section { margin-top: 31px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 17px; }
.section-title span { color: var(--muted); font-size: 12px; }
.room-list { display: grid; gap: 9px; }
.room-row { width: 100%; min-height: 82px; display: grid; grid-template-columns: 8px 1fr auto 18px; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s; }
.room-row:hover { border-color: #a9bbae; box-shadow: var(--shadow); transform: translateY(-1px); }
.room-state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.room-state-dot.ended { background: #99a29c; box-shadow: 0 0 0 4px #eff1ef; }
.room-code { font-size: 18px; font-weight: 850; }
.room-meta { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.room-total { min-width: 62px; display: grid; justify-items: end; font-size: 21px; font-weight: 850; }
.room-total small { margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 600; }
.room-chevron { color: #9fa8a2; font-size: 24px; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.empty-state { padding: 50px 20px; border: 1px dashed var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.42); color: var(--muted); text-align: center; }

.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; height: calc(66px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(3, minmax(74px, 120px)); justify-content: center; gap: clamp(4px, 5vw, 28px); padding: 3px 12px env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--line); background: rgba(255,255,255,.98); box-shadow: 0 -8px 24px rgba(28,47,36,.05); }
.bottom-nav button { min-width: 74px; display: grid; place-content: center; justify-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.bottom-nav button span { height: 23px; color: #7e8781; font-size: 20px; line-height: 23px; }
.bottom-nav button[aria-current="page"] { color: var(--green); font-weight: 800; }
.bottom-nav button[aria-current="page"] span { color: var(--green); }

.room-topbar { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 13px; margin-bottom: 20px; }
.room-topbar h1 { margin: 0; font-family: Consolas, "SFMono-Regular", monospace; font-size: 23px; letter-spacing: 0; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #a9d2c2; border-radius: 5px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; }
.status-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.ended { border-color: var(--line); background: #ecefeb; color: var(--muted); }
.room-summary { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; padding: 20px 22px; border-left: 4px solid var(--green); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.room-summary strong { display: block; margin-top: 3px; font-size: 25px; }
.summary-score strong { font-size: 34px; line-height: 1.05; }
.room-summary span { color: var(--muted); font-size: 11px; }
.countdown { text-align: right; }
.countdown strong { color: var(--ink-soft); font-size: 15px; }
.scoring-mode-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.72); }
.scoring-mode-panel strong { display: block; margin-top: 2px; font-size: 16px; }
.scoring-mode-panel p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.mode-switch { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, 64px); padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #edf1ee; }
.mode-switch button { min-height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 750; }
.mode-switch button[aria-pressed="true"] { background: var(--surface); color: var(--green); box-shadow: 0 2px 7px rgba(31,61,46,.12); }
.mode-badge { flex: 0 0 auto; padding: 5px 9px; border-radius: 5px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; }
.member-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.member { position: relative; min-width: 0; min-height: 116px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-rows: 1fr auto; align-items: center; gap: 5px 12px; padding: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.member { cursor: pointer; }
button.member:not(:disabled):hover { border-color: #8fb8a7; box-shadow: var(--shadow); transform: translateY(-1px); }
.member.left { opacity: .62; }
.avatar { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--avatar-border, transparent); border-radius: 50%; background: var(--avatar-bg, #e9eeea); color: var(--avatar-ink, var(--ink)); font-size: 26px; }
.member-main { min-width: 0; }
.member-name { overflow: hidden; font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.member-role { display: inline-flex; margin-top: 5px; padding: 2px 6px; border-radius: 4px; background: #edf1ee; color: var(--muted); font-size: 10px; }
.member-score { display: grid; justify-items: end; font-size: 24px; font-weight: 850; }
.member-score small { color: var(--muted); font-size: 9px; font-weight: 600; }
.member-pay-hint { grid-column: 2 / -1; color: var(--green); font-size: 10px; }
.tea-member { border-color: #e1c77f; background: var(--gold-soft); }
.tea-member .avatar { background: #ffdfa0; color: #76510e; font-size: 17px; font-weight: 850; }
.tea-member .member-role { background: rgba(255,255,255,.6); color: #7d641f; }
.tea-member .member-pay-hint, .tea-score { color: var(--gold); }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.score-round-button { width: 100%; min-height: 55px; margin-top: 15px; font-size: 16px; }
.score-round-button span { margin-right: 6px; font-size: 20px; }
.ledger { margin-top: 30px; }
.ledger-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.ledger-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; padding: 14px 15px; border-bottom: 1px solid #e8ece8; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; }
.ledger-row p { margin: 0; font-size: 13px; }
.ledger-arrow { margin: 0 7px; color: var(--muted); font-size: 11px; }
.ledger-row time { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.ledger-points { color: var(--red); font-size: 17px; font-weight: 850; }
.round-ledger { align-items: start; }
.round-scores { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.round-score { padding: 3px 6px; border-radius: 4px; background: #f1f4f1; font-size: 10px; font-weight: 750; }
.round-score.positive { background: var(--green-soft); }
.round-score.negative { background: #fcebed; }
.ledger-balanced { padding: 4px 6px; border-radius: 4px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 800; }

.profile-band { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 20px; padding: 20px; border-left: 4px solid var(--green); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.profile-band .profile-avatar { width: 76px; height: 76px; font-size: 38px; }
.profile-band h2 { margin: 0; font-size: 24px; }
.settings-section { padding: 27px 0; border-bottom: 1px solid var(--line-strong); }
.settings-section h2 { margin: 0 0 18px; font-size: 17px; }
.settings-section .field { max-width: 520px; }
.settings-section .avatar-select-trigger { max-width: 520px; }
.support-link { width: min(520px, 100%); min-height: 64px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.support-link:hover { border-color: #c7a354; box-shadow: 0 4px 14px rgba(83,65,22,.08); }
.support-link-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-size: 20px; }
.support-link strong, .support-link small { display: block; }
.support-link strong { font-size: 14px; }
.support-link small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.support-link-arrow { color: #9fa8a2; font-size: 24px; }
.donate-page { text-align: center; }
.donate-topbar { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; margin-bottom: 28px; }
.donate-topbar > div { min-width: 0; }
.donate-topbar h1 { margin: 0; font-size: 25px; }
.donate-intro h2 { margin: 0; font-size: 21px; }
.donate-intro p { margin: 8px 0 21px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.donate-code-frame { width: min(420px, 100%); aspect-ratio: 690 / 753; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 14px 36px rgba(31,50,39,.1); }
.donate-code-frame img { width: 162.03%; max-width: none; transform: translate(-19.14%, -18.77%); }
.donate-tip { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

.sheet { width: min(440px, calc(100vw - 28px)); max-height: calc(100svh - 28px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(20,28,23,.24); }
.sheet::backdrop { background: rgba(21,26,23,.58); backdrop-filter: blur(2px); }
.sheet-body { position: relative; margin: 0; padding: 28px; }
.sheet-body h2 { margin: 0 0 20px; font-size: 24px; }
.sheet-body p { line-height: 1.7; }
.icon-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 25px; }
.icon-close:hover { background: var(--surface-soft); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.dialog-message { margin-top: 14px; padding: 10px 12px; border: 1px solid #b9d6ca; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 700; line-height: 1.5; }
.dialog-message.error { border-color: #e6b6ba; background: var(--red-soft); color: #9f2f36; }
.dialog-message + .sheet-actions { margin-top: 10px; }
.pay-target { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 13px; margin: 17px 0 22px; }
.pay-target > span { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-weight: 850; }
.pay-target small { color: var(--muted); font-size: 11px; }
.pay-target h2 { margin: 2px 0 0; font-size: 21px; }
.score-field input { height: 68px; color: var(--green); font-size: 31px; font-weight: 850; text-align: center; }
.round-help { margin: -10px 0 18px; color: var(--muted); font-size: 12px; }
.round-inputs { display: grid; gap: 8px; }
.round-input-row { display: grid; grid-template-columns: 40px minmax(72px, 1fr) minmax(150px, 190px); align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.round-avatar { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--avatar-border, transparent); border-radius: 50%; background: var(--avatar-bg, #e9eeea); color: var(--avatar-ink, var(--ink)); font-size: 20px; }
.round-avatar.tea { background: #ffdfa0; color: #76510e; font-size: 13px; font-weight: 850; }
.round-input-row label { min-width: 0; }
.round-input-row label > span { display: block; overflow: hidden; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.round-input-row label small { color: var(--muted); font-size: 9px; }
.score-stepper { display: grid; grid-template-columns: 38px minmax(66px, 1fr) 38px; height: 40px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.score-stepper button { border: 0; background: #edf1ee; color: var(--green); cursor: pointer; font-size: 20px; font-weight: 800; }
.score-stepper input { min-width: 0; padding: 0 4px; border: 0; border-inline: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--ink); font-size: 18px; font-weight: 850; text-align: center; }
.score-stepper input:focus { outline: 2px solid rgba(23,107,82,.2); outline-offset: -2px; }
.round-balance { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid #b9d6ca; border-radius: 7px; background: var(--green-soft); color: var(--green); }
.round-balance span { font-size: 11px; font-weight: 750; }
.round-balance strong { grid-row: span 2; font-size: 25px; }
.round-balance small { font-size: 10px; }
.round-balance.unbalanced { border-color: #e6b6ba; background: #fcebed; color: var(--red); }
.round-confirm-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; }
.round-confirm-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.round-confirm-row:last-child { border-bottom: 0; }
.round-confirm-row strong { font-size: 17px; }
.confirm-sheet > p { margin-bottom: 12px; color: var(--muted); }
.payment-amount { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 20px; border: 1px solid #e5ca82; border-radius: 7px; background: var(--gold-soft); color: var(--gold); }
.payment-amount small { align-self: center; margin-right: auto; color: #816725; font-size: 11px; }
.payment-amount strong { font-size: 38px; }
.payment-amount span { font-weight: 750; }
.recovery-code { padding: 16px; border: 1px dashed var(--gold); border-radius: 6px; background: var(--gold-soft); font-family: Consolas, monospace; font-size: 22px; font-weight: 800; letter-spacing: 0; text-align: center; user-select: all; }
.warning { color: var(--red); font-size: 13px; }
.embedded-banner { padding: 11px 18px; background: #fff0ce; color: #624a13; font-size: 13px; line-height: 1.5; text-align: center; }
.toast { position: fixed; z-index: 100; right: 18px; bottom: calc(82px + env(safe-area-inset-bottom, 0px)); max-width: min(360px, calc(100vw - 36px)); padding: 12px 15px; border-radius: 6px; background: #222824; color: #fff; box-shadow: 0 12px 34px rgba(20,28,23,.2); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #963038; }

@media (max-width: 720px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 244px; padding: 24px 22px 28px; }
  .auth-brand-content { margin: 30px 0 18px; }
  .brand-tiles { margin-bottom: 18px; }
  .brand-tiles span { width: 37px; height: 46px; font-size: 20px; }
  .auth-brand h1 { font-size: 38px; }
  .auth-brand-content > p:last-child { max-width: 270px; font-size: 14px; }
  .auth-panel { place-items: start center; padding: 30px 20px 48px; }
  .action-grid { grid-template-columns: 1fr; }
  .page { padding: 25px 16px 34px; }
  .page-heading h1 { font-size: 25px; }
  .member-grid { grid-template-columns: 1fr 1fr; }
  .member { min-height: 120px; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 4px 10px; padding: 13px; }
  .member .avatar { width: 44px; height: 44px; font-size: 22px; }
  .member-score { grid-column: 2; justify-items: start; font-size: 22px; }
  .member-pay-hint { grid-column: 1 / -1; padding-top: 3px; border-top: 1px solid rgba(203,212,205,.6); }
}

@media (max-width: 460px) {
  .header-user { max-width: 112px; }
  .header-avatar { display: none; }
  .room-summary { padding: 17px; }
  .summary-score strong { font-size: 31px; }
  .countdown { max-width: 130px; }
  .countdown strong { font-size: 13px; }
  .member-grid { gap: 8px; }
  .scoring-mode-panel { align-items: stretch; flex-direction: column; }
  .mode-switch { width: 100%; grid-template-columns: repeat(2, 1fr); }
  .member { display: flex; min-height: 152px; flex-direction: column; align-items: flex-start; }
  .member-main { width: 100%; }
  .member-score { margin-top: auto; }
  .member-pay-hint { width: 100%; }
  .room-actions .button { flex: 1 1 auto; }
  .ledger-row { grid-template-columns: 32px minmax(0, 1fr) auto; padding-inline: 12px; }
  .ledger-mark { width: 32px; height: 32px; }
  .ledger-arrow { display: block; margin: 2px 0; }
  .profile-band { grid-template-columns: 70px 1fr; padding: 17px; }
  .profile-band .profile-avatar { width: 64px; height: 64px; font-size: 32px; }
  .sheet { width: calc(100vw - 20px); }
  .sheet-body { padding: 25px 20px 20px; }
  .avatar-sheet .sheet-body { padding-inline: 16px; }
  .avatar-option-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .avatar-option { font-size: 27px; }
  .round-input-row { grid-template-columns: 38px minmax(58px, 1fr) minmax(142px, 1.4fr); gap: 7px; padding: 8px; }
  .score-stepper { grid-template-columns: 36px minmax(54px, 1fr) 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
