:root {
  --game-felt: #1e5b3a;
  --game-felt-dark: #16462d;
  --game-rim: #6f4a28;
  --game-panel: #f7f3e8;
  --game-ink: #232323;
  --game-muted: #6f6a60;
  --game-gold: #d9a441;
  --game-red: #b9433a;
  --game-blue: #3b6fb6;
  --game-card-radius: 11px;
}

body {
  --card-w: clamp(58px, 6vw, 84px);
}

#field.game-page {
  padding: 0;
  margin: 0;
  min-height: 0;
}

.game-shell,
.game-shell *,
.game-shell *::before,
.game-shell *::after {
  box-sizing: border-box;
}

.game-shell {
  position: relative;
  width: min(1320px, calc(100vw - 20px));
  margin: 0 auto 24px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--game-ink);
}

.game-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--game-panel);
  border: 1px solid #bdb6a8;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.game-title {
  font-size: 18px;
  font-weight: 700;
}

.game-subtitle {
  font-size: 12px;
  color: var(--game-muted);
}

.game-turn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #efe6cc;
  border: 1px solid #d8c58f;
  font-size: 13px;
  font-weight: 600;
}

.game-turn.active {
  background: #e3f5e6;
  border-color: #2e9b45;
  color: #1f6b33;
  box-shadow: 0 0 0 3px rgba(46, 155, 69, 0.18);
}

.game-turn.active .game-turn-dot {
  background: #2e9b45;
}

.game-turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--game-gold);
}

.game-scores {
  position: relative;
}

.game-scoreboard {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  cursor: pointer;
}

.game-scoreboard::-webkit-details-marker {
  display: none;
}

.game-score-caret {
  font-size: 11px;
  color: var(--game-muted);
}

.game-score-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 300px;
  max-width: min(520px, 90vw);
  padding: 10px;
  background: var(--game-panel);
  border: 1px solid #bdb6a8;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.game-score-title {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.game-score-dropdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.game-score-dropdown th,
.game-score-dropdown td {
  padding: 4px 8px;
  text-align: right;
  border-bottom: 1px solid #e5e0d6;
}

.game-score-dropdown th:first-child,
.game-score-dropdown td:first-child {
  text-align: left;
}

.game-score-dropdown .score-meld {
  color: var(--game-muted);
  font-size: 10px;
}

.game-score-dropdown .score-total td {
  font-weight: 700;
  border-bottom: none;
}

.game-score {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d3ccbd;
  font-size: 13px;
}

.game-score strong { font-size: 15px; }

.team-chip {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 7px;
  border-radius: 999px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.team-1 { background: var(--game-red); }
.team-2 { background: var(--game-blue); }
.team-3 { background: #2e7d6b; }

.game-meld {
  font-size: 12px;
  color: var(--game-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.meld-track {
  width: 90px;
  height: 7px;
  border-radius: 999px;
  background: #ddd6c8;
  overflow: hidden;
}

.meld-fill {
  height: 100%;
  background: var(--game-gold);
  border-radius: 999px;
}

.game-turn-order {
  font-size: 12px;
  color: var(--game-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.game-turn-order .current {
  color: var(--game-ink);
  font-weight: 700;
}

.game-table {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "oppBooks"
    "turnRow"
    "myBooks"
    "hand";
  gap: 10px;
  padding: 14px;
  border: 10px solid var(--game-rim);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.10), transparent 55%),
    radial-gradient(circle at 50% 50%, var(--game-felt), var(--game-felt-dark));
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.32), 0 8px 24px rgba(0, 0, 0, 0.2);
}

.game-opp-books,
.game-my-books {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.game-opp-books {
  grid-area: oppBooks;
}

.game-my-books {
  grid-area: myBooks;
}

.game-turn-row {
  grid-area: turnRow;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.game-opponents {
  flex: 1 1 420px;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  padding-top: 8px;
  overflow-x: auto;
}


.game-opponents .game-seat {
  flex: 1 0 150px;
  max-width: 240px;
}

.center-area {
  flex: 0 0 auto;
}

.game-seat {
  position: relative;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 8px 10px;
  color: #f2efe5;
  min-height: 74px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.game-seat.seat-partner {
  justify-self: stretch;
  width: 100%;
}

.game-seat.seat-left,
.game-seat.seat-right {
  justify-self: stretch;
  width: 100%;
}

.game-seat.active {
  border-color: var(--game-gold);
  box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.35), 0 0 22px rgba(217, 164, 65, 0.25);
}

.seat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seat-name {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-stacks {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
}

.seat-stack {
  position: relative;
  flex: none;
  width: 82px;
  height: 52px;
}

.seat-stack-foot {
  width: 70px;
  height: 52px;
}

.seat-back {
  position: absolute;
  top: 0;
  width: 36px;
  height: 52px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: url("/cards/cardback_blue.svg") center/cover no-repeat;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.seat-count {
  position: absolute;
  left: 0;
  right: auto;
  bottom: -2px;
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  color: white;
}

.seat-foot-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 52px;
  border-radius: 4px;
  background: url("/cards/cardback_red.svg") center/cover no-repeat;
  border: 1px solid rgba(0, 0, 0, 0.3);
}

.seat-playing {
  position: absolute;
  top: -8px;
  right: 8px;
  background: var(--game-gold);
  color: #302609;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 2px 7px;
}

.center-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.center-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  width: 100%;
}

.pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.pile-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.deck-button,
.discard-button {
  position: relative;
  margin-top: 8px;
  width: calc(var(--card-w) * 0.9);
  height: calc(var(--card-w) * 0.9 * 190 / 140);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: var(--game-card-radius);
}

.deck-button:hover,
.discard-button:hover {
  transform: translateY(-3px);
}

.deck-button .pile-card,
.discard-button .pile-card {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--game-card-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.pile-card:nth-child(1) { transform: translate(-10px, -10px); }
.pile-card:nth-child(2) { transform: translate(-8px, -8px); }
.pile-card:nth-child(3) { transform: translate(-6px, -6px); }
.pile-card:nth-child(4) { transform: translate(-4px, -4px); }
.pile-card:nth-child(5) { transform: translate(-2px, -2px); }

.discard-button.empty { opacity: 0.45; }

.discard-button.empty .pile-card { filter: grayscale(1) brightness(0.9); }


.book-rack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.book-rack.mine {
  background: rgba(0, 0, 0, 0.28);
}

.book-rack-scroll {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0 4px;
}

.book-stack-group {
  display: flex;
  gap: 2px;
  width: max-content;
  margin: 0 auto;
}

.book-slot {
  position: relative;
  flex: none;
  width: 76px;
  height: 158px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #f5f1e8;
  text-align: left;
  padding: 0;
  font-family: inherit;
}

button.book-slot {
  cursor: pointer;
}

button.book-slot:hover {
  filter: brightness(1.12);
}

button.book-slot.selected-target {
  outline: 2px solid var(--game-gold);
  outline-offset: 2px;
}

.discard-button.selected-target {
  outline: 2px solid var(--game-gold);
  outline-offset: 2px;
}

.book-cards {
  position: absolute;
  inset: 0;
  height: 100%;
  margin: 0;
}

.book-card {
  position: absolute;
  left: 50%;
  margin-left: -38px;
  width: 76px;
  height: 104px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.34);
}

.book-preview-card {
  position: absolute;
  left: 50%;
  top: 27px;
  width: 76px;
  height: 104px;
  margin-left: -38px;
  border-radius: 5px;
  filter: grayscale(1);
  opacity: 0.35;
}

.book-tag {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 5;
  font-size: 9px;
  text-transform: uppercase;
  color: #302609;
  background: var(--game-gold);
  border-radius: 999px;
  padding: 1px 4px;
  border: 1px solid #000;
}


.game-hand-area {
  grid-area: hand;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
  color: #f5f1e8;
}

.hand-foot {
  flex: none;
  margin-top: 3px;
  max-width: 100%;
  text-align: right;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.hand-foot-stack {
  position: relative;
  width: 70px;
  height: 58px;
  margin-bottom: 4px;
}

.hand-foot-back {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 52px;
  border-radius: 4px;
  border: 0;
  background: url("/cards/cardback_red.svg") center/cover no-repeat;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}

.hand-cards {
  display: flex;
  align-items: flex-start;
  align-self: flex-start;
  justify-content: center;
  justify-content: safe center;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 17px 6px 4px;
}

.hand-card {
  flex: none;
  width: var(--card-w);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
  position: relative;
}

.hand-card + .hand-card {
  margin-left: calc(var(--card-w) * -0.45);
}

.hand-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 140 / 190;
  object-fit: contain;
  display: block;
  border-radius: var(--game-card-radius);
  border: 0;
}

.hand-card:not(:disabled):not(.selected):hover {
  transform: translateY(-4px);
}

.hand-card:not(:disabled) {
  cursor: grab;
  touch-action: none;
}

.hand-card:not(:disabled):active {
  cursor: grabbing;
}

.hand-card.selected {
  transform: translateY(-17px);
  cursor: grab;
  touch-action: none;
}

.hand-card.selected:active { cursor: grabbing; }

.hand-card.selected img {
  border-color: var(--game-gold);
}

.hand-card.is-new {
  overflow: hidden;
  border-radius: var(--game-card-radius);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.5), 0 0 12px rgba(217, 164, 65, 0.45);
}

.hand-card:disabled {
  cursor: default;
  filter: saturate(0.7) brightness(0.9);
}

.hand-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
  width: 160px;
  padding-right: 18px;
}

.go-out-question-button {
  width: 100%;
  padding: 7px 6px;
  font-size: 12px;
  white-space: nowrap;
}

.hand-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.hand-actions-row.with-go-out {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: end;
}

.hand-actions-row.with-go-out .go-out-question-button {
  grid-column: 1 / -1;
}

.game-button {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #a8a08e;
  background: #fff;
  color: var(--game-ink);
  cursor: pointer;
}

.game-button:hover:not(:disabled) {
  background: #f2ead8;
  border-color: #8e8570;
}

.game-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.hand-note {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  min-height: 28px;
  line-height: 1.25;
}

.game-notice {
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  background: #e8f2e8;
  border: 1px solid #9fc49f;
  color: #204a24;
}

.game-notice.error {
  background: #ffe7e0;
  border-color: #d79b8b;
  color: #7a2618;
}

.game-loading {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--game-panel);
  border: 1px solid #bdb6a8;
  border-radius: 12px;
  color: var(--game-muted);
  font-size: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.game-loading strong { color: var(--game-ink); font-size: 18px; }

.choose-panel {
  padding: 20px;
  border: 10px solid var(--game-rim);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.10), transparent 55%),
    radial-gradient(circle at 50% 50%, var(--game-felt), var(--game-felt-dark));
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.32), 0 8px 24px rgba(0, 0, 0, 0.2);
  color: #f5f1e8;
}

.choose-panel h2 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 20px;
}

.choose-panel p {
  margin: 0 0 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.choose-options {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.choose-option {
  width: 160px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.24);
  padding: 12px;
  color: #f7f3e8;
  cursor: pointer;
  font-family: inherit;
  transition: transform 140ms ease, border-color 140ms ease;
}

.choose-option:hover {
  transform: translateY(-4px);
  border-color: var(--game-gold);
}

.choose-option img {
  width: 100%;
  border-radius: var(--game-card-radius);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.choose-option strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.choose-option span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

@media (max-width: 980px) {
  .hand-actions { width: 140px; }
}

@media (max-width: 760px) {
  .game-table {
    grid-template-columns: 1fr;
    grid-template-areas:
      "oppBooks"
      "turnRow"
      "myBooks"
      "hand";
  }
  .game-hand-area {
    flex-wrap: wrap;
  }
  .hand-foot { margin-top: 0; }
  .hand-note { flex: none; min-width: 0; }
  .game-topbar { align-items: flex-start; }
  .game-score-dropdown {
    left: 0;
    right: auto;
    min-width: 0;
    width: min(340px, 90vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hand-card,
  .deck-button,
  .discard-button,
  .game-seat,
  .choose-option {
    transition: none;
  }
}

.score-round-row {
  cursor: pointer;
}

.score-round-row:hover td {
  background: #f2ead8;
}


.game-history-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 8px 14px;
  background: #efe6cc;
  border: 1px solid #d8c58f;
  border-radius: 8px;
  color: #3d3315;
  font-size: 13px;
  font-weight: 600;
}

.game-history-banner button {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid #a8a08e;
  border-radius: 6px;
  background: white;
  color: var(--game-ink);
  cursor: pointer;
}

.game-history-banner button:hover {
  background: #f7f3e8;
}

@media (max-width: 760px) {
  .game-history-banner {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

.hand-drag-ghost {
  position: fixed;
  z-index: 200;
  width: calc(var(--card-w) * 1.05);
  border-radius: var(--game-card-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transform: translate(-50%, -70%);
}

.spectator-area {
  align-items: center;
}

.spectator-area .hand-actions {
  margin-left: auto;
}

.book-expanded-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.88);
}

.book-expanded-panel {
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 12px;
  background: #f7f3e8;
  color: #232323;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.book-expanded-title {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 700;
}

.book-expanded-title span {
  margin-left: 6px;
  color: #6f6a60;
  font-size: 12px;
  font-weight: 600;
}

.book-expanded-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.book-expanded-cards img {
  width: clamp(60px, 8vw, 96px);
  height: auto;
  border-radius: var(--game-card-radius);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.book-expanded-hint {
  margin-top: 10px;
  text-align: center;
  color: #6f6a60;
  font-size: 12px;
}

.book-team-label {
  padding: 0 4px;
}

.game-hand-area .center-area {
  align-self: center;
  align-items: flex-start;
  padding: 4px 8px;
}

.game-hand-area .center-area .center-row {
  justify-content: flex-start;
}

@media (max-width: 700px) {
  body {
    --card-w: clamp(38px, 11vw, 54px);
  }

  .game-shell {
    width: 100%;
    margin: 0 auto 14px;
  }

  .game-topbar {
    gap: 6px;
    margin-bottom: 6px;
    padding: 7px 9px;
  }

  .game-title { font-size: 15px; }
  .game-subtitle { font-size: 10px; }
  .game-turn { padding: 4px 7px; font-size: 11px; }

  .game-table {
    gap: 6px;
    padding: 7px;
    border-width: 6px;
    border-radius: 14px;
  }

  .game-turn-row {
    gap: 6px;
    padding: 5px;
    border-radius: 8px;
  }

  .game-opponents {
    flex: 1 1 100%;
    gap: 6px;
    padding-top: 4px;
    justify-content: center;
    overflow-x: hidden;
  }

  .game-opponents .game-seat {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    max-width: 160px;
  }

  .game-seat {
    min-height: 58px;
    padding: 5px 6px;
    border-radius: 8px;
  }

  .seat-top,
  .seat-name { font-size: 10px; }
  .seat-count { font-size: 9px; }

  .center-row { gap: 12px; }
  .deck-button,
  .discard-button { margin-top: 4px; }

  .game-hand-area {
    gap: 6px;
    padding: 6px;
    border-radius: 8px;
  }

  .hand-cards {
    padding: 17px 3px 4px;
  }

  .hand-foot { font-size: 9px; }
  .seat-stack {
    width: 54px;
    height: 38px;
  }

  .seat-stack-foot {
    width: 46px;
    height: 38px;
  }

  .seat-back,
  .seat-foot-back {
    width: 24px;
    height: 36px;
  }

  .seat-count {
    padding: 0 4px;
    font-size: 8px;
  }

  .book-rack-scroll {
    overflow: hidden;
    padding: 0 4px;
  }

  .book-slot {
    width: 54px;
    height: 112px;
  }

  .book-card,
  .book-preview-card {
    width: 54px;
    height: 74px;
    margin-left: -27px;
  }

  .book-preview-card { top: 19px; }
  .book-tag { right: 3px; bottom: 3px; padding: 0 3px; font-size: 8px; }
  .book-team-label { font-size: 10px; }
}

.game-shell {
  max-width: 100%;
}

.game-table {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.game-table > * {
  min-width: 0;
  max-width: 100%;
}

.game-opp-books,
.game-my-books,
.game-turn-row,
.game-hand-area {
  width: 100%;
  min-width: 0;
}

.book-rack {
  min-width: 0;
}

.book-rack-scroll {
  max-width: 100%;
}

.game-turn-row > .game-seat {
  flex: 1 1 150px;
  max-width: 240px;
}

@media (max-width: 760px) {
  .game-turn-row > .game-seat {
    flex: 1 0 130px;
    width: auto;
    min-width: 130px;
    max-width: 160px;
  }
}

.game-hand-area.wrapped {
  flex-wrap: wrap;
}

.game-hand-area.wrapped > .hand-cards {
  order: 1;
  flex: 1 1 100%;
}

.game-hand-area.wrapped > .center-area {
  order: 2;
  flex: 1 1 0;
  min-width: 0;
  align-self: flex-start;
  justify-content: flex-start;
}

.game-hand-area.wrapped > .hand-actions {
  order: 3;
  flex: 0 1 160px;
  width: auto;
  min-width: 0;
}

@media (max-width: 760px) {
  .deck-button,
  .discard-button {
    transition: none;
  }

  .deck-button:hover,
  .discard-button:hover {
    transform: none;
  }

  .hand-card {
    transition: none;
  }

  .hand-card:not(:disabled):not(.selected):hover {
    transform: none;
  }
}

.hand-note-bar {
  flex: 1 1 100%;
  order: 99;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.25;
}

.book-card,
.book-preview-card,
.deck-button .pile-card,
.discard-button .pile-card,
.hand-card img,
.hand-drag-ghost,
.choose-option img,
.book-expanded-cards img,
.seat-back,
.seat-foot-back,
.hand-foot-back {
  border-radius: 0 !important;
}

.game-hand-area.measuring > :not(.hand-note-bar) {
  align-self: stretch !important;
}

.game-table {
  display: flex;
  flex-direction: column;
}

.game-row {
  position: relative;
}

.drag-grip {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 7;
  padding: 1px 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.drag-grip:active {
  cursor: grabbing;
}

.reordering {
  opacity: 0.65;
  pointer-events: none;
  outline: 2px dashed var(--game-gold);
  outline-offset: 2px;
}


.game-hand-area {
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.game-hand-area.active {
  border-color: var(--game-gold);
  box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.35), 0 0 22px rgba(217, 164, 65, 0.25);
}

.game-hand-area.active.hand-turn-alert {
  animation: hand-turn-blink 500ms ease-in-out 2;
}

@keyframes hand-turn-blink {
  0%, 100% {
    border-color: var(--game-gold);
    box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.35), 0 0 22px rgba(217, 164, 65, 0.25);
  }
  50% {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-hand-area.active.hand-turn-alert {
    animation: none;
  }
}

.choose-status {
  width: min(420px, 100%);
  margin: 18px auto 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: #f5f1e8;
}

.choose-status h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.choose-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}

.choose-status-row:last-child {
  border-bottom: 0;
}

.choose-status-row.waiting {
  color: rgba(255, 255, 255, 0.65);
}

.choose-status-row.chosen {
  color: #d8f0dc;
}

.choose-status-mark {
  width: 16px;
  text-align: center;
  font-weight: 700;
}

.choose-status-value {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}

.choose-option:disabled {
  cursor: default;
  opacity: 0.55;
}

.choose-option.selected:disabled {
  opacity: 1;
  border-color: var(--game-gold);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.28), 0 0 22px rgba(217, 164, 65, 0.2);
}

.book-slot.complete .book-tag {
  bottom: 20px;
}

@media (max-width: 700px) {
  .book-slot.complete .book-tag {
    bottom: 12px;
  }
}

.game-turn.finished {
  background: #e3f5e6;
  border-color: #2e9b45;
  color: #1f6b33;
  box-shadow: 0 0 0 3px rgba(46, 155, 69, 0.18);
}

.game-turn.finished .game-turn-dot {
  background: #2e9b45;
}

.book-rack {
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.book-rack.turn-active {
  border-color: var(--game-gold);
  box-shadow: 0 0 0 2px rgba(217, 164, 65, 0.35), 0 0 22px rgba(217, 164, 65, 0.25);
}

.pile-label.prompt-gold-text {
  color: var(--game-gold);
  font-weight: 700;
}

.book-rack-seats {
  display: flex;
  grid-area: seat;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.book-rack-seats .game-seat {
  flex: 0 0 140px;
  width: 140px;
  min-width: 0;
  max-width: 160px;
}

.book-rack.has-team-seat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label seat"
    "scroll seat";
  column-gap: 10px;
  align-items: stretch;
}

.book-rack.has-team-seat .book-team-label {
  grid-area: label;
}

.book-rack.has-team-seat .book-rack-scroll {
  grid-area: scroll;
}

.book-rack.has-team-seat .book-rack-seats {
  align-self: center;
}

@media (max-width: 700px) {
  .book-rack-seats .game-seat {
    width: 120px;
    flex-basis: 120px;
  }
}

.book-rack-seats .seat-stacks {
  flex-direction: column;
  align-items: flex-start;
}

.game-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.game-room-link {
  color: var(--game-felt-dark);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}

.game-room-link:hover {
  color: var(--game-ink);
}

.round-summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.82);
}

.round-summary-panel {
  width: min(1000px, 96vw);
  max-height: 90vh;
  overflow: auto;
  padding: 20px 22px;
  border-radius: 12px;
  background: #f7f3e8;
  color: #232323;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.round-summary-title {
  font-size: 22px;
  font-weight: 700;
}

.round-summary-badge {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--game-gold);
  color: #302609;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

.round-summary-subtitle {
  margin: 4px 0 14px;
  color: #6f6a60;
  font-size: 13px;
}

.round-summary-panel h3 {
  margin: 16px 0 6px;
  font-size: 15px;
}

.round-summary-scroll {
  overflow-x: auto;
}

.round-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.round-summary-table th,
.round-summary-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #d8d0bd;
  text-align: left;
  white-space: nowrap;
}

.round-summary-table th {
  color: #6f6a60;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.round-summary-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.round-summary-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.round-summary-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.round-summary-player {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #d8d0bd;
  border-radius: 8px;
  background: #fffdf7;
}

.round-summary-player-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.round-summary-team {
  color: #6f6a60;
  font-size: 12px;
}

.round-summary-out {
  margin-left: auto;
  color: #1f6b33;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.round-summary-card-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.round-summary-card-label {
  flex: none;
  width: 32px;
  padding-top: 14px;
  color: #6f6a60;
  font-size: 11px;
  text-transform: uppercase;
}

.round-summary-cards {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  padding: 2px 0 4px 8px;
}

.round-summary-card {
  flex: none;
  width: 34px;
  height: auto;
  margin-left: -8px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.round-summary-card:first-child {
  margin-left: 0;
}

.round-summary-empty {
  padding-top: 14px;
  color: #6f6a60;
}

.round-summary-continue {
  min-width: 140px;
  border-color: #1f6b33;
  background: #2e9b45;
  color: #fff;
  font-weight: 600;
}

.round-summary-continue:hover:not(:disabled) {
  border-color: #18572a;
  background: #25843a;
  color: #fff;
}

@media (max-width: 600px) {
  .round-summary-overlay {
    padding: 10px;
  }

  .round-summary-panel {
    padding: 14px;
  }

  .round-summary-table {
    font-size: 12px;
  }

  .round-summary-table th,
  .round-summary-table td {
    padding: 5px 6px;
  }
}

.go-out-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}

.go-out-panel {
  width: min(420px, 92vw);
  padding: 20px 22px;
  border-radius: 12px;
  background: #f7f3e8;
  color: #232323;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.go-out-kicker {
  color: #6f6a60;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.go-out-title {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
}

.go-out-prompt {
  margin-top: 10px;
  line-height: 1.4;
}

.go-out-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.go-out-response-list {
  margin-top: 12px;
  border: 1px solid #d8d0bd;
  border-radius: 8px;
  overflow: hidden;
}

.go-out-response {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid #e2dbc9;
  background: #fffdf7;
}

.go-out-response:last-child {
  border-bottom: 0;
}

.go-out-response-answer {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.go-out-response-answer.yes {
  color: #2f6b32;
}

.go-out-response-answer.no {
  color: #9b2d2d;
}

.go-out-response-empty {
  padding: 10px;
  color: #6f6a60;
}
