/* Crownspire Sabacc: the room's look, shared by the dealer table and the
   player tables. Loaded after each page's own styles: it changes how the
   room looks, never where things sit or how the game plays.

   Brass frames and rivets as on the slot cabinets, an oxblood felt table
   with a gold inlay ring, lit displays for the numbers, and coloured action
   keys. */

.sabacc-room {
  --brass: #b8893e;
  --brass-lit: #f0c978;
  --brass-dark: #5a3d16;
  --brass-text: #f3d9a0;
  --glass: #070605;
  --felt: #4a0d12;
  --felt-deep: #1f0406;
  --lcd: #ffd27a;
  --green: #4fd684;
  --red: #ff4d4d;
}

/* ---- the room ---- */
.sabacc-room main {
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(240, 180, 90, 0.10), transparent 70%);
}

/* ---- every panel: dark plate in a brass frame, riveted at the corners ---- */
.sabacc-room .panel {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(240, 201, 120, 0.07), transparent 65%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #24211d, #141210 60%, #0d0c0a);
  border: 0;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px #000, 0 0 0 2px var(--brass-dark), 0 0 0 3px var(--brass), 0 0 0 4px var(--brass-dark),
    0 18px 36px -18px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.sabacc-room .panel::after {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  --rivet: radial-gradient(circle at 4px 4px, #e2c07a 0 1.8px, #4a3412 2.4px, transparent 3.4px);
  background:
    var(--rivet) top left / 9px 9px no-repeat, var(--rivet) top right / 9px 9px no-repeat,
    var(--rivet) bottom left / 9px 9px no-repeat, var(--rivet) bottom right / 9px 9px no-repeat;
}
.sabacc-room .panel.prime::before { display: none; }

/* A panel's title: a brass nameplate. */
.sabacc-room .panel-title {
  margin: 0 auto 0.85rem;
  padding: 0.35rem 1.25rem 0.4rem;
  width: fit-content;
  max-width: 100%;
  border: 0;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: #1c1308;
  background: linear-gradient(180deg, #ffe7ad, var(--brass-lit) 40%, #a8742a);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.sabacc-room .empty { color: #a99a80; }

/* ---- the table: oxblood felt inside a gold inlay ring ---- */
.sabacc-room .panel.prime {
  background:
    radial-gradient(70% 55% at 50% 38%, rgba(255, 120, 110, 0.16), transparent 70%),
    radial-gradient(circle at 50% 45%, transparent 0 61%, rgba(240, 201, 120, 0.22) 61.3% 61.7%, transparent 62% 64%, rgba(240, 201, 120, 0.12) 64.3% 64.6%, transparent 65%),
    repeating-radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    radial-gradient(120% 100% at 50% 40%, var(--felt), var(--felt-deep));
  box-shadow:
    0 0 0 1px #000, 0 0 0 3px var(--brass-dark), 0 0 0 5px var(--brass), 0 0 0 6px var(--brass-lit), 0 0 0 8px var(--brass-dark),
    0 0 50px -6px rgba(240, 180, 90, 0.25), 0 28px 50px -22px rgba(0, 0, 0, 0.95), inset 0 0 60px rgba(0, 0, 0, 0.65);
}

/* The table's name, in brass, like the slot cabinets' nameplates. */
.sabacc-room h1.display.table-name {
  display: block;
  height: auto;
  margin: 0.2rem auto 0 !important;
  padding: 0;
  border: 0;
  font-family: var(--display);
  font-weight: 700;
  font-variant: normal;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem) !important;
  line-height: 1.1 !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: normal;
  text-align: center !important;
  background: linear-gradient(180deg, #fff1c9, var(--brass-lit) 45%, #a8742a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  text-shadow: none !important;
  filter: drop-shadow(0 0 10px rgba(240, 180, 90, 0.35));
}
.sabacc-room h1.display.table-name + * { border-top: 0; padding-top: 0; margin-top: 0.2rem !important; }
.sabacc-room .table-name::before, .sabacc-room .table-name::after { display: none; }
.sabacc-room .table-dealer { color: #d9c7a6; }

/* ---- lit displays: round, pots, wager, status ---- */
.sabacc-room .stats {
  gap: 6px;
  border: 0;
  max-width: 44rem;
}
.sabacc-room .stats div {
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #0b0a07, #000);
  box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass), inset 0 0 14px rgba(255, 190, 85, 0.08);
}
.sabacc-room .stats div:nth-child(n) { border: 0; }
.sabacc-room .stats dt { color: var(--brass-lit); font-family: var(--display); font-size: 0.68rem; letter-spacing: 0.2em; }
.sabacc-room .stats dd { color: var(--lcd); font-weight: 700; text-shadow: 0 0 10px rgba(255, 190, 85, 0.5); }

/* ---- seats: brass plaques on the felt ---- */
.sabacc-room .seat-box {
  position: relative;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 14, 10, 0.92), rgba(8, 6, 5, 0.95));
  box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass-dark), 0 0 0 3px rgba(184, 137, 62, 0.75), 0 10px 18px -10px rgba(0, 0, 0, 0.9);
}
.sabacc-room .seat-box.turn {
  box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass-dark), 0 0 0 3px var(--brass-lit), 0 0 22px 2px rgba(255, 196, 90, 0.55);
  animation: seat-turn 1.6s ease-in-out infinite alternate;
}
@keyframes seat-turn { from { filter: brightness(1); } to { filter: brightness(1.12); } }
.sabacc-room .seat-box.won { box-shadow: 0 0 0 1px #000, 0 0 0 2px #1e5a35, 0 0 0 3px var(--green), 0 0 24px 3px rgba(79, 214, 132, 0.5); }
.sabacc-room .seat-box.you { background: linear-gradient(180deg, rgba(40, 26, 12, 0.94), rgba(12, 8, 5, 0.96)); }
.sabacc-room .seat-label {
  display: inline-block;
  padding: 0.12rem 0.7rem;
  border-radius: 3px;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: #1c1308;
  background: linear-gradient(180deg, #ffe7ad, var(--brass-lit) 45%, #a8742a);
}
.sabacc-room .seat-name { color: #fff1d6; }
.sabacc-room .portrait {
  border: 0;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--brass), 0 0 0 5px var(--brass-dark), 0 6px 14px rgba(0, 0, 0, 0.7);
  background: radial-gradient(circle at 50% 35%, #3a2a14, #0b0806 75%);
  color: var(--brass-lit);
}
.sabacc-room .seat-status { color: #c9b896; }
.sabacc-room .seat-status strong { color: var(--lcd); }

/* ---- cards ---- */
.sabacc-room .card img { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.65)); }
.sabacc-room .slot.selected .card { filter: drop-shadow(0 0 10px rgba(255, 214, 130, 0.95)); }
.sabacc-room .p-field .slot .card, .sabacc-room .seat-cards .slot.protected .card { filter: drop-shadow(0 0 8px rgba(160, 120, 255, 0.85)); }
.sabacc-room .total { color: var(--lcd); text-shadow: 0 0 12px rgba(255, 190, 85, 0.55); }
.sabacc-room .hand-foot { color: #c9b896; }
.sabacc-room .badge { border-color: var(--brass); color: var(--brass-text); background: rgba(184, 137, 62, 0.12); }

/* ---- the story line ---- */
.sabacc-room .headline { color: #fff1d6; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }
.sabacc-room .headline.big { color: var(--lcd); text-shadow: 0 0 16px rgba(255, 190, 85, 0.6); }
.sabacc-room .p-table .sub, .sabacc-room .p-table .hint { color: #d9c7a6; }

/* ---- the turn clock: a lit display ---- */
.sabacc-room .clock {
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #0b0a07, #000);
  box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass), inset 0 0 14px rgba(255, 190, 85, 0.08);
}
.sabacc-room .clock .label { color: var(--brass-lit); font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.18em; }
.sabacc-room .clock .value { color: var(--lcd); font-weight: 700; text-shadow: 0 0 10px rgba(255, 190, 85, 0.5); }

/* ---- the action keys: coloured, lit from inside ---- */
.sabacc-room .actions .cs-button {
  --key: 120, 110, 90;
  min-width: 6.2rem;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(180deg, rgba(var(--key), 0.95), rgba(var(--key), 0.55) 55%, rgba(var(--key), 0.35));
  box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(var(--key), 0.9), 0 0 14px rgba(var(--key), 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 6px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.sabacc-room .actions .cs-button:hover:not(:disabled) { filter: brightness(1.15); color: #fff; background: linear-gradient(180deg, rgba(var(--key), 1), rgba(var(--key), 0.6) 55%, rgba(var(--key), 0.4)); box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(var(--key), 1), 0 0 22px rgba(var(--key), 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.sabacc-room .actions .cs-button:active:not(:disabled) { transform: translateY(2px); }
.sabacc-room .actions .cs-button:disabled { filter: saturate(0.45) brightness(0.72); box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(var(--key), 0.4); cursor: not-allowed; }
/* The keys by what they do. The dealer table names them by id, the player
   tables by data-act. */
.sabacc-room .actions #draw, .sabacc-room .actions [data-act="gain"], .sabacc-room .actions [data-act="draw"], .sabacc-room .actions [data-act="check"], .sabacc-room .actions [data-act="match"] { --key: 40, 150, 80; }
.sabacc-room .actions #trade, .sabacc-room .actions [data-act="trade"], .sabacc-room .actions [data-act="raise"] { --key: 196, 140, 30; }
.sabacc-room .actions #protect, .sabacc-room .actions [data-act="protect"] { --key: 120, 70, 200; }
.sabacc-room .actions #retrieve, .sabacc-room .actions [data-act="take"] { --key: 40, 110, 200; }
.sabacc-room .actions #stand, .sabacc-room .actions [data-act="stand"], .sabacc-room .actions [data-act="fold"] { --key: 200, 40, 45; }
.sabacc-room .actions #sudden, .sabacc-room .actions [data-act="call"], .sabacc-room .actions [data-act="announce"] { --key: 210, 95, 30; }
.sabacc-room .actions #push, .sabacc-room .actions #again, .sabacc-room .actions [data-act="ready"], .sabacc-room .actions [data-act="take-seat"] { --key: 184, 137, 62; }
.sabacc-room #again, .sabacc-room #push { color: #1c1308; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }

/* Buttons and fields elsewhere in the room, in brass. */
.sabacc-room .cs-button { border-color: var(--brass); color: var(--brass-text); }
.sabacc-room .cs-button:not(.actions .cs-button):hover:not(:disabled) { background: rgba(184, 137, 62, 0.22); border-color: var(--brass-lit); color: #fff; }
.sabacc-room .cs-button.gold:not(.actions .cs-button) { background: linear-gradient(180deg, #ffe7ad, var(--brass-lit) 40%, #a8742a); border-color: var(--brass-lit); color: #1c1308; }
.sabacc-room .cs-input { background: #0a0806; border-color: var(--brass-dark); color: #fff1d6; }
.sabacc-room .cs-input:focus { border-color: var(--brass-lit); box-shadow: 0 0 0 2px rgba(240, 201, 120, 0.3); }
.sabacc-room .balances .amount { color: var(--lcd); text-shadow: 0 0 10px rgba(255, 190, 85, 0.45); }
.sabacc-room .balances .label, .sabacc-room .seat label { color: #d9c7a6; }

/* ---- the dealer ---- */
.sabacc-room .dealer-card .portrait { width: 10rem; height: 10rem; box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--brass), 0 0 0 7px var(--brass-lit), 0 0 0 9px var(--brass-dark), 0 0 30px rgba(240, 180, 90, 0.35); }
.sabacc-room .dealer-name { color: var(--brass-lit); }
.sabacc-room .dealer-role { color: #c9b896; }
.sabacc-room .dealer-quote {
  border-top: 0;
  padding: 0.7rem 0.8rem;
  border-radius: 6px;
  background: linear-gradient(180deg, #0b0a07, #000);
  box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass-dark);
  color: #f3e3c3;
}
.sabacc-room .p-dealer details { border-top-color: rgba(184, 137, 62, 0.35); }
.sabacc-room .p-dealer summary { color: var(--brass-text); }
.sabacc-room .p-dealer details td { border-top-color: rgba(184, 137, 62, 0.2); color: #c9b896; }
.sabacc-room .p-dealer details td:last-child { color: var(--lcd); }

/* ---- the Shift: a felt dish for the dice ---- */
.sabacc-room .dice {
  min-height: 96px;
  padding: 0.75rem;
  border-radius: 50% / 40%;
  background: radial-gradient(circle at 50% 40%, #5a1218, var(--felt-deep) 75%);
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--brass), inset 0 6px 18px rgba(0, 0, 0, 0.8);
}
.sabacc-room .dice img { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.7)); }
.sabacc-room .shift-note { color: #c9b896; }
.sabacc-room .shift-note.alarm {
  color: #fff;
  border: 0;
  border-radius: 4px;
  background: repeating-linear-gradient(-45deg, rgba(200, 30, 40, 0.75) 0 12px, rgba(90, 8, 14, 0.85) 12px 24px);
  box-shadow: 0 0 0 1px var(--red), 0 0 18px rgba(255, 77, 77, 0.5);
  font-family: var(--display);
  font-size: 0.8rem;
  animation: alarm 0.6s ease-in-out infinite alternate;
}
@keyframes alarm { from { filter: brightness(0.9); } to { filter: brightness(1.25); } }

/* ---- table talk and the dealer's lines: black glass ---- */
.sabacc-room .feed {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: linear-gradient(180deg, #080706, #000);
  box-shadow: inset 0 0 0 1px rgba(184, 137, 62, 0.35), inset 0 6px 14px rgba(0, 0, 0, 0.6);
  color: #c9b896;
}
.sabacc-room .feed li { border-top-color: rgba(184, 137, 62, 0.16); }
.sabacc-room .feed .shift-line { color: var(--lcd); }
.sabacc-room .feed .mark { color: #fff1d6; }
.sabacc-room .says li { color: #f3e3c3; }
.sabacc-room .says li span:first-child { color: var(--brass-lit); }

/* ---- the scoreboard and the lobby (player tables) ---- */
.sabacc-room .board li { border-top-color: rgba(184, 137, 62, 0.2); }
.sabacc-room .board li.you { background: rgba(184, 137, 62, 0.12); }
.sabacc-room .board .place { color: var(--brass-lit); }
.sabacc-room .board .won { color: var(--lcd); }
.sabacc-room .lobby-head { color: var(--brass-lit); }
.sabacc-room .open-tables li { border-top-color: rgba(184, 137, 62, 0.25); }

/* Each stake in the lobby: a brass-framed plaque on the felt, with the
   cost on lit glass. */
.sabacc-room .tier {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 15, 10, 0.94), rgba(8, 6, 5, 0.96));
  box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass-dark), 0 0 0 3px rgba(184, 137, 62, 0.8), 0 14px 22px -14px rgba(0, 0, 0, 0.9);
  transition: box-shadow 0.2s, transform 0.2s;
}
.sabacc-room .tier:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--brass-dark), 0 0 0 3px var(--brass-lit), 0 0 22px rgba(240, 180, 90, 0.35); }
.sabacc-room .tier h3 { color: var(--brass-lit); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.04em; }
.sabacc-room .tiers { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.sabacc-room .tier dl { grid-template-columns: minmax(7.5rem, 1fr) auto; font-size: 0.875rem; padding: 0.5rem 0.6rem; border-radius: 5px; background: #000; box-shadow: inset 0 0 0 1px rgba(184, 137, 62, 0.35); }
.sabacc-room .tier dt { color: #b3a48a; }
.sabacc-room .tier dd { color: var(--lcd); font-variant-numeric: tabular-nums; }
.sabacc-room .marks span { border-color: var(--brass); color: var(--brass-text); background: rgba(184, 137, 62, 0.12); border-radius: 3px; }
.sabacc-room .seat-money { color: #c9b896; }
.sabacc-room .seat-money strong { color: #fff1d6; }

.sabacc-room .message.error { background: rgba(163, 38, 43, 0.35); border-color: rgba(255, 90, 90, 0.6); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .sabacc-room .seat-box.turn, .sabacc-room .shift-note.alarm { animation: none; }
}
@media (max-width: 640px) {
  .sabacc-room .actions .cs-button { min-width: 0; }
  .sabacc-room .dealer-card .portrait { width: 8rem; height: 8rem; }
}
