:root {
  color-scheme: light;
  --ink: #24241f;
  --muted: #77776d;
  --paper: #f4f1e9;
  --card: #fffefa;
  --line: #dedbd1;
  --orange: #e76f3c;
  --orange-dark: #bd4e25;
  --green: #617c65;
  --shadow: 0 18px 55px rgba(48, 43, 32, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 86% 3%, rgba(231, 111, 60, .10), transparent 31rem),
    var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(900px, calc(100% - 36px)); margin: 0 auto; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(36,36,31,.12); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.button-quiet { min-height: 36px; padding: 0 12px; color: var(--muted); border: 1px solid var(--line); background: transparent; font-size: 12px; }
.login-card { width: min(100%, 460px); margin: 56px auto; padding: 30px; }
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.login-copy { margin: 10px 0 24px; color: var(--muted); font-size: 14px; }
.login-card label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.login-card input[type="password"], .login-card input[type="email"], .login-card input[inputmode="numeric"] { display: block; width: 100%; height: 46px; margin-bottom: 14px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fbfaf6; }
.login-card .button-primary { width: 100%; }
.auth-switch { width: 100%; margin-top: 12px; }
.email-code-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.email-code-row label { margin: 0 0 8px; }
.email-code-row button { margin-bottom: 7px; }
.login-status { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.login-status[data-error="true"] { color: #b3483d; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { color: var(--orange); font: 500 20px "DM Mono", monospace; letter-spacing: -.15em; }
.local-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid #d8dfd1; border-radius: 999px; color: #586d59; background: rgba(255,255,255,.45); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #75a46f; box-shadow: 0 0 0 3px rgba(117,164,111,.13); }

.intro { padding: 66px 0 30px; }
.eyebrow { margin: 0 0 12px; color: var(--orange-dark); font: 500 10px "DM Mono", monospace; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(38px, 7vw, 66px); line-height: 1.13; letter-spacing: -.075em; font-weight: 800; }
h1 em { color: var(--orange); font-style: normal; }
.lede { max-width: 520px; margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.card { border: 1px solid rgba(36,36,31,.10); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.controls { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 20px; }
.range-fields { display: flex; align-items: end; gap: 12px; }
label { color: #55554d; font-size: 12px; font-weight: 700; }
.range-fields label { display: grid; gap: 8px; }
.source-field { display: grid; gap: 8px; min-width: 140px; }
select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fbfaf6; }
select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(231,111,60,.12); }
input[type="number"] { width: 132px; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fbfaf6; font: 500 15px "DM Mono", monospace; }
input:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(231,111,60,.12); }
.range-separator { padding: 0 0 13px; color: #aaa89c; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; min-height: 44px; padding: 0 17px; border: 0; border-radius: 9px; font-weight: 700; transition: transform .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .6; cursor: wait; transform: none; }
.button-primary { color: white; background: var(--orange); }
.button-primary:hover { background: var(--orange-dark); }
.button-arrow { font-size: 17px; }
.status-line { min-height: 24px; margin: 13px 4px 20px; color: var(--muted); font-size: 13px; }

.problem-card, .result-card { margin-top: 18px; padding: clamp(20px, 4vw, 34px); }
.section-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid #eeece5; }
.section-heading .eyebrow { margin-bottom: 6px; }
h2 { margin: 0; font-size: 25px; letter-spacing: -.045em; }
.question-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--orange-dark); background: #fff0e8; font: 500 18px "DM Mono", monospace; }
.statement { padding: 24px 0 4px; color: #383831; font-size: 15px; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.statement-image { display: block; max-width: min(100%, 680px); max-height: 520px; height: auto; object-fit: contain; margin: 14px auto; border-radius: 7px; }
.statement-image-error { display: block; margin: 10px 0; color: var(--muted); font-size: 12px; }
.statement-section { margin: 22px 0 0; }
.statement-section h3 { margin: 0 0 8px; color: #77776d; font: 500 10px "DM Mono", monospace; letter-spacing: .14em; text-transform: uppercase; }
.statement-section p { margin: 0; white-space: pre-wrap; }
.samples { display: grid; gap: 14px; margin-top: 24px; }
.sample { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf6; }
.sample-title { padding: 9px 12px; border-bottom: 1px solid var(--line); color: #77776d; font: 500 10px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.sample-columns { display: grid; grid-template-columns: 1fr 1fr; }
.sample-part { min-width: 0; }
.sample-part + .sample-part { border-left: 1px solid var(--line); }
.sample-label { padding: 8px 11px; border-bottom: 1px solid #e9e6dd; color: #77776d; font-size: 11px; font-weight: 700; }
.sample pre { margin: 0; padding: 12px; min-height: 60px; overflow: auto; color: #30302a; font: 12px/1.65 "DM Mono", Consolas, monospace; white-space: pre; }
.sample-explanation { padding: 10px 12px; border-top: 1px solid #e9e6dd; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.judge-form { margin-top: 28px; padding-top: 24px; border-top: 1px solid #eeece5; }
.judge-form label { display: block; color: var(--ink); font-size: 15px; }
.field-hint { margin: 6px 0 12px; color: var(--muted); font-size: 12px; }
textarea { display: block; width: 100%; min-height: 145px; resize: vertical; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: #fbfaf6; font-size: 14px; line-height: 1.8; }
.submit-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.char-count { color: #96958b; font: 11px "DM Mono", monospace; }
.button-dark { color: white; background: var(--ink); }
.button-dark:hover { background: #48483f; }

.practice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.coach-card { margin-top: 18px; }
.coach-card h2 { margin: 0; font-size: 21px; }
.coach-content { display: grid; gap: 10px; margin-top: 14px; }
.coach-content > p { margin: 0; color: var(--muted); }
.coach-block { padding: 12px 14px; border-radius: 9px; background: #f6f4ee; }
.coach-block h3 { margin: 0 0 6px; color: #77776d; font-size: 12px; }
.coach-block p { margin: 0; color: #48483f; font-size: 13px; line-height: 1.75; white-space: pre-wrap; }

.result-card { border-left: 4px solid var(--green); }
.result-card[data-verdict="wrong"] { border-left-color: #c75547; }
.result-card[data-verdict="partial"] { border-left-color: #d59b36; }
.result-card[data-verdict="unclear"] { border-left-color: #73809a; }
.result-card .eyebrow { margin-bottom: 7px; }
.result-copy { margin-top: 15px; color: #48483f; font-size: 14px; line-height: 1.85; white-space: pre-wrap; }
.result-details { display: grid; gap: 10px; margin-top: 15px; }
.detail-block { padding: 12px 14px; border-radius: 9px; background: #f6f4ee; }
.detail-block h3 { margin: 0 0 6px; color: #77776d; font-size: 11px; }
.detail-block p { margin: 0; color: #48483f; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
footer { display: flex; align-items: center; justify-content: space-between; padding: 28px 3px 36px; color: #939187; font-size: 11px; }
.footer-spark { color: var(--orange); font-size: 17px; }
.hidden { display: none !important; }

@media (max-width: 620px) {
  .intro { padding-top: 48px; }
  .controls { align-items: stretch; flex-direction: column; }
  .range-fields { justify-content: space-between; }
  .range-fields label { flex: 1; }
  input[type="number"] { width: 100%; }
  .button-primary { width: 100%; }
  .sample-columns { grid-template-columns: 1fr; }
  .sample-part + .sample-part { border-left: 0; border-top: 1px solid var(--line); }
}

/* Sokoban: a playful detective casebook palette, distinct from the practice UI. */
.soko-panel { --soko-night: #171126; --soko-board: #211936; --soko-tile: #2a2042; --soko-wall: #544786; --soko-wall-line: #a79adf; --soko-gold: #ffd36a; --soko-rose: #f08bb6; --soko-mint: #76f2bd; font-family: "Courier New", Consolas, monospace; }
.soko-panel h1, .soko-panel h2, .soko-panel button, .soko-panel select { font-family: "Courier New", Consolas, monospace; }
.soko-intro .eyebrow { color: #8d6a8c; }
.soko-intro h1 em { color: #d86b92; }
.soko-intro .lede { max-width: 620px; }
.soko-card { margin: 12px 0 40px; padding: clamp(16px, 4vw, 30px); overflow: hidden; }
.soko-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #eee8e3; }
.soko-kicker { margin: 0 0 7px; color: #a36c83; font: 700 11px/1.4 "DM Mono", Consolas, monospace; letter-spacing: .12em; }
.soko-kicker span { margin-left: 8px; color: #77776d; letter-spacing: .04em; }
.soko-topline h2 { font-size: clamp(19px, 4vw, 25px); }
.soko-stamp { flex: 0 0 auto; padding: 8px 11px; border: 2px solid #f0dce5; border-radius: 3px; color: #a24e70; background: #fff6f9; font-size: 12px; font-weight: 750; box-shadow: 3px 3px 0 #e4c8d4; }
.soko-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 18px 0 8px; }
.soko-toolbar label { display: grid; gap: 7px; width: min(360px, 100%); }
.soko-toolbar select { border-color: #e5d9df; background: #fffafc; }
.soko-stats { display: flex; gap: 8px; }
.soko-stats span { display: inline-flex; align-items: center; gap: 7px; min-height: 39px; padding: 0 12px; border: 2px solid #eee7df; border-radius: 3px; color: #77716e; background: #fffefa; font-size: 12px; box-shadow: 3px 3px 0 #e6ded8; }
.soko-stats strong { color: #3c3652; font: 750 16px "DM Mono", Consolas, monospace; }
.soko-status { min-height: 44px; margin: 10px 0 14px; padding: 11px 13px; border: 2px solid #eee2ed; border-radius: 3px; color: #5b5262; background: #faf3f6; font-size: 13px; line-height: 1.6; }
.soko-status[data-kind="won"] { color: #286044; background: #e8f8ee; }
.soko-status[data-kind="error"] { color: #a0444b; background: #fff0f0; }
.soko-status[data-kind="push"] { color: #815924; background: #fff6df; }
.soko-board-frame { display: grid; place-items: center; padding: clamp(10px, 2.8vw, 22px); border: 3px solid #786742; border-radius: 4px; background: #171126; box-shadow: inset 0 0 0 4px #352447, 5px 5px 0 #d7c4d1; }
.soko-board { display: grid; width: min(100%, 530px); gap: 3px; padding: 2px; touch-action: none; user-select: none; image-rendering: pixelated; }
.soko-cell { position: relative; display: grid; place-items: center; min-width: 0; aspect-ratio: 1; overflow: hidden; border-radius: 1px; }
.soko-cell.is-void { visibility: hidden; }
.soko-cell.is-floor { border: 1px solid #171126; background: #2a2042; box-shadow: inset 0 0 0 2px #30264b; }
.soko-cell.is-floor:nth-child(odd) { background: #302448; }
.soko-cell.is-wall { border: 2px solid var(--soko-wall-line); background: #544786; box-shadow: inset 0 0 0 3px #665999, inset 0 -5px 0 #393056, 3px 3px 0 #121020; }
.soko-wall-mark { position: absolute; top: 10%; left: 11%; width: 42%; height: 11%; background: #c1c7ff50; font-size: 0; }
.soko-cell.has-goal::after { position: absolute; inset: 0; background: #42e99c0d; content: ""; }
.soko-target { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; color: transparent; font-size: 0; }
.soko-target::before { width: 44%; aspect-ratio: 1; border-radius: 2px; background: linear-gradient(135deg, #a9ffd8, #45dfa4); box-shadow: 0 0 8px #52ffb8, inset 1px 1px #ddfff1; content: ""; transform: rotate(45deg); }
.soko-cell.has-box .soko-target { opacity: .42; }
.soko-cell.has-box.has-goal { outline: 2px solid var(--soko-mint); outline-offset: -3px; background: #283d3e; box-shadow: inset 0 0 0 3px #76f2bd38; }
.soko-feiqiu { position: relative; z-index: 2; display: grid; place-items: center; width: 94%; height: 94%; transition: transform .12s steps(2), filter .12s steps(2); }
.soko-feiqiu-img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(2px 3px 0 #171126); }
.soko-feiqiu.is-placed { filter: drop-shadow(0 0 3px #76f2bd); }
.soko-player { position: absolute; inset: 0; z-index: 3; display: grid; place-items: end center; }
.soko-player-sprite { display: block; width: 100%; height: 100%; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 #171126); }
.soko-player-sprite img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; }
.soko-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 15px; }
.soko-actions { position: absolute; left: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.soko-actions .button { min-height: 40px; }
.soko-panel .button-primary { border: 2px solid #713e69; border-radius: 3px; background: #c95e82; box-shadow: 3px 3px 0 #713e69; }
.soko-panel .button-primary:hover { background: #a94769; }
.soko-pad { display: grid; grid-template: repeat(2, 42px) / repeat(3, 42px); gap: 4px; }
.soko-pad button { display: grid; place-items: center; border: 2px solid #76678c; border-radius: 2px; color: #443b68; background: #f5eff8; box-shadow: 3px 3px 0 #c7bacf; font-size: 20px; font-weight: 800; touch-action: manipulation; }
.soko-pad button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #c7bacf; }
.soko-pad [data-soko-dir="up"] { grid-area: 1 / 2; }
.soko-pad [data-soko-dir="left"] { grid-area: 2 / 1; }
.soko-pad [data-soko-dir="down"] { grid-area: 2 / 2; }
.soko-pad [data-soko-dir="right"] { grid-area: 2 / 3; }
.soko-rules { margin-top: 17px; padding: 13px 15px; border: 2px solid #eee6df; border-radius: 3px; background: #fffdfa; box-shadow: 3px 3px 0 #e6ded8; }
.soko-rules summary { color: #59435c; font-size: 13px; font-weight: 750; cursor: pointer; }
.soko-rules p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

@media (max-width: 620px) {
  .soko-toolbar { align-items: stretch; flex-direction: column; }
  .soko-toolbar label { width: 100%; }
  .soko-stats { justify-content: flex-start; }
  .soko-controls { align-items: center; flex-direction: column-reverse; }
  .soko-actions { justify-content: center; }
  .soko-pad { grid-template: repeat(2, 48px) / repeat(3, 48px); }
  .soko-stamp { padding: 7px 9px; font-size: 11px; }
}

.app-nav { display: flex; gap: 8px; padding: 18px 0 0; border-bottom: 1px solid var(--line); }
.app-nav button { padding: 10px 16px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-weight: 700; }
.app-nav button.active { border-bottom-color: var(--orange); color: var(--orange-dark); }

/* The main app uses its unused left margin for navigation and gives game panels more room. */
.shell:has(#practiceApp:not(.hidden)) { width: min(1480px, calc(100% - 36px)); }
#practiceApp:not(.hidden) { display: grid; grid-template-columns: 205px minmax(0, 1fr); align-items: start; gap: 26px; }
#practiceApp > .app-nav { grid-column: 1; grid-row: 1; position: sticky; top: 12px; display: grid; align-content: start; gap: 5px; max-height: calc(100dvh - 24px); padding: 8px 0; overflow: auto; border: 0; }
#practiceApp > .app-nav button { min-height: 42px; padding: 9px 12px; border: 0; border-left: 3px solid transparent; border-radius: 0 10px 10px 0; text-align: left; }
#practiceApp > .app-nav button.active { border-left-color: var(--orange); background: #fff8f0; }
#practiceApp > section:not(.hidden) { grid-column: 2; grid-row: 1; min-width: 0; }
.tablegame-lobby { margin-top: 4px; padding: clamp(18px, 3vw, 32px); }
.tablegame-lobby > h2 { margin: 14px 0 20px; font-size: clamp(24px, 3vw, 34px); }
.tablegame-lobby .tablegame-entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .45fr) auto; align-items: end; gap: 14px; margin: 18px 0; }
.tablegame-lobby label { display: grid; gap: 7px; }
.tablegame-lobby input:not([type="file"]), .tablegame-lobby select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfaf6; }
.tablegame-lobby #tablegameJoin { margin: 22px 0 12px; }
.tablegame-lobby #tablegameJoin > label { display: block; margin-bottom: 8px; }
.tablegame-lobby details, .tractor-options { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.tablegame-lobby details summary, .tractor-options h3 { color: var(--ink); font-weight: 750; cursor: pointer; }
.tablegame-lobby details p, .tractor-options p { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.tractor-options h3 { margin: 0 0 12px; font-size: 15px; }
.tractor-option-row { display: flex; align-items: end; flex-wrap: wrap; gap: 18px; }
.tractor-option-row > label:not(.tractor-check) { display: grid; gap: 7px; min-width: 170px; }
.tractor-check { display: inline-flex !important; align-items: center; gap: 8px !important; min-height: 44px; }
.tablegame-lobby > p:last-child { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.splendor-card.selected { outline: 3px solid var(--orange); outline-offset: 2px; transform: translateY(-4px); }

@media (max-width: 850px) {
  .shell:has(#practiceApp:not(.hidden)) { width: min(900px, calc(100% - 24px)); }
  #practiceApp:not(.hidden) { display: block; }
  #practiceApp > .app-nav { position: sticky; top: 0; z-index: 20; display: flex; width: 100%; max-height: none; gap: 4px; padding: 10px 0 0; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--paper); }
  #practiceApp > .app-nav button { flex: 0 0 auto; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap; }
  #practiceApp > .app-nav button.active { border-bottom-color: var(--orange); background: transparent; }
  #practiceApp > section:not(.hidden) { min-width: 0; }
}
@media (max-width: 620px) {
  .tablegame-lobby .tablegame-entry { grid-template-columns: 1fr; }
  .tablegame-lobby .tablegame-entry > .button { width: 100%; }
  .tractor-option-row { align-items: stretch; flex-direction: column; gap: 8px; }
}

/* Full-screen Sokoban surface: keep the board in view and remove the site chrome. */
body.sokoban-active { height: 100%; min-height: 100%; overflow: hidden; background: #171126; }
body.sokoban-active .shell { width: 100%; max-width: none; height: 100dvh; margin: 0; }
body.sokoban-active .topbar,
body.sokoban-active .app-nav,
body.sokoban-active .shell > footer { display: none !important; }
.soko-panel { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 8px; width: 100vw; height: 100dvh; padding: 12px clamp(12px, 2vw, 28px); overflow: hidden; background: var(--soko-night); color: #f8f0d9; }
.soko-header { display: grid; grid-template-columns: auto minmax(150px, 1fr) minmax(140px, 1fr) auto minmax(145px, .8fr) auto auto; align-items: center; gap: 9px; width: min(100%, 1500px); margin: 0 auto; }
.soko-icon-button, .soko-tool-button { min-height: 42px; padding: 0 13px; border: 1px solid #66577d; border-radius: 11px; color: #f7edd5; background: #2b203d; font-weight: 750; box-shadow: 0 3px 0 #100c1d; }
.soko-icon-button { min-width: 42px; padding: 0 10px; font-size: 19px; }
.soko-tool-button:hover, .soko-icon-button:hover { border-color: #ffcf6c; background: #3a2d50; }
.soko-tool-button:disabled { opacity: .48; cursor: not-allowed; }
.soko-select-label, .soko-player-label { display: grid; gap: 4px; min-width: 0; color: #c7b8cf; font-size: 11px; font-weight: 700; }
.soko-select-label select, .soko-player-label input { height: 39px; min-width: 0; padding: 0 10px; border: 1px solid #68577a; border-radius: 9px; color: #f8f0d9; background: #211832; font-size: 13px; }
.soko-player-label input::placeholder { color: #978ba4; }
.soko-player-label input:focus, .soko-select-label select:focus { border-color: #76f2bd; outline: 2px solid #76f2bd33; }
.soko-header-stats { display: flex; gap: 7px; }
.soko-header-stats span { display: grid; min-width: 55px; gap: 1px; padding: 6px 9px; border: 1px solid #514260; border-radius: 9px; color: #b4a9bd; background: #211832; font-size: 10px; text-align: center; }
.soko-header-stats strong { color: #ffd36a; font-size: 17px; }
.soko-credit { width: min(100%, 1500px); min-height: 0; margin: 0 auto; color: #857996; font-size: 10px; }
.soko-status { width: min(100%, 1500px); min-height: 30px; margin: 0 auto; padding: 7px 12px; border: 1px solid #443750; border-radius: 9px; color: #d2c3d2; background: #20172e; font-size: 12px; line-height: 1.4; }
.soko-status[data-kind="won"] { border-color: #4da986; color: #baf5d4; background: #173328; }
.soko-status[data-kind="error"] { border-color: #b65769; color: #ffd4da; background: #3c1d2c; }
.soko-status[data-kind="push"] { border-color: #9a8050; color: #ffe1a1; background: #382d22; }
.soko-stage { min-width: 0; min-height: 0; overflow: hidden; }
.soko-board-viewport { display: grid; width: 100%; height: 100%; place-items: center; overflow: auto; overscroll-behavior: contain; scrollbar-color: #66577d #211832; scrollbar-width: thin; }
.soko-board-viewport.is-scrollable { display: flex; align-items: flex-start; justify-content: flex-start; padding: 8px; }
.soko-board-frame { display: grid; place-items: center; width: max-content; height: max-content; max-width: none; padding: 7px; border: 3px solid #786742; border-radius: 13px; background: #171126; box-shadow: inset 0 0 0 4px #352447, 5px 5px 0 #45334d; }
.soko-board-viewport.is-scrollable .soko-board-frame { flex: 0 0 auto; }
.soko-board { display: grid; width: max-content; height: max-content; gap: 3px; padding: 0; touch-action: pan-x pan-y; user-select: none; image-rendering: pixelated; }
.soko-cell { border-radius: 2px; }
.soko-cell.is-floor { border: 0; background: #2a2042; box-shadow: inset 0 0 0 2px #332849; }
.soko-cell.is-floor:nth-child(odd) { background: #302448; }
.soko-cell.is-wall { border: 2px solid var(--soko-wall-line); border-radius: 5px; background: #544786; box-shadow: inset 0 0 0 3px #665999, inset 0 -5px 0 #393056; }
.soko-cell.is-void { visibility: hidden; }
.soko-feiqiu, .soko-player-sprite { pointer-events: none; }
.soko-feiqiu { width: 96%; height: 96%; }
.soko-player-sprite { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 #171126); }
.soko-footer { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px; width: min(100%, 1500px); margin: 0 auto; }
.soko-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.soko-submit:not(:disabled) { border-color: #4da986; color: #c8ffe3; background: #23543f; }
.soko-pad { display: grid; grid-template: repeat(2, 38px) / repeat(3, 38px); gap: 4px; }
.soko-pad button { display: grid; place-items: center; border: 1px solid #716187; border-radius: 9px; color: #fff0d2; background: #352846; box-shadow: 0 3px 0 #100c1d; font-size: 17px; font-weight: 800; touch-action: manipulation; }
.soko-pad button:active { transform: translateY(2px); box-shadow: 0 1px 0 #100c1d; }
.soko-pad [data-soko-dir="up"] { grid-area: 1 / 2; }
.soko-pad [data-soko-dir="left"] { grid-area: 2 / 1; }
.soko-pad [data-soko-dir="down"] { grid-area: 2 / 2; }
.soko-pad [data-soko-dir="right"] { grid-area: 2 / 3; }
.soko-dialog { width: min(720px, calc(100vw - 24px)); max-height: min(82dvh, 850px); padding: clamp(18px, 3vw, 30px); overflow: auto; border: 2px solid #e8d8a7; border-radius: 20px; color: #332641; background: #fff8df; box-shadow: 0 24px 100px #080610aa; }
.soko-dialog::backdrop { background: #0d0918bb; backdrop-filter: blur(4px); }
.soko-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.soko-dialog-head h2 { color: #34253b; font-size: clamp(22px, 4vw, 30px); }
.soko-dialog-eyebrow { margin: 0 0 5px; color: #8b6878; font-size: 12px; font-weight: 800; }
.soko-dialog .soko-icon-button { border-color: #d9c8a1; color: #5b4964; background: #f7edcf; box-shadow: none; }
.soko-dialog-hint { margin: 11px 0 18px; color: #82777a; font-size: 13px; }
.soko-level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 9px; }
.soko-level-tile { display: grid; gap: 4px; min-height: 75px; padding: 9px; border: 1px solid #e3d6ae; border-radius: 12px; color: #554664; background: #fffdf5; text-align: left; }
.soko-level-tile:hover, .soko-level-tile.is-current { border-color: #e49a42; background: #ffedc7; }
.soko-level-tile strong { color: #34253b; font-size: 20px; }
.soko-level-tile span { color: #82777a; font-size: 10px; }
.soko-leaderboard-dialog { width: min(620px, calc(100vw - 24px)); }
.soko-name-dialog { width: min(440px, calc(100vw - 28px)); }
.soko-name-dialog-label { display: block; margin: 8px 0 6px; color: #5c4c66; font-size: 13px; font-weight: 800; }
.soko-name-dialog-input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #d9c8a1; border-radius: 11px; color: #34253b; background: #fffdf5; font: inherit; font-size: 16px; }
.soko-name-dialog-input:focus { border-color: #d06a92; outline: 2px solid #d06a9233; }
.soko-name-start-button { width: 100%; min-height: 46px; margin-top: 12px; border: 0; border-radius: 11px; color: #fff8df; background: #c6537d; font: inherit; font-size: 15px; font-weight: 850; cursor: pointer; }
.soko-name-start-button:disabled { opacity: .48; cursor: not-allowed; }
.soko-form-error { min-height: 1em; margin: 8px 0; color: #a72d50; font-size: 13px; }
.soko-name-dialog > .soko-win-secondary-button { width: 100%; margin-top: 10px; }
.soko-win-dialog { width: min(420px, calc(100vw - 28px)); }
.soko-win-moves { display: flex; align-items: baseline; justify-content: center; gap: 7px; margin: 8px 0; color: #a78239; }
.soko-win-moves strong { color: #c6537d; font-size: 48px; line-height: 1; }
.soko-win-moves span { font-size: 16px; font-weight: 800; }
.soko-win-note { margin: 0; color: #82777a; font-size: 13px; text-align: center; }
.soko-win-actions { display: grid; gap: 8px; margin-top: 18px; }
.soko-win-actions .soko-name-start-button { margin-top: 0; }
.soko-win-secondary-button { min-height: 42px; border: 1px solid #d9c8a1; border-radius: 11px; color: #5b4964; background: #f7edcf; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.soko-leaderboard-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 18px; padding: 4px; border-radius: 12px; background: #efe5c7; }
.soko-leaderboard-tabs button { min-height: 40px; border: 0; border-radius: 9px; color: #72667a; background: transparent; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.soko-leaderboard-tabs button.is-active { color: #3d2d42; background: #fffdf5; box-shadow: 0 2px 8px #39294318; }
.soko-leaderboard { min-height: 80px; color: #6e6270; font-size: 14px; }
.soko-ranking-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.soko-ranking-list li { display: grid; grid-template-columns: 42px minmax(0, 1fr) 70px 70px; align-items: center; gap: 8px; min-height: 45px; padding: 5px 10px; border-radius: 10px; background: #fffdf4; font-size: 12px; }
.soko-rank-number { color: #a78239; font-weight: 800; }
.soko-rank-name { overflow: hidden; color: #382b40; text-overflow: ellipsis; white-space: nowrap; }
.soko-rank-points { color: #704316; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .soko-panel { gap: 6px; padding: 8px; }
  .soko-header { grid-template-columns: auto minmax(135px, 1fr) minmax(125px, 1fr) auto auto; }
  .soko-player-label { grid-column: 2 / 4; grid-row: 2; }
  .soko-header-stats { grid-column: 4 / 6; grid-row: 2; justify-content: end; }
  .soko-credit { font-size: 9px; }
  .soko-board-frame { width: min(100%, 480px, calc((100dvh - 210px) * var(--soko-cols) / var(--soko-rows))); }
}
@media (max-width: 540px) {
  .soko-header { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .soko-icon-button, .soko-tool-button { min-height: 37px; padding: 0 8px; border-radius: 8px; font-size: 11px; }
  .soko-select-label { font-size: 9px; }
  .soko-select-label select, .soko-player-label input { height: 35px; padding: 0 7px; font-size: 11px; }
  .soko-player-label { grid-column: 2 / 4; grid-row: 2; }
  .soko-header-stats { grid-column: 1 / 2; grid-row: 2; gap: 3px; }
  .soko-header-stats span { min-width: 39px; padding: 4px; font-size: 8px; }
  .soko-header-stats strong { font-size: 13px; }
  #sokoLeaderboardButton { grid-column: 2 / 3; grid-row: 3; }
  #sokoChooseLevelButton { grid-column: 3 / 4; grid-row: 3; }
  .soko-status { padding: 6px 8px; font-size: 10px; }
  .soko-board-frame { width: min(100%, 480px, calc((100dvh - 248px) * var(--soko-cols) / var(--soko-rows))); padding: 5px; border-width: 2px; }
  .soko-footer { align-items: end; justify-content: space-between; gap: 6px; }
  .soko-actions { position: static; gap: 5px; }
  .soko-pad { grid-template: repeat(2, 34px) / repeat(3, 34px); gap: 3px; }
  .soko-ranking-list li { grid-template-columns: 30px minmax(0, 1fr) 48px 48px; gap: 4px; padding: 5px; font-size: 10px; }
}
/* Keep Sokoban in a phone-portrait column on desktop and mobile alike. */
.soko-panel { inset: 0 auto 0 50%; box-sizing: border-box; width: min(100vw, 520px); padding: 10px 12px; transform: translateX(-50%); }
.soko-header { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
.soko-set-label { grid-column: 1 / 5; grid-row: 1; }
.soko-level-label { grid-column: 1 / 4; grid-row: 2; }
.soko-header-stats { grid-column: 4 / 5; grid-row: 2; gap: 3px; }
.soko-header-stats span { min-width: 0; flex: 1; padding: 4px 3px; white-space: nowrap; }
.soko-header-stats strong { font-size: 12px; white-space: nowrap; }
.soko-player-label { grid-column: 1 / 3; grid-row: 3; }
#sokoLeaderboardButton { grid-column: 3 / 4; grid-row: 3; }
#sokoChooseLevelButton { grid-column: 4 / 5; grid-row: 3; }
.soko-credit, .soko-status, .soko-footer { width: 100%; }
.soko-credit { font-size: 9px; }
.soko-status { padding: 7px 9px; font-size: 11px; }
.soko-board-frame { width: min(100cqw, calc(100cqh * var(--soko-cols) / var(--soko-rows))); padding: 7px; }
.soko-footer { justify-content: space-between; gap: 8px; }
.soko-actions { position: static; flex-wrap: nowrap; gap: 4px; }
.soko-icon-button, .soko-tool-button { min-height: 36px; padding: 0 4px; font-size: 10px; }
.soko-pad { grid-template: repeat(2, 32px) / repeat(3, 32px); gap: 3px; }
.soko-ranking-list li { grid-template-columns: 30px minmax(0, 1fr) 48px 48px; gap: 4px; padding: 5px; font-size: 10px; }
.wordle-card { margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.wordle-options { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.wordle-options label { display: grid; gap: 8px; min-width: 190px; }
.wordle-guess-form { max-width: 560px; margin: 22px auto; }
.wordle-guess-form label { display: block; margin-bottom: 8px; }
.wordle-guess-row { display: flex; gap: 8px; }
.wordle-guess-row input { flex: 1; min-width: 0; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf6; color: var(--ink); font: 600 17px "DM Mono", Consolas, monospace; }
.wordle-board { display: grid; gap: 10px; max-width: 560px; margin: 20px auto; }
.wordle-row { display: grid; gap: 5px; }
.wordle-tiles { display: grid; grid-template-columns: repeat(var(--wordle-length, 5), minmax(0, 1fr)); gap: 5px; }
.wordle-tile { display: grid; place-items: center; min-height: 48px; border: 1px solid var(--line); border-radius: 5px; background: #fbfaf6; font: 700 20px "DM Mono", Consolas, sans-serif; }
.wordle-tile.hit { border-color: #6a9d70; color: white; background: #6a9d70; }
.wordle-tile.present { border-color: #d0a83d; color: white; background: #d0a83d; }
.wordle-tile.miss { border-color: #898980; color: white; background: #898980; }
.wordle-pinyin { color: var(--muted); text-align: center; font: 12px "DM Mono", Consolas, monospace; }
.wordle-details { color: var(--muted); font-size: 11px; text-align: center; }
.wordle-actions { display: flex; justify-content: center; }
.web-tools-card { margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.hog-card { margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.hog-options, .hog-roll-controls, .admin-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.hog-options label, .hog-roll-controls label { margin: 0; }
.hog-options select, .hog-roll-controls select { width: auto; min-width: 140px; }
.hog-scoreboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.hog-player { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf6; }
.hog-player.active { border: 2px solid var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 16%, transparent); }
.hog-player-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); }
.hog-player-score { display: block; margin: 8px 0 10px; font: 700 clamp(32px, 7vw, 52px) "DM Mono", Consolas, monospace; }
.hog-progress { height: 8px; overflow: hidden; border-radius: 99px; background: #e8e4d9; }
.hog-progress span { display: block; height: 100%; border-radius: inherit; background: var(--orange); transition: width .25s ease; }
.hog-turn-card { display: grid; grid-template-columns: minmax(100px, .5fr) 2fr; align-items: center; gap: 12px 20px; margin: 18px 0; padding: 18px; border-radius: 14px; background: #f4f1e9; }
.hog-turn-label { display: block; color: var(--muted); font-size: 13px; }
.hog-turn-card strong { display: block; font: 700 24px "DM Mono", Consolas, monospace; }
.hog-dice-tray { display: flex; flex-wrap: wrap; gap: 8px; min-height: 50px; }
.hog-die { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #d8d3c6; border-radius: 10px; background: #fffefa; color: var(--ink); font: 700 38px/1 "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif; box-shadow: 0 2px 0 #d8d3c6; }
.hog-turn-message { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.hog-events { display: grid; gap: 7px; margin: 14px 0 20px; padding-left: 22px; color: var(--muted); }
.hog-roll-controls { padding-top: 16px; border-top: 1px solid var(--line); }
.hog-roll-controls label { flex-basis: 100%; }
.admin-card { margin: 18px 0; padding: clamp(18px, 4vw, 28px); }
.admin-card h2 { margin-top: 0; }
.admin-card form { display: grid; gap: 10px; }
.admin-card form > label:not(.admin-check) { margin: 8px 0 0; }
.admin-check { display: flex; align-items: center; gap: 9px; margin: 4px 0; }
.admin-check input { width: auto; }
.admin-actions { align-items: center; }
.admin-note { margin: 0; color: var(--muted); font-size: 13px; }
@media (max-width: 620px) {
  .hog-scoreboard { gap: 8px; }
  .hog-player { padding: 13px; }
  .hog-turn-card { grid-template-columns: 1fr; }
  .hog-options > * { flex: 1 1 100%; }
  .hog-options select { width: 100%; }
  .hog-roll-controls > * { flex: 1 1 100%; }
  .hog-roll-controls select { width: 100%; }
}
.reminders-card { margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.reminder-form label { display: block; margin-bottom: 8px; }
.reminder-entry { display: flex; gap: 12px; }
.reminder-entry input { flex: 1; }
.reminder-list { display: grid; gap: 10px; margin-top: 16px; }
.chat-card { display: grid; gap: 14px; margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-toolbar .status-line { margin: 0; }
.chat-messages { display: grid; gap: 10px; max-height: 52vh; min-height: 120px; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.chat-message { max-width: min(85%, 760px); padding: 11px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.chat-message.user { justify-self: end; color: white; background: #b95630; }
.chat-message.assistant { justify-self: start; color: var(--ink); background: #ebe8df; }
.chat-form label { display: block; margin-bottom: 7px; color: var(--muted); font-weight: 700; }
.chat-form textarea { width: 100%; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; font: inherit; }
.chat-compose { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.chat-upload { margin: 0 !important; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
#chatImage { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.chat-image-name { flex: 1; min-width: 100px; color: var(--muted); font-size: 13px; }
.vp-card { display: grid; gap: 14px; margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.vp-search label { display: block; margin-bottom: 8px; }
.vp-random label { display: block; margin-bottom: 8px; }
.vp-random select { min-width: 110px; }
.vp-contests { display: grid; gap: 8px; }
.vp-contest-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.vp-contest-row span { overflow-wrap: anywhere; }
.vp-active-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vp-active-head h2 { margin: 0; }
.vp-layout { display: grid; grid-template-columns: minmax(210px, 0.35fr) minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.vp-layout h3 { margin: 0 0 8px; }
.vp-problems { display: grid; gap: 7px; }
.vp-problem { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; text-align: left; color: var(--ink); background: #fbfaf6; overflow-wrap: anywhere; }
.vp-problem.active { border-color: var(--orange); box-shadow: 0 0 0 2px #f3dfd4; }
.vp-scoreboard { display: grid; gap: 10px; margin: 12px 0; color: var(--muted); }
.vp-board-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.vp-board-metric { display: grid; gap: 4px; padding: 9px; border-radius: 9px; background: #f4f1e9; font-size: 11px; }
.vp-board-metric strong { color: var(--ink); font-size: 13px; }
.vp-board-grid { display: grid; gap: 7px; }
.vp-board-problem { display: grid; gap: 5px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf6; }
.vp-board-problem.solved { border-color: #8eb89a; background: #f0f7f0; }
.vp-board-problem.attempted { border-color: #dfb879; background: #fff8e9; }
.vp-board-problem-head { display: flex; justify-content: space-between; gap: 8px; color: var(--ink); }
.vp-board-problem-head span, .vp-board-problem small { color: var(--muted); font-size: 11px; }
.vp-board-problem p { margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.vp-statement { min-width: 0; }
.vp-image-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
#vpImage { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; margin: auto; }
.vp-submit { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
@media (max-width: 720px) { .vp-layout { grid-template-columns: 1fr; } }
.sticker-card { display: grid; gap: 14px; margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.sticker-search label { display: block; margin-bottom: 8px; }
.sticker-upload { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.sticker-upload > label { display: block; margin-bottom: 8px; }
.sticker-analysis { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #f7f4ec; }
.sticker-analysis p { margin: 4px 0; overflow-wrap: anywhere; }
.sticker-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.sticker-item { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.sticker-item img { display: block; width: 100%; height: 180px; object-fit: contain; border-radius: 8px; background: #fff; }
.sticker-item p { margin: 9px 0 4px; overflow-wrap: anywhere; }
.sticker-item-tags { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.archive-card { display: grid; gap: 14px; margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.archive-search label { display: block; margin-bottom: 8px; }
.archive-items { display: grid; gap: 8px; }
.archive-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.archive-row span { min-width: 0; overflow-wrap: anywhere; }
.home-index { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; margin: 20px 0 40px; }
.home-link { display: grid; gap: 8px; min-height: 126px; padding: 18px; border: 1px solid rgba(36,36,31,.10); border-radius: 14px; text-align: left; color: var(--ink); background: var(--card); box-shadow: var(--shadow); cursor: pointer; }
.home-link:hover, .home-link:focus-visible { border-color: var(--orange); box-shadow: 0 0 0 2px #f3dfd4; }
.home-link strong { font-size: 18px; }
.home-link span { color: var(--muted); }
.home-link code { color: var(--orange); font-size: 13px; }
.duel-card { display: grid; gap: 16px; margin: 20px 0 40px; padding: clamp(18px, 4vw, 32px); }
.duel-card label { display: block; margin-bottom: 8px; }
.duel-card form textarea { display: block; width: 100%; min-height: 120px; margin: 8px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfaf6; font: inherit; }
.duel-statement { max-height: 55vh; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; white-space: pre-wrap; line-height: 1.7; }
.duel-submissions { display: grid; gap: 12px; margin: 16px 0; }
.duel-submissions section { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.duel-submissions h3 { margin: 0 0 8px; }
.duel-submissions pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.duel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.duel-presence { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; color: var(--muted); }
.duel-presence span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fbfaf6; }
.ddz-card { display: grid; gap: 18px; margin: 20px 0 40px; padding: clamp(16px, 4vw, 30px); }
.ddz-entry, .ddz-entry form { display: grid; gap: 10px; }
.ddz-room-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ddz-room-head h2 { margin: 0; font-size: 21px; }
.ddz-room-head h2 strong { color: var(--orange-dark); font-family: "DM Mono", Consolas, monospace; letter-spacing: .08em; }
.ddz-room-head p { margin: 8px 0 0; }
.ddz-rename { display: flex; align-items: center; gap: 8px; }
.ddz-rename input { width: min(260px, 100%); min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf6; }
.ddz-seats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ddz-seat { display: grid; align-content: center; justify-items: center; gap: 8px; min-height: 112px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf6; text-align: center; }
.ddz-seat strong { font-size: 18px; }
.ddz-seat span, .ddz-seat b { color: var(--muted); font-size: 13px; }
.ddz-seat.is-me { border: 2px solid var(--orange); }
.ddz-seat.is-turn { box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 18%, transparent); }
.ddz-seat-open { color: var(--muted); font-weight: 600; cursor: pointer; }
.ddz-seat-open:disabled { cursor: default; opacity: .7; }
.ddz-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ddz-stage { display: grid; gap: 14px; }
.ddz-stage > h3, .flip7-stage > h3 { margin: 2px 0 0; color: var(--ink); font-size: 18px; }
.ddz-play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 330px); align-items: start; gap: 16px; }
.ddz-table-column, .ddz-play-sidebar { min-width: 0; }
.ddz-play-sidebar { position: sticky; top: 12px; display: grid; gap: 12px; }
.ddz-rules { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf6; }
.ddz-rules summary { cursor: pointer; font-weight: 700; }
.ddz-rules ul { display: grid; gap: 8px; margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.ddz-game { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.ddz-table-head { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.ddz-players { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ddz-player { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf6; text-align: center; font-size: 13px; }
.ddz-player.is-turn { border-color: var(--orange); box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 15%, transparent); }
.ddz-last-play { min-height: 100px; padding: 12px; border-radius: 12px; background: #f4f1e9; }
.ddz-last-play h3 { margin: 0 0 8px; font-size: 14px; }
.ddz-last-play .status-line { margin: 10px 0 0; }
.ddz-card-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; }
.ddz-playing-card { position: relative; display: inline-grid; place-items: center; min-width: 40px; height: 58px; padding: 0 5px; border: 1px solid #d9d5cb; border-radius: 8px; background: white; color: #222; font: 700 15px/1 "Segoe UI", sans-serif; box-shadow: 0 2px 3px #00000012; }
.ddz-playing-card::after { position: absolute; right: 2px; bottom: 2px; content: "✨"; font: 9px/1 "Segoe UI Emoji", sans-serif; opacity: .78; pointer-events: none; }
.ddz-playing-card.red { color: #c93636; }
.ddz-playing-card.black { color: #202020; }
.ddz-hand { flex-wrap: nowrap; justify-content: center; gap: 0; padding: 10px 4px; overflow-x: auto; }
.ddz-hand-card { margin-left: -18px; cursor: pointer; transition: transform .12s ease; }
.ddz-hand-card:hover, .ddz-hand-card.selected { transform: translateY(-10px); }
.ddz-hand-card.selected { border: 2px solid var(--orange); }
.ddz-hand-card:disabled { cursor: default; opacity: 1; }
.ddz-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border-radius: 10px; background: #fff5dc; }
.ddz-bottom strong { margin-right: 4px; }
.ddz-history { display: grid; gap: 4px; max-height: 150px; overflow: auto; margin: 0; padding-left: 22px; color: var(--muted); font-size: 13px; }
.ddz-players { grid-template-columns: 1fr 1fr; grid-template-areas: "left right" "self self"; }
.ddz-player-self { grid-area: self; justify-self: center; width: min(100%, 520px); }
.ddz-player-left { grid-area: left; }
.ddz-player-right { grid-area: right; }
.ddz-bot-tools { display: grid; gap: 12px; margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #f7f4ec; }
.ddz-bot-tools form { display: grid; gap: 10px; }
.ddz-bot-tools textarea { width: 100%; min-height: 110px; font-family: Consolas, monospace; }
.ddz-bot-tools details { border-top: 1px solid var(--line); padding-top: 12px; }
.ddz-bot-tools pre { max-width: 100%; overflow: auto; padding: 12px; border-radius: 10px; background: #ebe8df; }
.ddz-history-controls { margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
.ddz-rematch { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ddz-close-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border: 1px solid #ead7c8; border-radius: 14px; background: #fff8f2; }
.ddz-close-copy { min-width: 0; }
.ddz-close-heading { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.ddz-close-heading span { font-size: 20px; }
.ddz-close-copy > p { margin: 6px 0 8px; color: #6f6258; font-size: 13px; line-height: 1.6; }
.ddz-close-progress { display: flex; align-items: center; gap: 10px; color: #6f6258; font-size: 12px; }
.ddz-close-progress progress { width: min(180px, 35vw); height: 10px; accent-color: var(--orange); }
.ddz-close-button { flex: 0 0 auto; min-height: 42px; border: 1px solid #d9a78c; color: #934321; background: #fff; }
.ddz-close-button:hover { background: #ffede2; }
.ddz-player { display: grid; align-content: start; gap: 8px; min-width: 0; min-height: 130px; padding: 12px; text-align: left; }
.ddz-player-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ddz-avatar { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border: 1px solid #d9e1e5; border-radius: 50%; background: #eef5f8; font-size: 24px; }
.ddz-player-details { display: grid; gap: 3px; min-width: 0; }
.ddz-player-details strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.ddz-player-meta { color: var(--muted); font-size: 11px; line-height: 1.4; }
.ddz-player-action { min-height: 18px; color: #55554d; font-size: 12px; font-weight: 650; }
.ddz-pass-badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 9px; border: 1px solid #d5c493; border-radius: 999px; background: #fff5d9; color: #66501d; font-size: 12px; font-weight: 750; }
.ddz-mini-cards { display: flex; align-items: center; min-width: 0; max-width: 100%; overflow-x: auto; padding: 2px 1px 5px; }
.ddz-mini-card { flex: 0 0 30px; min-width: 30px; height: 42px; margin-left: -4px; padding: 0 2px; border-radius: 6px; font-size: 11px; }
.ddz-mini-card:first-child { margin-left: 0; }
.ddz-chat { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.ddz-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ddz-chat-head h3 { margin: 0; font-size: 17px; }
.ddz-chat-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ddz-chat-head > span { color: var(--green); font-size: 12px; }
.ddz-chat-messages { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f6f8f5; }
.ddz-chat-empty { margin: auto; padding: 18px 8px; color: var(--muted); font-size: 13px; text-align: center; }
.ddz-chat-message { width: fit-content; max-width: min(86%, 620px); padding: 8px 11px; border: 1px solid #e6e5dc; border-radius: 12px 12px 12px 4px; background: white; }
.ddz-chat-message.is-me { align-self: flex-end; border-color: #f0d0bd; border-radius: 12px 12px 4px 12px; background: #fff2e9; }
.ddz-chat-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.ddz-chat-meta strong { color: #4b554e; }
.ddz-chat-message p { margin: 4px 0 0; color: var(--ink); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.ddz-chat-form { display: grid; gap: 6px; }
.ddz-chat-form > label { font-size: 12px; }
.ddz-chat-form .reminder-entry { display: flex; gap: 8px; }
.ddz-chat-form input { min-width: 0; height: 44px; flex: 1; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf6; }
@media (max-width: 620px) { .ddz-room-head { align-items: flex-start; flex-direction: column; } .ddz-seats, .ddz-players { gap: 6px; } .ddz-seat { min-height: 90px; padding: 8px 4px; } .ddz-seat strong { font-size: 15px; } .ddz-seat span { font-size: 11px; } .ddz-rename { align-items: stretch; flex-wrap: wrap; } .ddz-rename input { flex: 1 1 100%; } .ddz-table-head { flex-wrap: wrap; } }
@media (max-width: 620px) { .ddz-close-panel { align-items: stretch; flex-direction: column; } .ddz-close-button { width: 100%; } .ddz-player { min-height: 122px; padding: 9px 7px; } .ddz-avatar { flex-basis: 34px; width: 34px; height: 34px; font-size: 20px; } .ddz-player-meta { font-size: 10px; } .ddz-mini-card { flex-basis: 26px; min-width: 26px; height: 38px; font-size: 10px; } }
@media (max-width: 600px) { .archive-row { align-items: flex-start; flex-direction: column; } }
.reminder-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.reminder-row p { margin: 6px 0 0; color: var(--muted); }
.reminder-due { margin: 14px 0; padding: 14px 16px; border-radius: 12px; background: #fff1d7; color: #714918; }
.reminder-due p { margin: 6px 0 0; }
@media (max-width: 560px) { .reminder-entry { flex-direction: column; } .reminder-row { align-items: flex-start; } }
.web-tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.web-tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.web-tool-form { display: grid; align-content: start; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf6; }
.web-tool-form h2 { margin: 0 0 3px; font-size: 18px; }
.web-tool-form input { width: 100%; min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }
.web-tool-form .button { justify-self: start; margin-top: 2px; }
.tools-result { padding: 18px; border-radius: 10px; background: #f6f4ee; }
.tools-result h2 { margin: 0 0 10px; font-size: 19px; }
.tools-result pre { margin: 0; overflow: auto; color: #48483f; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
@media (max-width: 620px) { .wordle-options { align-items: stretch; flex-direction: column; } .wordle-options label { min-width: 0; } .wordle-guess-row { align-items: stretch; flex-direction: column; } .wordle-guess-row .button { width: 100%; } }
.mines-intro { padding-top: 48px; }
.mines-unlock { margin: 18px auto 42px; }
.mines-unlock h2 { font-size: 23px; }
.mines-card { margin: 20px 0 40px; padding: clamp(14px, 3vw, 24px); overflow: hidden; }
.mines-options { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; margin: 0 0 18px; }
.mines-options label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.mines-options select { min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fbfaf6; font: inherit; }
.mines-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mines-toolbar p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.mines-hint { margin: 12px 0; color: var(--muted); font-size: 12px; }
.mines-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.mines-board-wrap { overflow: auto; text-align: center; border-radius: 10px; background: #111; }
.mines-board-stage { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.mines-board-stage img { display: block; width: auto; max-width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.mines-cell-targets { position: absolute; z-index: 2; inset: 0; pointer-events: auto; }
.mines-cell-target { position: absolute; box-sizing: border-box; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: transparent; cursor: crosshair; touch-action: none; }
.mines-cell-target:hover { background: rgba(231, 111, 60, .12); box-shadow: inset 0 0 0 2px #e17a48; }
.mines-cell-target:focus-visible { outline: 2px solid #e17a48; outline-offset: -2px; }
.mines-rule-dialog { width: min(680px, calc(100vw - 28px)); max-height: min(82vh, 760px); margin: auto; padding: 22px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(0, 0, 0, .24); }
.mines-rule-dialog::backdrop { background: rgba(22, 22, 20, .48); backdrop-filter: blur(2px); }
.mines-rule-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.mines-rule-dialog-head h2 { margin: 0; font-size: 20px; }
.mines-rule-search { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.mines-rule-search input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfaf6; font: inherit; }
.mines-rule-count { margin: 10px 0; color: var(--muted); font-size: 12px; }
.mines-rule-results { display: grid; gap: 9px; max-height: 54vh; overflow: auto; }
.mines-rule-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf6; }
.mines-rule-item h3 { margin: 0; font-size: 15px; }
.mines-rule-item code { color: var(--orange-dark); font-size: 12px; }
.mines-rule-category { display: inline-block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.mines-rule-item p { margin: 6px 0 0; line-height: 1.6; font-size: 13px; }
@media (max-width: 620px) { .topbar-actions { gap: 6px; } .mines-options { grid-template-columns: repeat(2, minmax(110px, 1fr)); } .mines-toolbar { align-items: stretch; flex-direction: column; } .mines-toolbar .button { width: 100%; } }
.flip7-card { display: grid; gap: 18px; margin: 20px 0 40px; padding: clamp(14px, 3vw, 26px); }
.flip7-entry-fields, .flip7-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.flip7-entry-fields label, .flip7-toolbar label { display: grid; flex: 1 1 170px; gap: 6px; color: var(--muted); font-size: 13px; }
.flip7-entry-fields input, .flip7-entry-fields select, .flip7-toolbar input, .flip7-toolbar select, #flip7JoinForm input { min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfaf6; font: inherit; }
.flip7-entry { display: grid; gap: 14px; }
.flip7-entry-fields { align-items: end; }
#flip7JoinForm { display: grid; gap: 6px; }
#flip7JoinForm > label { color: var(--muted); font-size: 13px; }
.flip7-room-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.table-room-controls { margin: 2px 0; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.35); }
.table-room-controls > summary { padding: 10px 13px; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.table-room-controls[open] > summary { border-bottom: 1px solid var(--line); }
.table-room-controls > .flip7-toolbar, .table-room-controls > .ddz-rename { margin: 10px; }
.table-room-controls > .flip7-seats, .table-room-controls > .ddz-seats { margin: 10px; }
.flip7-room-head h2 { margin: 0; font-size: 20px; }
.flip7-toolbar { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.flip7-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; }
.flip7-seat { display: flex; align-items: center; gap: 9px; min-height: 68px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.flip7-seat.is-open { cursor: pointer; border-style: dashed; color: var(--muted); }
.flip7-seat.is-open:hover, .flip7-seat.is-open:focus-visible { border-color: var(--orange); outline: 2px solid color-mix(in srgb, var(--orange) 25%, transparent); }
.flip7-seat.is-me { border-color: var(--orange); background: #fff5e8; }
.flip7-seat.is-dealer { box-shadow: inset 0 0 0 1px #caa546; }
.flip7-avatar { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 50%; background: #eee7dc; font-size: 23px; }
.flip7-seat-copy { display: grid; min-width: 0; gap: 3px; }
.flip7-seat-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flip7-seat-copy span { color: var(--muted); font-size: 11px; }
.flip7-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.flip7-stage { display: grid; gap: 14px; }
.flip7-play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); align-items: start; gap: 16px; }
.flip7-table-column, .flip7-play-sidebar { min-width: 0; }
.flip7-play-sidebar { position: sticky; top: 12px; display: grid; gap: 12px; }
.flip7-play-sidebar .flip7-chat { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.flip7-play-sidebar .ddz-chat-messages { max-height: 220px; }
.flip7-bot-tools, .flip7-rules { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf6; }
.flip7-bot-tools summary { cursor: pointer; font-weight: 700; }
.flip7-rules summary { cursor: pointer; font-weight: 700; }
.flip7-rules ul { display: grid; gap: 7px; margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.flip7-bot-tools form { display: grid; gap: 8px; margin: 12px 0; }
.flip7-bot-tools textarea { width: 100%; min-height: 100px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: 13px/1.5 Consolas, monospace; }
.flip7-bot-tools p, .flip7-rules p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.flip7-rules p { white-space: pre-line; }
.flip7-rules h3 { margin: 0; font-size: 16px; }
.flip7-game { display: grid; gap: 14px; padding: clamp(12px, 2vw, 20px); border: 1px solid #d7c99c; border-radius: 16px; background: linear-gradient(145deg, #f7f0dc, #f1e6c9); }
.flip7-scorebar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: #5a4a28; font-size: 13px; font-weight: 700; }
.flip7-prompt { margin: 0; padding: 12px 14px; border-radius: 10px; background: #fffaf0; color: #493d29; line-height: 1.55; }
.flip7-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.flip7-player { min-width: 0; padding: 12px; border: 1px solid #d7cba9; border-radius: 13px; background: rgba(255,255,255,.78); }
.flip7-player.is-turn { border: 2px solid #d29228; box-shadow: 0 4px 12px #d292282b; }
.flip7-player.is-me { background: #fff6e6; }
.flip7-player.is-busted { opacity: .65; }
.flip7-player-head { display: flex; align-items: center; gap: 8px; }
.flip7-player-head > span { font-size: 23px; }
.flip7-player-head strong { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
.flip7-player-head b { color: #946515; white-space: nowrap; }
.flip7-player > p { margin: 7px 0; color: var(--muted); font-size: 12px; }
.flip7-card-row { display: flex; flex-wrap: wrap; gap: 5px; min-height: 27px; }
.flip7-card-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 7px; border: 1px solid #e5d9bc; border-radius: 7px; background: #fff; color: #51452d; font-size: 12px; font-weight: 700; }
.flip7-card-chip.number { min-width: 42px; justify-content: center; color: #8f5529; }
.flip7-card-chip.modifier, .flip7-card-chip.multiplier { color: #28744e; }
.flip7-chat { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.flip7-chat-head { display: flex; align-items: center; justify-content: space-between; }
.flip7-chat-head h3 { margin: 0; }
@media (max-width: 620px) {
  .ddz-play-layout, .flip7-play-layout { grid-template-columns: 1fr; }
  .ddz-play-sidebar, .flip7-play-sidebar { position: static; }
  .flip7-room-head { align-items: flex-start; flex-direction: column; }
  .flip7-entry-fields, .flip7-toolbar { align-items: stretch; flex-direction: column; }
  .flip7-entry-fields label, .flip7-toolbar label { width: 100%; }
  .flip7-entry-fields .button, .flip7-toolbar .button { width: 100%; }
  .flip7-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flip7-seat { gap: 6px; padding: 7px; }
  .flip7-avatar { flex-basis: 30px; height: 30px; font-size: 19px; }
  .flip7-players { grid-template-columns: 1fr; }
  .flip7-scorebar { justify-content: flex-start; }
  .flip7-actions > button { flex: 1 1 130px; }
}
.tablegame-entry{display:grid;grid-template-columns:2fr 1fr auto;gap:12px;align-items:end;margin:18px 0}.tablegame-room-head{display:flex;align-items:center;justify-content:space-between}.tablegame-board{padding:18px;margin:16px 0;border-radius:18px;background:rgba(48,35,67,.08);line-height:1.8}.tablegame-board button,.tablegame-actions button,.tablegame-hand button{margin:5px;padding:10px 14px;border:1px solid #8f779f;border-radius:12px;background:#fffaf2;color:#342543;cursor:pointer}.tablegame-board button.selected,.tablegame-hand button.selected{outline:3px solid #73e4b9}.tablegame-hand{display:flex;flex-wrap:wrap;gap:4px;margin:14px 0}.tablegame-actions{display:flex;flex-wrap:wrap;gap:8px}.splendor-market{display:grid;gap:8px}.splendor-market>div{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.tablegame-board .flip7-players article{min-width:160px}@media(max-width:680px){.tablegame-entry{grid-template-columns:1fr}.tablegame-room-head{align-items:flex-start;gap:8px;flex-direction:column}.tablegame-board{padding:10px}}

/* Table games: visible, game-specific tabletop surfaces. */
.tablegame-board { padding: 0; background: transparent; line-height: 1.45; }
.tablegame-board > p { margin: 0; }
.tablegame-board button, .tablegame-actions button, .tablegame-hand button { margin: 0; }
.tablegame-board .table-playing-card, .tablegame-board .table-playing-card:hover { cursor: default; }
.table-empty-state { display: grid; justify-items: center; gap: 6px; padding: 34px 18px; border: 1px dashed #d5c7b2; border-radius: 18px; background: #fffaf3; text-align: center; }
.table-empty-state > span { font-size: 34px; }
.table-empty-state strong { font-size: 18px; }
.table-empty-state p { margin: 0; color: var(--muted); }
.splendor-table, .card-table { --table-ink: #282b2c; --table-muted: #687173; color: var(--table-ink); border: 1px solid #d9ceb5; border-radius: 22px; background: radial-gradient(ellipse at 50% 20%, #fffdf4 0, #f7f1e2 68%, #efe6d1 100%); box-shadow: 0 10px 28px #49392312, inset 0 0 0 5px #ffffff80; }
.splendor-eyebrow { display: block; font-size: 11px; font-weight: 750; }
.card-table-head h2 { margin: 3px 0; font-size: clamp(20px, 2.5vw, 29px); }
.tablegame-action-panel { height: 100%; }
.splendor-collection { padding: 12px; border: 1px solid #d8c89f; border-radius: 14px; background: #fffaf0; }.splendor-collection > summary { color: #554626; cursor: pointer; font-weight: 800; }.splendor-collection-grid { display: grid; gap: 14px; padding-top: 12px; }.splendor-collection-grid > section { display: grid; gap: 7px; min-width: 0; }.splendor-collection-grid h3 { margin: 0; color: #51442d; font-size: 14px; }.splendor-collection-grid h3 small { color: #806d4b; }.collection-card-row { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); }.collection-card-row .splendor-card { min-height: 128px; }.splendor-collection .splendor-noble-row { flex-wrap: wrap; }.splendor-collection .noble-tile { flex: 0 1 190px; }.noble-requirements { display: flex; flex-wrap: wrap; gap: 5px; }.noble-requirements span { white-space: nowrap; }.collection-help, .collection-empty { margin: 0; color: #687173; font-size: 12px; }.splendor-player-nobles { display: flex; flex-wrap: wrap; gap: 4px; color: #735a26; font-size: 10px; }.splendor-player-nobles > span:not(.collection-empty) { padding: 3px 6px; border-radius: 999px; background: #f6eac2; }
.tablegame-action-panel { display: grid; gap: 12px; padding: 14px; border: 1px solid #d8cbb5; border-radius: 16px; background: #fbf7ed; }.tablegame-action-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }.tablegame-action-panel > header > div { display: grid; gap: 2px; }.tablegame-action-panel > header > div > span { font-weight: 800; }.tablegame-action-panel small { color: var(--muted); font-size: 11px; }
.gem-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px,1fr)); gap: 7px; }.gem-action { display: flex; gap: 4px; }.gem-action-pick { display: grid; flex: 1; grid-template-columns: 30px 1fr auto; align-items: center; gap: 3px 6px; min-width: 0; padding: 8px 9px !important; border: 1px solid #ded4c2 !important; border-radius: 12px !important; background: white !important; text-align: left; }.gem-action-pick > span { grid-row: span 2; font-size: 22px; }.gem-action-pick > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.gem-action-pick > small { grid-column: 2 / 4; }.gem-action-pick > strong { grid-column: 3; grid-row: 1; color: #4f9876; font-size: 20px; }.gem-action-minus { width: 34px; border: 1px solid #ded4c2 !important; background: white !important; }.splendor-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-height: 24px; color: var(--muted); font-size: 12px; }.tablegame-action-buttons { display: flex; flex-wrap: wrap; gap: 7px; }.turn-hint { padding: 12px; border-radius: 12px; background: #fff7e3; color: #735e2b; }
.card-table { display: grid; gap: 14px; padding: clamp(14px,2vw,24px); border-color: #55715e; background: radial-gradient(ellipse at center, #3f765d 0, #285743 66%, #1c4435 100%); color: #fff8e9; box-shadow: inset 0 0 0 5px #ffffff20, 0 9px 20px #122e2440; }
.card-table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.card-table-head .splendor-eyebrow { color: #d5e5c8; }.card-table-head h2 { color: #fff7df; }.card-table-status { display: flex; flex-wrap: wrap; gap: 6px; }.card-table-status span { padding: 7px 10px; border: 1px solid #ffffff50; border-radius: 99px; background: #ffffff16; color: #fff8e9; font-size: 12px; font-weight: 750; }
.table-seat-ring { display: grid; grid-template-columns: minmax(130px,1fr) minmax(220px,2fr) minmax(130px,1fr); grid-template-rows: auto minmax(175px,auto) auto; grid-template-areas: ". top ." "left center right" ". bottom ."; align-items: center; gap: 9px; min-height: 310px; padding: 12px; border: 1px solid #ffffff30; border-radius: 24px; background: #173e3060; }
.table-seat { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px; border: 1px solid #ffffff38; border-radius: 13px; background: #ffffffec; color: #29332e; box-shadow: 0 4px 10px #0c2d2233; }.table-seat.seat-top { grid-area: top; justify-self: center; width: min(100%,300px); }.table-seat.seat-left { grid-area: left; }.table-seat.seat-right { grid-area: right; }.table-seat.seat-bottom { grid-area: bottom; justify-self: center; width: min(100%,300px); }.table-seat.is-turn { border: 2px solid #f2ce73; box-shadow: 0 0 0 3px #f2ce7345, 0 4px 10px #0c2d2233; }.table-seat.is-me { background: #fff6dd; }
.table-seat-avatar { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #efe8db; font-size: 21px; }.table-seat > div { display: grid; min-width: 0; }.table-seat > div strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }.table-seat > div small { color: #69726d; font-size: 10px; }.table-seat-count { margin-left: auto; color: #51432c; font-size: 20px; white-space: nowrap; }.table-seat-count small { margin-left: 2px; font-size: 10px; }
.table-center-play { grid-area: center; display: grid; align-content: center; justify-items: center; gap: 10px; min-width: 0; min-height: 175px; padding: 12px; border: 1px dashed #ffffff62; border-radius: 20px; background: #ffffff0c; text-align: center; }.table-center-play > p { margin: 0; color: #e1e9db; font-size: 11px; }.table-center-pot { color: #f9e1a0; font-size: 12px; font-weight: 800; }.table-center-score { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }.table-center-score span { padding: 4px 8px; border-radius: 99px; background: #ffffff18; font-size: 11px; }.table-center-score b { color: #ffe39a; }.table-center-cards { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; max-width: 100%; }.table-play-group { display: grid; justify-items: center; gap: 3px; padding: 5px; border-radius: 9px; background: #ffffff0e; }.table-play-group small { color: #f2dfb0; font-size: 9px; }.table-waiting { color: #d4dfd3; font-size: 12px; }.table-playing-card { display: grid; position: relative; flex: 0 0 43px; grid-template-rows: auto 1fr auto; place-items: center; width: 43px; height: 62px; padding: 3px !important; border: 1px solid #ded6c9 !important; border-radius: 7px !important; background: linear-gradient(145deg,#fff,#f4efe5) !important; color: #222 !important; box-shadow: 0 3px 7px #0003; line-height: 1; }.table-playing-card b { justify-self: start; font-size: 14px; }.table-playing-card i { align-self: center; font-size: 18px; font-style: normal; }.table-playing-card small { justify-self: end; color: #777; font-size: 7px; }.table-playing-card.is-red { color: #c53643 !important; }
.tablegame-action-panel > header > div > span { color: #343333; }.tablegame-hand { align-items: flex-end; gap: 0; max-width: 100%; padding: 8px 4px 12px; overflow-x: auto; }.hand-card-button { flex: 0 0 auto; padding: 0 !important; border: 0 !important; background: transparent !important; }.hand-card-button + .hand-card-button { margin-left: -8px !important; }.doudizhu4 .tablegame-hand { flex-wrap: nowrap; }.doudizhu4 .hand-card-button + .hand-card-button { margin-left: -18px !important; }.hand-card-button .table-playing-card { width: 48px; height: 68px; }.hand-card-button:hover .table-playing-card, .hand-card-button.selected .table-playing-card { transform: translateY(-8px); box-shadow: 0 0 0 2px #e6a03d, 0 8px 12px #0002; }
.card-table-notice { margin: 0; padding: 9px 12px; border-radius: 12px; background: #ffffff14; color: #edf2e8; font-size: 12px; }.table-finish-banner { padding: 12px; border: 1px solid #edd27c; border-radius: 13px; background: #fff3cc; color: #6c5320; font-weight: 800; }
.flip7-game { border-color: #d7c99c; background: radial-gradient(ellipse at top, #fff8e5, #f2e7cc 72%); box-shadow: 0 8px 24px #47381a16, inset 0 0 0 4px #ffffff80; }.flip7-scorebar > span { padding: 7px 11px; border: 1px solid #dccb9e; border-radius: 99px; background: #fffaf0; color: #655328; }.flip7-prompt { border: 1px solid #e3d5b2; box-shadow: 0 2px 6px #55451c0b; }.flip7-players { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); }.flip7-player { border-color: #ddd1b2; background: linear-gradient(155deg,#fffefa,#f8f2e6); box-shadow: 0 4px 11px #45391e12; }.flip7-player.is-turn { border-color: #d29228; }.flip7-card-row { align-items: flex-start; gap: 5px; }.flip7-card-chip { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 2px; min-width: 56px; min-height: 77px; padding: 5px 6px; border: 1px solid #e2d6be; border-radius: 9px; background: linear-gradient(145deg,#fff,#f8f2e7); box-shadow: 0 3px 6px #3c321812; }.flip7-card-chip > small { color: #837861; font-size: 8px; }.flip7-card-chip > strong { align-self: center; color: #59492b; font-size: 22px; line-height: 1; }.flip7-card-chip > span { color: #837861; font-size: 9px; }.flip7-card-chip.number { min-width: 56px; color: #8f5529; }.flip7-card-chip.modifier { border-color: #b6d7be; background: linear-gradient(145deg,#fafff8,#e7f6e8); }.flip7-card-chip.multiplier { border-color: #e2cf83; background: linear-gradient(145deg,#fffdf3,#fbf0c7); }.flip7-card-chip.freeze, .flip7-card-chip.flip_three, .flip7-card-chip.second_chance { border-color: #c9c5e7; background: linear-gradient(145deg,#fff,#efedff); }.flip7-card-chip.is-reveal { border: 2px solid #e87863; background: #fff0eb; }
.ddz-game { padding: 15px; border: 1px solid #62816c; border-radius: 20px; background: radial-gradient(ellipse at center,#357155,#23523c 72%,#1c4533); box-shadow: inset 0 0 0 4px #ffffff1c; }.ddz-table-head span { padding: 6px 10px; border: 1px solid #ffffff38; border-radius: 99px; background: #ffffff15; color: #f7f1df; }.ddz-players { gap: 12px; padding: 12px; border-radius: 18px; background: #173e3060; }.ddz-player { border-color: #ffffff45; background: #fffdf4; }.ddz-player.is-turn { border-color: #f0c65d; box-shadow: 0 0 0 3px #f0c65d55; }.ddz-last-play { display: grid; gap: 8px; justify-items: center; min-height: 140px; align-content: center; border: 1px dashed #ffffff68; background: #ffffff12; color: #fff8e8; }.ddz-last-play h3 { color: #f8e7b4; }.ddz-game .ddz-hand { min-height: 94px; padding: 12px 7px; border-radius: 15px; background: #183d2e80; }.ddz-game .ddz-playing-card { width: 45px; height: 65px; border-color: #e4dbc9; border-radius: 8px; }.ddz-game .ddz-hand-card { margin-left: -8px; }.ddz-game .ddz-bottom { border: 1px solid #e4ce90; background: #fff5d9; }
@media (max-width: 760px) {
  .table-seat-ring { grid-template-columns: minmax(0,1fr) minmax(96px,1.2fr) minmax(0,1fr); gap: 5px; min-height: 270px; padding: 7px; }
  .table-seat { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 4px; text-align: center; }
  .table-seat-avatar { flex-basis: 26px; width: 26px; height: 26px; font-size: 17px; }
  .table-seat > div strong { max-width: 90px; font-size: 10px; }
  .table-seat > div small { font-size: 8px; }
  .table-seat-count { margin: 0; font-size: 15px; }
  .table-center-play { min-height: 142px; padding: 7px 3px; }.table-playing-card { flex-basis: 32px; width: 32px; height: 48px; }.table-playing-card b { font-size: 11px; }.table-playing-card i { font-size: 14px; }
  .card-table-head { align-items: start; flex-direction: column; }
  .hand-card-button .table-playing-card { width: 40px; height: 59px; }.doudizhu4 .hand-card-button + .hand-card-button { margin-left: -14px !important; }
  .ddz-game { padding: 9px; }.ddz-players { padding: 7px; }
  .ddz-game .ddz-playing-card { width: 38px; height: 56px; }
}

/* Splendor: one market, one resource panel, contextual actions. */
html:has(#tablegamesPanel:not(.hidden) #tablegameRoom:not(.hidden) .splendor-workspace) { scrollbar-gutter: stable; }
body:has(#tablegamesPanel:not(.hidden) #tablegameRoom:not(.hidden) .splendor-workspace) .shell { width: min(1400px, calc(100% - 24px)); }
body:has(#tablegamesPanel:not(.hidden) #tablegameRoom:not(.hidden) .splendor-workspace) .topbar,
body:has(#tablegamesPanel:not(.hidden) #tablegameRoom:not(.hidden) .splendor-workspace) .app-nav,
body:has(#tablegamesPanel:not(.hidden) #tablegameRoom:not(.hidden) .splendor-workspace) .shell > footer,
#tablegamesPanel:has(#tablegameRoom:not(.hidden) .splendor-workspace) > .intro { display: none !important; }
body:has(#tablegamesPanel:not(.hidden) #tablegameRoom:not(.hidden) .splendor-workspace) #practiceApp { display: block; }
#tablegamesHub:has(#tablegameRoom:not(.hidden) .splendor-workspace), #tablegameRoom:has(.splendor-workspace) { border: 0; box-shadow: none; background: transparent; }
#tablegameRoom:has(.splendor-workspace) .tablegame-room-head { min-height: 44px; gap: 8px; }
#tablegameRoom:has(.splendor-workspace) .tablegame-room-head h2 { font-size: 16px; }
#tablegameRoom:has(.splendor-workspace) .tablegame-room-head .button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
#tablegameRoom:has(.splendor-workspace) { position: relative; }
#tablegameRoom:has(.splendor-workspace) .tablegame-room-head > div { display: flex; align-items: center; gap: 6px; }
#tablegameRoom:has(.splendor-workspace) #tablegameRoomControls { margin: 0; font-size: 12px; }
#tablegameRoom:has(.splendor-workspace) #tablegameRoomControls > summary { padding: 7px 10px; font-size: 12px; }
#tablegameRoom:has(.splendor-workspace) #tablegameRoomControls[open] { position: absolute; z-index: 30; top: 42px; right: 0; width: min(600px, 100%); padding: 8px; background: #fffdf7; box-shadow: 0 10px 30px #203b2429; }
#tablegameRoom:has(.splendor-workspace) > .flip7-actions { margin: 4px 0; }
#tablegameRoom:has(.splendor-workspace) > .flip7-actions .button { min-height: 30px; font-size: 12px; }
#tablegameRoom:has(.splendor-workspace) > .flip7-actions:not(:has(button:not(.hidden))) { display: none; }
#tablegameBoard:has(.splendor-workspace) { margin: 8px 0; padding: 4px; border: 3px solid #35614d; border-radius: 18px; background: #f6f3e9; }
.splendor-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px 20px; padding: 14px 18px; border: 0; border-radius: 12px; background: #f6f3e9; box-shadow: none; line-height: 1.4; }
.splendor-workspace button { margin: 0; font: inherit; cursor: pointer; }
.splendor-workspace button:disabled { cursor: default; }
.splendor-workspace button:focus-visible, .splendor-drawer button:focus-visible { outline: 3px solid #2671bc; outline-offset: 3px; }
.splendor-table-top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.splendor-table-top h2 { font-size: 22px; }
.splendor-turn { padding: 6px 12px; border-radius: 20px; background: #e0ece2; color: #245339; font-size: 14px; }
.splendor-workspace h3 { margin: 0; color: #303930; font-size: 15px; }
.splendor-workspace small { color: #59645c; font-size: 12px; }
.splendor-market { display: grid; align-content: start; gap: 10px; min-width: 0; }
.splendor-nobles { display: grid; gap: 6px; }
.splendor-nobles > header, .splendor-tier > header, .splendor-sidebar section > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.splendor-noble-row { display: flex; gap: 8px; }
.splendor-workspace .noble-tile, .splendor-drawer .noble-tile { display: grid; align-content: center; gap: 6px; min-width: 0; padding: 8px; border: 1px solid #d5c38d; border-radius: 9px; background: #f3e9c6; color: #514323; }
.splendor-nobles .noble-tile { flex: 1; min-height: 65px; text-align: left; }
.noble-tile > span:first-child { display: flex; justify-content: space-between; }
.noble-requirements { display: flex; flex-wrap: wrap; gap: 4px; }
.splendor-tier { display: grid; gap: 4px; }
.splendor-tier > header { justify-content: start; font-size: 13px; }
.splendor-workspace .splendor-deck { margin-left: auto; padding: 2px 6px; border: 0; border-radius: 5px; color: #56635b; background: transparent; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.splendor-deck:disabled { opacity: .55; }
.splendor-card-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.splendor-workspace .splendor-card, .splendor-drawer .splendor-card { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-width: 0; height: clamp(88px, 11.5vh, 126px); padding: 10px; border: 1px solid #d5d8cf; border-radius: 10px; background: #fffefb; color: #273329; text-align: left; box-shadow: 0 2px 3px #223d2410; transition: border-color .12s, box-shadow .12s; }
.splendor-card-art, .splendor-noble-portrait { background-image: url("./splendor-art-v1.png"); background-size: 500% 500%; background-position: var(--art-x) var(--art-y); background-repeat: no-repeat; }
.splendor-card-art { position: absolute; z-index: -2; top: 50%; left: 0; width: 100%; aspect-ratio: 1; transform: translateY(-50%); pointer-events: none; }
.splendor-card::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(180deg, #17292112, transparent 35%, #fffaf499); pointer-events: none; }
.splendor-workspace .noble-illustrated, .splendor-drawer .noble-illustrated { grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto; gap: 5px 7px; align-content: center; }
.noble-illustrated > .splendor-noble-portrait { display: block; grid-column: 1; grid-row: 1 / span 2; align-self: center; width: 38px; height: 48px; border: 1px solid #bba577; border-radius: 6px; box-shadow: 0 1px 4px #51432320; }
.noble-identity { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; font-size: 12px; line-height: 1.2; }
.noble-identity strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.noble-identity b { flex: 0 0 auto; color: #705018; }
.noble-illustrated > .noble-requirements { grid-column: 2; }
.splendor-noble-detail { display: grid; grid-template-columns: 120px minmax(0,1fr); align-items: center; gap: 18px; }
.splendor-noble-detail > .splendor-noble-portrait { display: block; width: 120px; height: 140px; border: 1px solid #c0ad80; border-radius: 10px; }
.splendor-noble-detail h3 { margin: 0; }
.splendor-card:not(:disabled):hover { border-color: #498064; box-shadow: 0 3px 8px #23452d26; }
.splendor-workspace .splendor-card.selected, .splendor-drawer .splendor-card.selected { border-color: #276845; outline: 3px solid #75a68a; outline-offset: 1px; background: #f0f8f1; }
.splendor-card-top { display: flex; align-items: start; justify-content: space-between; gap: 5px; }
.splendor-card-score { display: inline-flex; align-items: baseline; padding: 2px 5px; border: 1px solid #ffffff99; border-radius: 6px; background: #fffdf3f5; color: #2a332b; font-size: 26px; font-weight: 850; line-height: 1; box-shadow: 0 1px 4px #1a281d22; }
.splendor-card-score:empty { visibility: hidden; }
.splendor-card-score small { margin-left: 3px; font-size: 11px; font-weight: 500; }
.splendor-card-color-tag { display: inline-flex; align-items: center; gap: 3px; padding: 5px 7px; border: 1px solid #b9c6b9; border-radius: 6px; font-size: 14px; font-weight: 800; }
.gem-white { --gem-fill: #f0eeeb; --gem-ink: #393831; }
.gem-blue { --gem-fill: #dceffa; --gem-ink: #155b88; }
.gem-green { --gem-fill: #deefe3; --gem-ink: #215f3c; }
.gem-red { --gem-fill: #f9e3e0; --gem-ink: #96342f; }
.gem-black { --gem-fill: #e3e5e9; --gem-ink: #303744; }
.gem-gold { --gem-fill: #fff0b7; --gem-ink: #78540e; }
.splendor-card-color-tag, .splendor-cost-gem, .gem-pill { background: var(--gem-fill, #fff); color: var(--gem-ink, #303a32); }
.splendor-card.color-white { border-top: 5px solid #c2bfb5; }
.splendor-card.color-blue { border-top: 5px solid #298ac0; }
.splendor-card.color-green { border-top: 5px solid #318457; }
.splendor-card.color-red { border-top: 5px solid #c6493c; }
.splendor-card.color-black { border-top: 5px solid #41454e; }
.splendor-card-cost { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.splendor-cost-gem { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 30px; padding: 3px 5px; border: 1px solid #00000012; border-radius: 7px; font-size: 14px; line-height: 1.2; }
.splendor-cost-gem b { font-size: 16px; }
.noble-requirements .splendor-cost-gem { min-width: 0; padding: 2px 3px; font-size: 12px; }
.noble-requirements .splendor-cost-gem b { font-size: 13px; }
.splendor-sidebar { display: grid; align-content: start; gap: 10px; min-width: 0; }
.splendor-sidebar > section, .splendor-action { padding: 12px; border: 1px solid #d7ded2; border-radius: 10px; background: #fffdf7; }
.splendor-bank-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 4px; margin-top: 8px; }
.splendor-workspace .splendor-bank-gem { position: relative; display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 5px 3px; border: 1px solid #d0d8ce; border-radius: 8px; background: var(--gem-fill); color: var(--gem-ink); font-size: 12px; }
.splendor-bank-gem b { grid-column: 1 / -1; text-align: center; font-size: 20px; }
.splendor-bank-gem:disabled { opacity: 1; }
.splendor-bank-gem sup { position: absolute; right: 2px; top: -7px; padding: 1px 3px; border-radius: 4px; background: #286444; color: #fff; font-size: 10px; }
.splendor-workspace .splendor-bank-gem.selected { outline: 2px solid #397c54; }
.splendor-self > header > strong { color: #775615; }
.splendor-holding { display: block; margin: 7px 0; }
.splendor-resource-row { display: grid; grid-template-columns: 30px repeat(6,minmax(0,1fr)); align-items: center; gap: 4px; margin: 5px 0; font-size: 12px; color: #59655b; }
.gem-pill { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 0; padding: 4px 2px; border-radius: 6px; font-size: 13px; line-height: 1.1; }
.gem-pill i { font-style: normal; font-size: 12px; }
.gem-pill b { font-size: 14px; }
.splendor-resource-row > button { display: flex; padding: 0; border: 1px solid #70a880; background: #fff; border-radius: 6px; }
.splendor-resource-row > button .gem-pill { width: 100%; padding: 8px 0; }
.splendor-workspace .splendor-collection-open { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; margin-top: 9px; padding: 9px 0 0; border: 0; border-top: 1px solid #e0e5dc; border-radius: 0; background: transparent; color: #2a5439; font-size: 13px; font-weight: 750; }
.splendor-collection-open span { color: #5f6b61; font-size: 12px; font-weight: 500; }
.splendor-action-slot #tablegameActions { display: block; margin: 0; }
.splendor-action { display: grid; gap: 9px; background: #edf4ec; border-color: #c4d6c3; }
.splendor-action p, .splendor-action-help { margin: 0; color: #4c6051; font-size: 13px; line-height: 1.5; }
.splendor-workspace .splendor-action .button { min-height: 38px; padding: 8px 10px; border: 1px solid #8da48e; border-radius: 7px; font-size: 14px; }
.splendor-workspace .splendor-action .button-primary { background: #2d6748; color: #fff; border-color: #2d6748; }
.splendor-workspace .splendor-action .button:disabled { opacity: .5; }
.splendor-context-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.splendor-context-buttons > button { flex: 1; }
.splendor-selection { display: flex; flex-wrap: wrap; gap: 6px; }
.splendor-workspace .splendor-selection > button { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid #b0c3ad; border-radius: 7px; background: #fff; }
.splendor-workspace .splendor-cancel { justify-self: start; padding: 2px 0; border: 0; border-radius: 0; background: transparent; color: #4b6452; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.splendor-payment { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.splendor-info-slot { display: flex; flex: 1; align-items: center; justify-content: end; gap: 12px; min-width: 0; color: #556359; font-size: 12px; }
.splendor-info-slot #tablegameNotice { max-width: 360px; margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.splendor-info-slot .flip7-rules { padding: 7px 9px; border-color: #d7ded2; background: transparent; }
.splendor-info-slot .flip7-rules { position: relative; flex: 0 0 auto; }
.splendor-info-slot .flip7-rules p { position: absolute; z-index: 20; top: 24px; right: 0; width: min(500px, 78vw); max-height: 230px; padding: 14px; overflow: auto; border: 1px solid #b4c4b0; border-radius: 10px; background: #fffef8; color: #3b4d40; box-shadow: 0 6px 20px #223b2426; }
.splendor-opponents { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 10px; padding: 8px 0 0; border-top: 1px solid #d8dfd3; }
.splendor-workspace .splendor-opponent { min-width: 0; padding: 9px 12px; border: 1px solid #d7ded2; border-radius: 10px; background: #fdfcf7; color: #303c32; text-align: left; }
.splendor-workspace .splendor-opponent.is-turn { border-color: #769c75; background: #edf4e9; box-shadow: inset 3px 0 #759b75; }
.splendor-player-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 14px; }
.splendor-player-title > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.splendor-player-title small { margin-left: 6px; color: #356c44; }
.splendor-player-title > b { white-space: nowrap; color: #796224; }
.splendor-opponent .splendor-resource-row { margin: 3px 0 0; }
.splendor-drawer { inset: 0 0 0 auto; width: min(500px, 94vw); max-width: none; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid #becdb9; color: #2f3f32; background: #f8f7f0; box-shadow: -15px 0 60px #122d2230; }
.splendor-drawer::backdrop { background: #16291d66; }
.splendor-drawer-panel { display: flex; flex-direction: column; height: 100%; }
.splendor-drawer-panel > header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid #d4dece; }
.splendor-drawer h2 { font-size: 20px; }
.splendor-drawer button { cursor: pointer; }
.splendor-drawer button:disabled { cursor: default; }
#splendorDrawerClose { width: 40px; height: 40px; border: 1px solid #bccbbb; border-radius: 8px; background: #fff; color: #314b36; font-size: 26px; }
.splendor-drawer-content { flex: 1; min-height: 0; padding: 20px; overflow-y: auto; }
.splendor-drawer-content p { font-size: 14px; line-height: 1.6; }
.splendor-collection-tabs { display: flex; gap: 7px; margin-bottom: 16px; }
.splendor-collection-tabs button { flex: 1; min-height: 40px; padding: 7px; border: 1px solid #c6d2c2; border-radius: 8px; background: #fff; color: #3a513f; font: inherit; }
.splendor-collection-tabs button[aria-pressed=true] { background: #2d6748; color: #fff; border-color: #2d6748; }
.splendor-drawer-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.splendor-drawer-nobles { display: grid; gap: 12px; }
body:has(.splendor-drawer[open]) { overflow: hidden; }
.collection-empty { align-self: center; color: #526254; font-size: 13px; }
#tablegameRoom:has(.splendor-workspace) > .flip7-chat { display: grid; grid-template-columns: auto 1fr minmax(240px, 360px); align-items: center; gap: 8px; padding: 6px 0 10px; }
#tablegameRoom:has(.splendor-workspace) > .flip7-chat h3 { margin: 0; font-size: 13px; }
#tablegameRoom:has(.splendor-workspace) #tablegameMessages { min-height: 30px; max-height: 34px; padding: 3px 8px; border-radius: 7px; font-size: 12px; }
#tablegameRoom:has(.splendor-workspace) #tablegameMessages p { margin: 0; }
#tablegameRoom:has(.splendor-workspace) #tablegameChat .reminder-entry { display: flex; gap: 6px; }
#tablegameRoom:has(.splendor-workspace) #tablegameMessage { height: 32px; min-height: 32px; padding: 5px 8px; font-size: 12px; }
#tablegameRoom:has(.splendor-workspace) #tablegameChat button { min-height: 32px; padding: 4px 12px; font-size: 12px; }
@media(max-width:1000px) {
  .splendor-workspace { grid-template-columns: minmax(0,1fr) 290px; gap: 10px 12px; padding: 12px; }
  .splendor-workspace .splendor-card { padding: 8px; }
  .splendor-workspace .splendor-cost-gem { padding: 3px; gap: 1px; min-width: 26px; }
  .splendor-nobles .noble-requirements { gap: 2px; }
  .splendor-nobles > header small { font-size: 11px; }
}
@media(max-width:700px) {
  .splendor-workspace { grid-template-columns: 1fr; gap: 12px; padding: 10px; }
  .splendor-workspace .splendor-card { height: 132px; }
  .splendor-card-cost { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px 2px; }
  .splendor-table-top { flex-wrap: wrap; }
  .splendor-info-slot { order: 3; flex: 1 1 100%; justify-content: space-between; }
  .splendor-card-row { gap: 6px; }
  .splendor-card-color-tag { padding: 3px; font-size: 12px; }
  .splendor-card-score { font-size: 22px; }
  .splendor-workspace .splendor-card { padding: 6px; }
  .splendor-workspace .splendor-cost-gem { min-width: 22px; font-size: 11px; }
  .splendor-cost-gem b { font-size: 13px; }
  .splendor-noble-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .splendor-nobles .noble-tile { flex: 1 1 85px; min-height: 56px; padding: 5px; }
  .splendor-nobles > header small { max-width: 170px; text-align: right; }
  .splendor-sidebar { grid-template-columns: 1fr; }
  .splendor-opponents { grid-template-columns: 1fr; }
  #tablegameRoom:has(.splendor-workspace) > .flip7-chat { grid-template-columns: 1fr; }
  #tablegameRoom:has(.splendor-workspace) .tablegame-room-head { flex-direction: row; align-items: center; }
}
@media(min-width:701px) and (max-height:800px) {
  .splendor-workspace { gap: 8px 14px; padding: 10px 14px; }
  .splendor-sidebar { gap: 8px; }
  .splendor-sidebar > section, .splendor-action { padding: 9px; }
  .splendor-nobles .noble-tile { min-height: 56px; }
  .splendor-workspace .noble-illustrated { padding: 6px; }
  .noble-illustrated > .splendor-noble-portrait { height: 42px; }
  .splendor-holding { margin: 5px 0; }
  .splendor-workspace .splendor-collection-open { margin-top: 6px; padding-top: 6px; }
}


/* Keep each table's status, live hand and controls inside one felt surface. */
#tablegameBoard { display: grid; gap: 12px; padding: clamp(10px, 1.8vw, 20px); border: 1px solid #517561; border-radius: 24px; background: repeating-linear-gradient(24deg, #ffffff05 0 2px, transparent 2px 15px), radial-gradient(ellipse at center, #347155, #1c4937 88%); box-shadow: inset 0 0 0 4px #ffffff18; }
#tablegameBoard > .card-table, #tablegameBoard > .splendor-table { width: 100%; }
#tablegameBoard > #tablegameNotice { margin: 0; padding: 9px 12px; border: 1px solid #ffffff28; border-radius: 12px; background: #123e2f99; color: #fff4d8; }
#tablegameBoard > details.flip7-rules { margin: 0; border-color: #ffffff36; border-radius: 12px; background: #ffffff10; color: #fff4d8; }
#tablegameBoard > details.flip7-rules summary { color: #ffdf8e; }
#tablegameBoard > details.flip7-rules p,
#tablegameBoard > details.flip7-rules li { color: #fff7e5; font-size: 14px; line-height: 1.75; }
#tablegameBoard > #tablegameActions { margin: 0; padding: 12px; border: 1px solid #ffffff36; border-radius: 16px; background: #143f2f99; }
#tablegameBoard > #tablegameActions .tablegame-action-panel { border-color: #eddbac; background: #fffaf0; color: #30352f; }
#tablegameBoard > #tablegameActions .turn-hint, #tablegameBoard > #tablegameActions > p { color: #fff3d0; }
.table-seat { flex-wrap: wrap; }
.table-seat-play { display: grid !important; flex: 1 1 100%; justify-items: center; gap: 3px; max-width: 100%; padding: 5px; border-radius: 9px; background: #24584014; }
.table-seat-play > small { color: #68756c; font-size: 9px; font-weight: 700; }
.table-seat-play > div { display: flex !important; flex-wrap: nowrap; gap: 2px; max-width: 100%; overflow-x: auto; }
.table-seat-pass { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 4px 9px; border: 1px solid #d6c99e; border-radius: 999px; background: #fff5d9; color: #5e4c25; font-size: 11px; font-weight: 800; }
.table-playing-card.table-mini-card { flex-basis: 29px; width: 29px; height: 42px; padding: 2px !important; border-radius: 6px !important; }
.table-mini-card b { font-size: 10px; }.table-mini-card i { font-size: 12px; }.table-mini-card small { font-size: 6px; }
.ddz-game { position: relative; overflow: hidden; border-color: #698e79; background: repeating-linear-gradient(25deg, #ffffff06 0 2px, transparent 2px 15px), radial-gradient(ellipse at 50% 45%, #347657 0, #255943 68%, #173e2f 100%); }
.ddz-players { position: relative; grid-template-columns: minmax(84px,1fr) minmax(140px,2.2fr) minmax(84px,1fr); grid-template-rows: auto minmax(120px,auto) auto; grid-template-areas: ". top ." "left center right" ". self ."; align-items: center; min-height: 340px; }
.ddz-player-self { grid-area: self; justify-self: center; width: min(100%, 520px); }
.ddz-player-left { grid-area: left; }.ddz-player-top { grid-area: top; justify-self: center; width: min(100%, 360px); }.ddz-player-right { grid-area: right; }
.ddz-players > .ddz-last-play { grid-area: center; min-width: 0; }
.ddz-player-action { min-width: 0; overflow-wrap: anywhere; }
.ddz-game .ddz-hand-card { margin-left: -18px; }
.ddz-mini-cards { flex-wrap: nowrap; }
.table-playing-card.is-level { outline: 2px solid #e8be54; box-shadow: 0 0 0 3px #f7e6ac, 0 3px 7px #0003; }
.hand-card-button:disabled .table-playing-card { opacity: .75; }
#tablegameBoard .table-finish-banner { border-color: #f1d778; }
@media (max-width: 620px) {
  #tablegameBoard { gap: 8px; padding: 7px; border-radius: 16px; }
  #tablegameBoard > #tablegameActions { padding: 8px; }
  .table-seat-play { padding: 3px; }.table-playing-card.table-mini-card { flex-basis: 23px; width: 23px; height: 34px; }
  .table-mini-card b { font-size: 8px; }.table-mini-card i { font-size: 10px; }
  .ddz-players { grid-template-columns: minmax(62px,.75fr) minmax(110px,1.7fr) minmax(62px,.75fr); grid-template-rows: auto minmax(108px,auto) auto; min-height: 285px; gap: 5px; }
  .ddz-player { min-height: 0; padding: 7px 5px; }.ddz-player-self { width: min(100%, 420px); }
  .ddz-player .ddz-avatar { flex-basis: 28px; width: 28px; height: 28px; font-size: 17px; }
  .ddz-mini-card { flex-basis: 22px; min-width: 22px; height: 33px; font-size: 9px; }
  .ddz-last-play { min-height: 108px; padding: 6px; }
}
