@import url("./type.css");
@import url("./cards.css");

/* Il Tavolo / SIAMO Games brand system. */
:root {
  --navy: #16354a;
  --argilla: #d6534a;
  --action-red: #c3463d;
  --sage: #7da69c;
  --gold: #e3b869;
  --cream: #f5ead5;
  --bg: #fbf8f1;
  --surface: #fffdf8;
  --ink: var(--navy);
  --muted: #536b70;
  --line: #dedcd3;
  --paper: #fffaf0;
  --coral: #c3463d;
  --card-w: clamp(70px, calc(17dvh - 40px), 102px);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  line-height: 1.45;
}
button,
input {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  border: 0;
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--action-red);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.08;
}
h1 {
  font-size: clamp(40px, 5.4vw, 64px);
}
h2 {
  font-size: clamp(28px, 3vw, 38px);
}
p {
  color: var(--muted);
}
button {
  transition:
    background 0.15s,
    color 0.15s;
}
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #536e75;
  margin-bottom: 14px;
}
.masthead {
  height: 88px;
  max-width: 1240px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  margin: auto;
}
.wordmark {
  display: block;
  flex: none;
  width: 180px;
  line-height: 0;
}
.wordmark img {
  width: 180px;
  height: 60px;
  object-fit: contain;
}
.club-tag {
  margin: auto;
  color: var(--muted);
  font-size: 13px;
}
.header-join {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--navy);
  border-radius: 12px;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}
.header-join span {
  margin-left: 8px;
}
.header-join:hover {
  background: var(--navy);
  color: var(--cream);
}
.text-button {
  background: none;
  min-height: 44px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
}
.masthead > .text-button {
  white-space: nowrap;
}
.home-shell {
  width: min(1192px, calc(100% - 48px));
  margin: 12px auto 0;
}
.home-hero {
  background: var(--navy);
  border-radius: 24px;
  color: var(--cream);
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  position: relative;
  overflow: hidden;
  min-height: 450px;
}
.hero-copy {
  padding: 60px 0 44px 52px;
  position: relative;
  z-index: 2;
}
.hero-copy .eyebrow {
  color: #bfd4d2;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mini-line {
  width: 22px;
  height: 2px;
  background: var(--gold);
}
.hero-copy h1 {
  margin: 26px 0 22px;
  font-size: clamp(44px, 5.2vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}
.hero-copy h1 em {
  color: var(--gold);
  font-style: normal;
}
.intro {
  color: #d3dfdd;
  line-height: 1.65;
  font-size: 16px;
  max-width: 480px;
}
.primary,
.secondary {
  min-height: 50px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 800;
}
.primary {
  background: var(--navy);
  color: var(--surface);
}
.primary:enabled:hover {
  background: #254e64;
}
.primary:disabled,
.secondary:disabled {
  opacity: 0.45;
}
.secondary {
  background: var(--action-red);
  color: white;
}
.secondary:enabled:hover {
  background: #a53933;
}
.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.cream-button {
  background: var(--cream);
  color: var(--navy);
  min-width: 170px;
}
.cream-button:enabled:hover {
  background: #fff4dd;
}
.light-button {
  border: 1px solid #f5ead570;
  background: transparent;
  color: var(--cream);
}
.light-button:enabled:hover {
  background: #f5ead51a;
}
.hero-foot {
  font-size: 11px;
  color: #bed4d3;
  margin: 32px 0 0;
}
.hero-foot span {
  padding: 0 8px;
}
.hero-art {
  position: relative;
  min-width: 0;
}
.hero-ring {
  position: absolute;
  width: 420px;
  height: 420px;
  border: 1px solid #f5ead515;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.inner-ring {
  width: 300px;
  height: 300px;
}
.hero-cards {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 310px;
  height: 270px;
}
.hero-cards > .card-back,
.hero-cards > .card-face {
  position: absolute;
  width: 144px;
  height: 222px;
  border-radius: 12px;
  box-shadow: 0 14px 24px #08253640;
}
.hero-cards > .card-back {
  left: 18px;
  top: 30px;
  transform: rotate(-16deg);
  border-width: 5px;
  background: var(--argilla);
}
.hero-cards > .card-back img {
  border-radius: 10px;
}
.hero-cards > .card-face {
  left: 150px;
  top: 12px;
  transform: rotate(12deg);
}
.hero-token {
  position: absolute;
  width: 76px;
  height: 76px;
  right: 30px;
  bottom: 30px;
  border-radius: 18px;
  transform: rotate(-10deg);
}
.welcome {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 64px;
  align-items: start;
  margin: 64px 0 48px;
  scroll-margin-top: 20px;
}
.game-intro > h2 {
  font-size: 38px;
  margin-bottom: 15px;
}
.game-intro > p {
  font-size: 16px;
  line-height: 1.6;
}
.game-feature {
  position: relative;
  overflow: hidden;
  border: 1px solid #d9e1d7;
  border-radius: 20px;
  background: #edf1e9;
  padding: 30px;
  margin-top: 28px;
}
.feature-tag {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: #536b63;
}
.game-feature h3 {
  font-size: 32px;
  margin: 100px 0 10px;
}
.game-feature p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.feature-cards {
  position: absolute;
  right: 32px;
  top: 58px;
  height: 170px;
  width: 155px;
}
.feature-cards .card-face {
  position: absolute;
  width: 87px;
  height: 135px;
  transform: rotate(-14deg);
  top: 12px;
  left: 0;
}
.feature-cards .card-face:last-child {
  transform: rotate(12deg);
  left: 63px;
  top: 0;
}
.feature-footer {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #436358;
}
.status-dot,
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
  display: inline-block;
}
.gather-note {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 30px;
}
.join-panel {
  background: var(--surface);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.panel-heading .eyebrow {
  font-size: 9px;
  margin: 0;
}
.pill {
  font-size: 9px;
  font-weight: 700;
  background: #edf1e9;
  border-radius: 20px;
  padding: 7px 9px;
  white-space: nowrap;
  color: #456358;
}
.join-panel h2 {
  font-size: 32px;
  margin-bottom: 10px;
}
.join-panel > p {
  font-size: 15px;
  margin-bottom: 26px;
}
.mode-picker {
  border: 0;
  padding: 0;
  margin: 0 0 20px;
  min-width: 0;
}
.mode-picker legend,
label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 9px;
}
.mode-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mode-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.mode-options label {
  margin: 0;
  padding: 14px 5px;
  border: 1px solid #dedfd5;
  border-radius: 12px;
  background: #f8f8f1;
  text-align: center;
  cursor: pointer;
  line-height: 1.3;
}
.mode-options label b {
  display: block;
  font-size: 12px;
}
.mode-options label span {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  display: block;
  margin-top: 5px;
}
.mode-options input:checked + label {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.mode-options input:checked + label span {
  color: #c9dcd9;
}
.mode-options input:focus-visible + label {
  outline: 3px solid var(--action-red);
  outline-offset: 3px;
}
input {
  width: 100%;
  height: 52px;
  min-width: 0;
  border: 1px solid #ccd4d1;
  border-radius: 12px;
  background: white;
  padding: 0 14px;
  color: var(--ink);
  font-size: 16px;
}
input::placeholder {
  color: #6d8184;
  font-size: 13px;
}
#nickname {
  margin-bottom: 16px;
}
#room-form > .primary {
  width: 100%;
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin: 26px 0 20px;
}
.or:before,
.or:after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}
.join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.join-row input {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}
.home-rules {
  display: block;
  margin: 8px auto -6px;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.form-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  margin: 22px 0 0;
}
body > footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1192px;
  border-top: 1px solid var(--line);
  margin: 0 auto;
  padding: 26px 0 34px;
  font-size: 11px;
  color: var(--muted);
}
footer a {
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
}
.loading {
  text-align: center;
  padding: 100px 24px;
}
.loading .secondary {
  margin: 30px auto;
}

/* Portrait table: hand, turn and score stay inside the phone's visual viewport. */
body.is-table {
  height: 100dvh;
  min-height: 540px;
  display: flex;
  flex-direction: column;
}
.is-table .masthead {
  flex: 0 0 calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  width: min(1200px, 100%);
  height: auto;
}
.is-table .wordmark,
.is-table .wordmark img {
  width: 160px;
}
.is-table .wordmark img {
  height: 52px;
}
.is-table .header-join,
.is-table .club-tag,
.is-table > footer {
  display: none;
}
.is-table .masthead > .text-button {
  margin-left: auto;
}
.is-table #app {
  flex: 1;
  min-height: 0;
}
.game-shell {
  height: 100%;
  width: min(760px, 100%);
  margin: auto;
  padding: 0 max(12px, env(safe-area-inset-left))
    max(5px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: 44px 132px minmax(0, 1fr) 38px auto 44px;
  gap: 6px;
}
.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.table-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.table-title .eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--navy);
}
.table-title small {
  font-size: 8px;
  color: var(--muted);
  margin-left: 6px;
}
.connection {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
}
.dot {
  background: var(--argilla);
  width: 6px;
  height: 6px;
}
.dot.online {
  background: #45816e;
}
.room-code,
.solo-table-tag {
  border: 1px solid #d0d9d3;
  background: #edf1e9;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.room-code > span {
  font-size: 9px;
  color: var(--muted);
  font-weight: 700;
}
.room-code strong {
  font-size: 13px;
  letter-spacing: 0.09em;
}
.room-code .copy-icon {
  font-size: 20px;
  color: var(--navy);
}
.solo-table-tag {
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #37594e;
}
.game-aside {
  display: contents;
}
.table-people {
  display: none;
}
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 82px 1fr;
  grid-template-rows: minmax(0, 1fr) 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
}
.score-team {
  min-width: 0;
  padding: 8px 12px 0;
  color: var(--navy);
}
.score-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.team-color {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
}
.opponent-score .team-color {
  background: var(--argilla);
}
.score-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 1px 0 4px;
}
.score-value strong {
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}
.score-value > span {
  font-size: 10px;
  color: var(--muted);
}
.score-team progress {
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 10px;
  background: #e6e7dd;
  overflow: hidden;
  accent-color: var(--sage);
}
.score-team progress::-webkit-progress-bar {
  background: #e6e7dd;
  border-radius: 10px;
}
.score-team progress::-webkit-progress-value {
  background: var(--sage);
  border-radius: 10px;
}
.score-team progress::-moz-progress-bar {
  background: var(--sage);
  border-radius: 10px;
}
.opponent-score progress {
  accent-color: var(--argilla);
}
.opponent-score progress::-webkit-progress-value {
  background: var(--argilla);
}
.opponent-score progress::-moz-progress-bar {
  background: var(--argilla);
}
.score-team small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}
.score-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 9px;
  text-align: center;
}
.score-middle > b {
  font-size: 22px;
  line-height: 1;
  margin: 4px 0 2px;
  font-weight: 800;
}
.score-middle > span {
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.score-middle .live-label {
  font-size: 7px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.live-label i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #45816e;
}
.score-middle .round-label {
  font-size: 7px;
  margin-top: 4px;
}
.score-footnote {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-top: 1px solid #e9e7de;
}
.score-footnote > span {
  font-size: 9px;
  color: var(--muted);
}
.score-footnote i {
  font-style: normal;
  margin: 0 4px;
}
.score-footnote .text-button {
  font-size: 10px;
  padding: 0 0 0 4px;
}
.score-footnote button span {
  margin-left: 3px;
}

/* Calm navy surface and quiet circles from the supplied reference. */
.felt-table {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  border: 3px solid #315769;
  border-radius: 20px;
  color: var(--cream);
  background: #193c52;
}
.felt-line {
  position: absolute;
  width: 420px;
  height: 420px;
  border: 1px solid #f5ead518;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.inner-line {
  width: 290px;
  height: 290px;
}
.player {
  position: absolute;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  z-index: 3;
}
.avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.seat-color-top {
  background: var(--sage);
}
.player-left .avatar,
.seat-color-left {
  background: var(--gold);
}
.player-right .avatar,
.seat-color-right {
  background: var(--argilla);
  color: white;
}
.player-bottom .avatar,
.self-player .avatar,
.seat-color-bottom {
  background: var(--cream);
  color: var(--navy);
}
.avatar .presence {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border: 2px solid #193c52;
  border-radius: 50%;
  background: #d6534a;
}
.avatar .presence.is-online {
  background: #aed4b6;
}
.player strong {
  font-size: 11px;
  font-weight: 700;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player > span {
  font-size: 9px;
  color: #c1d4d4;
}
.dealer-badge {
  display: inline-flex;
  width: 13px;
  height: 13px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  font-size: 8px;
  margin-left: 3px;
  vertical-align: middle;
}
.active-player .avatar {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.active-player .avatar:before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  animation: turn-pulse 2.4s ease-out infinite;
}
.active-player > span {
  color: #ffe0a1;
}
.offline-player {
  opacity: 0.65;
}
.player-top {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 95px;
  width: max-content;
  display: grid;
  grid-template-columns: 32px auto;
  column-gap: 8px;
  text-align: left;
  justify-items: start;
}
.player-top .avatar {
  grid-row: span 2;
}
.player-top > strong {
  align-self: end;
}
.player-top > span {
  align-self: start;
}
.player-top .mini-hand {
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
}
.player-left {
  top: 44%;
  left: 6px;
  transform: translateY(-50%);
}
.player-right {
  top: 44%;
  right: 6px;
  transform: translateY(-50%);
}
.player-bottom {
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
}
.mini-hand {
  display: flex;
  justify-content: center;
  height: 32px;
  margin-top: 3px;
}
.mini-hand .card-back {
  width: 21px;
  height: 32px;
  border-width: 2px;
  margin: 0 -5px;
  border-radius: 4px;
}
.mini-hand .card-back:before {
  inset: 2px;
}
.trick-area {
  position: absolute;
  width: 180px;
  height: 184px;
  left: 50%;
  top: 51%;
  transform: translate(-50%, -50%);
}
.played-card {
  position: absolute;
  width: 60px;
  height: 92px;
  z-index: 1;
}
.played-card > .card-face {
  width: 100%;
  height: 100%;
}
.played-card > span:not(.card-face) {
  display: none;
}
.played-top {
  left: 60px;
  top: 0;
}
.played-top > .card-face {
  transform: rotate(-4deg);
}
.played-left {
  left: 4px;
  top: 42px;
  z-index: 2;
}
.played-left > .card-face {
  transform: rotate(-10deg);
}
.played-right {
  left: 116px;
  top: 42px;
  z-index: 3;
}
.played-right > .card-face {
  transform: rotate(8deg);
}
.played-bottom {
  left: 60px;
  top: 86px;
  z-index: 4;
}
.played-bottom > .card-face {
  transform: rotate(4deg);
}
.table-stamp {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.table-stamp img {
  width: 64px;
  height: 64px;
  border-radius: 15px;
}
.table-stamp > span {
  font-size: 7px;
  color: #b7cbcd;
  letter-spacing: 0.1em;
}
.deck-area {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
}
.stock-cards {
  position: relative;
  width: 62px;
  height: 64px;
  flex-shrink: 0;
}
.stock-cards > .card-back {
  position: absolute;
  width: 38px;
  height: 59px;
  left: 2px;
  top: 0;
  transform: rotate(-8deg);
  border-width: 3px;
}
.stock-cards > .card-face {
  position: absolute;
  left: 19px;
  top: 3px;
  width: 38px;
  height: 59px;
  transform: rotate(12deg);
  border-radius: 4px;
}
.trump-symbol {
  width: 34px;
  height: 48px;
  background: var(--cream);
  margin: 6px auto;
  padding: 3px;
  border-radius: 6px;
  display: flex;
}
.deck-area > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.deck-label {
  font-size: 7px;
  letter-spacing: 0.08em;
  color: #c1d4d4;
  font-weight: 700;
}
.deck-area b {
  font-size: 11px;
  font-weight: 700;
}
.deck-area > div:last-child > span:last-child {
  font-size: 9px;
  color: #c1d4d4;
}
.trick-pot {
  position: absolute;
  bottom: 14px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 5;
}
.trick-pot > span {
  font-size: 7px;
  letter-spacing: 0.06em;
  color: #c1d4d4;
}
.trick-pot > span:last-child {
  font-size: 9px;
  letter-spacing: 0;
}
.trick-pot > b {
  font-size: 27px;
  line-height: 1;
  color: var(--cream);
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}
.trick-pot small {
  font-size: 9px;
  color: #c1d4d4;
  font-weight: 500;
}
.turn-banner {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #415d63;
  font-size: 12px;
  border-radius: 10px;
  background: #edf0e9;
}
.your-turn {
  color: #255c4a;
  background: #e3eee3;
  font-weight: 800;
}
.your-turn .status-dot {
  background: #45816e;
}
.turn-arrow {
  font-size: 16px;
  margin-left: 3px;
}
.is-offline {
  color: #9e3731;
  background: #f8e7e1;
}
.hand-area {
  padding: 6px 12px 3px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.hand-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  gap: 8px;
}
.self-player {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.self-player .avatar {
  width: 27px;
  height: 27px;
  font-size: 12px;
}
.self-player > span:last-child {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 700;
  gap: 1px;
  max-width: 140px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.self-player small {
  font-size: 8px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.hand-title > span {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted);
}
.hand-active .hand-title > span {
  color: #346d59;
}
.hand {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 6px;
  min-height: calc(var(--card-w) * 1.55 + 16px);
}
.play-card {
  width: var(--card-w);
  height: calc(var(--card-w) * 1.55);
  padding: 0;
  border-radius: 10px;
  background: none;
  flex-shrink: 0;
  position: relative;
}
.play-card .card-face {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  box-shadow: 0 5px 12px #16354a20;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.play-card:enabled .card-face {
  border-color: #709d8f;
  box-shadow:
    0 0 0 1px #7da69c55,
    0 5px 12px #16354a20;
}
.play-card:disabled .card-face {
  filter: saturate(0.85);
}
.play-card:enabled:active .card-face {
  transform: translateY(-9px);
}
@media (hover: hover) {
  .play-card:enabled:hover .card-face,
  .play-card:enabled:focus-visible .card-face {
    transform: translateY(-8px);
    box-shadow: 0 8px 16px #16354a30;
  }
}
.last-trick {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}
.points-gain {
  font-size: 12px;
  font-weight: 800;
  color: #346d59;
}
.last-lost .points-gain {
  color: var(--action-red);
}
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  gap: 8px;
}
.table-footer > span {
  font-size: 8px;
  letter-spacing: 0.02em;
}
.table-footer .text-button {
  font-size: 11px;
  min-width: 72px;
}

/* Lobby and results. */
.game-shell.is-lobby {
  grid-template-rows: 44px auto minmax(0, 1fr) 38px auto 44px;
}
.lobby-heading {
  text-align: center;
  padding: 10px 0;
}
.lobby-heading .eyebrow {
  font-size: 9px;
  margin: 0 0 9px;
}
.lobby-heading h1 {
  font-size: 36px;
  margin-bottom: 10px;
}
.lobby-heading p:not(.eyebrow) {
  font-size: 14px;
  margin-bottom: 12px;
}
.seats-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.seats-counter > span {
  width: 15px;
  height: 5px;
  background: #dce5dc;
  border-radius: 3px;
}
.seats-counter .seat-filled {
  background: var(--sage);
}
.seats-counter b {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 6px;
}
.lobby-table .player-top {
  display: flex;
  flex-direction: column;
  text-align: center;
  width: 100px;
  align-items: center;
}
.lobby-table .player-top > strong,
.lobby-table .player-top > span {
  align-self: center;
}
.table-invitation {
  position: absolute;
  left: 50%;
  top: 51%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 160px;
}
.table-monogram {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  margin: auto;
}
.table-invitation p {
  color: var(--cream);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 10px 0;
}
.table-invitation > span:last-child {
  font-size: 7px;
  color: #c1d4d4;
  letter-spacing: 0.08em;
}
.lobby-controls {
  padding: 4px 12px;
  max-width: 450px;
  width: 100%;
  margin: auto;
  text-align: center;
}
.lobby-controls .primary {
  width: 100%;
}
.lobby-controls p {
  font-size: 12px;
  margin: 12px 0 0;
}
.waiting-pulse {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 10px;
}
.waiting-pulse span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
  animation: waiting 1.4s ease-in-out infinite;
}
.waiting-pulse span:nth-child(2) {
  animation-delay: 0.15s;
}
.waiting-pulse span:nth-child(3) {
  animation-delay: 0.3s;
}
.results {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
  padding: 16px;
}
.results .eyebrow {
  color: #356a58;
  font-size: 10px;
  margin-bottom: 10px;
}
.results h2 {
  font-size: clamp(26px, 6vw, 36px);
  margin-bottom: 10px;
}
.results > p:not(.eyebrow) {
  font-size: 12px;
  margin-bottom: 12px;
}
.results .primary {
  width: 100%;
  max-width: 370px;
  margin: 14px auto 0;
}
.results .muted {
  margin-bottom: 0;
}

/* Points and help sheets use the same cream components. */
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  width: min(92%, 540px);
  max-height: 88dvh;
  padding: 28px;
  box-shadow: 0 24px 80px #0c29364d;
  line-height: 1.6;
}
dialog::backdrop {
  background: #102b3dbb;
  backdrop-filter: blur(4px);
}
.dialog-close {
  float: right;
  font-size: 18px;
  width: 44px;
  border-radius: 50%;
  background: #edf1e9;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -12px -12px 0 0;
}
dialog .eyebrow {
  margin-top: 7px;
  font-size: 9px;
}
dialog h2 {
  font-size: 30px;
  margin: 15px 0 20px;
}
dialog p,
dialog li {
  font-size: 14px;
  color: var(--muted);
}
dialog ol {
  padding-left: 20px;
}
dialog li {
  margin: 11px 0;
}
dialog a {
  font-size: 13px;
  font-weight: 700;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.points-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 18px 0;
  border-block: 1px solid var(--line);
}
.points-summary > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.points-summary span {
  font-size: 12px;
  font-weight: 700;
}
.points-summary b {
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.points-summary small {
  font-size: 12px;
  color: var(--muted);
}
dialog .points-help {
  font-size: 12px;
  margin-top: 16px;
}
.history-heading,
.history-row {
  display: grid;
  grid-template-columns: 1fr 48px 82px;
  gap: 6px;
  align-items: center;
}
.history-heading {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 0;
}
.history-heading > span:last-child,
.history-row > span:last-child {
  text-align: right;
}
.history-row {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  font-size: 12px;
}
.history-row > span:first-child {
  display: flex;
  gap: 12px;
  align-items: center;
}
.history-row > span > b {
  font-size: 18px;
  color: #647b7a;
}
.history-row small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.history-row > b {
  color: #346d59;
}
.history-row.won-by-them > b {
  color: var(--action-red);
}
.history-row > span:last-child {
  font-variant-numeric: tabular-nums;
}
dialog .history-empty {
  padding: 25px 5px;
  font-size: 13px;
  text-align: center;
}
dialog .points-legend {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 11px;
}
#notice {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 20px);
  padding: 14px 18px;
  background: var(--navy);
  color: var(--cream);
  border-radius: 12px;
  box-shadow: 0 8px 30px #16354a30;
  width: max-content;
  max-width: 90%;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 30;
}
#notice.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.flying-card {
  position: fixed;
  z-index: 15;
  pointer-events: none;
}
.flying-card > .card-face {
  width: 100%;
  height: 100%;
}
.flying-card > span:not(.card-face) {
  display: none;
}
.confetti {
  position: fixed;
  left: 0;
  top: 0;
  width: 6px;
  height: 11px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 20;
}
@keyframes turn-pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  75%,
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}
@keyframes waiting {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@media (max-width: 800px) {
  .masthead {
    height: 72px;
    gap: 10px;
    padding: 0 16px;
  }
  .wordmark,
  .wordmark img {
    width: 160px;
  }
  .club-tag {
    display: none;
  }
  .header-join {
    margin-left: auto;
  }
  .masthead > .text-button {
    display: none;
  }
  .is-table .masthead > .text-button {
    display: block;
  }
  .home-shell {
    width: calc(100% - 28px);
    margin-top: 4px;
  }
  .home-hero {
    grid-template-columns: 1fr;
    border-radius: 20px;
    min-height: 0;
  }
  .hero-copy {
    padding: 34px 26px 0;
  }
  .hero-copy h1 {
    font-size: clamp(40px, 8vw, 58px);
    margin: 23px 0 20px;
  }
  .hero-copy .eyebrow {
    font-size: 9px;
  }
  .intro {
    font-size: 15px;
  }
  .desktop-break {
    display: none;
  }
  .hero-actions {
    margin-top: 23px;
  }
  .hero-foot {
    margin-top: 24px;
    font-size: 10px;
  }
  .hero-foot span {
    padding: 0 4px;
  }
  .hero-art {
    height: 232px;
  }
  .hero-ring {
    width: 320px;
    height: 320px;
  }
  .inner-ring {
    width: 220px;
    height: 220px;
  }
  .hero-cards {
    width: 230px;
    height: 190px;
  }
  .hero-cards > .card-back,
  .hero-cards > .card-face {
    width: 104px;
    height: 161px;
  }
  .hero-cards > .card-back {
    left: 15px;
    top: 18px;
  }
  .hero-cards > .card-face {
    left: 110px;
    top: 5px;
  }
  .hero-token {
    width: 54px;
    height: 54px;
    right: 22px;
    bottom: 20px;
    border-radius: 12px;
  }
  .welcome {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 26px 0 32px;
  }
  .game-intro {
    display: none;
  }
  .join-panel {
    width: 100%;
    padding: 24px 20px;
    border-radius: 18px;
  }
  .join-panel h2 {
    font-size: 28px;
  }
  .join-panel > p {
    font-size: 14px;
  }
  .panel-heading {
    margin-bottom: 20px;
  }
  .panel-heading .eyebrow {
    font-size: 8px;
  }
  .pill {
    font-size: 8px;
  }
  body > footer {
    margin: 0 16px;
    padding: 22px 0;
    flex-direction: column;
    font-size: 10px;
    gap: 10px;
  }
}
@media (max-width: 400px) {
  .masthead > .header-join {
    font-size: 12px;
    padding: 8px 10px;
  }
  .hero-copy {
    padding-inline: 22px;
  }
  .hero-actions .primary,
  .hero-actions .secondary {
    min-height: 46px;
    padding: 10px 12px;
    font-size: 12px;
  }
  .cream-button {
    min-width: 135px;
  }
  .join-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .join-row .secondary {
    padding-inline: 12px;
    font-size: 12px;
  }
  .mode-options {
    gap: 6px;
  }
  .mode-options label b {
    font-size: 11px;
  }
  .mode-options label span {
    font-size: 9px;
  }
  .connection {
    display: none;
  }
  .game-shell {
    padding-inline: 9px;
  }
  .table-title .eyebrow {
    font-size: 12px;
  }
  .room-code {
    padding-inline: 8px;
  }
  .scoreboard {
    grid-template-columns: 1fr 72px 1fr;
  }
  .score-team {
    padding-inline: 10px;
  }
  .score-label {
    font-size: 8px;
  }
  .score-footnote > span {
    font-size: 8px;
  }
  .score-footnote .text-button {
    font-size: 9px;
  }
  .score-footnote {
    padding-inline: 9px;
  }
  .player {
    width: 64px;
  }
  .player-top {
    width: max-content;
  }
  .player-left {
    left: 3px;
  }
  .player-right {
    right: 3px;
  }
  .trick-area {
    transform: translate(-50%, -50%) scale(0.85);
  }
  .deck-area {
    left: 7px;
    bottom: 10px;
    gap: 0;
  }
  .stock-cards {
    width: 54px;
    transform: scale(0.85);
    transform-origin: left center;
  }
  .trick-pot {
    right: 10px;
  }
  .hand-title > span {
    font-size: 7px;
  }
  .last-trick {
    font-size: 9px;
  }
  .table-footer > span {
    font-size: 7px;
  }
}
@media (max-height: 740px) and (max-width: 900px) {
  .is-table .masthead {
    display: none;
  }
  .game-shell {
    grid-template-rows: 44px 122px minmax(0, 1fr) 36px auto;
    gap: 5px;
    padding-top: max(4px, env(safe-area-inset-top));
  }
  .table-footer {
    position: absolute;
    top: max(4px, env(safe-area-inset-top));
    left: max(9px, env(safe-area-inset-left));
    z-index: 6;
  }
  .table-footer > span {
    display: none;
  }
  .table-footer .text-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    font-size: 0;
  }
  .table-footer .text-button:before {
    content: "‹";
    font-size: 30px;
    color: var(--navy);
  }
  .table-title {
    margin-left: 40px;
  }
  .table-title .connection {
    display: none;
  }
  .score-team {
    padding-top: 6px;
  }
  .score-value strong {
    font-size: 29px;
  }
  .score-team small {
    font-size: 8px;
    margin-top: 2px;
  }
  .score-middle {
    padding-top: 7px;
  }
  .score-middle > b {
    font-size: 20px;
    margin-top: 2px;
  }
  .score-middle .round-label {
    margin-top: 2px;
  }
  .hand-area {
    padding: 4px 8px 2px;
  }
  .hand-title {
    height: 28px;
  }
  .hand {
    padding: 7px 0 4px;
    min-height: calc(var(--card-w) * 1.55 + 11px);
  }
  .last-trick {
    height: 20px;
  }
  .game-shell.is-lobby {
    grid-template-rows: 44px auto minmax(0, 1fr) 36px auto;
  }
  .lobby-heading {
    padding: 6px 0;
  }
  .lobby-heading h1 {
    font-size: 30px;
  }
  .lobby-heading p:not(.eyebrow) {
    font-size: 12px;
  }
  .lobby-controls p {
    font-size: 11px;
    margin-top: 10px;
  }
}
@media (max-height: 620px) and (max-width: 900px) {
  .game-shell {
    --card-w: 68px;
    grid-template-rows: 44px 116px minmax(0, 1fr) 34px auto;
    gap: 4px;
  }
  .trick-area {
    top: 53%;
    transform: translate(-50%, -50%) scale(0.7);
  }
  .player .mini-hand {
    display: none;
  }
  .player-top {
    top: 8px;
  }
  .player .avatar {
    width: 27px;
    height: 27px;
    font-size: 11px;
  }
  .player-top {
    grid-template-columns: 27px auto;
  }
  .player strong {
    font-size: 10px;
  }
  .player > span {
    font-size: 8px;
  }
  .stock-cards {
    transform: scale(0.7);
    transform-origin: left bottom;
    width: 45px;
    height: 48px;
  }
  .stock-cards > .card-back,
  .stock-cards > .card-face {
    top: -10px;
  }
  .deck-area {
    left: 8px;
    bottom: 6px;
  }
  .deck-area b {
    font-size: 10px;
  }
  .deck-area > div:last-child > span:last-child {
    font-size: 8px;
  }
  .deck-label {
    font-size: 6px;
  }
  .trick-pot {
    bottom: 8px;
  }
  .trick-pot > b {
    font-size: 22px;
  }
  .trick-pot > span {
    font-size: 6px;
  }
  .trick-pot > span:last-child {
    font-size: 8px;
  }
  .table-invitation p {
    font-size: 16px;
  }
  .table-monogram {
    width: 40px;
    height: 40px;
  }
  .table-invitation {
    width: 140px;
  }
}
@media (min-width: 901px) {
  body.is-table {
    min-height: 800px;
  }
  .game-shell:not(.is-lobby) {
    --card-w: 100px;
    width: min(1200px, 100%);
    grid-template-columns: minmax(0, 1fr) 288px;
    grid-template-rows: 44px minmax(300px, 1fr) 38px auto 44px;
    gap: 12px 20px;
    padding-bottom: 10px;
  }
  .game-shell:not(.is-lobby) .room-bar {
    grid-column: 1/-1;
  }
  .game-aside {
    display: flex;
    flex-direction: column;
    gap: 14px;
    grid-column: 2;
    grid-row: 2 / 5;
  }
  .game-shell:not(.is-lobby) > .felt-table {
    grid-column: 1;
    grid-row: 2;
  }
  .game-shell:not(.is-lobby) > .turn-banner {
    grid-column: 1;
    grid-row: 3;
  }
  .game-shell:not(.is-lobby) > .hand-area,
  .game-shell:not(.is-lobby) > .results {
    grid-column: 1;
    grid-row: 4;
  }
  .game-shell:not(.is-lobby) > .table-footer {
    grid-column: 1 / -1;
    grid-row: 5;
  }
  .game-aside .scoreboard {
    flex-shrink: 0;
    min-height: 202px;
    grid-template-rows: 1fr 48px;
    grid-template-columns: 1fr 64px 1fr;
  }
  .game-aside .score-team {
    padding: 24px 14px 0;
  }
  .game-aside .score-value {
    margin: 12px 0 10px;
  }
  .game-aside .score-value strong {
    font-size: 38px;
  }
  .game-aside .score-middle {
    padding-top: 25px;
  }
  .game-aside .score-middle > b {
    margin: 14px 0 6px;
  }
  .game-aside .score-middle .round-label {
    margin-top: 12px;
  }
  .game-aside .score-label {
    font-size: 8px;
  }
  .game-aside .score-footnote > span {
    font-size: 8px;
  }
  .game-aside .score-footnote .text-button {
    font-size: 9px;
  }
  .table-people {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .people-card,
  .quick-tip {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
  }
  .people-card .eyebrow,
  .quick-tip .eyebrow {
    margin-bottom: 14px;
    font-size: 9px;
  }
  .roster-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 0;
    border-top: 1px solid #e8e8df;
  }
  .roster-row:last-child {
    padding-bottom: 0;
  }
  .roster-row .avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
  .roster-row > div {
    min-width: 0;
  }
  .roster-row b {
    display: block;
    font-size: 12px;
    max-width: 120px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .roster-row small {
    display: block;
    color: var(--muted);
    font-size: 10px;
  }
  .roster-state {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    color: #346d59;
  }
  .quick-tip {
    background: #edf1e9;
  }
  .quick-tip > p:not(.eyebrow) {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 6px;
  }
  .quick-tip .text-button {
    padding-left: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .player-left {
    left: 20px;
  }
  .player-right {
    right: 20px;
  }
  .player-top {
    top: 18px;
  }
  .player strong {
    font-size: 12px;
  }
  .player > span {
    font-size: 10px;
  }
  .deck-area {
    left: 22px;
    bottom: 18px;
  }
  .trick-pot {
    right: 24px;
    bottom: 24px;
  }
  .trick-area {
    transform: translate(-50%, -50%) scale(1.12);
  }
}
.heads-up .trick-area {
  width: 150px;
  height: 118px;
  top: 49%;
}
.heads-up .played-top {
  left: 6px;
  top: 0;
}
.heads-up .played-bottom {
  left: 82px;
  top: 18px;
}
.heads-up .table-stamp {
  inset: -22px -10px;
}
.player-bot .avatar {
  background: var(--sage);
  color: var(--navy);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Scopa shares room chrome and seats; the centre is a public capture layout. */
.game-picker {
  border: 0;
  padding: 0;
  margin: 0 0 22px;
  min-width: 0;
}
.game-picker legend {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 9px;
}
.game-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.game-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.game-options label {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 0;
  cursor: pointer;
  background: #f8f8f1;
}
.game-options label b {
  display: block;
  font-size: 17px;
}
.game-options label span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.game-options input:checked + label {
  background: #edf1e9;
  border-color: #568677;
  box-shadow: inset 0 0 0 1px #568677;
}
.game-options input:focus-visible + label {
  outline: 3px solid var(--action-red);
  outline-offset: 3px;
}
.scopa-scoreboard .score-team small {
  font-size: 8px;
  line-height: 1.25;
}
.scopa-scoreboard .score-team small b {
  display: block;
  font-size: 9px;
  color: #346d59;
}
.scopa-room .felt-table:not(.lobby-table) .player-left,
.scopa-room .felt-table:not(.lobby-table) .player-right {
  top: 47%;
}
.scopa-board-heading {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c1d4d4;
  white-space: nowrap;
}
.scopa-board-heading span {
  font-size: 7px;
  letter-spacing: 0.08em;
}
.scopa-board-heading b {
  font-size: 9px;
  font-weight: 600;
}
.scopa-board {
  position: absolute;
  top: 76px;
  bottom: 76px;
  left: 76px;
  right: 76px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #7da69c #193c52;
  scrollbar-width: thin;
  padding: 3px 3px 7px;
}
.scopa-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 6px;
  align-content: start;
}
.scopa-table-card {
  position: relative;
  aspect-ratio: 659/1020;
  min-width: 0;
  width: 100%;
  max-width: 80px;
  justify-self: center;
}
.scopa-table-card .card-face {
  width: 100%;
  height: 100%;
}
.capture-value {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 2;
  background: var(--cream);
  color: var(--navy);
  border: 1px solid #d6c9b0;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.scopa-hand-card .capture-value {
  right: 5px;
  bottom: 5px;
  min-width: 22px;
  height: 22px;
  font-size: 13px;
}
.being-captured .card-face {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.scopa-empty {
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: #c1d4d4;
  padding: 12px 0;
}
.scopa-played {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: 38px;
  height: 59px;
  z-index: 4;
}
.scopa-played .card-face {
  width: 100%;
  height: 100%;
}
.scopa-played .capture-value {
  height: 13px;
  min-width: 13px;
  font-size: 8px;
  right: 1px;
  bottom: 1px;
}
.scopa-room .deck-area .stock-cards {
  width: 38px;
}
.scopa-room .deck-area > div:last-child {
  margin-left: 4px;
}
.scopa-pot > b {
  font-size: 24px;
}
.scopa-announcement {
  color: #346d59;
  font-weight: 700;
}
.scopa-room .last-trick {
  text-align: center;
  height: auto;
  min-height: 22px;
  font-size: 9px;
  line-height: 1.3;
  padding: 3px 0;
}
.scopa-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 15px;
}
.scopa-breakdown th,
.scopa-breakdown td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
.scopa-breakdown th:first-child {
  text-align: left;
  font-weight: 600;
}
.scopa-breakdown thead th {
  font-size: 10px;
}
.scopa-round-history {
  margin-top: 24px;
}
.scopa-history-round {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.scopa-history-round summary {
  cursor: pointer;
  min-height: 32px;
  font-size: 13px;
  font-weight: 700;
}
.scopa-history-round summary b {
  float: right;
}
.scopa-history-round p {
  font-size: 12px;
  margin: 0;
}
.scopa-results .round-explanation {
  font-size: 10px;
  margin-bottom: 10px;
}
.capture-options {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
.capture-option {
  min-height: 70px;
  border: 1px solid #cdd8cf;
  border-radius: 12px;
  background: #edf1e9;
  color: var(--navy);
  padding: 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.capture-option:hover {
  border-color: var(--navy);
}
.capture-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 9px;
}
.capture-preview .card-face {
  width: 34px;
  height: 53px;
}
.capture-preview > .capture-value {
  display: none;
}
@media (max-width: 400px) {
  .scopa-board {
    left: 62px;
    right: 62px;
  }
  .scopa-layout {
    gap: 7px 5px;
  }
  .scopa-scoreboard .score-team small {
    font-size: 7px;
  }
  .scopa-scoreboard .score-team small b {
    font-size: 8px;
  }
  .scopa-room .deck-area > div:last-child {
    margin-left: -2px;
  }
}
@media (max-height: 620px) and (max-width: 900px) {
  .scopa-board-heading {
    top: 39px;
  }
  .scopa-board {
    top: 58px;
    bottom: 57px;
  }
  .scopa-played {
    width: 30px;
    height: 46px;
    bottom: 5px;
  }
  .scopa-room .deck-area {
    bottom: 4px;
  }
  .scopa-room .deck-label {
    font-size: 5px;
  }
  .scopa-room .deck-area > div:last-child > span:last-child {
    font-size: 7px;
  }
  .scopa-room .scopa-pot {
    bottom: 7px;
  }
  .scopa-room .last-trick {
    font-size: 8px;
    min-height: 20px;
  }
  .scopa-results {
    padding: 10px;
  }
  .scopa-results h2 {
    font-size: 24px;
    margin-bottom: 8px;
  }
  .scopa-results .round-explanation {
    font-size: 9px;
  }
}
@media (min-width: 901px) {
  .scopa-board {
    left: 118px;
    right: 118px;
    top: 84px;
    bottom: 90px;
  }
  .scopa-layout {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px 8px;
  }
  .scopa-board-heading {
    top: 58px;
  }
  .scopa-board-heading span {
    font-size: 9px;
  }
  .scopa-board-heading b {
    font-size: 11px;
  }
  .scopa-table-card {
    max-width: 80px;
  }
  .scopa-room .game-aside .scoreboard {
    min-height: 220px;
  }
}
.scopa-scoreboard .score-team small b {
  display: inline;
  margin-left: 3px;
}
.scopa-layout {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.scopa-scroll-hint {
  font-size: 8px;
  font-weight: 400;
}
.scopa-board:focus-visible {
  outline-color: var(--gold);
}
@media (max-height: 620px) and (max-width: 900px) {
  .scopa-board {
    top: 55px;
    bottom: 52px;
  }
  .scopa-table-card .capture-value {
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    bottom: 1px;
    right: 1px;
    border-radius: 3px;
  }
}

/* Tombola: a warm numbered ticket and a shared caller's board. */
body.is-table.is-tombola {
  height: auto;
  min-height: 100dvh;
  display: block;
}
.is-tombola #app {
  min-height: 0;
}
.is-tombola .masthead {
  height: 64px;
  min-height: 64px;
}
.tb-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 max(16px, env(safe-area-inset-bottom));
}
.tb-shell > .room-bar {
  margin-bottom: 18px;
}
.tb-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 24px;
}
.tb-panel h2 {
  font-size: 25px;
  margin-bottom: 18px;
}
.tb-panel .eyebrow {
  font-size: 9px;
  margin-bottom: 8px;
}
.tb-lobby-copy {
  text-align: center;
  max-width: 650px;
  margin: 40px auto;
}
.tb-lobby-copy h1 {
  font-size: clamp(36px, 5vw, 54px);
  margin-bottom: 18px;
}
.tb-lobby-copy > p:not(.eyebrow) {
  font-size: 16px;
  line-height: 1.6;
}
.tb-lobby-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.tb-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid #e8e8df;
}
.tb-person > span:nth-child(2) {
  min-width: 0;
}
.tb-person b {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.tb-person small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.tb-presence {
  margin-left: auto;
  font-size: 11px;
  color: #346d59;
  white-space: nowrap;
}
.tb-welcome {
  background: #edf1e9;
}
.tb-welcome p {
  font-size: 15px;
  line-height: 1.6;
}
.tb-welcome .primary {
  width: 100%;
  margin-top: 24px;
}
.tb-demo-numbers {
  display: flex;
  gap: 14px;
  margin: 8px 0 32px;
}
.tb-demo-numbers span {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--cream);
  display: grid;
  place-items: center;
  font-size: 29px;
  font-weight: 800;
}
.tb-demo-numbers span:nth-child(2) {
  background: var(--action-red);
  color: white;
  transform: rotate(8deg);
}
.tb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}
.tb-game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}
.tb-main,
.tb-aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.tb-call {
  background: var(--navy);
  color: var(--cream);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.tb-call .eyebrow {
  color: #c1d4d4;
  font-size: 10px;
  margin-bottom: 12px;
}
.tb-last-number {
  font-size: 88px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
}
.tb-call p:not(.eyebrow) {
  color: #d3dfdd;
  font-size: 13px;
  margin: 14px 0 0;
}
.tb-recent {
  max-width: 180px;
}
.tb-recent > span {
  font-size: 8px;
  letter-spacing: 0.1em;
  color: #c1d4d4;
}
.tb-recent > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  margin: 10px 0;
}
.tb-recent b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
}
.tb-recent small {
  font-size: 10px;
  color: #c1d4d4;
}
.tb-ticket-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.tb-ticket-heading h2 {
  margin: 0;
  font-size: 25px;
  overflow-wrap: anywhere;
}
.tb-ticket-heading .pill {
  font-size: 13px;
}
.tb-ticket {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
  padding: 5px;
  border: 1px solid #d0c5ad;
  background: var(--cream);
  border-radius: 12px;
}
.tb-ticket-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 56px;
  background: #fffdf8;
  color: var(--navy);
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border-radius: 5px;
}
.tb-ticket-cell.blank {
  background: #e8dfcc;
}
.tb-ticket-cell.marked {
  background: var(--sage);
}
.tb-ticket-cell.marked:after {
  content: "";
  position: absolute;
  width: 6px;
  height: 3px;
  border-left: 1.5px solid var(--navy);
  border-bottom: 1.5px solid var(--navy);
  transform: rotate(-45deg);
  bottom: 6px;
}
.tb-ticket-cell.current {
  background: var(--action-red);
  color: white;
}
.tb-ticket-cell.current:after {
  border-color: white;
}
.tb-row-progress {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-top: 15px;
  color: var(--muted);
}
.tb-row-progress b {
  color: var(--navy);
  margin-left: 4px;
}
.tb-help {
  font-size: 12px !important;
  line-height: 1.6;
  color: var(--muted);
  margin: 14px 0 0;
}
.tb-panel summary {
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
}
.tb-panel summary > span {
  float: right;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.tb-number-board {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  margin-top: 14px;
}
.tb-board-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: #edf0e9;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tb-board-cell.called {
  background: var(--sage);
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tb-board-cell.current {
  background: var(--action-red);
  color: white;
}
.tb-prize {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.tb-prize > div {
  flex-shrink: 0;
}
.tb-prize b {
  display: block;
  font-size: 14px;
}
.tb-prize small {
  display: block;
  font-size: 10px;
  margin-top: 3px;
  color: var(--muted);
}
.tb-prize > span {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.tb-prize.awarded > span {
  color: var(--navy);
  font-weight: 700;
}
.tb-prize.won-by-you {
  border-left: 3px solid var(--sage);
  padding-left: 9px;
}
.tb-result {
  background: #edf1e9;
}
.tb-result h2 {
  font-size: 38px;
  margin-bottom: 12px;
}
.tb-result > p:not(.eyebrow) {
  font-size: 18px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.tb-result .primary {
  width: 100%;
  margin-top: 22px;
}
.tb-draw-controls {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0 max(12px, env(safe-area-inset-bottom));
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  margin-top: 22px;
  z-index: 6;
}
.tb-draw-controls p {
  margin: 0;
  font-size: 13px;
}
.tb-draw-controls .primary {
  min-width: 220px;
}
.tb-auto-label {
  font-size: 11px;
  color: #346d59;
}
.tb-mode-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.tb-mode-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.tb-mode-options label {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}
.tb-mode-options label b,
.tb-mode-options label span {
  display: block;
}
.tb-mode-options label b {
  font-size: 13px;
}
.tb-mode-options label span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.tb-mode-options input:checked + label {
  background: #edf1e9;
  border-color: #568677;
  box-shadow: inset 0 0 0 1px #568677;
}
.tb-mode-options input:focus-visible + label {
  outline: 3px solid var(--action-red);
  outline-offset: 3px;
}
.game-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.game-options label {
  padding: 12px 10px;
}
.game-options label b {
  font-size: 15px;
}
.game-options label span {
  font-size: 10px;
}
.fresh-draw .tb-last-number {
  animation: tb-number 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes tb-number {
  from {
    opacity: 0.3;
    transform: translateY(-12px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (max-width: 900px) {
  .tb-game-layout {
    grid-template-columns: 1fr;
  }
  .tb-lobby-layout {
    grid-template-columns: 1fr;
  }
  .tb-shell {
    width: calc(100% - 28px);
  }
  .tb-panel {
    padding: 20px;
  }
  .tb-call {
    padding: 24px;
  }
  .tb-last-number {
    font-size: 76px;
  }
  .tb-call > div:first-child {
    min-width: 0;
  }
  .tb-recent {
    width: 125px;
    flex-shrink: 0;
  }
  .tb-recent b {
    width: 27px;
    height: 27px;
    font-size: 12px;
  }
  .tb-recent > div {
    gap: 4px;
  }
  .tb-ticket-cell {
    min-height: 44px;
    font-size: 19px;
  }
  .tb-ticket-panel {
    padding: 18px 12px;
  }
  .tb-ticket {
    padding: 3px;
    gap: 2px;
  }
  .tb-ticket-heading {
    padding: 0 5px;
  }
  .tb-ticket-heading h2 {
    font-size: 22px;
  }
  .tb-row-progress {
    padding: 0 5px;
    font-size: 10px;
  }
  .tb-board-cell {
    font-size: 12px;
  }
  .tb-number-board {
    gap: 3px;
  }
  .tb-draw-controls {
    flex-direction: column;
    gap: 10px;
  }
  .tb-draw-controls .primary {
    width: 100%;
  }
  .tb-draw-controls p {
    font-size: 12px;
  }
  .tb-lobby-copy {
    margin: 24px 0;
  }
  .is-tombola .masthead {
    display: flex;
  }
  .tb-auto-label {
    display: none;
  }
}
@media (max-width: 360px) {
  .tb-call {
    padding: 20px;
    gap: 10px;
  }
  .tb-last-number {
    font-size: 64px;
  }
  .tb-recent {
    width: 105px;
  }
  .tb-ticket-cell {
    font-size: 16px;
    min-height: 42px;
  }
  .game-options label {
    padding: 12px 7px;
  }
  .game-options label b {
    font-size: 13px;
  }
  .game-options label span {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fresh-draw .tb-last-number {
    animation: none;
  }
}
@media (max-height: 620px) and (max-width: 900px) {
  .is-tombola .masthead {
    height: 56px;
    min-height: 56px;
  }
  .tb-shell > .room-bar {
    margin-bottom: 12px;
  }
  .tb-call {
    padding: 18px;
  }
  .tb-call > div:first-child > p:not(.eyebrow) {
    display: none;
  }
  .tb-last-number {
    font-size: 56px;
  }
  .tb-call .eyebrow {
    font-size: 8px;
    margin-bottom: 8px;
  }
  .tb-ticket-heading {
    margin-bottom: 14px;
  }
  .tb-main,
  .tb-aside {
    gap: 14px;
  }
}
.tb-draw-controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100% - 32px));
  margin: 0;
  bottom: 0;
  box-shadow: 0 -8px 20px #fbf8f1c0;
}
.tb-shell:has(.tb-draw-controls) {
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
@media (max-height: 620px) and (max-width: 900px) {
  .is-tombola .masthead {
    display: none;
  }
}
