/* Zhao Peng You — modern Chinese card salon */
*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --ink-950: #061d1a;
  --ink-900: #082f2a;
  --ink-850: #0b3932;
  --ink-800: #0d443b;
  --jade-700: #126451;
  --jade-500: #2d9377;
  --ivory: #fffaf0;
  --ivory-2: #f4ead8;
  --gold: #f4c968;
  --gold-soft: #ffe3a1;
  --cinnabar: #b94335;
  --cinnabar-bright: #ff8a7b;
  --lapis: #3276a8;
  --text: #fffaf0;
  --text-muted: #c8d5ce;
  --text-dim: #9db1a8;
  --line: rgba(255, 250, 240, .16);
  --line-strong: rgba(244, 201, 104, .48);
  --line-control: rgba(255, 250, 240, .3);
  --panel: rgba(6, 29, 26, .88);
  --panel-soft: rgba(8, 47, 42, .82);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, .42);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, .34);
  --shadow-float: 0 18px 44px rgba(0, 0, 0, .28);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --card-w: 72px;
  --card-h: 108px;
  --hand-overlap: 26px;
  --hand-dock-height: 188px;
  --focus: #9de9d4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  font-size: 16px;
  color: var(--text);
}

html { min-width: 300px; background: var(--ink-950); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--ink-950); overflow-x: hidden; }
button, input, select { font: inherit; }
button { color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: "Noto Serif SC", "Songti SC", Georgia, serif; letter-spacing: .01em; }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-control);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(255, 255, 255, .075);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
input:hover, select:hover { border-color: rgba(255, 250, 240, .42); }
input:focus, select:focus { border-color: var(--gold); background: rgba(255, 255, 255, .1); box-shadow: 0 0 0 4px rgba(244, 201, 104, .1); }
input::placeholder { color: #a9bbb3; }
select option { color: #10241f; background: var(--ivory); }
label { display: block; margin: 14px 0 7px; color: var(--ivory-2); font-size: .9rem; font-weight: 700; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10000;
  transform: translateY(-160%);
  padding: 10px 14px;
  color: var(--ink-950);
  background: var(--gold);
  border-radius: 8px;
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }

.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; }

.eyebrow, .small-label, .hud-label {
  display: block;
  color: var(--gold-soft);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.context-copy, .field-help { color: var(--text-muted); line-height: 1.5; }
.field-help { margin-top: 7px; font-size: .8rem; }

.btn, .icon-button, .brand-button, .mode-tab, .text-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}
.btn { padding: 10px 16px; }
.btn:hover:not(:disabled), .icon-button:hover:not(:disabled), .mode-tab:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled), .icon-button:active:not(:disabled), .mode-tab:active:not(:disabled) { transform: translateY(0) scale(.985); }
.btn:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .48; }
.btn[aria-busy="true"]::before {
  content: "";
  width: .78em;
  height: .78em;
  display: inline-block;
  margin-right: .5em;
  vertical-align: -.06em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin .7s linear infinite;
}
@keyframes button-spin { to { transform: rotate(1turn); } }
.btn-primary { color: #172018; background: linear-gradient(135deg, #ffe294, var(--gold) 58%, #eab654); box-shadow: 0 8px 22px rgba(244, 201, 104, .2), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #ffebaf, #ffcf69 60%, #efb955); box-shadow: 0 11px 28px rgba(244, 201, 104, .28), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn-secondary { color: #0b2c26; background: #cfe8df; }
.btn-secondary:hover:not(:disabled) { background: #e4f5ef; }
.btn-quiet, .icon-button {
  color: var(--text);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line-control);
}
.btn-quiet:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: rgba(255, 255, 255, .13); border-color: var(--line-strong); }
.btn-wide { width: 100%; margin-top: 18px; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-button { padding: 8px 11px; font-size: .82rem; }
.text-button {
  min-height: 36px;
  padding: 4px 6px;
  color: var(--gold-soft);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  color: var(--ivory);
  background: transparent;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 1.05rem;
}
.brand-button img, .game-brand img { width: 34px; height: 34px; }

.salon-panel {
  background: linear-gradient(145deg, rgba(15, 65, 56, .91), rgba(6, 29, 26, .96));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px) saturate(1.08);
}

/* Festive salon decoration */
.festive-scene { position: absolute; pointer-events: none; }
.decor-lantern {
  --lantern: #bd4538;
  --lantern-dark: #712920;
  --lantern-light: #ffc378;
  --lantern-mark: #fff0bd;
  position: absolute;
  width: 58px;
  height: 112px;
  pointer-events: auto;
  cursor: default;
  touch-action: pan-y;
  transform-origin: 50% 0;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .34));
  transition: filter .22s ease;
}
.lantern-gold { --lantern: #d18d2f; --lantern-dark: #77451e; --lantern-light: #ffe6a4; --lantern-mark: #702b23; }
.lantern-hanger { position: absolute; left: calc(50% - .5px); top: 0; width: 1px; height: 27%; background: linear-gradient(#d7bd73, #755a26); }
.lantern-hanger::after { content: ""; position: absolute; left: -11px; bottom: -2px; width: 23px; height: 6px; border-radius: 2px; background: #e5c674; box-shadow: inset 0 -2px rgba(90, 54, 21, .4), 0 2px 4px rgba(0, 0, 0, .25); }
.lantern-shell {
  position: absolute;
  left: 8%;
  top: 25%;
  width: 84%;
  height: 45%;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 1px solid rgba(255, 226, 151, .72);
  border-radius: 42% 42% 38% 38% / 28% 28% 48% 48%;
  background:
    linear-gradient(90deg, transparent 16%, rgba(255, 238, 184, .32) 17% 19%, transparent 20% 39%, rgba(255, 238, 184, .28) 40% 42%, transparent 43% 59%, rgba(255, 238, 184, .28) 60% 62%, transparent 63% 81%, rgba(255, 238, 184, .32) 82% 84%, transparent 85%),
    radial-gradient(circle at 50% 25%, var(--lantern-light), var(--lantern) 53%, var(--lantern-dark) 100%);
  box-shadow: inset 0 0 11px rgba(255, 239, 179, .38), 0 0 17px color-mix(in srgb, var(--lantern-light) 36%, transparent);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), filter .24s ease, box-shadow .24s ease;
}
.lantern-shell::before, .lantern-shell::after { content: ""; position: absolute; left: 17%; width: 66%; height: 9%; border: 1px solid rgba(255, 225, 150, .64); border-radius: 3px; background: linear-gradient(90deg, #6b3422, #c4883e 45%, #6b3422); box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.lantern-shell::before { top: -7%; }
.lantern-shell::after { bottom: -7%; }
.lantern-mark { position: relative; z-index: 1; display: block; color: var(--lantern-mark); font-family: "Noto Serif SC", "Songti SC", Georgia, serif; font-size: 1rem; font-weight: 900; text-shadow: 0 1px 2px rgba(72, 30, 18, .55); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
.lantern-tassel { position: absolute; left: calc(50% - 1px); top: 72%; width: 2px; height: 24%; transform-origin: 50% 0; background: linear-gradient(#dfb956, #a8372c); box-shadow: -5px 6px 0 -1px #a8372c, 5px 6px 0 -1px #a8372c; }
.lantern-tassel::before { content: ""; position: absolute; left: -4px; top: -4px; width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid #f2cf75; background: #9f3128; }
.paper-cloud { --cloud-color: rgba(185, 67, 53, .44); position: absolute; width: 104px; height: 34px; border-bottom: 2px solid var(--cloud-color); border-radius: 0 0 50% 50%; opacity: .74; }
.paper-cloud::before, .paper-cloud::after { content: ""; position: absolute; bottom: -2px; border: 2px solid var(--cloud-color); border-bottom: 0; border-radius: 999px 999px 0 0; }
.paper-cloud::before { left: 12px; width: 42px; height: 25px; }
.paper-cloud::after { right: 8px; width: 56px; height: 17px; }

@keyframes lantern-greeting {
  0%, 100% { transform: rotate(0); }
  24% { transform: translateY(-2px) rotate(-7deg); }
  52% { transform: translateY(1px) rotate(6deg); }
  76% { transform: rotate(-2.5deg); }
}
@keyframes tassel-flick { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(10deg); } 68% { transform: rotate(-7deg); } }
@keyframes lantern-event {
  0%, 100% { transform: rotate(0) scale(1); }
  28% { transform: translateY(-4px) rotate(-5deg) scale(1.04); }
  58% { transform: translateY(1px) rotate(4deg) scale(1.02); }
}
@keyframes lantern-event-glow { 45% { filter: brightness(1.22) saturate(1.12); box-shadow: inset 0 0 15px rgba(255, 246, 205, .55), 0 0 28px color-mix(in srgb, var(--lantern-light) 66%, transparent); } }

/* Lobby */
.screen-lobby { position: relative; align-items: stretch; overflow-x: hidden; overflow-y: auto; background: var(--ink-900); isolation: isolate; }
.screen-lobby::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 76% 16%, rgba(244, 201, 104, .08), transparent 31%);
}
.lobby-art {
  position: absolute;
  inset: 0 42% 0 0;
  background-image: linear-gradient(90deg, rgba(6, 29, 26, .02), rgba(6, 29, 26, .73)), url("assets/lobby-table.jpg");
  background-image: linear-gradient(90deg, rgba(6, 29, 26, .02), rgba(6, 29, 26, .73)), url("assets/lobby-table.webp");
  background-position: left center;
  background-size: cover;
}
.lobby-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(6, 29, 26, .55), transparent 45%);
}
.lobby-decor { z-index: 4; inset: 0; overflow: hidden; }
.lobby-decor .decor-lantern { width: 64px; height: 124px; top: -4px; }
.lobby-decor .lantern-left { left: 54%; }
.lobby-decor .lantern-right { right: 2.5%; width: 52px; height: 101px; }
.lobby-decor .cloud-left { left: 3%; bottom: 14%; transform: rotate(5deg); }
.lobby-decor .cloud-right { right: 2%; top: 24%; transform: scaleX(-1) rotate(8deg); opacity: .36; }
.lobby-content {
  position: relative;
  z-index: 3;
  width: min(100%, 650px);
  margin-left: auto;
  padding: clamp(28px, 5vw, 72px) clamp(22px, 6vw, 84px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  background: linear-gradient(90deg, rgba(8, 47, 42, .16), var(--ink-900) 19%);
}
.lobby-brand { display: flex; align-items: center; gap: 18px; }
.brand-seal { width: 74px; height: 74px; filter: drop-shadow(0 10px 25px rgba(0, 0, 0, .28)); }
.lobby-brand h1 { color: var(--gold); font-size: clamp(2.8rem, 6vw, 4.7rem); line-height: .94; margin-top: 6px; text-shadow: 0 5px 26px rgba(244, 201, 104, .13); }
.brand-translation { margin-top: 7px; color: var(--text-muted); font-size: .95rem; letter-spacing: .04em; }
.lobby-panel { position: relative; padding: clamp(20px, 4vw, 32px); overflow: hidden; }
.lobby-panel::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--gold-soft), transparent 72%); opacity: .72; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .22); }
.mode-tab { min-height: 46px; padding: 8px 10px; color: var(--text-muted); background: transparent; }
.mode-tab.active { color: var(--ink-950); background: linear-gradient(145deg, #fffaf0, #ecdfc9); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.mode-panel { padding-top: 8px; }
.code-input { text-transform: uppercase; letter-spacing: .16em; font-weight: 850; }
.resume-panel { margin-top: 18px; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(244, 201, 104, .08); }
.resume-panel p { margin-bottom: 10px; color: var(--ivory-2); }
.form-message { min-height: 1.4em; margin-top: 12px; font-size: .86rem; }
.error-message { color: #ff9c91; line-height: 1.45; }
.lobby-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-dim); font-size: .8rem; }
.lobby-story {
  position: absolute;
  z-index: 3;
  left: clamp(32px, 5vw, 88px);
  bottom: clamp(42px, 8vh, 92px);
  width: min(430px, 34vw);
  padding-left: 22px;
  border-left: 1px solid rgba(244, 201, 104, .52);
  text-shadow: 0 2px 20px rgba(0, 0, 0, .62);
}
.story-kicker { color: var(--gold-soft); font-size: .74rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.story-title { margin-top: 9px; color: var(--ivory); font-family: "Noto Serif SC", "Songti SC", Georgia, serif; font-size: clamp(2rem, 3vw, 3.2rem); font-weight: 800; line-height: 1.02; letter-spacing: -.015em; }
.story-copy { max-width: 390px; margin-top: 15px; color: #dce7e1; font-size: .92rem; line-height: 1.62; }
.story-stats { display: flex; gap: 24px; margin: 22px 0 0; }
.story-stats div { min-width: 0; }
.story-stats dt { color: var(--gold); font-family: Georgia, serif; font-size: 1.05rem; font-weight: 900; }
.story-stats dd { margin: 3px 0 0; color: var(--text-muted); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }

/* Shared header */
.site-header, .game-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: rgba(4, 24, 21, .94);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
  backdrop-filter: blur(18px);
}
.header-actions { display: flex; align-items: center; gap: 7px; }

/* Waiting room */
.screen-room { position: relative; flex-direction: column; isolation: isolate; background: radial-gradient(circle at 50% 15%, rgba(22, 101, 82, .67) 0, rgba(10, 57, 49, .86) 34%, rgba(6, 29, 26, .97) 78%), url("assets/lobby-table.webp") center / cover no-repeat; }
.screen-room::before { content: ""; position: fixed; z-index: 0; inset: 58px 0 0; pointer-events: none; opacity: .22; background-image: radial-gradient(circle at center, rgba(255, 255, 255, .08) 0 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, black, transparent 72%); }
.screen-room > .site-header, .screen-room > .connection-strip { position: relative; z-index: 3; }
.room-wrap { position: relative; z-index: 2; flex: 1; display: grid; place-items: center; width: 100%; padding: 24px 16px 44px; isolation: isolate; }
.room-decor { z-index: 0; inset: 0; overflow: hidden; }
.room-decor .decor-lantern { top: -24px; }
.room-decor .lantern-left { left: clamp(12px, 7vw, 118px); }
.room-decor .lantern-right { right: clamp(12px, 7vw, 118px); }
.room-decor .cloud-left { left: clamp(34px, 10vw, 170px); bottom: 15%; }
.room-decor .cloud-right { right: clamp(34px, 10vw, 170px); top: 25%; transform: scaleX(-1); }
.room-card { position: relative; width: min(720px, 100%); padding: clamp(22px, 5vw, 38px); overflow: hidden; }
.room-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 0 0, rgba(185, 67, 53, .19), transparent 18%), radial-gradient(circle at 100% 100%, rgba(244, 201, 104, .1), transparent 20%); }
.room-card::after { content: ""; position: absolute; inset: 9px; pointer-events: none; border: 1px solid rgba(244, 201, 104, .1); border-radius: calc(var(--radius-lg) - 7px); }
.screen-room.is-table-ready .room-decor .lantern-shell { filter: brightness(1.07) saturate(1.04); }
.screen-room.table-ready-celebration .room-decor .decor-lantern { animation: lantern-event .88s cubic-bezier(.2, .8, .2, 1) both; }
.screen-room.table-ready-celebration .room-decor .lantern-right { animation-delay: 90ms; }
.screen-room.table-ready-celebration .room-decor .lantern-shell { animation: lantern-event-glow .88s ease both; }
.room-heading, .roster-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.room-heading h1 { margin-top: 4px; font-size: clamp(1.7rem, 5vw, 2.4rem); }
.room-subtitle { max-width: 460px; margin-top: 5px; color: var(--text-muted); font-size: .82rem; line-height: 1.45; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 10px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 750;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #63d7ac; box-shadow: 0 0 0 3px rgba(99, 215, 172, .12); }
.status-pill.paused .status-dot { background: var(--cinnabar-bright); box-shadow: 0 0 0 3px rgba(255, 138, 123, .12); }
.invite-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px 18px;
  margin: 24px 0;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 0, 0, .25), rgba(10, 66, 55, .17));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}
.room-code { display: block; margin-top: 4px; color: var(--gold); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.9rem; letter-spacing: .2em; text-shadow: 0 4px 18px rgba(244, 201, 104, .16); }
.invite-actions { display: flex; gap: 8px; }
.invite-url { grid-column: 1 / -1; min-height: 38px; font-size: .75rem; color: var(--text-dim); background: rgba(0, 0, 0, .18); border-color: rgba(255, 255, 255, .13); }
.roster-heading { margin-bottom: 10px; }
.roster-heading h2 { font-size: 1.2rem; }
.roster-heading span { color: var(--text-dim); font-size: .82rem; }
.player-list { max-height: min(334px, 38dvh); list-style: none; margin: 0; padding: 0 3px 0 0; display: grid; gap: 7px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(244, 201, 104, .35) transparent; }
.player-entry {
  min-height: 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .052);
  border: 1px solid rgba(255, 255, 255, .07);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}
.player-entry:hover { transform: translateX(2px); border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .075); }
.player-entry.is-self { border-color: var(--line-strong); background: rgba(244, 201, 104, .07); }
.player-entry.is-bot { border-color: rgba(244, 201, 104, .15); background: linear-gradient(90deg, rgba(185, 67, 53, .09), rgba(244, 201, 104, .045)); }
.player-entry.is-bot .player-avatar, .opponent-box.is-bot .opponent-avatar { color: #fff4dc; background: linear-gradient(145deg, #b94335, #7c241d); border: 1px solid rgba(244, 201, 104, .58); box-shadow: inset 0 1px rgba(255, 255, 255, .2), 0 4px 12px rgba(0, 0, 0, .2); font-family: "Noto Serif SC", Georgia, serif; }
.player-entry.empty-seat { min-height: 46px; border-style: dashed; color: var(--text-dim); background: rgba(0, 0, 0, .09); }
.player-entry.empty-seat .player-avatar { color: var(--text-dim); background: rgba(255, 255, 255, .07); border: 1px dashed rgba(255, 255, 255, .18); }
.player-avatar, .opponent-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-950);
  background: var(--ivory-2);
  font-weight: 900;
}
.player-avatar { width: 34px; height: 34px; }
.player-entry:not(.is-bot):nth-child(4n + 1) .player-avatar, .opponent-box:not(.is-bot):nth-child(4n + 1) .opponent-avatar { background: #f0d7a0; }
.player-entry:not(.is-bot):nth-child(4n + 2) .player-avatar, .opponent-box:not(.is-bot):nth-child(4n + 2) .opponent-avatar { background: #b8e2d2; }
.player-entry:not(.is-bot):nth-child(4n + 3) .player-avatar, .opponent-box:not(.is-bot):nth-child(4n + 3) .opponent-avatar { background: #e7beb1; }
.player-entry:not(.is-bot):nth-child(4n) .player-avatar, .opponent-box:not(.is-bot):nth-child(4n) .opponent-avatar { background: #bfd6e8; }
.player-primary { min-width: 0; }
.player-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.player-meta { color: var(--text-dim); font-size: .74rem; }
.player-entry-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.bot-remove { min-width: 44px; min-height: 44px; padding: 5px 8px; color: var(--gold-soft); background: rgba(0, 0, 0, .13); border: 1px solid rgba(244, 201, 104, .24); border-radius: 8px; font: inherit; font-size: .68rem; font-weight: 800; cursor: pointer; transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease; }
.bot-remove:hover:not(:disabled) { color: var(--ivory); border-color: rgba(244, 201, 104, .48); background: rgba(185, 67, 53, .2); transform: translateY(-1px); }
.bot-remove:disabled { opacity: .48; cursor: wait; }
.player-level { color: var(--gold-soft); font-weight: 800; }
.connection-state { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: .72rem; }
.connection-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7ce2ba; }
.connection-state.offline { color: #ffaaa2; }
.connection-state.offline::before { background: var(--cinnabar-bright); }
.connection-state.seat-needed { color: var(--text-dim); }
.connection-state.seat-needed::before { background: rgba(255, 255, 255, .26); }
.connection-state.bot-ready { color: var(--gold-soft); }
.connection-state.bot-ready::before { background: var(--gold); box-shadow: 0 0 0 3px rgba(244, 201, 104, .1); }
.bot-controls { margin-top: 16px; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; border: 1px solid rgba(244, 201, 104, .18); border-radius: 13px; background: linear-gradient(135deg, rgba(185, 67, 53, .1), rgba(6, 38, 33, .64)); box-shadow: inset 0 1px rgba(255, 255, 255, .025); }
.bot-controls-copy { min-width: 0; display: flex; align-items: center; gap: 11px; }
.bot-controls h3 { color: var(--ivory); font-size: .92rem; }
.bot-controls p { max-width: 430px; margin-top: 2px; color: var(--text-dim); font-size: .72rem; line-height: 1.42; }
.bot-seal { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; color: #fff2d1; background: linear-gradient(145deg, #c24d3e, #84291f); border: 1px solid rgba(244, 201, 104, .58); border-radius: 9px; box-shadow: inset 0 0 0 3px rgba(255, 245, 218, .09), 0 5px 15px rgba(0, 0, 0, .22); font-family: "Noto Serif SC", Georgia, serif; font-weight: 900; transform: rotate(-2deg); transition: transform .25s cubic-bezier(.2, .8, .2, 1), filter .25s ease; }
.bot-controls:hover .bot-seal { filter: brightness(1.08); transform: rotate(3deg) translateY(-1px); }
.bot-actions { display: flex; justify-content: flex-end; gap: 7px; }
.bot-actions .btn { min-height: 44px; padding-inline: 13px; white-space: nowrap; }
.room-footer { display: grid; gap: 12px; margin-top: 22px; text-align: center; }

/* Game chrome */
.screen-game { height: 100vh; height: 100dvh; min-height: 0; flex-direction: column; background: radial-gradient(ellipse at 50% 38%, #176b57 0%, #0a3b32 48%, #041d19 100%); overflow: hidden; }
.game-header { min-height: 54px; }
.game-brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.compact-code { color: var(--gold-soft); font-size: .78rem; font-weight: 900; letter-spacing: .14em; }
.phase-rail { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 4px; }
.phase-rail li { display: flex; align-items: center; gap: 5px; padding: 5px 9px; color: var(--text-dim); border-radius: 999px; font-size: .72rem; font-weight: 800; transition: color .2s ease, background-color .2s ease, transform .2s ease; }
.phase-rail li span { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: .65rem; }
.phase-rail li.complete { color: var(--text-muted); }
.phase-rail li.complete span { border-color: var(--jade-500); background: var(--jade-700); }
.phase-rail li.active { color: var(--ink-950); background: linear-gradient(135deg, var(--gold-soft), var(--gold)); box-shadow: 0 5px 18px rgba(244, 201, 104, .2); transform: translateY(-1px); }
.phase-rail li.active span { border-color: var(--ink-950); }
.unread-badge { min-width: 19px; height: 19px; margin-left: 3px; display: inline-grid; place-items: center; padding: 0 5px; color: white; background: var(--cinnabar); border-radius: 999px; font-size: .65rem; }

.game-hud {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 1.35fr 1.35fr .6fr;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 10px 9px;
  background: linear-gradient(180deg, rgba(3, 22, 19, .92), rgba(4, 31, 27, .72));
  border-bottom: 1px solid rgba(244, 201, 104, .12);
}
.hud-item { min-width: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; background: linear-gradient(145deg, rgba(16, 68, 58, .55), rgba(5, 32, 28, .72)); border: 1px solid rgba(255, 250, 240, .1); border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025); }
.hud-self { border-color: rgba(244, 201, 104, .27); }
.hud-item strong, .hud-item > span:not(.hud-label):not(.score-meter) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-item strong { color: var(--ivory); font-size: .9rem; }
.hud-item > span:not(.hud-label):not(.score-meter) { color: var(--text-dim); font-size: .72rem; }
.hud-round { text-align: center; }
.hud-calls { overflow: hidden; }
.call-chips { min-width: 0; display: flex; align-items: stretch; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.call-chips::-webkit-scrollbar { display: none; }
.call-chip {
  min-width: 128px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1px 7px;
  padding: 5px 7px;
  color: var(--ivory);
  border: 1px solid rgba(244, 201, 104, .24);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(185, 67, 53, .12), rgba(2, 25, 22, .78));
  box-shadow: inset 0 1px rgba(255, 255, 255, .035);
}
.call-chip-label { grid-column: 1 / -1; color: var(--gold-soft); font-size: .49rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.call-chip-card { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.call-chip-card strong { color: currentColor; font-family: Georgia, serif; font-size: .92rem; }
.call-chip-order { color: var(--text-muted); font-size: .58rem; font-weight: 850; }
.call-chip-suit { font-size: .9rem; line-height: 1; }
.call-chip-status { min-width: 0; overflow: hidden; color: var(--text-dim); font-size: .56rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.call-chip.suit-hearts, .call-chip.suit-diamonds { color: #ffb1a7; }
.call-chip.suit-clubs, .call-chip.suit-spades { color: #e9f2ec; }
.call-chip.is-fulfilled { border-color: rgba(107, 197, 166, .62); background: linear-gradient(145deg, rgba(29, 126, 99, .34), rgba(3, 39, 33, .86)); }
.call-chip.is-fulfilled .call-chip-status { color: #adf0d7; font-weight: 800; }
.call-chip.is-spent { border-color: rgba(255, 255, 255, .12); filter: saturate(.55); opacity: .72; }
.call-empty-state { display: inline-flex; align-items: center; padding: 6px 9px; color: var(--text-dim); border: 1px dashed rgba(255, 255, 255, .16); border-radius: 8px; font-size: .62rem; }
.call-empty-compact { min-height: 30px; }
.score-meter { width: 100%; height: 3px; margin-top: 3px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.score-meter span { display: block; width: 0; height: 100%; background: var(--gold); transition: width .25s ease; }

.game-layout { position: relative; flex: 1; min-height: 0; isolation: isolate; background: radial-gradient(circle at 50% 0, rgba(244, 201, 104, .035), transparent 35%); }
.game-layout::before { content: ""; position: absolute; z-index: 0; inset: 0; pointer-events: none; opacity: .06; background: url("assets/lobby-table.webp") center / cover no-repeat; -webkit-mask-image: radial-gradient(ellipse at center, transparent 10%, #000 88%); mask-image: radial-gradient(ellipse at center, transparent 10%, #000 88%); }
.game-stage { position: relative; z-index: 1; height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; scrollbar-color: rgba(244, 201, 104, .35) transparent; }
.opponents-section { position: relative; z-index: 4; flex: 0 0 auto; margin-bottom: -19px; pointer-events: none; }
.opponents-row { min-height: 78px; display: flex; justify-content: safe center; gap: 9px; padding: 9px 14px 4px; overflow-x: auto; pointer-events: auto; }
.opponent-box {
  position: relative;
  min-width: 134px;
  max-width: 166px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 7px;
  padding: 9px 10px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(12, 57, 49, .96), rgba(4, 27, 24, .96));
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .035);
}
.opponent-box.active-player { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244, 201, 104, .12), 0 12px 30px rgba(0, 0, 0, .32); transform: translateY(-3px); }
.opponent-box.new-teammate, .hud-self.new-teammate { animation: teammate-halo 1.6s cubic-bezier(.16, .8, .2, 1) both; }
.opponent-box.active-player::after { content: "TURN"; position: absolute; top: -6px; right: 7px; padding: 1px 5px; color: var(--ink-950); background: var(--gold); border-radius: 4px; font-size: .54rem; font-weight: 900; letter-spacing: .06em; }
.opponent-box.is-bot.active-player::after { content: "THINKING"; animation: bot-thinking 1s ease-in-out infinite alternate; }
@keyframes teammate-halo {
  0%, 100% { transform: none; }
  28% { border-color: #ffe39a; box-shadow: 0 0 0 5px rgba(244, 201, 104, .16), 0 0 34px rgba(244, 201, 104, .34), 0 14px 30px rgba(0, 0, 0, .32); transform: translateY(-4px) scale(1.035); }
}
.opponent-box.disconnected { border-style: dashed; opacity: .72; }
.opponent-avatar { grid-row: 1 / 3; width: 30px; height: 30px; font-size: .75rem; }
.opp-name-row { min-width: 0; display: flex; align-items: center; gap: 5px; }
.opp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ivory); font-size: .82rem; font-weight: 800; }
.opp-meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .7rem; white-space: nowrap; }
.bot-badge { flex: 0 0 auto; padding: 1px 4px; color: var(--gold-soft); border: 1px solid rgba(244, 201, 104, .28); border-radius: 999px; font-size: .5rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.team-badge { grid-column: 1 / -1; justify-self: start; margin-top: 3px; padding: 2px 7px; border-radius: 999px; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.team-badge.attacker { color: #fff4eb; background: var(--cinnabar); }
.team-badge.defender { color: #eef8ff; background: var(--lapis); }

.table-area {
  position: relative;
  isolation: isolate;
  flex: 1 1 260px;
  min-height: 300px;
  display: grid;
  place-items: center;
  margin: 0 clamp(10px, 2.5vw, 34px);
  padding: 38px clamp(92px, 8vw, 138px) 72px;
  overflow: auto;
  border: 1px solid rgba(244, 201, 104, .31);
  border-radius: clamp(44px, 7vw, 96px);
  background:
    radial-gradient(ellipse at center, rgba(29, 126, 99, .34), rgba(7, 55, 46, .28) 48%, rgba(2, 30, 26, .58) 100%),
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, .018) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 0 0 8px rgba(2, 22, 19, .34), inset 0 0 70px rgba(0, 0, 0, .29), 0 24px 65px rgba(0, 0, 0, .2);
}
.table-area::before { content: ""; position: absolute; z-index: 0; inset: 11px; pointer-events: none; border: 1px solid rgba(244, 201, 104, .16); border-radius: inherit; }
.table-area::after { content: ""; position: absolute; z-index: 0; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(115deg, rgba(255, 255, 255, .025), transparent 28%, transparent 72%, rgba(244, 201, 104, .025)); }
.table-art-echo { position: absolute; z-index: 0; inset: 1px; pointer-events: none; overflow: hidden; border-radius: inherit; opacity: .15; background: url("assets/lobby-table.webp") center top / cover no-repeat; mix-blend-mode: screen; -webkit-mask-image: radial-gradient(ellipse at center, transparent 0 48%, #000 91%); mask-image: radial-gradient(ellipse at center, transparent 0 48%, #000 91%); }
.table-decor { z-index: 1; inset: 0; overflow: hidden; border-radius: inherit; }
.table-decor::before { content: ""; position: absolute; left: 78px; right: 78px; top: 13px; height: 1px; background: linear-gradient(90deg, transparent, rgba(244, 201, 104, .31) 14% 86%, transparent); }
.table-decor .decor-lantern { top: -10px; width: 46px; height: 89px; }
.table-decor .lantern-left { left: 26px; }
.table-decor .lantern-right { right: 26px; }
.table-decor .cloud-left { left: 84px; bottom: 25px; transform: rotate(4deg) scale(.78); opacity: .25; }
.table-decor .cloud-right { right: 84px; top: 34px; transform: scaleX(-1) rotate(4deg) scale(.72); opacity: .23; }
.screen-game.trump-revealed .table-decor .decor-lantern,
.screen-game.ally-revealed .table-decor .decor-lantern,
.screen-game.call-announced .table-decor .decor-lantern { animation: lantern-event 1.25s cubic-bezier(.2, .8, .2, 1) both; }
.screen-game.trump-revealed .table-decor .lantern-right,
.screen-game.ally-revealed .table-decor .lantern-right,
.screen-game.call-announced .table-decor .lantern-right { animation-delay: 90ms; }
.screen-game.trump-revealed .table-decor .lantern-shell,
.screen-game.ally-revealed .table-decor .lantern-shell,
.screen-game.call-announced .table-decor .lantern-shell { animation: lantern-event-glow 1.25s ease both; }

.call-ceremony {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(620px, calc(100% - 40px));
  max-height: calc(100% - 30px);
  overflow: auto;
  padding: 22px 24px 20px;
  text-align: center;
  pointer-events: none;
  border: 1px solid rgba(255, 226, 151, .66);
  border-radius: 22px;
  color: var(--ivory);
  background:
    radial-gradient(circle at 50% 0, rgba(244, 201, 104, .17), transparent 45%),
    linear-gradient(145deg, rgba(104, 29, 23, .97), rgba(7, 44, 37, .98) 72%);
  box-shadow: 0 26px 64px rgba(0, 0, 0, .46), inset 0 0 0 4px rgba(255, 247, 221, .035);
  transform: translate(-50%, -50%);
}
.call-ceremony::before, .call-ceremony::after { content: ""; position: absolute; top: 16px; width: 70px; height: 1px; background: linear-gradient(90deg, transparent, rgba(244, 201, 104, .72)); }
.call-ceremony::before { left: 18px; }
.call-ceremony::after { right: 18px; transform: scaleX(-1); }
.call-ceremony-seal { width: 48px; height: 48px; margin: -3px auto 8px; display: grid; place-items: center; color: #fff3ce; border: 1px solid rgba(255, 226, 151, .72); border-radius: 50%; background: linear-gradient(145deg, #c64e3f, #7d231d); box-shadow: 0 8px 22px rgba(0, 0, 0, .3), inset 0 0 0 4px rgba(255, 243, 208, .08); font-family: "Noto Serif SC", Georgia, serif; font-size: 1.35rem; font-weight: 900; }
.call-ceremony h2 { margin-top: 3px; color: #fff7df; font-size: clamp(1.2rem, 3vw, 1.75rem); }
.call-ceremony > p:not(.eyebrow) { max-width: 510px; margin: 6px auto 0; color: #d9e5dc; font-size: .82rem; line-height: 1.48; }
.call-chips-ceremony { justify-content: center; flex-wrap: wrap; margin-top: 16px; overflow: visible; }
.call-chips-ceremony .call-chip { min-width: 178px; padding: 9px 11px; text-align: left; border-color: rgba(255, 226, 151, .38); background: rgba(3, 29, 25, .68); box-shadow: 0 8px 18px rgba(0, 0, 0, .22); }
.call-chips-ceremony .call-chip-label { font-size: .56rem; }
.call-chips-ceremony .call-chip-card strong, .call-chips-ceremony .call-chip-suit { font-size: 1.2rem; }
.call-chips-ceremony .call-chip-status { font-size: .61rem; }
.call-chips-ceremony.is-empty { justify-content: center; }
.call-ceremony.is-revealing { animation: call-ceremony-in 1.25s cubic-bezier(.16, .8, .2, 1) both; }
.call-ceremony.is-revealing .call-ceremony-seal { animation: call-seal-arrive 1.05s cubic-bezier(.16, .8, .2, 1) both; }
.call-ceremony.is-revealing .call-chip { animation: call-chip-arrive .72s calc(.22s + var(--call-order, 0) * 90ms) cubic-bezier(.16, .8, .2, 1) both; }
.table-area:has(.call-ceremony:not([hidden])) { min-height: 290px; }
@keyframes call-ceremony-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)) scale(.94); } }
@keyframes call-seal-arrive { 0% { opacity: 0; transform: rotate(-16deg) scale(.55); } 55% { transform: rotate(5deg) scale(1.08); } }
@keyframes call-chip-arrive { from { opacity: 0; transform: translateY(12px) scale(.94); } }

.friend-reveal-banner {
  position: absolute;
  left: 50%;
  top: 16px;
  z-index: 10;
  width: min(520px, calc(100% - 34px));
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 11px;
  padding: 10px 15px;
  pointer-events: none;
  color: var(--ivory);
  border: 1px solid rgba(255, 228, 157, .72);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(158, 48, 38, .98), rgba(5, 57, 47, .98));
  box-shadow: 0 16px 38px rgba(0, 0, 0, .4), 0 0 0 5px rgba(244, 201, 104, .07);
  transform: translateX(-50%);
}
.friend-reveal-banner > span:last-child { min-width: 0; display: grid; text-align: left; }
.friend-reveal-banner strong { color: #fff6d8; font-size: .9rem; }
.friend-reveal-banner span span { margin-top: 2px; color: #d8ebe2; font-size: .69rem; line-height: 1.35; }
.friend-reveal-seal { width: 35px; height: 35px; display: grid; place-items: center; color: #6c1d17; border-radius: 50%; background: var(--gold-soft); font-family: "Noto Serif SC", Georgia, serif; font-weight: 900; box-shadow: 0 4px 12px rgba(0, 0, 0, .28); }
.friend-reveal-banner.is-revealing { animation: friend-banner-reveal 2.8s cubic-bezier(.16, .8, .2, 1) both; }
@keyframes friend-banner-reveal { 0% { opacity: 0; transform: translate(-50%, -18px) scale(.94); } 12%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -9px) scale(.98); } }
.draw-deck-area { position: absolute; left: clamp(24px, 5vw, 76px); top: 50%; transform: translateY(-50%); display: grid; justify-items: center; gap: 10px; z-index: 3; }
.deck-button {
  position: relative;
  width: 88px;
  aspect-ratio: 2 / 3;
  border: 2px solid var(--gold-soft);
  border-radius: 10px;
  color: var(--ivory);
  background: var(--ink-800) url("assets/card-back.svg") center / cover no-repeat;
  cursor: pointer;
  box-shadow: 4px 5px 0 #071f1b, 8px 9px 0 rgba(244, 201, 104, .24), var(--shadow-card);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.deck-button:hover:not(:disabled) { transform: translateY(-4px) rotate(-1deg); box-shadow: 5px 7px 0 #071f1b, 10px 12px 0 rgba(244, 201, 104, .3), 0 20px 40px rgba(0, 0, 0, .34); }
.deck-button:disabled { cursor: not-allowed; opacity: .62; }
.deck-button.is-drawing { opacity: 1; animation: deck-draw-nod .52s cubic-bezier(.2, .8, .2, 1); }
.screen-game.is-my-turn .deck-button:not(:disabled) { animation: deck-ready 1.8s ease-in-out infinite; }
@keyframes deck-ready { 50% { box-shadow: 4px 5px 0 #071f1b, 8px 9px 0 rgba(244, 201, 104, .34), 0 0 0 7px rgba(244, 201, 104, .08), var(--shadow-card); } }
@keyframes deck-draw-nod {
  36% { transform: translateY(-8px) rotate(-2deg) scale(1.025); box-shadow: 6px 9px 0 #071f1b, 11px 14px 0 rgba(244, 201, 104, .34), 0 22px 42px rgba(0, 0, 0, .38); }
  100% { transform: none; }
}
.draw-card-flight {
  position: fixed;
  z-index: 140;
  display: block;
  pointer-events: none;
  perspective: 760px;
  transform-style: preserve-3d;
  will-change: transform;
  animation: draw-card-travel .76s cubic-bezier(.18, .72, .16, 1) both;
}
.draw-card-flight-back,
.draw-card-flight-face {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  pointer-events: none !important;
  will-change: transform;
}
.draw-card-flight-back {
  z-index: 2;
  border: 2px solid var(--gold-soft);
  border-radius: 10px;
  background: var(--ink-800) url("assets/card-back.svg") center / cover no-repeat;
  box-shadow: var(--shadow-card);
  animation: draw-card-back-turn .76s ease-in-out both;
}
.draw-card-flight-face {
  z-index: 1 !important;
  flex: none !important;
  animation: draw-card-face-turn .76s ease-in-out both !important;
}
@keyframes draw-card-travel {
  0% { opacity: .98; transform: translate3d(0, 0, 0) rotate(-3deg) scale(.96); }
  28% { opacity: 1; transform: translate3d(0, -16px, 0) rotate(2deg) scale(1.07); }
  46% { opacity: 1; transform: translate3d(0, -15px, 0) rotate(1deg) scale(1.07); }
  100% { opacity: 1; transform: translate3d(var(--draw-flight-x), var(--draw-flight-y), 0) rotate(0) scale(1); }
}
@keyframes draw-card-back-turn {
  0%, 13% { transform: rotateY(0); }
  38%, 100% { transform: rotateY(180deg); }
}
@keyframes draw-card-face-turn {
  0%, 13% { transform: rotateY(-180deg); }
  38%, 100% { transform: rotateY(0); }
}
.screen-game.trump-revealed .table-area::after { animation: table-trump-flash .9s ease-out; }
@keyframes table-trump-flash {
  0%, 100% { opacity: 1; }
  35% { opacity: 1; background-color: rgba(244, 201, 104, .17); box-shadow: inset 0 0 70px rgba(244, 201, 104, .18); }
}
.deck-count { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); min-width: 32px; padding: 2px 6px; border-radius: 999px; color: var(--ink-950); background: var(--gold); font-size: .8rem; font-weight: 900; }
.deck-label { position: absolute; left: 0; right: 0; bottom: 8px; font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.trick-area { position: relative; z-index: 2; width: min(820px, 100%); min-height: 198px; display: grid; align-content: center; justify-items: center; gap: 11px; }
.table-watermark { position: absolute; z-index: -1; inset: 50% auto auto 50%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 8px; color: rgba(244, 201, 104, .16); font-family: "Noto Serif SC", Georgia, serif; font-size: 1.3rem; letter-spacing: .16em; }
.table-watermark img { width: 68px; height: 68px; opacity: .13; filter: grayscale(1) sepia(.5); }
.trick-result { min-height: 1.5em; color: var(--gold-soft); font-size: .94rem; font-weight: 850; text-align: center; }
.trick-result:not(:empty) { padding: 6px 14px; border: 1px solid rgba(244, 201, 104, .3); border-radius: 999px; background: rgba(4, 28, 24, .84); box-shadow: 0 7px 20px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .035); }
.trick-result.result-reveal { animation: trick-result-in .72s .35s cubic-bezier(.2, .8, .2, 1) both; }
.trick-result.result-hold { color: var(--ivory-2); border-color: rgba(244, 201, 104, .2); }
.trick-plays { width: 100%; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 12px; }
.trick-play-group { position: relative; display: grid; justify-items: center; gap: 4px; padding: 5px; border: 1px solid transparent; border-radius: 10px; transition: opacity .28s ease, filter .28s ease, transform .28s ease, border-color .28s ease; }
.trick-play-group.trick-group-arriving { animation: trick-group-in .32s calc(var(--play-order, 0) * 35ms) ease-out both; }
.trick-play-group.winner { border-color: var(--gold); background: linear-gradient(145deg, rgba(244, 201, 104, .14), rgba(244, 201, 104, .035)); box-shadow: 0 0 0 3px rgba(244, 201, 104, .08), 0 12px 28px rgba(0, 0, 0, .2); }
.trick-play-group.winner::after { content: "胜"; position: absolute; top: -10px; right: -9px; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #ffe8aa; border-radius: 50%; color: #fff8e5; background: var(--cinnabar); box-shadow: 0 5px 14px rgba(0, 0, 0, .32); font-family: "Noto Serif SC", Georgia, serif; font-size: .67rem; font-weight: 900; }
.trick-plays.has-winner .trick-play-group:not(.winner) { opacity: .56; filter: saturate(.72); transform: scale(.97); }
.trick-plays.winner-revealing .trick-play-group:not(.winner) { animation: trick-yield .9s .38s ease both; }
.trick-plays.winner-revealing .trick-play-group.winner { animation: winner-rise 1.65s .28s cubic-bezier(.16, .8, .2, 1) both; }
.trick-plays.winner-revealing .trick-play-group.winner .playing-card { animation: winner-card-lift 1.18s calc(.32s + var(--trick-card-order, 0) * 55ms) cubic-bezier(.16, .8, .2, 1) both; }
.trick-player-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: .78rem; font-weight: 750; }
.trick-play-group.winner .trick-player-name { padding: 2px 8px; color: var(--ink-950); background: var(--gold); border-radius: 999px; font-weight: 900; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); }
.trick-cards { display: flex; justify-content: center; }
.trick-cards .playing-card + .playing-card { margin-left: -20px; }
.trick-cards .playing-card.trick-arriving { animation: trick-card-in .48s calc(var(--trick-card-order, 0) * 46ms) cubic-bezier(.16, .8, .2, 1) both; }
@keyframes trick-group-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes trick-card-in { from { opacity: 0; transform: translateY(42px) rotate(8deg) scale(.82); } }
@keyframes trick-yield { from { opacity: 1; filter: none; transform: none; } to { opacity: .56; filter: saturate(.72); transform: scale(.97); } }
@keyframes winner-rise {
  0% { transform: scale(.98); box-shadow: none; }
  34% { transform: translateY(-7px) scale(1.035); box-shadow: 0 0 0 8px rgba(244, 201, 104, .11), 0 18px 34px rgba(0, 0, 0, .28); }
  100% { transform: none; }
}
@keyframes winner-card-lift { 0% { transform: none; } 38% { transform: translateY(-10px) rotate(-2deg); } 100% { transform: none; } }
@keyframes trick-result-in { from { opacity: 0; transform: translateY(5px) scale(.98); } }

.pause-card { position: absolute; top: 12px; left: 50%; z-index: 4; transform: translateX(-50%); width: min(440px, calc(100% - 24px)); padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 9px; text-align: center; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ivory); background: rgba(6, 29, 26, .96); box-shadow: var(--shadow-card); }
.pause-card span { color: var(--text-muted); font-size: .78rem; }
.summary-card { position: relative; z-index: 2; width: min(560px, 100%); padding: clamp(18px, 4vw, 30px); overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgba(8, 48, 41, .97), rgba(4, 25, 22, .98)); box-shadow: var(--shadow-lg); text-align: center; isolation: isolate; }
.summary-card::before { content: ""; position: absolute; inset: 7px; z-index: 0; pointer-events: none; border: 1px solid rgba(244, 201, 104, .12); border-radius: calc(var(--radius-lg) - 6px); }
.summary-card > :not(.celebration-sparks) { position: relative; z-index: 1; }
.summary-card.winner-attacker { border-color: rgba(201, 84, 69, .78); }
.summary-card.winner-defender { border-color: rgba(117, 169, 207, .7); }
.summary-card.winner-game { border-color: rgba(244, 201, 104, .85); background: radial-gradient(circle at 50% -5%, rgba(244, 201, 104, .15), transparent 44%), linear-gradient(145deg, rgba(8, 48, 41, .98), rgba(4, 25, 22, .99)); }
.summary-card.is-revealing { animation: summary-arrive .68s cubic-bezier(.16, .82, .22, 1) both; }
.summary-card.is-dealing { animation: summary-dealing 1.2s ease-in-out infinite; }
.summary-card h2 { margin: 3px 0 15px; color: var(--gold); }
.summary-card > .btn { margin-top: 16px; }
.result-banner { margin-bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--gold-soft); font-family: "Noto Serif SC", Georgia, serif; font-size: 1.2rem; font-weight: 900; }
.result-emblem { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #ffe7a5; border-radius: 50%; color: #fff8e6; background: var(--cinnabar); box-shadow: 0 5px 13px rgba(0, 0, 0, .25), inset 0 0 0 2px rgba(255, 255, 255, .12); font-size: .78rem; }
.score-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.score-entry { padding: 9px; border: 1px solid rgba(255, 255, 255, .055); border-radius: 10px; background: rgba(255, 255, 255, .06); }
.summary-card.is-revealing .score-entry { animation: score-tile-in .5s calc(.2s + var(--summary-order, 0) * 90ms) cubic-bezier(.16, .8, .2, 1) both; }
.score-entry strong { display: block; color: var(--gold); font-size: 1.3rem; }
.score-entry span { color: var(--text-muted); font-size: .68rem; }
.result-note { margin-top: 7px; color: var(--text-muted); font-size: .78rem; line-height: 1.45; }
.level-table { width: 100%; margin-top: 14px; border-collapse: collapse; text-align: left; font-size: .78rem; }
.level-table th, .level-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.level-table th { color: var(--text-dim); font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; }
.level-gain { color: #9be3c6; font-weight: 850; }
.summary-card.is-revealing .level-table tbody tr { animation: summary-row-in .38s calc(.3s + var(--summary-order, 0) * 55ms) ease-out both; }
.celebration-sparks { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.celebration-spark { position: absolute; left: 50%; top: 42%; width: 7px; height: 7px; border-radius: 2px; background: var(--spark-color); opacity: 0; box-shadow: 0 0 9px color-mix(in srgb, var(--spark-color) 55%, transparent); }
.celebration-spark:nth-child(3n) { width: 4px; height: 11px; border-radius: 999px; }
.celebration-spark:nth-child(4n) { border-radius: 50%; }
.summary-card.is-revealing .celebration-spark { animation: celebration-burst 1.25s var(--spark-delay) cubic-bezier(.1, .65, .2, 1) both; }
@keyframes summary-arrive { from { opacity: 0; transform: translateY(16px) scale(.975); } }
@keyframes score-tile-in { from { opacity: 0; transform: translateY(12px) scale(.94); } }
@keyframes summary-row-in { from { opacity: 0; transform: translateX(-9px); } }
@keyframes celebration-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  14% { opacity: 1; }
  72% { opacity: .9; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))) rotate(var(--spark-rotate)) scale(.75); }
}
@keyframes summary-dealing { 50% { box-shadow: var(--shadow-lg), 0 0 0 7px rgba(244, 201, 104, .08); } }

.phase-action-panel { position: relative; z-index: 6; width: min(720px, calc(100% - 34px)); flex: 0 0 auto; margin: -52px auto 10px; padding: 11px 18px; border: 1px solid rgba(244, 201, 104, .28); border-radius: 999px; background: linear-gradient(135deg, rgba(6, 38, 33, .96), rgba(3, 24, 21, .96)); box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, .045); backdrop-filter: blur(16px); }
.screen-game.is-my-turn .phase-action-panel { border-color: rgba(244, 201, 104, .65); box-shadow: 0 16px 42px rgba(0, 0, 0, .3), 0 0 0 4px rgba(244, 201, 104, .07); }
.phase-context { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.phase-context h2 { font-family: inherit; font-size: .94rem; }
.phase-context p { margin-top: 2px; color: var(--text-muted); font-size: .78rem; }
.turn-indicator { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--text-dim); }
.turn-indicator.yours { background: var(--gold); box-shadow: 0 0 0 5px rgba(244, 201, 104, .13); }
.call-area { position: relative; margin: 12px auto 3px; width: min(900px, 100%); padding: 14px; border: 1px solid rgba(244, 201, 104, .22); border-radius: var(--radius); background: linear-gradient(145deg, rgba(89, 28, 24, .2), rgba(0, 0, 0, .23)); }
.call-guide { display: flex; align-items: center; gap: 11px; padding: 10px 12px; color: var(--text-muted); border: 1px solid rgba(244, 201, 104, .16); border-radius: 12px; background: rgba(3, 31, 27, .66); }
.call-guide-mark { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; color: #fff3ce; border: 1px solid rgba(244, 201, 104, .46); border-radius: 9px; background: linear-gradient(145deg, #b94538, #76251e); font-family: "Noto Serif SC", Georgia, serif; font-weight: 900; transform: rotate(-2deg); }
.call-guide strong { color: var(--ivory); font-size: .82rem; }
.call-guide p { margin-top: 2px; color: var(--text-dim); font-size: .68rem; line-height: 1.42; }
.call-capacity { margin: 9px 3px 8px; color: var(--gold-soft); font-size: .7rem; font-weight: 750; }
.call-slots { max-height: min(42dvh, 430px); display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 10px; overflow-y: auto; padding: 2px; scrollbar-color: rgba(244, 201, 104, .4) transparent; }
.call-slot { min-width: 0; margin: 0; padding: 11px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 8px; border: 1px solid rgba(244, 201, 104, .2); border-radius: 12px; background: rgba(2, 28, 24, .58); transition: border-color .2s ease, background-color .2s ease; }
.call-slot:not(.is-empty) { border-color: rgba(244, 201, 104, .5); background: rgba(8, 50, 42, .74); }
.call-slot legend { padding: 0 6px; color: var(--gold-soft); font-size: .7rem; font-weight: 900; letter-spacing: .02em; }
.call-slot label { min-width: 0; margin: 0; color: var(--text-muted); font-size: .66rem; }
.call-slot select { width: 100%; margin-top: 4px; min-height: 44px; padding: 7px 28px 7px 8px; font-size: .78rem; }
.call-slot select:disabled { cursor: not-allowed; opacity: .48; }
.call-slot-preview { grid-column: 1 / -1; min-height: 48px; display: flex; align-items: center; gap: 9px; padding: 8px; color: var(--text-dim); border-radius: 9px; background: rgba(0, 0, 0, .18); font-size: .63rem; line-height: 1.35; }
.call-slot-preview > strong { flex: 0 0 auto; color: var(--text-muted); font-size: .69rem; }
.call-slot-preview .call-chip { flex: 0 0 150px; }
.call-slot-preview > span:last-child { min-width: 0; }
.call-preview-warning { color: #ffd2a3; }
.call-area > .btn { position: sticky; bottom: 0; z-index: 1; width: 100%; margin-top: 10px; box-shadow: 0 -9px 20px rgba(2, 21, 18, .68), var(--shadow-card); }

.hand-area { position: sticky; bottom: 0; z-index: 5; flex: 0 0 auto; min-height: 128px; padding: 9px 12px max(9px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(244, 201, 104, .35); background: linear-gradient(180deg, rgba(4, 29, 25, .91), rgba(2, 20, 17, .995)); box-shadow: 0 -18px 44px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .025); }
.hand-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1180px; margin: 0 auto 2px; }
.hand-header h2 { display: inline; font-family: inherit; font-size: .8rem; }
.selection-summary { color: var(--gold-soft); font-size: .72rem; }
.card-row { display: flex; flex-wrap: nowrap; align-items: flex-end; justify-content: safe center; min-height: calc(var(--card-h) + 28px); overflow-x: auto; overflow-y: hidden; padding: 14px max(12px, calc((100% - 1180px) / 2)) 14px; scrollbar-width: thin; scrollbar-color: rgba(244, 201, 104, .45) transparent; }
.card-row .playing-card + .playing-card { margin-left: calc(-1 * var(--hand-overlap)); }
.hand-actions { min-height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.hand-actions:has(.btn:not([hidden])) { min-height: 44px; margin-top: 2px; }
.screen-game[data-phase="round_end"] .hand-area, .screen-game[data-phase="game_end"] .hand-area { display: none; }
.screen-game[data-phase="calling"] .hand-area { min-height: 0; padding-block: 6px; }
.screen-game[data-phase="calling"] .card-row { max-height: 82px; min-height: 0; opacity: .7; }
.screen-game[data-phase="calling"] .phase-action-panel { width: min(900px, calc(100% - 28px)); margin-top: -36px; border-radius: 20px; }

/* Cards */
.playing-card {
  --card-ink: #17201c;
  --court-accent: #23685a;
  position: relative;
  z-index: 1;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  height: var(--card-h);
  padding: 0;
  display: block;
  overflow: visible;
  appearance: none;
  border: 1px solid #b9a78f;
  border-radius: 10px;
  color: var(--card-ink);
  background:
    radial-gradient(circle at 17% 10%, rgba(255, 255, 255, .92), transparent 21%),
    radial-gradient(circle at 86% 91%, rgba(121, 89, 49, .07), transparent 29%),
    repeating-linear-gradient(112deg, rgba(91, 68, 40, .025) 0 1px, transparent 1px 4px),
    linear-gradient(145deg, #fffef9 0%, #f8f1e6 58%, #e9dcc9 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .28), inset 0 0 0 2px rgba(255, 255, 255, .58), inset 0 -8px 16px rgba(105, 73, 36, .035);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  isolation: isolate;
  transition: transform .18s cubic-bezier(.2, .76, .2, 1), box-shadow .18s ease, border-color .18s ease, opacity .18s ease, filter .18s ease;
  text-align: left;
}
.playing-card::before { content: ""; position: absolute; inset: 3px; z-index: 0; pointer-events: none; border: 1px solid rgba(126, 98, 62, .16); border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38); }
.playing-card:focus-visible { z-index: 40; }
.playing-card:hover { z-index: 20; transform: translateY(-9px) rotate(-.35deg); box-shadow: 0 16px 32px rgba(0, 0, 0, .38), inset 0 0 0 2px rgba(255, 255, 255, .58); }
.playing-card[aria-pressed="true"] { z-index: 30; transform: translateY(-13px); border-color: #946711; box-shadow: 0 0 0 3px var(--gold), 0 17px 32px rgba(0, 0, 0, .4), inset 0 0 0 2px rgba(255, 255, 255, .58); }
.playing-card[aria-disabled="true"] { cursor: default; }
.playing-card[aria-disabled="true"]:hover { transform: none; box-shadow: 0 6px 14px rgba(0, 0, 0, .28), inset 0 0 0 2px rgba(255, 255, 255, .58); }
.playing-card.trump-card { border-color: #b95340; box-shadow: inset 4px 0 0 var(--cinnabar), 0 6px 14px rgba(0, 0, 0, .3), inset 0 0 0 2px rgba(255, 255, 255, .58); }
.playing-card.trump-card::after { content: "主"; position: absolute; left: 3px; top: 50%; z-index: 7; width: 17px; height: 17px; display: grid; place-items: center; transform: translateY(-50%); border: 1px solid #f6d7ae; border-radius: 50%; color: #fff9ea; background: var(--cinnabar); font-family: "Noto Serif SC", Georgia, serif; font-size: .54rem; font-weight: 900; box-shadow: 0 3px 7px rgba(0, 0, 0, .26), inset 0 0 0 1px rgba(255, 255, 255, .15); }
.suit-hearts, .suit-diamonds, .big-joker { --card-ink: #a52826; --court-accent: #b64438; color: var(--card-ink); }
.suit-clubs, .suit-spades, .small-joker { --card-ink: #15201d; --court-accent: #23685a; color: var(--card-ink); }

.card-corner { position: absolute; left: 7px; top: 6px; z-index: 5; min-width: 14px; display: flex; flex-direction: column; align-items: center; line-height: .82; text-align: center; }
.card-bottom { inset: auto 7px 6px auto; transform: rotate(180deg); }
.card-rank { font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; font-variant-numeric: tabular-nums; font-weight: 900; letter-spacing: -.06em; }
.card-suit { margin-top: 2px; font-size: .76rem; line-height: .75; }
.card-face { position: absolute; z-index: 2; pointer-events: none; }
.pip-face { inset: 16px 9px 15px; }
.card-pip { position: absolute; left: var(--pip-x); top: var(--pip-y); display: block; transform: translate(-50%, -50%); font-family: Georgia, "Times New Roman", serif; font-size: .86rem; line-height: 1; text-shadow: 0 1px 0 rgba(255, 255, 255, .8); }
.card-pip.is-inverted { transform: translate(-50%, -50%) rotate(180deg); }
.ace-halo { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%) rotate(45deg); border: 1px solid color-mix(in srgb, currentColor 24%, transparent); border-radius: 8px; box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .28); }
.ace-face .card-pip { font-size: 2.18rem; filter: drop-shadow(0 2px 0 rgba(115, 84, 44, .08)); }
.rank-2 .card-pip, .rank-3 .card-pip { font-size: 1.08rem; }

.court-face { inset: 19px 9px 18px; display: grid; place-items: stretch; }
.court-portrait { position: relative; display: grid; place-items: center; overflow: hidden; border: 1px solid color-mix(in srgb, var(--court-accent) 66%, #72572d); border-radius: 4px; background: linear-gradient(145deg, rgba(255, 251, 233, .92) 0 46%, var(--court-accent) 46% 54%, #e5c988 54% 100%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .48), 0 1px 2px rgba(72, 49, 24, .15); }
.court-portrait::before, .court-portrait::after { content: ""; position: absolute; width: 24px; height: 24px; border: 1px solid rgba(255, 255, 255, .64); transform: rotate(45deg); background: color-mix(in srgb, var(--court-accent) 78%, #202e29); }
.court-portrait::before { left: -15px; top: -14px; }
.court-portrait::after { right: -15px; bottom: -14px; }
.court-mark { position: relative; z-index: 2; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid rgba(255, 250, 225, .78); border-radius: 50%; color: #fff8df; background: var(--court-accent); box-shadow: 0 2px 6px rgba(66, 42, 18, .26), inset 0 0 0 2px rgba(255, 255, 255, .13); font-family: "Noto Serif SC", Georgia, serif; font-size: .8rem; font-weight: 900; }
.court-suit { position: absolute; z-index: 3; right: 2px; bottom: 1px; font-size: .65rem; filter: drop-shadow(0 1px rgba(255, 255, 255, .8)); }
.court-ornament { position: absolute; z-index: 2; color: rgba(255, 252, 232, .92); font-size: .5rem; }
.court-ornament-top { top: 2px; right: 3px; }
.court-ornament-bottom { left: 3px; bottom: 2px; transform: rotate(180deg); }
.court-caption { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); padding-inline: 3px; color: #6f5534; background: #f3e7d5; font-family: Georgia, "Times New Roman", serif; font-size: .35rem; font-weight: 900; letter-spacing: .13em; }

.joker-center { --joker-accent: #24695a; position: absolute; inset: 6px; z-index: 2; display: grid; grid-template-columns: 12px 1fr; grid-template-rows: 1fr auto auto; gap: 1px 3px; place-items: center; overflow: hidden; border: 1px solid color-mix(in srgb, var(--joker-accent) 55%, #927342); border-radius: 6px; background: radial-gradient(circle at 65% 37%, color-mix(in srgb, var(--joker-accent) 12%, transparent), transparent 37%), linear-gradient(145deg, rgba(255, 255, 255, .45), rgba(224, 204, 171, .16)); }
.big-joker .joker-center { --joker-accent: #b83f37; }
.joker-ribbon { grid-row: 1 / 4; align-self: stretch; display: grid; place-items: center; writing-mode: vertical-rl; color: #fff7df; background: var(--joker-accent); font-family: Georgia, "Times New Roman", serif; font-size: .42rem; font-weight: 900; letter-spacing: .14em; }
.joker-seal { position: relative; width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--joker-accent) 70%, #81642f); border-radius: 50%; color: #fff9e7; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--joker-accent) 84%, #213a33) 0 10deg, color-mix(in srgb, var(--joker-accent) 58%, #f2d58e) 10deg 20deg); box-shadow: inset 0 0 0 4px #f3e4c8, 0 3px 7px rgba(72, 46, 20, .22); }
.joker-rays { color: #f5df9c; font-size: 1.7rem; line-height: 1; }
.joker-mark { position: absolute; inset: 0; display: grid; place-items: center; color: #fffdf4; font-family: "Noto Serif SC", Georgia, serif; font-size: .72rem; font-weight: 900; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.joker-title { color: var(--joker-accent); font-family: Georgia, "Times New Roman", serif; font-size: .39rem; font-weight: 900; letter-spacing: .1em; }
.joker-chinese { color: #846a3f; font-family: "Noto Serif SC", Georgia, serif; font-size: .48rem; font-weight: 900; }
.card-points { position: absolute; left: 5px; bottom: 5px; z-index: 6; min-width: 20px; padding: 2px 4px; border: 1px solid rgba(255, 244, 199, .72); border-radius: 999px; color: #fff9e9; background: #7b5a24; font-size: .52rem; font-weight: 900; line-height: 1; text-align: center; box-shadow: 0 2px 5px rgba(0, 0, 0, .22); }

.playing-card.card-entering { animation: card-deal-in .62s calc(var(--deal-order, 0) * 28ms) cubic-bezier(.14, .76, .19, 1) both; }
.playing-card.draw-landing { opacity: 0 !important; pointer-events: none !important; }
.playing-card.just-drawn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244, 201, 104, .72), 0 15px 28px rgba(0, 0, 0, .38), inset 0 0 0 2px rgba(255, 255, 255, .62); animation: card-draw-settle .48s cubic-bezier(.18, .84, .2, 1) both; }
.playing-card.selection-pop[aria-pressed="true"] { animation: card-select .26s cubic-bezier(.2, .9, .25, 1) both; }
.playing-card.selection-pop[aria-pressed="false"] { animation: card-unselect .22s ease-out both; }
.playing-card.trump-awakening { animation: trump-awaken .72s ease-out both; }
.playing-card.card-committing { animation: card-commit .5s ease-in both; }
.card-flight-face { position: fixed !important; z-index: 130 !important; margin: 0 !important; pointer-events: none !important; animation: card-play-flight .7s var(--flight-delay, 0ms) cubic-bezier(.2, .74, .18, 1) both !important; }
@keyframes card-deal-in { from { opacity: 0; transform: translate(34px, -54px) rotate(8deg) scale(.78); filter: blur(1px); } 72% { opacity: 1; } }
@keyframes card-draw-settle { 0% { transform: translateY(-7px) scale(1.045); } 58% { transform: translateY(2px) scale(.992); } 100% { transform: none; } }
@keyframes card-select { 0% { transform: translateY(-5px) scale(.98); } 65% { transform: translateY(-15px) scale(1.035); } 100% { transform: translateY(-13px); } }
@keyframes card-unselect { from { transform: translateY(-13px) scale(1.02); } to { transform: none; } }
@keyframes trump-awaken { 0%, 100% { filter: none; } 38% { filter: brightness(1.18) drop-shadow(0 0 8px rgba(201, 84, 69, .78)); transform: translateY(-5px); } }
@keyframes card-commit { to { opacity: .35; transform: translateY(-26px) scale(.92); } }
@keyframes card-play-flight {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0) scale(1); }
  68% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--flight-x), var(--flight-y), 0) rotate(var(--flight-rotate)) scale(.72); }
}

.playing-card.small { --card-w: 64px; --card-h: 96px; border-radius: 8px; pointer-events: none; opacity: 1; }
.playing-card.small::before { inset: 2px; border-radius: 4px; }
.playing-card.small .card-corner { left: 4px; top: 4px; min-width: 10px; }
.playing-card.small .card-bottom { inset: auto 4px 4px auto; }
.playing-card.small .card-rank { font-size: .84rem; }
.playing-card.small .card-suit { margin-top: 1px; font-size: .62rem; }
.playing-card.small .pip-face { inset: 14px 7px; }
.playing-card.small .card-pip { font-size: .72rem; }
.playing-card.small.rank-2 .card-pip, .playing-card.small.rank-3 .card-pip { font-size: .84rem; }
.playing-card.small .ace-face .card-pip { font-size: 1.62rem; }
.playing-card.small .ace-halo { width: 27px; height: 27px; border-radius: 6px; }
.playing-card.small .court-face { inset: 16px 7px; }
.playing-card.small .court-mark { width: 23px; height: 23px; font-size: .66rem; }
.playing-card.small .court-caption, .playing-card.small .court-ornament { display: none; }
.playing-card.small .court-suit { font-size: .56rem; }
.playing-card.small .joker-center { inset: 4px; grid-template-columns: 8px 1fr; }
.playing-card.small .joker-ribbon { font-size: .29rem; }
.playing-card.small .joker-seal { width: 34px; height: 34px; box-shadow: inset 0 0 0 3px #f3e4c8, 0 2px 5px rgba(72, 46, 20, .2); }
.playing-card.small .joker-rays { font-size: 1.45rem; }
.playing-card.small .joker-mark { font-size: .62rem; }
.playing-card.small .joker-title { font-size: .31rem; }
.playing-card.small .joker-chinese { font-size: .4rem; }
.playing-card.small .card-points { left: 3px; bottom: 3px; min-width: 17px; padding: 1px 3px; font-size: .44rem; }
.playing-card.small.trump-card::after { left: 2px; width: 15px; height: 15px; font-size: .46rem; }

.connection-strip { flex: 0 0 auto; min-height: 26px; padding: 4px 10px; text-align: center; color: var(--text-muted); background: rgba(0, 0, 0, .3); border-top: 1px solid var(--line); font-size: .72rem; }
.connection-strip.connected { color: #a6e8cd; }
.screen-game .connection-strip.connected { min-height: 20px; padding-block: 2px; opacity: .78; }
.connection-strip.error { color: #ffaaa2; }

/* Chat drawer / sheet */
.chat-backdrop { position: fixed; inset: 0; z-index: 39; border: 0; background: rgba(0, 0, 0, .54); cursor: pointer; }
.chat-sidebar { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(350px, 92vw); display: flex; flex-direction: column; color: var(--text); background: #071f1b; border-left: 1px solid var(--line-strong); box-shadow: -20px 0 60px rgba(0, 0, 0, .36); transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility .22s step-end; }
.screen-game.chat-open .chat-sidebar { transform: translateX(0); visibility: visible; transition: transform .22s ease, visibility 0s; }
.chat-header { min-height: 66px; padding: max(12px, env(safe-area-inset-top)) 14px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.chat-header h2 { margin-top: 2px; font-size: 1.2rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.chat-empty { margin: auto; color: var(--text-dim); text-align: center; font-size: .8rem; }
.chat-msg { align-self: flex-start; max-width: 86%; padding: 8px 10px; border-radius: 4px 12px 12px; color: var(--ivory); background: rgba(255, 255, 255, .08); line-height: 1.35; word-break: break-word; font-size: .82rem; }
.chat-msg.self { align-self: flex-end; border-radius: 12px 4px 12px 12px; background: rgba(244, 201, 104, .15); }
.chat-name { display: block; margin-bottom: 2px; color: var(--gold-soft); font-size: .68rem; font-weight: 850; }
.chat-input-row { flex: 0 0 auto; padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); display: grid; grid-template-columns: 1fr auto; gap: 7px; border-top: 1px solid var(--line); }
.chat-input-row input { min-width: 0; }

/* Dialogs, banners, and toasts */
.rules-dialog { width: min(680px, calc(100% - 24px)); max-height: min(82vh, 760px); max-height: min(82dvh, 760px); padding: 0; color: var(--text); background: var(--ink-900); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.rules-dialog[open] { display: flex; flex-direction: column; }
.rules-dialog::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(3px); }
.dialog-header { position: sticky; top: 0; z-index: 2; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: rgba(8, 47, 42, .98); border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-top: 3px; color: var(--gold); }
.rules-content { min-height: 0; padding: 18px; overflow-y: auto; }
.rules-intro { margin-bottom: 16px; color: var(--text-muted); line-height: 1.5; }
.rules-content details { border-top: 1px solid var(--line); }
.rules-content details:last-child { border-bottom: 1px solid var(--line); }
.rules-content summary { min-height: 50px; display: flex; align-items: center; cursor: pointer; color: var(--ivory); font-weight: 850; }
.rules-content details p { padding: 0 3px 16px; color: var(--text-muted); font-size: .86rem; line-height: 1.58; }
.connection-banner { position: fixed; z-index: 80; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(620px, calc(100% - 24px)); padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text); background: #171f1d; border: 1px solid var(--cinnabar-bright); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.connection-banner p { margin-top: 3px; color: var(--text-muted); font-size: .78rem; }
.toast-container { position: fixed; z-index: 100; top: max(70px, calc(env(safe-area-inset-top) + 58px)); right: max(14px, env(safe-area-inset-right)); width: min(360px, calc(100% - 28px)); display: grid; gap: 7px; pointer-events: none; }
.toast { position: relative; overflow: hidden; padding: 10px 12px; color: var(--ivory); background: rgba(6, 29, 26, .97); border: 1px solid var(--line); border-left: 4px solid var(--jade-500); border-radius: 10px; box-shadow: var(--shadow-card); font-size: .8rem; line-height: 1.4; animation: toast-in .18s ease both; }
.toast::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: currentColor; opacity: .42; transform-origin: left; animation: toast-life 3.2s linear both; }
.toast.error::after { animation-duration: 5.2s; }
.toast.leaving { animation: toast-out .18s ease both; }
.toast.error { border-left-color: var(--cinnabar-bright); }
.toast.success { border-left-color: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-life { to { transform: scaleX(0); } }
@keyframes bot-thinking { from { filter: brightness(.94); transform: translateY(0); } to { filter: brightness(1.12); transform: translateY(-1px); } }

@media (min-width: 761px) {
  .chat-backdrop { display: none !important; }
  .screen-game.chat-open .game-stage { padding-right: 350px; transition: padding-right .22s ease; }
  .screen-game .game-stage { transition: padding-right .22s ease; }
}

@media (hover: hover) and (pointer: fine) {
  .decor-lantern:hover { z-index: 5; animation: lantern-greeting .82s cubic-bezier(.2, .8, .2, 1) both; filter: drop-shadow(0 13px 18px rgba(0, 0, 0, .4)); }
  .decor-lantern:hover .lantern-shell { transform: scale(1.065); filter: brightness(1.14) saturate(1.08); box-shadow: inset 0 0 14px rgba(255, 246, 205, .52), 0 0 28px color-mix(in srgb, var(--lantern-light) 62%, transparent); }
  .decor-lantern:hover .lantern-tassel { animation: tassel-flick .78s ease-in-out both; }
  .decor-lantern:hover .lantern-mark { transform: rotate(-4deg) scale(1.08); }
  .playing-card:hover { z-index: 20; transform: translateY(-9px) rotate(-.35deg); box-shadow: 0 16px 32px rgba(0, 0, 0, .38), inset 0 0 0 2px rgba(255, 255, 255, .58); }
  .playing-card[aria-disabled="true"]:hover { transform: none; box-shadow: 0 6px 14px rgba(0, 0, 0, .28), inset 0 0 0 2px rgba(255, 255, 255, .58); }
}

@media (pointer: coarse) {
  :root { --hand-overlap: 20px; }
  .decor-lantern:active .lantern-shell { transform: scale(.96); filter: brightness(1.13) saturate(1.06); }
  .decor-lantern:active .lantern-tassel { transform: rotate(6deg); }
  .playing-card:hover { transform: none; }
  .playing-card:active { z-index: 30; transform: translateY(-5px) scale(.98); }
}

@media (max-width: 1100px) {
  .game-hud {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(105px, .64fr);
    grid-template-areas: "self trump round" "calls score score";
  }
  .hud-self { grid-area: self; }
  .game-hud .hud-item:nth-child(2) { grid-area: trump; }
  .game-hud .hud-item:nth-child(3) { grid-area: calls; }
  .game-hud .hud-item:nth-child(4) { grid-area: score; }
  .hud-round { grid-area: round; }
  .phase-rail li { padding: 5px; }
  .phase-rail li:not(.active) { font-size: 0; gap: 0; }
  .phase-rail li:not(.active) span { font-size: .65rem; }
  .table-area { padding-inline: 92px; }
}

@media (max-width: 760px) {
  :root { --card-w: 62px; --card-h: 93px; --hand-overlap: 21px; --hand-dock-height: 172px; }
  .lobby-art { inset: 0; opacity: .42; }
  .lobby-art { background-position: center; }
  .lobby-decor .lantern-left, .lobby-decor .paper-cloud { display: none; }
  .lobby-decor .lantern-right { top: -8px; right: 4px; width: 43px; height: 84px; opacity: .74; }
  .lobby-content { width: 100%; margin: 0; padding: max(28px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(6, 29, 26, .34), rgba(6, 29, 26, .92) 38%, var(--ink-900)); }
  .lobby-story { display: none; }
  .lobby-brand { align-items: flex-end; }
  .brand-seal { width: 58px; height: 58px; }
  .lobby-brand h1 { font-size: 2.75rem; }
  .lobby-panel { backdrop-filter: none; }
  .site-header { padding-inline: 8px; }
  .site-header .btn { padding-inline: 10px; }
  .room-wrap { align-items: start; padding: 14px 10px 38px; }
  .room-decor { z-index: 2; }
  .room-decor .decor-lantern { top: -10px; width: 42px; height: 82px; opacity: .82; }
  .room-decor .lantern-left { left: -10px; }
  .room-decor .lantern-right { display: none; }
  .room-decor .paper-cloud { display: none; }
  .room-card { border-radius: 16px; }
  .room-heading { align-items: flex-start; }
  .invite-card { grid-template-columns: 1fr; }
  .invite-actions { width: 100%; }
  .invite-actions .btn { flex: 1; padding-inline: 8px; }
  .bot-controls { grid-template-columns: 1fr; }
  .bot-actions { justify-content: stretch; }
  .bot-actions .btn { flex: 1; }

  .game-header { display: grid; grid-template-columns: 1fr auto; padding-inline: 8px; }
  .game-brand img { width: 30px; height: 30px; }
  .game-brand .icon-button { display: none; }
  .game-header .header-actions { justify-self: end; }
  .game-header .header-actions .icon-button { padding-inline: 8px; font-size: .72rem; }
  .phase-rail { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .phase-rail li, .phase-rail li:not(.active) { flex: 1; justify-content: center; padding: 4px; font-size: .62rem; }
  .phase-rail li:not(.active) span { font-size: .58rem; }
  .game-hud { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 88px; grid-template-areas: "self trump round" "calls calls calls" "score score score"; gap: 4px; padding: 5px 6px 6px; }
  .hud-item { padding: 6px 8px; }
  .hud-item strong { font-size: .79rem; }
  .hud-item > span:not(.hud-label):not(.score-meter) { font-size: .66rem; }
  .game-hud .hud-item:nth-child(3) { display: grid; }
  .hud-calls { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 6px; padding-block: 4px; }
  .hud-calls > strong { font-size: .7rem; }
  .hud-calls > #g-calls-detail { display: none; }
  .hud-calls .call-chips { margin-left: 2px; }
  .hud-calls .call-chip { min-width: 118px; padding-block: 3px; }
  .hud-calls .call-empty-state { min-height: 27px; padding-block: 4px; }
  .opponents-row { justify-content: flex-start; scroll-snap-type: x proximity; }
  .opponent-box { scroll-snap-align: start; }
  .opponent-box.is-bot .bot-badge { display: none; }
  .table-area { flex-basis: 230px; min-height: 210px; margin-inline: 6px; padding: 28px 12px 60px; border-radius: 34px; }
  .call-ceremony { width: calc(100% - 28px); padding: 18px 16px 16px; }
  .call-ceremony-seal { width: 42px; height: 42px; }
  .call-chips-ceremony .call-chip { min-width: min(100%, 165px); }
  .friend-reveal-banner { top: 10px; }
  .table-art-echo { display: none; }
  .table-decor::before { left: 48px; right: 48px; top: 9px; }
  .table-decor .decor-lantern { top: -6px; width: 35px; height: 69px; opacity: .8; }
  .table-decor .lantern-left { left: 8px; }
  .table-decor .lantern-right { right: 8px; }
  .table-decor .paper-cloud { display: none; }
  .draw-deck-area { position: static; transform: none; align-self: center; margin-right: 10px; }
  .table-area:has(.draw-deck-area:not([hidden])) { grid-template-columns: auto minmax(0, 1fr); }
  .deck-button { width: 70px; }
  .trick-area { min-height: 152px; }
  .trick-plays { gap: 6px; }
  .trick-cards .playing-card.small { --card-w: 58px; --card-h: 87px; }
  .trick-area:has(.trick-result:not(:empty)) { align-content: start; padding-top: 42px; }
  .trick-play-group.winner .trick-player-name { max-width: 104px; }
  .game-stage:has(.trick-plays.has-winner) .phase-action-panel { margin-top: 0; }
  .phase-action-panel { width: calc(100% - 20px); margin-top: -46px; padding: 9px 12px; border-radius: 15px; }
  .phase-context { text-align: left; justify-content: flex-start; }
  .call-slot { grid-template-columns: 1fr 1fr; }
  .call-slot > label:last-of-type { grid-column: 1 / -1; }
  .call-guide { align-items: flex-start; }
  .call-slot-preview { align-items: flex-start; flex-wrap: wrap; }
  .call-slot-preview .call-chip { flex-basis: 100%; }
  .hand-area { min-height: 116px; padding-inline: 8px; }
  .card-row { padding-inline: 5px; }
  .hand-actions .btn { flex: 1; min-width: 120px; padding-inline: 8px; }
  .chat-sidebar { top: auto; left: 0; width: 100%; height: min(72dvh, 590px); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 20px 20px 0 0; transform: translateY(105%); }
  .screen-game.chat-open .chat-sidebar { transform: translateY(0); }
  .connection-banner { align-items: stretch; flex-direction: column; bottom: calc(var(--hand-dock-height) + max(12px, env(safe-area-inset-bottom))); }
  .connection-banner .button-row > * { flex: 1; }
  .toast-container { top: max(96px, calc(env(safe-area-inset-top) + 88px)); right: 14px; bottom: auto; }
}

@media (max-width: 420px) {
  .bot-actions { flex-direction: column; }
  .bot-actions .btn { width: 100%; }
  .player-entry { grid-template-columns: auto minmax(0, 1fr) auto; }
  .player-entry-actions { align-items: flex-end; flex-direction: column; gap: 3px; }
  .bot-remove { min-height: 44px; }
  .lobby-content { gap: 20px; }
  .lobby-brand .eyebrow { display: none; }
  .lobby-links { justify-content: center; }
  .room-heading { display: grid; }
  .status-pill { justify-self: start; }
  .game-header .header-actions .icon-button { min-width: 44px; font-size: .68rem; }
  .compact-code { font-size: .68rem; }
  .phase-rail li, .phase-rail li:not(.active) { font-size: .56rem; }
  .pause-card { align-items: flex-start; flex-direction: column; border-radius: 12px; }
  .score-row { gap: 4px; }
  .score-entry { padding: 7px 3px; }
}

@media (max-height: 600px) and (orientation: landscape) {
  :root { --card-w: 48px; --card-h: 72px; --hand-overlap: 10px; --hand-dock-height: 104px; }
  .screen-lobby { align-items: flex-start; }
  .lobby-decor, .room-decor, .table-decor .decor-lantern, .table-decor .paper-cloud { display: none; }
  .lobby-content { justify-content: flex-start; gap: 14px; padding-block: 16px; }
  .lobby-brand h1 { font-size: 2.25rem; }
  .lobby-panel { padding: 14px; }
  .lobby-links { padding-bottom: 10px; }
  .game-header { min-height: 42px; padding-block: 4px; }
  .game-brand img { width: 26px; height: 26px; }
  .game-hud { grid-template-areas: "self trump score round" "calls calls calls calls"; grid-template-columns: 1fr 1fr 1.25fr 74px; padding: 3px 6px 4px; }
  .game-hud .hud-item:nth-child(3) { display: grid; }
  .hud-calls { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .hud-calls > strong { display: none; }
  .hud-calls .call-chip { min-width: 108px; }
  .hud-item { padding: 4px 7px; }
  .hud-item > span:not(.hud-label):not(.score-meter) { display: none; }
  .opponents-row { min-height: 53px; padding-block: 4px 0; }
  .opponent-box { min-width: 118px; padding-block: 5px; border-radius: 9px; }
  .opponent-avatar { width: 26px; height: 26px; }
  .table-area { flex-basis: 130px; min-height: 118px; padding: 15px 72px 40px; border-radius: 28px; }
  .table-area:has(.call-ceremony:not([hidden])) { min-height: 245px; padding-inline: 12px; }
  .call-ceremony { max-height: calc(100% - 18px); padding: 14px 12px 12px; border-radius: 16px; }
  .call-ceremony::before, .call-ceremony::after { width: 42px; }
  .call-ceremony-seal { width: 36px; height: 36px; margin-bottom: 5px; font-size: 1rem; }
  .call-ceremony h2 { font-size: 1rem; }
  .call-ceremony > p:not(.eyebrow) { font-size: .69rem; }
  .call-chips-ceremony { margin-top: 9px; }
  .call-chips-ceremony .call-chip { min-width: 134px; padding: 6px 8px; }
  .friend-reveal-banner { width: calc(100% - 22px); padding: 8px 10px; }
  .draw-deck-area { left: 22px; }
  .deck-button { width: 52px; }
  .trick-area { min-height: 104px; }
  .trick-cards .playing-card.small { --card-w: 52px; --card-h: 78px; }
  .table-watermark img { width: 42px; height: 42px; }
  .phase-action-panel { width: min(620px, calc(100% - 24px)); margin-top: -34px; margin-bottom: 4px; padding: 6px 10px; }
  .phase-context h2 { font-size: .78rem; }
  .phase-context p { font-size: .68rem; }
  .hand-area { min-height: 86px; padding-block: 4px; }
  .hand-header { margin-bottom: -8px; }
  .card-row { min-height: 76px; padding-block: 8px 3px; }
  .hand-cards .playing-card .card-corner { left: 4px; top: 4px; min-width: 10px; }
  .hand-cards .playing-card .card-bottom { inset: auto 4px 4px auto; }
  .hand-cards .playing-card .card-rank { font-size: .69rem; }
  .hand-cards .playing-card .card-suit { margin-top: 1px; font-size: .5rem; }
  .hand-cards .playing-card .pip-face { inset: 11px 5px; }
  .hand-cards .playing-card .card-pip { font-size: .58rem; }
  .hand-cards .playing-card.rank-a .card-pip { font-size: 1.18rem; }
  .hand-cards .playing-card .court-face { inset: 13px 5px; }
  .hand-cards .playing-card .court-mark { width: 18px; height: 18px; font-size: .52rem; }
  .hand-cards .playing-card .court-caption, .hand-cards .playing-card .court-ornament { display: none; }
  .hand-cards .playing-card .joker-center { inset: 4px; grid-template-columns: 8px 1fr; }
  .hand-cards .playing-card .joker-ribbon { font-size: .27rem; }
  .hand-cards .playing-card .joker-seal { width: 26px; height: 26px; box-shadow: inset 0 0 0 3px #f3e4c8, 0 2px 5px rgba(72, 46, 20, .2); }
  .hand-cards .playing-card .joker-rays { font-size: 1.1rem; }
  .hand-cards .playing-card .joker-mark { font-size: .5rem; }
  .hand-cards .playing-card .joker-title { font-size: .25rem; }
  .hand-cards .playing-card .joker-chinese { font-size: .32rem; }
  .hand-cards .playing-card .card-points { display: none; }
  .hand-actions:has(.btn:not([hidden])) { min-height: 34px; }
  .hand-actions .btn { min-height: 34px; padding-block: 5px; }
  .screen-game .connection-strip.connected { display: none; }
  .screen-game[data-phase="calling"] .hand-area,
  .screen-game[data-phase="round_end"] .hand-area,
  .screen-game[data-phase="game_end"] .hand-area { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .decor-lantern, .decor-lantern:hover, .screen-room.table-ready-celebration .decor-lantern, .screen-game.trump-revealed .decor-lantern, .screen-game.ally-revealed .decor-lantern, .screen-game.call-announced .decor-lantern { animation: none !important; transform: none !important; }
  .decor-lantern .lantern-shell, .decor-lantern:hover .lantern-shell { animation: none !important; transform: none !important; }
  .decor-lantern:hover .lantern-shell { filter: brightness(1.06); }
  .decor-lantern:hover .lantern-mark, .decor-lantern:active .lantern-mark { transform: none !important; }
  .lantern-tassel { animation: none !important; transform: none !important; }
}

@media (forced-colors: active) {
  .festive-scene, .table-art-echo, .game-layout::before { display: none !important; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(255, 255, 255, .42); --line-strong: rgba(255, 227, 161, .86); }
  .playing-card { border-width: 2px; }
}
