:root {
  color-scheme: dark;
  --ink: #f7f1e5;
  --ink-muted: #b9c6bf;
  --felt-950: #071713;
  --felt-900: #0b211c;
  --felt-800: #10352c;
  --felt-700: #195044;
  --felt-600: #236b5a;
  --cream: #fbf7ed;
  --paper-ink: #15201c;
  --gold: #dbb968;
  --gold-soft: #f0d895;
  --red: #ba3f4d;
  --red-bright: #ef6673;
  --line: rgba(240, 216, 149, 0.2);
  --line-strong: rgba(240, 216, 149, 0.38);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  --radius-large: 1.75rem;
  --radius-medium: 1.1rem;
  --radius-small: 0.7rem;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Baskerville, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--felt-950);
  font-family: var(--sans);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(35, 107, 90, 0.24), transparent 34rem),
    radial-gradient(circle at 88% 100%, rgba(219, 185, 104, 0.09), transparent 28rem),
    var(--felt-950);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
  content: "";
  opacity: 0.14;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--paper-ink);
  background: var(--cream);
  border-radius: 0.5rem;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, 82rem);
  min-height: 5.25rem;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand strong {
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 1.18em;
  font-weight: 600;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  color: var(--felt-950);
  background: var(--gold);
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--felt-800);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 800;
}

.button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.78rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 0.8rem;
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-2px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.43;
}

.button-primary {
  color: #10231e;
  background: var(--gold);
  border-color: var(--gold-soft);
  box-shadow: 0 8px 24px rgba(219, 185, 104, 0.14);
}

.button-primary:not(:disabled):hover {
  background: var(--gold-soft);
}

.button-secondary,
.button-quiet {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line-strong);
}

.button-secondary:not(:disabled):hover,
.button-quiet:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.09);
}

.button-danger {
  color: #ffdfe2;
  background: rgba(186, 63, 77, 0.13);
  border-color: rgba(239, 102, 115, 0.42);
}

.button-danger:not(:disabled):hover {
  background: rgba(186, 63, 77, 0.25);
}

.button-small {
  min-height: 2.5rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.86rem;
}

.button-wide {
  width: 100%;
  justify-content: space-between;
  margin-top: 0.35rem;
}

.button.is-loading {
  cursor: wait;
  opacity: 0.65;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
}

.eyebrow,
.meta-label {
  margin: 0 0 0.5rem;
  color: var(--gold-soft);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Home */

.home-layout {
  display: grid;
  width: min(100% - 2rem, 74rem);
  min-height: calc(100vh - 10rem);
  align-items: center;
  margin: 0 auto;
  padding: 3rem 0 4rem;
  grid-template-columns: minmax(0, 1fr) minmax(21rem, 29rem);
  gap: clamp(2.5rem, 8vw, 8rem);
}

.home-logo {
  display: block;
  width: min(100%, 34rem);
  height: auto;
  margin: 0 auto 0 0;
  filter: drop-shadow(0 1.4rem 2.5rem rgba(0, 0, 0, 0.32));
}

.red-suit {
  color: var(--red-bright) !important;
}

.resume-card {
  display: flex;
  max-width: 32rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
}

.resume-card div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.resume-card .meta-label {
  margin: 0 0 0.25rem;
}

.entry-card {
  overflow: hidden;
  background: rgba(16, 53, 44, 0.74);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.choice-tabs {
  display: grid;
  padding: 0.45rem;
  background: rgba(0, 0, 0, 0.16);
  border-bottom: 1px solid var(--line);
  grid-template-columns: 1fr 1fr;
}

.choice-tab {
  min-height: 3rem;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: 0.7rem;
  font-weight: 750;
  cursor: pointer;
}

.choice-tab.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line);
}

.entry-form {
  padding: 1.8rem;
}

.form-heading {
  display: grid;
  align-items: start;
  margin-bottom: 1.65rem;
  grid-template-columns: auto 1fr;
  gap: 1rem;
}

.step-number {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.9rem;
  font-style: italic;
  line-height: 1;
}

.form-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
}

.form-heading p {
  margin: 0.35rem 0 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.field-label {
  display: block;
  margin: 0.9rem 0 0.4rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.text-input {
  width: 100%;
  min-height: 3.35rem;
  padding: 0.78rem 0.9rem;
  color: var(--ink);
  background: rgba(4, 20, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: border-color 150ms ease, background 150ms ease;
}

.text-input::placeholder {
  color: #80928a;
}

.text-input:hover,
.text-input:focus {
  background: rgba(4, 20, 16, 0.72);
  border-color: var(--gold);
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.field-help {
  display: block;
  margin: 0.35rem 0 1.2rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.form-status {
  margin: 1rem 1.8rem 0;
  padding: 0.8rem 0.9rem;
  color: #ffe4e6;
  background: rgba(186, 63, 77, 0.16);
  border: 1px solid rgba(239, 102, 115, 0.38);
  border-radius: 0.7rem;
  font-size: 0.88rem;
  line-height: 1.4;
}

.site-footer {
  display: flex;
  width: min(100% - 2rem, 82rem);
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  color: #82958d;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.rules-dialog,
.confirm-dialog {
  width: min(calc(100% - 2rem), 39rem);
  max-height: min(85vh, 48rem);
  padding: 0;
  color: var(--ink);
  background: #102b25;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.rules-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(3, 11, 9, 0.75);
  backdrop-filter: blur(5px);
}

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2,
.confirm-dialog h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
}

.icon-button {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
}

.rules-body {
  overflow: auto;
  padding: 1.5rem;
  color: var(--ink-muted);
  line-height: 1.65;
}

.rules-body > p:first-child {
  margin-top: 0;
}

.round-list {
  display: grid;
  margin: 1.4rem 0;
  padding: 0;
  list-style: none;
  gap: 0.55rem;
}

.round-list li {
  display: grid;
  align-items: center;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.8rem;
}

.round-list li > span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--felt-950);
  background: var(--gold);
  border-radius: 50%;
  font-family: var(--serif);
  font-weight: 800;
}

.round-list div {
  display: flex;
  flex-direction: column;
}

.round-list strong {
  color: var(--ink);
}

.round-list small {
  font-size: 0.8rem;
}

.rule-callout {
  margin-bottom: 0 !important;
  padding: 0.85rem 1rem;
  color: var(--gold-soft);
  background: rgba(219, 185, 104, 0.08);
  border-left: 3px solid var(--gold);
}

/* Shared game header */

.game-header {
  position: relative;
  min-height: 5.75rem;
  gap: 1rem;
}

.game-header-actions {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  gap: 0.7rem;
}

.game-exit {
  min-height: 2.5rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.65rem;
  font-size: 0.78rem;
}

.game-code-button {
  position: absolute;
  left: 50%;
  display: grid;
  min-width: 10rem;
  padding: 0.6rem 1.1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-strong);
  border-radius: 0.85rem;
  cursor: pointer;
  transform: translateX(-50%);
  grid-template-columns: auto auto;
  gap: 0.1rem 0.6rem;
}

.game-code-button > span,
.game-code-button > small {
  color: var(--ink-muted);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-code-button > strong {
  grid-column: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.09em;
}

.game-code-button > small {
  align-self: center;
  grid-row: 1 / span 2;
  grid-column: 2;
}

.game-code-button-inline {
  display: none;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.connection-status > span:first-child {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(219, 185, 104, 0.1);
}

.connection-status.is-online > span:first-child {
  background: #61c995;
  box-shadow: 0 0 0 4px rgba(97, 201, 149, 0.1);
}

.connection-status.is-offline > span:first-child {
  background: var(--red-bright);
  box-shadow: 0 0 0 4px rgba(239, 102, 115, 0.1);
}

.departure-banner {
  display: flex;
  width: min(100% - 2rem, 88rem);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem auto 0;
  padding: 0.75rem 0.9rem;
  color: #ffe6bf;
  background: rgba(121, 75, 29, 0.28);
  border: 1px solid rgba(240, 216, 149, 0.48);
  border-radius: 0.85rem;
}

.departure-banner > div {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.18rem;
}

.departure-banner strong {
  font-size: 0.9rem;
}

.departure-banner span {
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Loading */

.loading-view,
.lost-view {
  display: grid;
  min-height: calc(100vh - 6rem);
  padding: 2rem;
  place-items: center;
  text-align: center;
}

.loading-view h1 {
  margin: 1rem 0;
  color: var(--ink-muted);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
}

.loading-cards {
  position: relative;
  width: 6.5rem;
  height: 4.5rem;
}

.loading-cards i {
  position: absolute;
  left: 2rem;
  display: block;
  width: 2.8rem;
  height: 4rem;
  background: var(--cream);
  border: 2px solid var(--gold);
  border-radius: 0.4rem;
  animation: deal 1.2s ease-in-out infinite alternate;
}

.loading-cards i:nth-child(1) { transform: rotate(-15deg) translateX(-1.4rem); }
.loading-cards i:nth-child(2) { z-index: 2; animation-delay: 100ms; }
.loading-cards i:nth-child(3) { transform: rotate(15deg) translateX(1.4rem); animation-delay: 200ms; }

@keyframes deal {
  to { margin-top: -0.4rem; }
}

/* Lobby */

.lobby-view {
  display: flex;
  width: min(100% - 2rem, 45rem);
  min-height: calc(100vh - 5.75rem);
  flex-direction: column;
  margin: 0 auto;
  padding: 3rem 0 2rem;
}

.lobby-heading {
  text-align: center;
}

.lobby-heading h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 8vw, 4.3rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.lobby-heading > p:last-child {
  margin: 0.75rem 0 0;
  color: var(--ink-muted);
}

.lobby-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 2rem;
  padding: 1rem 1.2rem;
  background: rgba(219, 185, 104, 0.07);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-medium);
}

.lobby-qr-card {
  display: flex;
  width: min(100%, 34rem);
  align-items: center;
  justify-content: center;
  margin: 1.5rem auto 0;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  gap: 1.05rem;
}

.lobby-qr-card img {
  display: block;
  flex: 0 0 auto;
  width: 10rem;
  height: 10rem;
  padding: 0.45rem;
  background: var(--cream);
  border: 1px solid var(--gold-soft);
  border-radius: 0.5rem;
}

.lobby-qr-card .eyebrow {
  margin-bottom: 0.2rem;
}

.lobby-qr-card h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
}

.lobby-qr-card p:last-child {
  max-width: 16rem;
  margin: 0.4rem 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.lobby-code-card > span {
  color: var(--ink-muted);
  font-size: 0.83rem;
}

.lobby-code-card > strong {
  color: var(--gold-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.45rem;
  letter-spacing: 0.11em;
}

.lobby-code-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.player-count-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.player-count-line h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
}

.player-count-line span {
  color: var(--ink-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.lobby-players {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.55rem;
}

.lobby-player {
  display: grid;
  min-height: 4.4rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  animation: enter-player 220ms ease both;
}

@keyframes enter-player {
  from { opacity: 0; transform: translateY(5px); }
}

.player-avatar {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  color: var(--felt-950);
  background: var(--gold);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 800;
}

.lobby-player > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
}

.lobby-player strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player div span {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.host-badge {
  padding: 0.35rem 0.55rem;
  color: var(--gold-soft);
  background: rgba(219, 185, 104, 0.08);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lobby-actions {
  margin-top: auto;
  padding-top: 2rem;
}

.action-hint {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
  font-size: 0.82rem;
  text-align: right;
}

/* Playing view */

.play-view {
  width: min(100% - 2rem, 88rem);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.orientation-hint {
  display: none;
  margin: 0 0 0.65rem;
  padding: 0.6rem 0.75rem;
  color: var(--gold-soft);
  background: rgba(219, 185, 104, 0.08);
  border: 1px solid rgba(219, 185, 104, 0.24);
  border-radius: 0.65rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.round-banner {
  display: grid;
  min-height: 5.2rem;
  align-items: center;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  grid-template-columns: auto minmax(10rem, 1fr) minmax(12rem, auto) auto;
  gap: 1rem;
}

.round-number {
  display: flex;
  min-width: 5rem;
  flex-direction: column;
  padding-right: 1rem;
  border-right: 1px solid var(--line);
}

.round-number span {
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.round-number strong {
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: 1.55rem;
}

.round-banner h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
}

.round-banner p {
  margin: 0.2rem 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.score-strip {
  display: flex;
  overflow-x: auto;
  padding: 0.75rem 0 0.85rem;
  scrollbar-width: thin;
  gap: 0.55rem;
}

.round-player-summary {
  align-self: center;
  min-width: 0;
  padding: 0;
}

.score-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.6rem;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.74rem;
}

.score-chip strong {
  color: var(--ink);
}

.score-chip.is-you {
  color: var(--gold-soft);
  border-color: var(--line-strong);
}

.table-layout {
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(12rem, 15rem) minmax(24rem, 1fr) minmax(12rem, 15rem);
  gap: 0.9rem;
}

.seat-panel,
.special-panel {
  min-height: 25rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
}

.panel-heading {
  margin-bottom: 0.85rem;
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.panel-heading > span {
  color: var(--ink-muted);
  font-size: 0.69rem;
}

.seat-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 0.45rem;
}

.seat-item {
  display: grid;
  min-width: 0;
  align-items: center;
  padding: 0.65rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  grid-template-columns: 0.55rem 1fr auto;
  gap: 0.55rem;
}

.seat-item.is-you {
  background: rgba(219, 185, 104, 0.055);
}

.seat-item.is-current {
  background: rgba(35, 107, 90, 0.3);
  border-color: var(--line-strong);
}

.seat-item.is-disconnected {
  background: rgba(186, 63, 77, 0.12);
  border-color: rgba(239, 102, 115, 0.38);
}

.seat-item.is-disconnected .turn-dot {
  background: var(--red-bright);
  box-shadow: 0 0 0 4px rgba(239, 102, 115, 0.1);
}

.turn-dot {
  width: 0.48rem;
  height: 0.48rem;
  background: rgba(255, 255, 255, 0.17);
  border-radius: 50%;
}

.seat-item.is-current .turn-dot {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(219, 185, 104, 0.1);
}

.seat-item > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.seat-item strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-item div span {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-card-count {
  display: grid;
  width: 1.8rem;
  height: 2.35rem;
  place-items: center;
  color: var(--cream);
  background:
    repeating-linear-gradient(45deg, rgba(219, 185, 104, 0.12) 0 3px, transparent 3px 6px),
    var(--felt-700);
  border: 1px solid var(--gold);
  border-radius: 0.25rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.felt-table {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 25rem;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 3.5rem 1rem 2rem;
  background:
    radial-gradient(circle at center, rgba(35, 107, 90, 0.8), rgba(11, 33, 28, 0.93) 72%),
    var(--felt-800);
  border: 1px solid rgba(219, 185, 104, 0.34);
  border-radius: 45% / 18%;
  box-shadow: inset 0 0 45px rgba(0, 0, 0, 0.3), 0 16px 45px rgba(0, 0, 0, 0.2);
}

.felt-table::before,
.felt-table::after {
  position: absolute;
  inset: 0.55rem;
  border: 1px solid rgba(219, 185, 104, 0.16);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.felt-table::after {
  inset: 1rem;
  border-color: rgba(255, 255, 255, 0.045);
}

.felt-table.is-drop-target {
  border-color: var(--gold-soft);
  box-shadow: inset 0 0 0 3px rgba(240, 216, 149, 0.22), inset 0 0 45px rgba(0, 0, 0, 0.3), 0 16px 45px rgba(0, 0, 0, 0.2);
}

.felt-table.is-drop-target::before {
  border-color: rgba(240, 216, 149, 0.78);
}

.felt-table.is-build-round {
  justify-content: center;
  padding: 3.65rem 1rem 1.65rem;
  border-radius: 1.6rem;
}

.felt-table.is-build-round .felt-ring {
  display: none;
}

.felt-ring {
  position: absolute;
  width: 8rem;
  height: 8rem;
  opacity: 0.09;
  border: 1px solid var(--gold);
  border-radius: 50%;
}

.felt-ring::before {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--gold);
  content: "♣";
  font-family: var(--serif);
  font-size: 4rem;
}

.turn-message,
.trick-label,
.trick-result {
  position: relative;
  z-index: 2;
}

.turn-message {
  position: absolute;
  top: 1.15rem;
  left: 50%;
  padding: 0.45rem 0.7rem;
  color: var(--ink-muted);
  background: rgba(4, 20, 16, 0.6);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  transform: translateX(-50%);
  white-space: nowrap;
}

.turn-message.is-yours {
  color: var(--felt-950);
  background: var(--gold);
  border-color: var(--gold-soft);
}

.turn-message.is-paused {
  color: #ffe6bf;
  background: rgba(121, 75, 29, 0.86);
  border-color: rgba(240, 216, 149, 0.55);
}

.trick-label {
  margin-bottom: 0.85rem;
  color: var(--ink-muted);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.trick-cards {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 8rem;
  align-items: center;
  justify-content: center;
  gap: clamp(0.2rem, 1.3vw, 0.75rem);
}

.played-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0.3rem;
  animation: card-played 210ms ease both;
}

@keyframes card-played {
  from { opacity: 0; transform: translateY(12px) rotate(-2deg); }
}

.played-card > span {
  display: block;
  overflow: hidden;
  max-width: 5rem;
  color: var(--ink-muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-trick {
  max-width: 15rem;
  margin: 0;
  color: rgba(247, 241, 229, 0.56);
  font-family: var(--serif);
  font-style: italic;
  text-align: center;
}

.trick-result {
  min-height: 1.4rem;
  margin-top: 0.7rem;
  color: var(--gold-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.build-board {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 21rem);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, 4.95rem);
  gap: 0.45rem 0.5rem;
}

.build-stack-cell {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
}

.playing-card.is-build-card {
  flex: 0 0 3.25rem;
  width: 3.25rem;
  height: 4.7rem;
  border-color: rgba(240, 216, 149, 0.74);
  border-radius: 0.38rem;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.28);
}

.playing-card.is-build-card .card-corner b {
  font-size: 0.76rem;
}

.playing-card.is-build-card .card-corner i {
  margin-top: 0.08rem;
  font-size: 0.59rem;
}

.playing-card.is-build-card .card-corner-top {
  top: 0.24rem;
  left: 0.27rem;
}

.playing-card.is-build-card .card-corner-bottom {
  right: 0.27rem;
  bottom: 0.24rem;
}

.playing-card.is-build-card .card-suit {
  font-size: 1.55rem;
}

.build-stack-cell.is-up .is-build-card {
  transform: translateY(0.12rem);
}

.build-stack-cell.is-down .is-build-card {
  transform: translateY(-0.12rem);
}

.tracker-main {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.tracker-note {
  margin: 0.75rem 0 0;
  color: var(--ink-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.special-panel #special-content {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.special-panel #special-content > * {
  margin: 0;
}

.special-panel progress {
  width: 100%;
  height: 0.55rem;
  overflow: hidden;
  accent-color: var(--gold);
  border: 0;
  border-radius: 999px;
}

.captured-cards {
  display: grid;
  gap: 0.55rem;
}

.captured-record {
  display: flex;
  align-items: center;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  gap: 0.55rem;
}

.captured-record > span {
  color: var(--ink-muted);
  font-size: 0.69rem;
  line-height: 1.35;
}

.featured-record {
  border-color: var(--line-strong);
}

.pass-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
}

.pass-player {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.45rem 0.5rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 0.55rem;
}

.pass-player > span:first-child {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pass-dots {
  display: flex;
  min-height: 0.62rem;
  align-items: center;
  flex-wrap: wrap;
  color: rgba(247, 241, 229, 0.38);
  font-size: 0.9rem;
  line-height: 1;
  gap: 0.22rem;
}

.pass-dot {
  display: block;
  width: 0.44rem;
  height: 0.44rem;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(219, 185, 104, 0.12);
}

.hand-panel {
  margin-top: 0.9rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
}

.hand-controls-row {
  display: contents;
}

.hand-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.hand-heading .eyebrow {
  margin-bottom: 0.15rem;
  font-size: 0.64rem;
}

.hand-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
}

.hand-heading > p {
  margin: 0;
  color: var(--gold-soft);
  font-size: 0.78rem;
  text-align: right;
}

.hand-groups {
  display: flex;
  overflow-x: auto;
  min-height: 8.75rem;
  align-items: end;
  padding: 0.15rem 0.15rem 0.65rem;
  scrollbar-color: var(--felt-600) transparent;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
  gap: 0.8rem;
}

.suit-group {
  display: flex;
  min-width: max-content;
  flex: 0 0 auto;
  flex-direction: column;
}

.suit-group + .suit-group {
  padding-left: 0.8rem;
  border-left: 1px solid var(--line);
}

.suit-group h3 {
  margin: 0 0 0.4rem;
  color: var(--ink-muted);
  font-size: 0.69rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hand-row {
  display: flex;
  min-height: 7.4rem;
  align-items: end;
  padding: 0.25rem 0.15rem 0;
  gap: 0.28rem;
}

.playing-card {
  position: relative;
  display: block;
  flex: 0 0 4.3rem;
  width: 4.3rem;
  height: 6.25rem;
  padding: 0;
  color: #15201c;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), transparent 48%),
    var(--cream);
  border: 2px solid rgba(21, 32, 28, 0.16);
  border-radius: 0.48rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  font-family: Georgia, serif;
  cursor: default;
  transition: transform 150ms ease, opacity 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

button.playing-card {
  cursor: pointer;
}

button.playing-card[draggable="true"] {
  cursor: grab;
}

button.playing-card[draggable="true"]:active {
  cursor: grabbing;
}

.playing-card.is-red {
  color: #b32637;
}

.playing-card:disabled {
  opacity: 0.28;
  filter: saturate(0.35);
  cursor: not-allowed;
}

.playing-card.is-playable {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(219, 185, 104, 0.14), 0 8px 17px rgba(0, 0, 0, 0.27);
}

.playing-card.is-playable:hover {
  transform: translateY(-0.45rem);
}

.playing-card.is-selected {
  border-color: #fff0b3;
  box-shadow: 0 0 0 4px rgba(240, 216, 149, 0.26), 0 13px 24px rgba(0, 0, 0, 0.33);
  transform: translateY(-0.65rem);
}

.playing-card.is-dragging {
  opacity: 0.48;
  transform: translateY(-0.7rem) rotate(2deg);
}

.playing-card.is-touch-dragging {
  z-index: 5;
  opacity: 0.72;
  pointer-events: none;
  transform: translate(var(--touch-drag-x, 0), var(--touch-drag-y, 0)) rotate(3deg);
}

.card-corner {
  position: absolute;
  display: flex;
  align-items: center;
  flex-direction: column;
  line-height: 0.9;
}

.card-corner b {
  font-size: 0.96rem;
}

.card-corner i {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  font-style: normal;
}

.card-corner-top {
  top: 0.35rem;
  left: 0.38rem;
}

.card-corner-bottom {
  right: 0.38rem;
  bottom: 0.35rem;
  transform: rotate(180deg);
}

.card-suit {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 2rem;
  transform: translate(-50%, -50%);
}

.playing-card.is-compact {
  width: 4.6rem;
  height: 6.7rem;
  flex-basis: 4.6rem;
}

.playing-card.is-tiny {
  width: 2.4rem;
  height: 3.4rem;
  flex-basis: 2.4rem;
  border-width: 1px;
  border-radius: 0.3rem;
}

.playing-card.is-tiny .card-corner b { font-size: 0.6rem; }
.playing-card.is-tiny .card-corner i { display: none; }
.playing-card.is-tiny .card-corner-top { top: 0.18rem; left: 0.2rem; }
.playing-card.is-tiny .card-corner-bottom { right: 0.2rem; bottom: 0.18rem; }
.playing-card.is-tiny .card-suit { font-size: 1.15rem; }

.play-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.play-action > span {
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.hand-groups .playing-card[draggable="true"] {
  touch-action: pan-x;
}

/* Scoreboard */

.scoreboard-view {
  display: grid;
  min-height: calc(100vh - 5.75rem);
  padding: 2.5rem 1rem;
  place-items: center;
}

.scoreboard-card {
  overflow: hidden;
  width: min(100%, 52rem);
  background: rgba(16, 53, 44, 0.78);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.scoreboard-heading {
  padding: 2rem 2rem 1.5rem;
  text-align: center;
}

.scoreboard-heading h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.scoreboard-heading > p:last-child {
  margin: 0.65rem 0 0;
  color: var(--ink-muted);
}

.scoreboard-table-wrap {
  overflow-x: auto;
  padding: 0 1rem;
}

.scoreboard-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
}

.scoreboard-table th,
.scoreboard-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.scoreboard-table thead th {
  color: var(--ink-muted);
  font-size: 0.67rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.scoreboard-table thead th:nth-child(2),
.scoreboard-table tbody th {
  text-align: left;
}

.scoreboard-table tbody tr.is-you {
  background: rgba(219, 185, 104, 0.07);
}

.scoreboard-table tbody tr:first-child td,
.scoreboard-table tbody tr:first-child th {
  color: var(--gold-soft);
}

.scoreboard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  background: rgba(0, 0, 0, 0.14);
  border-top: 1px solid var(--line);
}

.scoreboard-actions p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.lost-card {
  width: min(100%, 30rem);
  padding: 2rem;
  background: rgba(16, 53, 44, 0.75);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.lost-symbol {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 3rem;
}

.lost-card h1 {
  margin: 0.5rem 0;
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 500;
}

.lost-card p {
  margin: 0 0 1.5rem;
  color: var(--ink-muted);
}

.toast {
  position: fixed;
  z-index: 90;
  right: 1rem;
  bottom: 1rem;
  max-width: min(25rem, calc(100% - 2rem));
  padding: 0.85rem 1rem;
  color: var(--ink);
  background: #174b3f;
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  animation: toast-in 180ms ease both;
}

.toast.is-error {
  background: #59262d;
  border-color: rgba(239, 102, 115, 0.5);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
}

.confirm-dialog {
  width: min(calc(100% - 2rem), 28rem);
  padding: 1.5rem;
}

.confirm-dialog p {
  margin: 0.75rem 0 1.5rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.confirm-dialog .departure-countdown {
  margin-top: -0.75rem;
  color: var(--gold-soft);
  font-size: 0.86rem;
}

/* Responsive */

@media (max-width: 70rem) {
  .table-layout {
    grid-template-columns: minmax(11rem, 14rem) 1fr;
  }

  .special-panel {
    min-height: auto;
    grid-column: 1 / -1;
  }

  .special-panel #special-content {
    gap: 0.7rem;
  }
}

@media (max-width: 48rem), (max-height: 34rem) and (orientation: landscape) {
  .site-header,
  .game-header {
    width: min(100% - 1.25rem, 82rem);
  }

  .home-layout {
    width: min(100% - 1.25rem, 36rem);
    min-height: auto;
    padding: 2.5rem 0 3rem;
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }

  .home-logo {
    width: min(100%, 31rem);
    margin-inline: auto;
  }

  .site-footer {
    width: min(100% - 1.25rem, 82rem);
  }

  .brand-compact > span:last-child {
    display: none;
  }

  .game-code-button {
    min-width: 8.9rem;
    padding-inline: 0.8rem;
  }

  .game-header-actions {
    gap: 0.45rem;
  }

  .game-exit {
    min-height: 2.35rem;
    padding-inline: 0.65rem;
  }

  .connection-status > span:last-child {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0, 0, 0, 0);
  }

  .departure-banner {
    width: min(100% - 1rem, 88rem);
    align-items: stretch;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.65rem;
  }

  .departure-banner .button {
    width: 100%;
  }

  .lobby-view {
    width: min(100% - 1.25rem, 45rem);
    padding-top: 2rem;
  }

  .lobby-code-card {
    align-items: center;
    flex-direction: column;
    gap: 0.6rem;
    text-align: center;
  }

  .lobby-code-card > span,
  .lobby-code-card > strong {
    width: 100%;
  }

  .lobby-qr-card {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .lobby-qr-card p:last-child {
    max-width: 21rem;
  }

  .lobby-code-card .button {
    width: min(100%, 18rem);
    justify-content: center;
    text-align: center;
  }

  .lobby-code-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    justify-items: center;
  }

  .play-view {
    width: min(100% - 1rem, 88rem);
  }

  .round-banner {
    grid-template-columns: auto 1fr;
  }

  .round-banner h1 {
    font-size: 1.25rem;
  }

  .table-layout {
    grid-template-columns: 1fr;
  }

  .seat-panel {
    min-height: auto;
    order: 2;
  }

  .felt-table {
    min-height: 21rem;
    order: 1;
    border-radius: 3.2rem;
  }

  .felt-table.is-build-round {
    min-height: 22rem;
    padding: 3.35rem 0.5rem 1rem;
    border-radius: 1.15rem;
  }

  .build-board {
    width: min(100%, 18rem);
    grid-template-rows: repeat(3, 4.35rem);
    gap: 0.3rem 0.32rem;
  }

  .playing-card.is-build-card {
    flex-basis: 2.85rem;
    width: 2.85rem;
    height: 4.12rem;
  }

  .playing-card.is-build-card .card-suit {
    font-size: 1.35rem;
  }

  .special-panel {
    order: 3;
    grid-column: auto;
  }

  .seat-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trick-cards {
    min-height: 7rem;
    gap: 0.2rem;
  }

  .playing-card.is-compact {
    width: 3.6rem;
    height: 5.25rem;
    flex-basis: 3.6rem;
  }

  .playing-card.is-compact .card-suit {
    font-size: 1.55rem;
  }

  .hand-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.4rem;
  }

  .hand-heading > p {
    text-align: left;
  }

  .hand-groups {
    min-height: 5.5rem;
    padding-bottom: 0.55rem;
    gap: 0.6rem;
  }

  .suit-group + .suit-group {
    padding-left: 0.6rem;
  }

  .suit-group h3 {
    margin-bottom: 0.25rem;
    font-size: 0.61rem;
  }

  .hand-row {
    min-height: var(--hand-card-height, 4.15rem);
    gap: var(--hand-card-gap, 0.2rem);
  }

  .hand-groups .playing-card {
    flex-basis: var(--hand-card-width, 2.9rem);
    width: var(--hand-card-width, 2.9rem);
    height: var(--hand-card-height, 4.15rem);
    border-width: 1px;
    border-radius: 0.35rem;
  }

  .hand-groups .playing-card .card-corner b {
    font-size: var(--hand-rank-size, 0.67rem);
  }

  .hand-groups .playing-card .card-corner i {
    margin-top: 0.05rem;
    font-size: var(--hand-suit-size, 0.5rem);
  }

  .hand-groups .playing-card .card-corner-top {
    top: 0.2rem;
    left: 0.22rem;
  }

  .hand-groups .playing-card .card-corner-bottom {
    right: 0.22rem;
    bottom: 0.2rem;
  }

  .hand-groups .playing-card .card-suit {
    font-size: var(--hand-center-suit-size, 1.3rem);
  }

  .hand-groups[data-player-count="3"] {
    --hand-card-width: 2.2rem;
    --hand-card-height: 3.2rem;
    --hand-card-gap: 0.14rem;
    --hand-rank-size: 0.56rem;
    --hand-suit-size: 0.43rem;
    --hand-center-suit-size: 1.05rem;
  }

  .hand-groups[data-player-count="4"] {
    --hand-card-width: 2.5rem;
    --hand-card-height: 3.62rem;
    --hand-card-gap: 0.16rem;
    --hand-rank-size: 0.61rem;
    --hand-suit-size: 0.46rem;
    --hand-center-suit-size: 1.16rem;
  }

  .hand-groups[data-player-count="5"] {
    --hand-card-width: 2.82rem;
    --hand-card-height: 4.08rem;
    --hand-card-gap: 0.19rem;
    --hand-rank-size: 0.66rem;
    --hand-suit-size: 0.5rem;
    --hand-center-suit-size: 1.3rem;
  }

  .hand-groups[data-player-count="6"] {
    --hand-card-width: 3.15rem;
    --hand-card-height: 4.56rem;
    --hand-card-gap: 0.22rem;
    --hand-rank-size: 0.73rem;
    --hand-suit-size: 0.55rem;
    --hand-center-suit-size: 1.46rem;
  }

  .play-action {
    position: sticky;
    z-index: 10;
    bottom: 0;
    align-items: stretch;
    flex-direction: column;
    padding: 0.75rem;
    background: rgba(7, 23, 19, 0.96);
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    gap: 0.5rem;
  }

  .play-action .button {
    width: 100%;
  }

  .scoreboard-heading,
  .scoreboard-actions {
    padding-inline: 1rem;
  }

  .scoreboard-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .scoreboard-actions .button {
    width: 100%;
  }
}

@media (max-width: 48rem) and (orientation: portrait) {
  .orientation-hint {
    display: block;
  }
}

@media (max-height: 34rem) and (orientation: landscape) {
  .game-header {
    min-height: 4.3rem;
  }

  .play-view {
    width: min(100% - 1rem, 88rem);
    padding-top: 0.55rem;
  }

  .round-banner {
    min-height: 4.35rem;
    padding-block: 0.55rem;
  }

  .table-layout {
    grid-template-columns: minmax(9rem, 11rem) minmax(19rem, 1fr) minmax(9rem, 11rem);
    gap: 0.55rem;
  }

  .seat-panel,
  .special-panel,
  .felt-table {
    min-height: 15.5rem;
  }

  .special-panel {
    grid-column: auto;
  }

  .felt-table {
    padding: 3rem 0.65rem 1rem;
  }

  .felt-table.is-build-round {
    min-height: 15.5rem;
    padding: 3rem 0.45rem 0.65rem;
  }

  .hand-panel {
    margin-top: 0.55rem;
    padding: 0.7rem;
  }
}

/* Phone game mode: the board is the main surface, not a squeezed desktop table. */
body.is-phone-landscape .game-header {
    width: min(100% - 1rem, 88rem);
    min-height: 2.55rem;
    padding-top: 0.25rem;
}

body.is-phone-landscape .game-header .brand-compact,
body.is-phone-landscape .game-header > .game-code-button:not(.game-code-button-inline) {
    display: none;
}

body.is-phone-landscape .game-header-actions {
    gap: 0.35rem;
}

body.is-phone-landscape .game-exit {
    min-height: 2rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.67rem;
}

body.is-phone-landscape .play-view {
    width: min(100% - 0.7rem, 88rem);
    padding: 0.2rem 0 0.45rem;
}

body.is-phone-landscape .lobby-code-card {
    align-items: center;
    flex-direction: column;
    gap: 0.5rem;
    margin-block: 0.8rem 1rem;
    padding: 0.7rem;
    text-align: center;
}

body.is-phone-landscape .lobby-code-card > span,
body.is-phone-landscape .lobby-code-card > strong {
    width: 100%;
}

body.is-phone-landscape .lobby-code-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    justify-items: center;
}

body.is-phone-landscape .lobby-code-actions .button {
    width: min(100%, 18rem);
    justify-content: center;
    text-align: center;
}

body.is-phone-landscape .round-banner {
    min-height: 3.15rem;
    padding: 0.35rem 0.45rem;
    border-radius: 0.75rem;
    grid-template-columns: 3.1rem minmax(8.3rem, 1.35fr) minmax(0, 2.05fr) 4.65rem;
    gap: 0.35rem;
}

body.is-phone-landscape .round-number {
    min-width: 0;
    padding-right: 0.35rem;
}

body.is-phone-landscape .round-number > span {
    font-size: 0.53rem;
    letter-spacing: 0.07em;
}

body.is-phone-landscape .round-number strong {
    font-size: 0.93rem;
}

body.is-phone-landscape .round-banner h1 {
    overflow: visible;
    font-size: clamp(0.71rem, 2.4vw, 0.95rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
}

body.is-phone-landscape .round-banner p {
    display: none;
}

body.is-phone-landscape .round-player-summary {
    width: 100%;
    min-width: 0;
    gap: 0.2rem;
}

body.is-phone-landscape .round-player-summary .score-chip {
    gap: 0.2rem;
    padding: 0.2rem 0.28rem;
    border-radius: 0.5rem;
    font-size: 0.58rem;
    white-space: nowrap;
}

body.is-phone-landscape .game-code-button-inline {
    position: static;
    display: grid;
    min-width: 0;
    padding: 0.22rem 0.3rem;
    border-radius: 0.48rem;
    transform: none;
    grid-template-columns: 1fr;
    gap: 0.08rem;
}

body.is-phone-landscape .game-code-button-inline > span {
    font-size: 0.47rem;
    letter-spacing: 0.06em;
}

body.is-phone-landscape .game-code-button-inline > strong {
    grid-column: 1;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

body.is-phone-landscape .game-code-button-inline > small {
    display: none;
}

body.is-phone-landscape .table-layout {
    grid-template-columns: minmax(0, 1fr) minmax(7.3rem, 9.2rem);
    gap: 0.4rem;
}

body.is-phone-landscape .seat-panel {
    display: none;
}

body.is-phone-landscape .felt-table,
body.is-phone-landscape .special-panel,
body.is-phone-landscape .felt-table.is-build-round {
    min-height: clamp(13rem, calc(100svh - 12rem), 21rem);
}

body.is-phone-landscape .felt-table {
    order: initial;
    padding: 2.35rem 0.55rem 0.6rem;
    border-radius: 2rem;
}

body.is-phone-landscape .felt-table.is-build-round {
    padding: 2.3rem 0.35rem 0.45rem;
    border-radius: 0.9rem;
}

body.is-phone-landscape .special-panel {
    order: initial;
    min-width: 0;
    padding: 0.55rem;
    grid-column: auto;
}

body.is-phone-landscape .special-panel .panel-heading {
    margin-bottom: 0.35rem;
}

body.is-phone-landscape .special-panel .panel-heading h2 {
    font-size: 0.82rem;
}

body.is-phone-landscape .special-panel .tracker-main {
    margin-bottom: 0.45rem;
    font-size: 0.68rem;
}

body.is-phone-landscape .special-panel .tracker-note,
body.is-phone-landscape .special-panel .captured-record > span,
body.is-phone-landscape .special-panel .pass-player > span:first-child {
    font-size: 0.58rem;
}

body.is-phone-landscape .turn-message {
    top: 0.55rem;
    max-width: calc(100% - 1rem);
    padding: 0.28rem 0.5rem;
    font-size: 0.64rem;
}

body.is-phone-landscape .trick-label {
    margin-bottom: 0.35rem;
    font-size: 0.56rem;
}

body.is-phone-landscape .trick-cards {
    min-height: 5.5rem;
}

body.is-phone-landscape .trick-result {
    min-height: 0.9rem;
    margin-top: 0.3rem;
    font-size: 0.62rem;
}

body.is-phone-landscape .hand-panel {
    margin-top: 0.35rem;
    padding: 0.38rem 0.5rem;
    border-radius: 0.75rem;
}

body.is-phone-landscape .hand-heading {
    display: block;
    margin-bottom: 0.2rem;
}

body.is-phone-landscape .hand-heading > div {
    display: none;
}

body.is-phone-landscape .hand-heading > p {
    overflow: hidden;
    color: var(--gold-soft);
    font-size: 0.63rem;
    line-height: 1.2;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.is-phone-landscape .hand-controls-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.4rem;
}

body.is-phone-landscape .hand-groups {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 4.45rem;
    padding: 0.1rem 0.1rem 0.25rem;
    gap: 0.45rem;
}

body.is-phone-landscape .suit-group + .suit-group {
    padding-left: 0.45rem;
}

body.is-phone-landscape .suit-group h3 {
    margin-bottom: 0.12rem;
    font-size: 0.51rem;
}

body.is-phone-landscape .play-action {
    flex: 0 0 auto;
    align-self: stretch;
    justify-content: center;
    padding: 0 0 0 0.4rem;
    background: transparent;
    border: 0;
    border-left: 1px solid var(--line);
    gap: 0.28rem;
}

body.is-phone-landscape .play-action > span {
    display: none;
}

body.is-phone-landscape .play-action .button {
    width: auto;
    min-height: 1.8rem;
    padding: 0.34rem 0.48rem;
    border-radius: 0.42rem;
    font-size: 0.61rem;
    line-height: 1.1;
    white-space: nowrap;
}

@media (max-width: 29rem) {
  .brand:not(.brand-compact) > span:last-child {
    font-size: 0.88rem;
  }

  .site-header .button-quiet {
    padding-inline: 0.7rem;
  }

  .entry-form {
    padding: 1.25rem;
  }

  .form-status {
    margin-inline: 1.25rem;
  }

  .resume-card {
    align-items: stretch;
    flex-direction: column;
  }

  .resume-card .button {
    width: 100%;
  }

  .game-header {
    min-height: 5.2rem;
  }

  .brand-compact .brand-mark {
    width: 2.25rem;
    height: 2.25rem;
  }

  .game-code-button {
    min-width: 8.1rem;
  }

  .connection-status {
    width: 0.6rem;
  }

  .lobby-actions .button-row {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .lobby-actions .button {
    width: 100%;
  }

  .action-hint {
    text-align: center;
  }

  .seat-list {
    grid-template-columns: 1fr;
  }

  .playing-card {
    width: 4rem;
    height: 5.85rem;
    flex-basis: 4rem;
  }

  .playing-card.is-compact {
    width: 3.2rem;
    height: 4.75rem;
    flex-basis: 3.2rem;
  }

  .playing-card.is-compact .card-corner b { font-size: 0.77rem; }
  .playing-card.is-compact .card-corner i { font-size: 0.62rem; }

  .build-board {
    width: min(100%, 15.5rem);
    grid-template-rows: repeat(3, 3.85rem);
    gap: 0.22rem;
  }

  .playing-card.is-build-card {
    flex-basis: 2.55rem;
    width: 2.55rem;
    height: 3.68rem;
  }

  .playing-card.is-build-card .card-corner b {
    font-size: 0.64rem;
  }

  .playing-card.is-build-card .card-suit {
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
