/**
 * public/css/styles.css
 * Realistic, refined sunlit tabletop lounge HUD & UI styling.
 * Uses warm frosted glass, subtle brushed-brass trim, and realistic soft elevation shadows
 * (replacing cartoon/comic thick outlines and hard offset shadows).
 * Bottom HUD panels are docked to bottom-left and bottom-right corners so the bottom-center
 * 3D table (player's pyramid + bottom row of action/bonus cards) is 100% unobstructed.
 */
:root {
  --bg-light: #e8dfd1;
  --cream: #fcfaf5;
  --cream-soft: #f3ece0;
  --walnut: #2c1e14;
  --walnut-muted: #6e5a49;
  --teal: #0e8a94;
  --teal-bright: #18a4b0;
  --brass: #c59b47;
  --brass-light: rgba(197, 155, 71, 0.42);
  --gold-bright: #f2c94c;
  --marigold: #d97724;
  --emerald: #1f9d55;
  --coral: #d64545;
  --panel-bg: rgba(252, 249, 243, 0.88);
  --panel-border: 1px solid rgba(184, 146, 78, 0.48);
  --shadow-sm: 0 2px 8px rgba(28, 19, 12, 0.09);
  --shadow-md: 0 8px 24px rgba(28, 19, 12, 0.14), 0 2px 6px rgba(28, 19, 12, 0.08);
  --shadow-lg: 0 18px 42px rgba(24, 16, 10, 0.22), 0 4px 12px rgba(24, 16, 10, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-light);
  color: var(--walnut);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  cursor: grab;
}

#game-canvas:active {
  cursor: grabbing;
}

.hidden {
  display: none !important;
}

/* Modal Backdrops & Realistic Frosted Lounge Cards */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: radial-gradient(circle at center, rgba(44, 30, 20, 0.25), rgba(28, 19, 12, 0.58));
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: linear-gradient(180deg, rgba(254, 252, 248, 0.97) 0%, rgba(245, 238, 225, 0.97) 100%);
  color: var(--walnut);
  border: 1px solid rgba(197, 155, 71, 0.65);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 28px 32px;
  max-width: 540px;
  width: 100%;
  animation: popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Brand Header */
.brand-header {
  text-align: center;
  margin-bottom: 22px;
}

.deco-ribbon-banner {
  display: inline-block;
  background: linear-gradient(135deg, #1599a6 0%, #0b6f78 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: var(--shadow-md);
  padding: 10px 34px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.logo-badge {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--cream);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}

.brand-subtitle {
  color: var(--walnut-muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 6px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--walnut-muted);
  margin-bottom: 6px;
}

input[type='text'],
select {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(140, 112, 82, 0.45);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--walnut);
  font-size: 0.98rem;
  font-weight: 600;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type='text']:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 138, 148, 0.18);
}

/* Game Mode Picker: Classic or Vengeance, with Brutal Mode as an option of Vengeance */
.deco-ribbon-banner.vengeance-banner {
  background: linear-gradient(135deg, #be123c 0%, #581c87 100%);
}

.deco-ribbon-banner.brutal-banner {
  background: linear-gradient(135deg, #991b1b 0%, #c2410c 50%, #450a0a 100%);
}

.edition-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.edition-option {
  cursor: pointer;
  background: #ffffff;
  border: 2px solid rgba(140, 112, 82, 0.32);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--walnut);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.edition-option:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 138, 148, 0.55);
}

.edition-option.active {
  background: linear-gradient(180deg, #f3fbfc 0%, #e4f5f6 100%);
  border-color: #0e8a94;
  box-shadow: 0 4px 12px rgba(14, 138, 148, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.edition-option.vengeance-option:hover {
  border-color: rgba(190, 18, 60, 0.6);
}

.edition-option.vengeance-option.active {
  background: linear-gradient(180deg, #fff4f6 0%, #fce6eb 100%);
  border-color: #be123c;
  box-shadow: 0 4px 14px rgba(190, 18, 60, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.edition-brutal-option {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--walnut);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.edition-brutal-option input {
  width: auto;
}

.hud-version-pill {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14, 138, 148, 0.16);
  color: #0b6f78;
}

.hud-version-pill.vengeance {
  background: linear-gradient(135deg, #be123c 0%, #6b21a8 100%);
  color: #ffffff;
}

.hud-version-pill.brutal {
  background: linear-gradient(135deg, #991b1b 0%, #ea580c 100%);
  color: #ffffff;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--walnut-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  margin: 16px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(197, 155, 71, 0.4);
}

.divider span {
  padding: 0 12px;
}

.join-row {
  display: flex;
  gap: 10px;
}

#room-code-input {
  text-transform: uppercase;
  letter-spacing: 3px;
  text-align: center;
  font-weight: 800;
}

/* Realistic Tactile Buttons */
.btn {
  cursor: pointer;
  border: 1px solid rgba(44, 30, 20, 0.22);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.93rem;
  padding: 11px 18px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  width: 100%;
  padding: 13px 20px;
  font-size: 1.02rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(180deg, #e5852e 0%, #c86817 100%);
  color: #ffffff;
  border-color: rgba(145, 70, 12, 0.5);
}

.btn-secondary {
  background: linear-gradient(180deg, #179ca8 0%, #0d7a84 100%);
  color: #ffffff;
  border-color: rgba(10, 95, 102, 0.5);
  white-space: nowrap;
}

.btn-outline {
  background: linear-gradient(180deg, #fdfbf7 0%, #efe6d5 100%);
  color: var(--walnut);
  border-color: rgba(180, 145, 85, 0.5);
}

.btn-danger-outline {
  background: linear-gradient(180deg, #e05252 0%, #c23636 100%);
  color: #ffffff;
  border-color: rgba(140, 30, 30, 0.5);
}

/* Lobby Modal */
.lobby-card {
  max-width: 720px;
}

.lobby-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--brass-light);
}

/* Invite link in the lobby */
.invite-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.invite-row label {
  flex-shrink: 0;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--walnut-muted);
}

.invite-row input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  font-size: 0.82rem;
  user-select: text;
}

.invite-row .btn {
  flex-shrink: 0;
}

/* Start screen when opened from an invite link: name and Join only */
.invite-only {
  display: none;
}

.welcome-card.invite-mode .invite-only {
  display: block;
}

.welcome-card.invite-mode .hide-on-invite {
  display: none;
}

.welcome-card.invite-mode #btn-join-room {
  flex: 1;
}

.invite-message {
  margin-top: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--walnut);
}

.invite-exit {
  width: 100%;
  margin-top: 12px;
  background: none;
  border: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--walnut-muted);
  text-decoration: underline;
  cursor: pointer;
}

.label-Overline {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--walnut-muted);
}

.room-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

#lobby-room-code {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--teal);
}

.lobby-count-box {
  background: var(--cream-soft);
  border: 1px solid var(--brass-light);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
}

.lobby-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
}

.lobby-player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid rgba(180, 145, 85, 0.38);
  box-shadow: var(--shadow-sm);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.seat-num {
  color: var(--walnut-muted);
  font-weight: 700;
  font-size: 0.75rem;
}

.avatar-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.p-name {
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
}

.host-tag {
  background: rgba(242, 201, 76, 0.35);
  color: #7a5800;
  border: 1px solid rgba(197, 155, 71, 0.5);
}

.bot-tag {
  background: rgba(24, 164, 176, 0.16);
  color: #0b646c;
  border: 1px solid rgba(24, 164, 176, 0.35);
}

.btn-kick {
  background: transparent;
  border: none;
  color: var(--walnut-muted);
  cursor: pointer;
  font-weight: 800;
  padding: 2px 5px;
}

.btn-kick:hover {
  color: var(--coral);
}

.lobby-controls-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--cream-soft);
  border: 1px solid var(--brass-light);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.bot-controls {
  display: flex;
  gap: 8px;
}

.settings-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.84rem;
  font-weight: 700;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-item select {
  width: auto;
  padding: 5px 10px;
  font-size: 0.82rem;
}

.lobby-hint {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: 9px;
  margin-bottom: 16px;
}

.lobby-hint.warning {
  background: rgba(242, 201, 76, 0.25);
  border: 1px solid rgba(197, 155, 71, 0.55);
  color: #6b4c00;
}

.lobby-hint.ready {
  background: rgba(31, 157, 85, 0.15);
  border: 1px solid rgba(31, 157, 85, 0.4);
  color: #14532d;
}

.lobby-footer-actions {
  display: flex;
  gap: 12px;
}

/* HUD Layer: small floating groups, so the table stays the focus. */
.hud-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* Soft golden screen edge while it is the local player's turn */
.hud-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.hud-layer.is-my-turn::after {
  opacity: 1;
  animation: myTurnEdge 2.4s ease-in-out infinite;
}

@keyframes myTurnEdge {
  0%,
  100% {
    box-shadow: inset 0 0 70px 6px rgba(242, 178, 60, 0.3);
  }
  50% {
    box-shadow: inset 0 0 110px 16px rgba(242, 178, 60, 0.5);
  }
}

.hud-top-left > *,
.hud-top-right > *,
.turn-banner,
.hud-sidebar-left,
.hud-sidebar-right,
.my-tableau-panel,
.action-buttons-dock {
  pointer-events: auto;
}

.hud-top-bar {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  z-index: 2;
}

.hud-top-left,
.hud-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-top-right {
  justify-content: flex-end;
}

.hud-chip,
.cam-group,
.btn-icon-pill {
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(184, 146, 78, 0.3);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  color: var(--walnut);
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.hud-chip-sep {
  width: 1px;
  height: 14px;
  background: rgba(110, 90, 73, 0.3);
}

.hud-chip-muted {
  color: var(--walnut-muted);
  font-weight: 600;
}

.turn-banner {
  padding: 8px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: center;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  color: var(--walnut);
  border: 1px solid rgba(184, 146, 78, 0.3);
  box-shadow: var(--shadow-sm);
  transition: background 0.2s;
}

.turn-banner.my-turn {
  background: linear-gradient(180deg, #ffd76a 0%, #f0a82e 100%);
  color: #2c1e14;
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 22px rgba(242, 178, 60, 0.65), var(--shadow-sm);
}

.turn-banner.alert-turn {
  background: linear-gradient(180deg, #e25c5c 0%, #c23a3a 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.turn-banner.action-turn {
  background: linear-gradient(180deg, #f5d04c 0%, #e0b422 100%);
  color: #2c1e14;
  border-color: rgba(160, 120, 15, 0.5);
  animation: pulseBanner 1.4s infinite ease-in-out;
}

@keyframes pulseBanner {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.cam-group {
  display: flex;
  height: 34px;
  padding: 3px;
}

.btn-cam {
  background: transparent;
  border: none;
  color: var(--walnut-muted);
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-cam.active {
  background: var(--teal);
  color: #ffffff;
}

.btn-icon-pill {
  width: 34px;
  height: 34px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-icon-pill:hover {
  background: #ffffff;
}

/* Overflow menu: room code, discard count, sound, rules, exit */
.hud-menu {
  position: relative;
}

.hud-menu-panel {
  position: absolute;
  top: 42px;
  right: 0;
  width: 190px;
  padding: 6px;
  background: rgba(252, 249, 243, 0.97);
  border: 1px solid rgba(184, 146, 78, 0.3);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-menu-info {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--walnut-muted);
}

.hud-menu-info strong {
  color: var(--walnut);
}

.hud-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: rgba(110, 90, 73, 0.18);
}

.hud-menu-item {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--walnut);
  cursor: pointer;
}

.hud-menu-item:hover {
  background: rgba(197, 155, 71, 0.18);
}

.hud-menu-item.danger {
  color: var(--coral);
}

/* Scoreboard */
.hud-sidebar-left {
  position: absolute;
  top: 58px;
  left: 16px;
  width: 216px;
  max-height: calc(100vh - 150px);
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(184, 146, 78, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Table feed: shows the newest line until expanded */
.hud-sidebar-right {
  position: absolute;
  top: 58px;
  right: 16px;
  width: 230px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(184, 146, 78, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  padding: 8px 12px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--walnut-muted);
  background: transparent;
  border: none;
}

.panel-header-note {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.panel-toggle {
  cursor: pointer;
}

.panel-chevron {
  transition: transform 0.15s;
}

.hud-sidebar-right.expanded .panel-chevron {
  transform: rotate(180deg);
}

.scoreboard-list {
  overflow-y: auto;
  padding: 2px 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.score-row {
  position: relative;
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--walnut);
  transition: background 0.15s, transform 0.15s;
}

.score-row:hover {
  background: rgba(197, 155, 71, 0.1);
}

.score-row.active-turn {
  background: linear-gradient(90deg, rgba(246, 182, 62, 0.42) 0%, rgba(246, 182, 62, 0.14) 100%);
  box-shadow: inset 3px 0 0 #e9a02a;
}

.score-row.active-turn .score-name {
  font-weight: 800;
}

.score-row.active-turn .avatar-dot {
  animation: activeDot 1.3s ease-in-out infinite;
}

@keyframes activeDot {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(233, 160, 42, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(233, 160, 42, 0.12);
  }
}

.score-row.targetable-row {
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--teal);
  background: rgba(24, 164, 176, 0.08);
}

.score-row.targetable-row:hover {
  background: rgba(31, 157, 85, 0.15);
  box-shadow: inset 0 0 0 1.5px var(--emerald);
  transform: translateX(2px);
}

.score-row.status-busted .score-name,
.score-row.status-busted .score-numbers {
  opacity: 0.55;
}

.score-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.score-player-id {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.score-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-badge {
  flex-shrink: 0;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
}

.badge-stopped {
  background: var(--emerald);
  color: #fff;
}

.badge-frozen {
  background: #4fa8d1;
  color: #fff;
}

.badge-busted {
  background: var(--coral);
  color: #fff;
}

.badge-flip7 {
  background: var(--marigold);
  color: #fff;
}

.score-numbers {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
}

.round-pts {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald);
}

.total-pts {
  min-width: 24px;
  text-align: right;
  font-size: 0.86rem;
  font-weight: 800;
}

/* A player's cards are on the table; hover a row to read them here */
.score-mini-cards {
  display: none;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}

.score-row:hover .score-mini-cards {
  display: flex;
}

.mini-card {
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid currentColor;
}

.no-cards-hint {
  font-size: 0.68rem;
  color: var(--walnut-muted);
}

/* Action Log */
.action-log-list {
  overflow-y: auto;
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
}

.hud-sidebar-right.expanded .action-log-list {
  max-height: 240px;
}

.hud-sidebar-right:not(.expanded) .log-item:not(:first-child) {
  display: none;
}

.log-item {
  padding: 2px 0;
  color: var(--walnut);
}

.log-bust {
  color: var(--coral);
  font-weight: 700;
}

.log-flip7,
.log-winner {
  color: #b8620b;
  font-weight: 800;
}

.log-bank {
  color: var(--emerald);
  font-weight: 700;
}

/* Bottom corners stay small so the bottom-center 3D table is fully open */
.hud-bottom-bar {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.my-tableau-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(184, 146, 78, 0.3);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
}

.my-tableau-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.unique-badge {
  display: flex;
  gap: 4px;
}

.unique-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(110, 90, 73, 0.18);
}

.unique-pip.filled {
  background: var(--teal);
}

.unique-badge.almost .unique-pip.filled {
  background: var(--marigold);
}

.round-score-badge {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--walnut);
  white-space: nowrap;
}

.my-hand-strip {
  display: none;
}

/* Swap / Steal / Discard: the picked cards, shown large enough to read, and accepting them */
.action-confirm {
  /* In the corner, so it never covers the player's own cards at the bottom centre */
  position: absolute;
  right: 0;
  bottom: 0;
  pointer-events: auto;
  width: 290px;
  padding: 12px 14px;
  background: rgba(252, 249, 243, 0.97);
  border: 2px solid var(--selection-color, #c59b47);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-confirm-title {
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
  color: var(--walnut);
}

.action-confirm-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.action-confirm-arrow {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--walnut-muted);
}

.action-confirm-slot {
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.action-confirm-slot canvas,
.action-confirm-empty {
  width: 76px;
  height: 110px;
  border-radius: 7px;
}

.action-confirm-slot canvas {
  box-shadow: 0 0 0 3px var(--selection-color, #c59b47), 0 4px 10px rgba(0, 0, 0, 0.25);
}

.action-confirm-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--walnut-muted);
  border: 2px dashed rgba(110, 90, 73, 0.4);
}

.action-confirm-owner {
  max-width: 100%;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--walnut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-confirm-buttons {
  display: flex;
  gap: 8px;
}

.action-confirm-buttons .btn-primary {
  flex: 1;
}

/* Draw / Stay only appear when they can be used */
.action-buttons-dock {
  display: flex;
  gap: 10px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.action-buttons-dock.dock-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  visibility: hidden;
}

.btn-game-action {
  cursor: pointer;
  border: 1px solid rgba(44, 30, 20, 0.25);
  border-radius: 12px;
  padding: 12px 24px;
  min-width: 124px;
  color: var(--walnut);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease, opacity 0.2s;
}

.btn-game-action:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.btn-game-action:active:not(:disabled) {
  transform: translateY(0);
}

.btn-game-action:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  filter: saturate(0.35);
}

.btn-draw {
  background: linear-gradient(180deg, #f7d768 0%, #e4b634 100%);
  border-color: rgba(168, 124, 18, 0.55);
  color: #2b1d08;
}

.btn-stop {
  background: linear-gradient(180deg, #34b86b 0%, #219450 100%);
  border-color: rgba(20, 112, 58, 0.55);
  color: #ffffff;
}

.btn-stop .btn-text-col small {
  color: rgba(255, 255, 255, 0.9);
}

.btn-text-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-main-text {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.btn-text-col small {
  font-size: 0.74rem;
  font-weight: 700;
  color: rgba(43, 29, 8, 0.82);
}

.btn-text-col small:empty {
  display: none;
}

/* Enlarged card (hover + Alt): never takes the pointer, so the card underneath stays hovered */
.card-preview {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle, rgba(20, 14, 9, 0.5) 0%, rgba(20, 14, 9, 0.12) 70%);
}

.card-preview-art {
  height: min(78vh, 720px);
  aspect-ratio: 1024 / 1488;
  border-radius: 3.2vh;
  box-shadow: 0 24px 70px rgba(15, 10, 6, 0.6);
  animation: cardPreviewIn 0.12s ease-out;
}

@keyframes cardPreviewIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

/* Summary Tables */
.summary-subtitle {
  color: var(--walnut-muted);
  font-weight: 600;
  margin: 8px 0 16px;
}

.summary-table-wrap {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 18px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.summary-table th,
.summary-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--brass-light);
}

.summary-table th {
  color: var(--walnut-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.pts-gain {
  color: var(--emerald);
  font-weight: 800;
}

.pts-zero {
  color: var(--coral);
  font-weight: 800;
}

/* Rules Modal */
.rules-modal-card {
  max-width: 620px;
}

.rules-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.rules-content {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--walnut);
  max-height: 68vh;
  overflow-y: auto;
}

.rules-content h4 {
  color: var(--teal);
  margin: 14px 0 6px;
}

.rules-content ul {
  padding-left: 20px;
}

.rules-content li {
  margin-bottom: 6px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: var(--panel-border);
  color: var(--walnut);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transition: opacity 0.3s, transform 0.3s;
}

.toast-error {
  background: var(--coral);
  color: #fff;
}

.toast-success {
  background: var(--emerald);
  color: #fff;
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

.rules-credits {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid rgba(184, 146, 78, 0.3);
  font-size: 0.75rem;
  color: var(--walnut-muted);
}
.rules-credits a {
  color: inherit;
}

/* ===== Emote wheel (hold Q, or the Emote button next to your points) ===== */
.emote-button {
  --emote-cooldown: 1200ms;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 9px;
  border: 1px solid rgba(184, 146, 78, 0.5);
  border-radius: 999px;
  background: var(--cream);
  color: var(--walnut);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.emote-button:hover,
.emote-button.active {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(197, 155, 71, 0.35);
}
.emote-button-icon svg {
  display: block;
  width: 17px;
  height: 17px;
}
.emote-button-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.emote-button-key {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--walnut-muted);
  border: 1px solid rgba(110, 90, 73, 0.4);
  border-radius: 4px;
  padding: 0 4px;
}
/* Cooldown: a bar sweeping across the bottom of the button */
.emote-button::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: var(--teal-bright);
}
.emote-button.cooling::after {
  animation: emote-cooldown var(--emote-cooldown) linear forwards;
}
@keyframes emote-cooldown {
  from { width: 100%; }
  to { width: 0; }
}

.emote-wheel {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(28, 19, 12, 0.28) 0, rgba(28, 19, 12, 0) 260px);
  animation: emote-wheel-in 0.12s ease-out;
}
@keyframes emote-wheel-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.emote-wheel-ring {
  position: relative;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(252, 249, 243, 0.2) 0 38%, rgba(252, 249, 243, 0.82) 39% 69%, rgba(252, 249, 243, 0) 70%);
  box-shadow: 0 18px 42px rgba(24, 16, 10, 0.25);
}
.emote-wheel-centre {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 104px;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--cream);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.emote-wheel.cooling .emote-wheel-item {
  opacity: 0.45;
}
.emote-wheel-item {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid rgba(184, 146, 78, 0.55);
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 6px;
  cursor: pointer;
  font: inherit;
  color: var(--walnut);
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, background 0.1s ease, border-color 0.1s ease;
}
.emote-wheel-icon svg {
  display: block;
  width: 34px;
  height: 34px;
}
.emote-wheel-label {
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.emote-wheel-item.highlighted,
.emote-wheel-item:focus-visible {
  transform: translate(-50%, -50%) scale(1.16);
  background: var(--gold-bright);
  border-color: var(--marigold);
  outline: none;
}

@media (max-width: 960px) {
  .hud-sidebar-right {
    display: none;
  }
  .hud-sidebar-left {
    width: 220px;
  }
  .hud-bottom-bar {
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }
}
