:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-elevated: #243044;
  --text: #e8eef7;
  --muted: #8b9bb4;
  --accent: #3d9cf0;
  --accent-dim: #2a6fad;
  --bank-gold: #f0c14b;
  --bank-gold-dim: #b8922e;
  --danger: #e85d5d;
  --success: #3ecf8e;
  --warning: #f0a030;
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  /* Fixed play action dock — keep Roll/BANK on-screen on small phones */
  --play-actions-h: 6.5rem;
  --app-max: 480px;
  /* Chat + room voice panels — lighter blue so they stand apart from game UI */
  --comms-bg: #1e3a56;
  --comms-bg-elevated: #2a4d6e;
  --comms-bg-deep: #173049;
  --comms-border: rgba(120, 185, 240, 0.32);
  --comms-shadow: 0 10px 36px rgba(20, 60, 100, 0.45), 0 0 0 1px rgba(100, 175, 235, 0.12);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61, 156, 240, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(240, 193, 75, 0.08), transparent),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled,
button.is-locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.45);
  box-shadow: none;
  transform: none;
}

button:disabled:active,
button.is-locked:active {
  transform: none;
}

.app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  min-height: 100dvh;
}

body.play-active .app {
  /* Extra room for fixed bottom dock */
  padding-bottom: 0;
}

.hidden {
  display: none !important;
}

/* —— Themed confirm dialog —— */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.confirm-dialog.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.confirm-dialog-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: 20px;
  text-align: center;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(61, 156, 240, 0.22), transparent 58%),
    linear-gradient(165deg, #1e2d42 0%, #152030 55%, #0f1722 100%);
  border: 1px solid rgba(100, 160, 220, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(61, 156, 240, 0.12);
  transform: scale(0.92) translateY(10px);
  transition: transform 0.22s cubic-bezier(0.22, 1.15, 0.36, 1);
}

.confirm-dialog.is-open .confirm-dialog-card {
  transform: scale(1) translateY(0);
}

.confirm-dialog.is-danger .confirm-dialog-card {
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(232, 93, 93, 0.22), transparent 58%),
    linear-gradient(165deg, #3a1f24 0%, #241418 55%, #140c0e 100%);
  border-color: rgba(232, 93, 93, 0.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(232, 93, 93, 0.14);
}

.confirm-dialog.is-warning .confirm-dialog-card {
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(240, 160, 48, 0.2), transparent 58%),
    linear-gradient(165deg, #3a2a14 0%, #241a0c 55%, #141008 100%);
  border-color: rgba(240, 160, 48, 0.4);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(240, 160, 48, 0.12);
}

.confirm-dialog-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #9cc9f5;
  margin-bottom: 0.45rem;
}

.confirm-dialog.is-danger .confirm-dialog-kicker {
  color: #f5a8a8;
}

.confirm-dialog.is-warning .confirm-dialog-kicker {
  color: #f0c14b;
}

.confirm-dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.confirm-dialog-message {
  margin: 0 0 1.15rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted);
}

.confirm-dialog-actions {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.confirm-dialog-actions > button {
  flex: 1 1 0;
  width: auto;
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border-radius: 11px;
}

.confirm-dialog-cancel {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.confirm-dialog-cancel:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

.confirm-dialog.is-danger .confirm-dialog-ok {
  background: linear-gradient(160deg, #e85d5d, #b83a3a) !important;
  color: #fff !important;
  border: none !important;
}

.confirm-dialog.is-warning .confirm-dialog-ok {
  background: linear-gradient(160deg, #f0a030, #c47a18) !important;
  color: #1a1408 !important;
  border: none !important;
}

/* —— Header —— */
.brand {
  text-align: center;
  padding: 1.25rem 0 0.5rem;
}

.brand h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.12em;
  color: var(--bank-gold);
  text-shadow: 0 0 24px rgba(240, 193, 75, 0.35);
}

.brand .conn-status {
  margin-top: 0.4rem;
}

/* —— Cards —— */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 156, 240, 0.2);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: #fff;
  margin-top: 0.25rem;
}

.btn-secondary {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-bank {
  width: 100%;
  background: linear-gradient(160deg, var(--bank-gold), var(--bank-gold-dim));
  color: #1a1408;
  font-size: 1.35rem;
  padding: 1.1rem;
  letter-spacing: 0.08em;
  box-shadow: 0 4px 20px rgba(240, 193, 75, 0.3);
}

.btn-roll {
  width: 100%;
  background: linear-gradient(160deg, var(--success), #2a9d66);
  color: #062418;
  font-size: 1.2rem;
  padding: 1rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1.25rem 0 0.25rem;
}

.home-host-actions {
  margin-top: 0.5rem;
}

.home-host-actions .divider {
  margin: 1rem 0 0.15rem;
}

#home-create-card {
  margin-top: 1rem;
}

#home-identity-card {
  margin-bottom: 1rem;
}

#home-identity-card.is-needs-name {
  border-color: rgba(240, 160, 48, 0.55);
  box-shadow: 0 0 0 2px rgba(240, 160, 48, 0.18);
}

#home-identity-card.is-needs-name #join-name {
  border-color: rgba(240, 160, 48, 0.65);
}

.home-identity-hint {
  margin: -0.25rem 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#home-public-card {
  margin-bottom: 1rem;
}

#home-join-card {
  margin-bottom: 0.25rem;
}

.public-games-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.public-games-header h2 {
  margin: 0;
}

.btn-ghost-sm {
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-sm:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

.public-games-hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.public-games-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.public-game-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.public-game-main {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.public-game-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.65rem;
}

.public-game-code {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
}

.public-game-host {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.public-game-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
  margin-top: 0.15rem;
}

.public-game-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact join control — overrides .btn-primary width:100% */
.public-game-row .btn-public-join.btn-primary {
  flex: 0 0 auto;
  align-self: center;
  width: auto;
  max-width: none;
  min-width: 0;
  margin-top: 0;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 0.25rem 0.5rem;
  border-radius: 7px;
  white-space: nowrap;
}

.public-game-row .btn-public-join.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.public-games-empty {
  margin: 0.25rem 0 0;
  text-align: center;
}

.visibility-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

/* Override .field input { width: 100% } so radios sit left of the text */
.radio-label input[type='radio'],
.field .radio-label input[type='radio'] {
  width: auto;
  min-width: 1rem;
  height: auto;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  align-self: center;
  accent-color: var(--accent);
}

.radio-label span {
  flex: 1 1 auto;
  min-width: 0;
}

.radio-label strong {
  color: var(--bank-gold);
}

/* —— Toast / errors —— */
.toast {
  position: fixed;
  left: 50%;
  top: 1rem;
  bottom: auto;
  transform: translateX(-50%) translateY(-120%);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.75rem 1.15rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  z-index: 200;
  max-width: min(90vw, 400px);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.toast.error {
  border-color: rgba(232, 93, 93, 0.5);
  background: #3a1f24;
}

.conn-status {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.conn-status.live {
  color: var(--success);
}

.conn-status.down {
  color: var(--danger);
}

/* —— Lobby —— */
.room-code-box {
  text-align: center;
  padding: 1rem;
  background: var(--bg-elevated);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.room-code-box .label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.room-code-box .code {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--bank-gold);
  margin: 0.25rem 0;
  font-variant-numeric: tabular-nums;
}

.room-code-box .hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.invite-link-heading {
  margin-top: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.invite-link-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  margin-top: 0.35rem;
  text-align: left;
}

.room-code-box .invite-link {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  padding: 0.3rem 0.45rem;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.25);
  color: #9cc9f5;
  font-size: 0.7rem;
  word-break: break-all;
  line-height: 1.25;
  user-select: all;
  cursor: text;
  display: flex;
  align-items: center;
}

.btn-copy-icon {
  flex: 0 0 auto;
  width: 2rem;
  min-height: 2rem;
  padding: 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 156, 240, 0.15);
  border: 1px solid rgba(61, 156, 240, 0.35);
  color: var(--accent);
  cursor: pointer;
}

.btn-copy-icon:hover {
  background: rgba(61, 156, 240, 0.28);
  border-color: rgba(61, 156, 240, 0.55);
}

.btn-copy-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-copy-icon .icon-clipboard {
  display: block;
}

.lobby-color-field {
  margin: 0;
}

.lobby-waiting {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.65rem 0 0;
  min-height: 1.2em;
}

.lobby-actions {
  margin-top: 0.75rem;
  gap: 0.45rem;
}

/* Compact lobby buttons — same colors, smaller footprint */
.lobby-actions .btn-primary,
.lobby-actions .btn-secondary {
  margin-top: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 10px;
}

.lobby-btn-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

.lobby-btn-row > .btn-primary,
.lobby-btn-row > .btn-secondary {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

/* When a sibling is hidden, remaining button fills the row */
.lobby-btn-row > .hidden {
  display: none !important;
}

/* Non-host: only Leave is shown — keep it full width */
.lobby-host-row:not(.is-host) #btn-start {
  display: none !important;
}

.lobby-players-section {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lobby-players-section h2 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  margin-bottom: 0.4rem;
  gap: 0.4rem;
}

.player-list .name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1 1 auto;
}

.player-list .player-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-list .lobby-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #0f1419;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* Avatar color picker — avoids green (turn indicator) */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.color-swatch {
  position: relative;
  width: 1.33rem;
  height: 1.33rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  overflow: hidden;
}

.color-swatch:hover:not(:disabled) {
  transform: scale(1.08);
}

.color-swatch.is-selected {
  border-color: #fff;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.4);
  transform: scale(1.1);
}

/* Taken: keep full color, show X instead of fading */
.color-swatch:disabled,
.color-swatch.is-taken {
  opacity: 1;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.color-swatch.is-taken::before,
.color-swatch.is-taken::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  height: 2.5px;
  background: rgba(15, 20, 25, 0.88);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 1;
}

.color-swatch.is-taken::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.color-swatch.is-taken::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.color-swatch.is-taken.is-selected {
  opacity: 1;
  filter: none;
}

/* Your own selected color is not "taken" for you — no X */
.color-swatch.is-selected:not(.is-taken)::before,
.color-swatch.is-selected:not(.is-taken)::after {
  content: none;
}

.player-list .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 55%;
}

.player-list .player-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.2rem;
  min-width: 0;
}

.player-list .player-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(61, 156, 240, 0.2);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.badge.host {
  background: rgba(240, 193, 75, 0.2);
  color: var(--bank-gold);
}

.badge.you {
  background: rgba(62, 207, 142, 0.2);
  color: var(--success);
}

.badge.banked {
  background: rgba(240, 193, 75, 0.25);
  color: var(--bank-gold);
}

.badge.offline {
  background: rgba(232, 93, 93, 0.2);
  color: var(--danger);
}

.badge.ready {
  background: rgba(62, 207, 142, 0.2);
  color: var(--success);
}

.badge.spectator {
  background: rgba(139, 155, 180, 0.22);
  color: #b8c4d8;
}

.player-list li.is-spectator .name {
  opacity: 0.88;
}

/* Compact icon-only player actions (lobby + seats) */
.btn-player-icon {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-player-icon svg {
  display: block;
}

.btn-player-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn-make-host.btn-player-icon,
.btn-make-host {
  background: rgba(240, 193, 75, 0.15);
  color: var(--bank-gold);
  border-color: rgba(240, 193, 75, 0.4);
  margin-right: 0;
  font-size: inherit;
  padding: 0;
  font-weight: 600;
}

.btn-make-host.btn-player-icon:hover,
.btn-make-host:hover {
  background: rgba(240, 193, 75, 0.3);
}

.btn-make-spectator.btn-player-icon,
.btn-make-spectator {
  background: rgba(139, 155, 180, 0.16);
  color: #b8c4d8;
  border-color: rgba(139, 155, 180, 0.35);
  margin-right: 0;
  font-size: inherit;
  padding: 0;
  font-weight: 600;
}

.btn-make-spectator.btn-player-icon:hover,
.btn-make-spectator:hover {
  background: rgba(139, 155, 180, 0.3);
}

.btn-kick.btn-player-icon,
.btn-kick {
  background: rgba(232, 93, 93, 0.2);
  color: var(--danger);
  border-color: rgba(232, 93, 93, 0.35);
  font-size: inherit;
  padding: 0;
  font-weight: 600;
}

.btn-kick.btn-player-icon:hover,
.btn-kick:hover {
  background: rgba(232, 93, 93, 0.35);
}

.btn-vote-kick.btn-player-icon,
.btn-vote-kick {
  background: rgba(240, 160, 48, 0.15);
  color: var(--warning);
  border-color: rgba(240, 160, 48, 0.35);
  font-size: inherit;
  padding: 0;
  font-weight: 600;
}

.btn-vote-kick.btn-player-icon:hover,
.btn-vote-kick:hover {
  background: rgba(240, 160, 48, 0.3);
}

.seat-make-host {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  font-size: 0.55rem;
  padding: 0.12rem 0.25rem;
  border-radius: 6px;
  background: rgba(240, 193, 75, 0.95);
  color: #1a1408;
  border: none;
  font-weight: 800;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
}

.vote-kick-banner {
  text-align: center;
  padding: 0.55rem 0.65rem;
  margin: 0.5rem 0 0.65rem;
  border-radius: 12px;
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.4);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.35;
}

.vote-kick-banner.hidden {
  display: none;
}

.vote-kick-banner strong {
  color: var(--danger);
}

.vote-kick-banner .vote-kick-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.vote-kick-banner .vote-kick-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.vote-kick-banner .vote-kick-actions button {
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.vote-kick-banner .btn-vote-yes {
  background: rgba(62, 207, 142, 0.25);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.4);
}

.vote-kick-banner .btn-vote-no {
  background: rgba(232, 93, 93, 0.2);
  color: var(--danger);
  border: 1px solid rgba(232, 93, 93, 0.4);
}

.seat-kick.seat-vote-kick {
  background: rgba(240, 160, 48, 0.9);
  font-size: 0.5rem;
  padding: 0.14rem 0.22rem;
}

.cooldown-banner {
  text-align: center;
  padding: 0.4rem 0.45rem;
  margin-bottom: 0.4rem;
  border-radius: 10px;
  background: rgba(240, 160, 48, 0.15);
  border: 1px solid rgba(240, 160, 48, 0.35);
  color: var(--warning);
  font-weight: 600;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  min-height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-end-game {
  color: var(--danger);
  border-color: rgba(232, 93, 93, 0.35);
}

.score-row .row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* —— Play —— */
.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  font-size: 0.85rem;
  line-height: 1.25;
  color: var(--muted);
  margin-bottom: 0.5rem;
  gap: 0.4rem 0.5rem;
  min-height: 1.5rem;
}

#play-round {
  justify-self: start;
  min-width: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  justify-self: end;
  min-width: 0;
}

#play-round.is-final-round {
  color: #f0c14b;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* All-time high for current round length (risk target) */
.record-high-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  margin: 0 0 0.55rem;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    rgba(240, 193, 75, 0.14),
    rgba(240, 193, 75, 0.05)
  );
  border: 1px solid rgba(240, 193, 75, 0.28);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: center;
}

.record-high-banner.is-empty {
  opacity: 0.85;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

.record-high-banner--inline {
  margin: 0 0 0.85rem;
}

.record-high-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
  color: var(--bank-gold-dim);
}

.record-high-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
  font-size: 0.95rem;
}

.record-high-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.record-high-banner.is-beating .record-high-score {
  color: var(--success);
}

.record-high-banner.is-beating {
  border-color: rgba(62, 207, 142, 0.4);
  background: linear-gradient(
    135deg,
    rgba(62, 207, 142, 0.12),
    rgba(62, 207, 142, 0.04)
  );
}

.record-high-banner.is-beating .record-high-label {
  color: var(--success);
}

.play-code-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

#play-code {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.btn-copy-link {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 0.22rem 0.45rem;
  border-radius: 7px;
  background: rgba(61, 156, 240, 0.15);
  border: 1px solid rgba(61, 156, 240, 0.35);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy-link:hover {
  background: rgba(61, 156, 240, 0.28);
  border-color: rgba(61, 156, 240, 0.55);
}

/* Compact control: same visual height as Round / room code row */
.sound-control {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  justify-self: center;
  flex-shrink: 0;
  height: 1.5rem;
  box-sizing: border-box;
  padding: 0 0.3rem 0 0.1rem;
  border-radius: 7px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: min(8.5rem, 36vw);
  max-width: 9rem;
}

.btn-sound {
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  border-radius: 5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
}

.btn-sound:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.sound-control.is-muted .btn-sound,
.btn-sound.is-muted {
  opacity: 0.75;
  filter: grayscale(0.45);
}

.btn-sound-icon {
  pointer-events: none;
  font-size: 0.85rem;
  line-height: 1;
}

.sound-volume {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.sound-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 0.22rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  outline: none;
  cursor: pointer;
}

.sound-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent, #3d9cf0);
  border: 1.5px solid #0f1419;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.sound-volume-slider::-moz-range-thumb {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent, #3d9cf0);
  border: 1.5px solid #0f1419;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.sound-control.is-muted .sound-volume-slider {
  opacity: 0.55;
}

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

.field-checkbox {
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-label input {
  margin-top: 0.2rem;
  width: auto;
}

.spectator-banner {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(167, 139, 250, 0.15);
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: #d4c4fc;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.spectator-banner strong {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #c4b5fd;
}

/* Subtle in-game spectator list (above table so dock never covers it) */
.spectators-strip {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.55rem;
  padding: 0.3rem 0.15rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0.9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.spectators-strip-label {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: rgba(167, 139, 250, 0.75);
  flex-shrink: 0;
}

.spectators-strip-names {
  color: rgba(200, 210, 225, 0.7);
  font-weight: 500;
  word-break: break-word;
}

.spectators-strip-names .is-you-spec {
  color: rgba(196, 181, 253, 0.95);
  font-weight: 600;
}

.seat.is-vacant .seat-avatar {
  background: #4a5568 !important;
  opacity: 0.75;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.25);
}

.seat.is-vacant .seat-name {
  color: var(--muted);
  font-style: italic;
}

.sit-down-panel {
  margin-top: 0.25rem;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  background: rgba(36, 48, 68, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 5.5rem;
  overflow-y: auto;
}

.sit-down-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.sit-down-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sit-down-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.sit-down-row button {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 8px;
  background: rgba(62, 207, 142, 0.2);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.35);
  font-weight: 700;
}

.bank-display {
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
  transition:
    background 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

/* First 3 rolls of the round — protected (cool / safe blue) */
.bank-display--protected {
  background:
    linear-gradient(165deg, rgba(61, 156, 240, 0.45) 0%, rgba(30, 90, 150, 0.55) 45%, rgba(20, 45, 80, 0.9) 100%),
    var(--bg-card);
  border: 1px solid rgba(120, 190, 255, 0.55);
  box-shadow:
    0 0 24px rgba(61, 156, 240, 0.25),
    var(--shadow);
}

.bank-display--protected .label {
  color: #9cc9f5;
}

.bank-display--protected .amount {
  color: #f0f7ff;
  text-shadow: 0 0 18px rgba(100, 180, 255, 0.35);
}

.bank-display--protected .sub {
  color: #a8c8e8;
}

/* After first 3 rolls — open pot (warm gold / risk) */
.bank-display--open {
  background:
    linear-gradient(165deg, rgba(240, 193, 75, 0.5) 0%, rgba(180, 100, 40, 0.45) 50%, rgba(60, 35, 20, 0.95) 100%),
    var(--bg-card);
  border: 1px solid rgba(240, 193, 75, 0.55);
  box-shadow:
    0 0 24px rgba(240, 160, 48, 0.28),
    var(--shadow);
}

.bank-display--open .label {
  color: var(--bank-gold);
}

.bank-display--open .amount {
  color: #fff8e8;
  text-shadow: 0 0 18px rgba(240, 193, 75, 0.4);
}

.bank-display--open .sub {
  color: #e8c98a;
}

.bank-display .label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.bank-display .amount {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 0.1rem 0;
}

.bank-display .sub {
  font-size: 0.7rem;
}

/* —— Table seats (avatars left / right) —— */
.play-table {
  display: grid;
  grid-template-columns: minmax(4.5rem, 5.5rem) minmax(0, 1fr) minmax(4.5rem, 5.5rem);
  gap: 0.35rem;
  align-items: stretch;
  min-height: min(62dvh, 520px);
}

.seat-col {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 0.35rem;
  min-height: 100%;
}

.play-center {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  position: relative;
  padding: 0.15rem 0;
}

.seat.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.seat-avatar-wrap {
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
}

.seat-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #0f1419;
  border: 3px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  user-select: none;
}

/* White + green ring — reads clearly on every avatar hue (no green swatches) */
.seat.is-turn .seat-avatar {
  border-color: #ffffff;
  box-shadow:
    0 0 0 3px var(--success),
    0 0 14px rgba(62, 207, 142, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  transform: scale(1.06);
}

.seat.is-you .seat-avatar {
  outline: 1px dashed rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.seat.is-offline .seat-avatar {
  filter: grayscale(0.7);
  opacity: 0.65;
}

.seat-bank-badge {
  position: absolute;
  top: -0.4rem;
  right: -0.55rem;
  background: var(--bank-gold);
  color: #1a1408;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.14rem 0.32rem;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  line-height: 1.1;
  z-index: 1;
  max-width: 3.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— Pre-game start countdown —— */
.game-start-announce {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(8, 12, 18, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.game-start-announce.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.game-start-announce-card {
  text-align: center;
  max-width: min(92vw, 22rem);
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 20px;
  background: linear-gradient(165deg, #1c2838 0%, #121a24 100%);
  border: 1px solid rgba(240, 193, 75, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  transform: scale(0.92);
  transition: transform 0.28s ease;
}

.game-start-announce.is-visible .game-start-announce-card {
  transform: scale(1);
}

.game-start-announce-message {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 1rem;
}

.game-start-announce-caption {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bank-gold);
  margin-bottom: 0.35rem;
}

.game-start-announce-count {
  font-size: 4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--bank-gold);
  text-shadow: 0 0 28px rgba(240, 193, 75, 0.35);
}

/* —— BANK celebration overlay —— */
.bank-announce {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  /* Leave bottom dock free so other players can still tap BANK */
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(6, 10, 16, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  /* Never block the action dock — celebrations are visual only */
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.bank-announce.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.bank-announce.is-fading {
  opacity: 0;
}

.bank-announce-card {
  text-align: center;
  max-width: min(92vw, 420px);
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(240, 193, 75, 0.35), transparent 60%),
    linear-gradient(165deg, #2a2210 0%, #1a2332 55%, #121820 100%);
  border: 2px solid rgba(240, 193, 75, 0.65);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(240, 193, 75, 0.25);
  transform: scale(0.86) translateY(12px);
  transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.bank-announce.is-visible .bank-announce-card {
  transform: scale(1) translateY(0);
  animation: bank-pulse 0.9s ease 0.15s both;
}

.bank-announce-kicker {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: var(--bank-gold);
  text-shadow: 0 0 20px rgba(240, 193, 75, 0.55);
  margin-bottom: 0.5rem;
}

.bank-announce-name {
  font-size: clamp(1.6rem, 6vw, 2.25rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.bank-announce-amount {
  font-size: clamp(2.6rem, 12vw, 3.75rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
  line-height: 1.05;
  text-shadow: 0 0 28px rgba(240, 193, 75, 0.45);
}

.bank-announce-sub {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

@keyframes bank-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

/* —— DOUBLES celebration (violet — distinct from gold BANK) —— */
.double-announce {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(12, 8, 28, 0.78);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.double-announce.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.double-announce.is-fading {
  opacity: 0;
}

.double-announce-card {
  text-align: center;
  max-width: min(92vw, 420px);
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(168, 85, 247, 0.45), transparent 60%),
    linear-gradient(165deg, #2a1848 0%, #1a1530 55%, #100e1c 100%);
  border: 2px solid rgba(192, 132, 252, 0.75);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(168, 85, 247, 0.35);
  transform: scale(0.86) translateY(12px);
  transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.double-announce.is-visible .double-announce-card {
  transform: scale(1) translateY(0);
  animation: double-pulse 0.9s ease 0.15s both;
}

.double-announce-kicker {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: #d8b4fe;
  text-shadow: 0 0 20px rgba(192, 132, 252, 0.65);
  margin-bottom: 0.5rem;
}

.double-announce-name {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.double-announce-amount {
  font-size: clamp(2.6rem, 12vw, 3.75rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #c084fc;
  line-height: 1.05;
  text-shadow: 0 0 28px rgba(168, 85, 247, 0.55);
}

.double-announce-sub {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: #c4b5d8;
  letter-spacing: 0.04em;
}

/* —— Protected +70 seven (lucky cyan/gold — not the red bust) —— */
.plus70-announce {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(8, 24, 32, 0.78);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.plus70-announce.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.plus70-announce.is-fading {
  opacity: 0;
}

.plus70-announce-card {
  text-align: center;
  max-width: min(92vw, 420px);
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(56, 189, 248, 0.4), transparent 55%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(240, 193, 75, 0.2), transparent 50%),
    linear-gradient(165deg, #0c3040 0%, #152028 55%, #0c1218 100%);
  border: 2px solid rgba(56, 189, 248, 0.7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(56, 189, 248, 0.3);
  transform: scale(0.86) translateY(12px);
  transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.plus70-announce.is-visible .plus70-announce-card {
  transform: scale(1) translateY(0);
  animation: double-pulse 0.9s ease 0.15s both;
}

.plus70-announce-kicker {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #7dd3fc;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.55);
  margin-bottom: 0.5rem;
}

.plus70-announce-name {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.plus70-announce-amount {
  font-size: clamp(2.8rem, 13vw, 4rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
  line-height: 1.05;
  text-shadow: 0 0 28px rgba(240, 193, 75, 0.5);
}

.plus70-announce-sub {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: #9cc9f5;
  letter-spacing: 0.03em;
}

@keyframes double-pulse {
  0% {
    transform: scale(1) rotate(0deg);
  }
  30% {
    transform: scale(1.06) rotate(-1deg);
  }
  60% {
    transform: scale(1.03) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* —— SEVEN bust celebration (red — round ends) —— */
.seven-announce {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(28, 8, 10, 0.82);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.seven-announce.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.seven-announce.is-fading {
  opacity: 0;
}

.seven-announce-card {
  text-align: center;
  max-width: min(92vw, 420px);
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(239, 68, 68, 0.4), transparent 60%),
    linear-gradient(165deg, #4a1218 0%, #2a1014 55%, #140a0c 100%);
  border: 2px solid rgba(248, 113, 113, 0.75);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(239, 68, 68, 0.35);
  transform: scale(0.86) translateY(12px);
  transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.seven-announce.is-visible .seven-announce-card {
  transform: scale(1) translateY(0);
  animation: seven-shake 0.85s ease 0.1s both;
}

.seven-announce-kicker {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: #fca5a5;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.65);
  margin-bottom: 0.5rem;
}

.seven-announce-name {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.seven-announce-amount {
  font-size: clamp(2.8rem, 14vw, 4rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #f87171;
  line-height: 1.05;
  text-shadow: 0 0 28px rgba(239, 68, 68, 0.55);
}

.seven-announce-sub {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: #e8b4b8;
  letter-spacing: 0.03em;
  line-height: 1.35;
  padding: 0 0.25rem;
}

@keyframes seven-shake {
  0% {
    transform: scale(1) rotate(0deg);
  }
  20% {
    transform: scale(1.05) rotate(-2deg);
  }
  40% {
    transform: scale(1.02) rotate(2deg);
  }
  60% {
    transform: scale(1.04) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* —— Round-start YOUR TURN (green) —— */
.turn-announce {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(6, 22, 16, 0.78);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.turn-announce.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.turn-announce.is-fading {
  opacity: 0;
}

.turn-announce-card {
  text-align: center;
  max-width: min(92vw, 420px);
  width: 100%;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 24px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(62, 207, 142, 0.4), transparent 60%),
    linear-gradient(165deg, #0f3d2a 0%, #122820 55%, #0a1812 100%);
  border: 2px solid rgba(62, 207, 142, 0.7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(62, 207, 142, 0.3);
  transform: scale(0.86) translateY(12px);
  transition: transform 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.turn-announce.is-visible .turn-announce-card {
  transform: scale(1) translateY(0);
  animation: turn-pulse 0.9s ease 0.12s both;
}

/* Other players: cooler blue-teal so it doesn't look like "your turn" */
.turn-announce.is-others {
  background: rgba(8, 16, 28, 0.78);
}

.turn-announce.is-others .turn-announce-card {
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(61, 156, 240, 0.35), transparent 60%),
    linear-gradient(165deg, #0f2740 0%, #121a28 55%, #0a1018 100%);
  border-color: rgba(100, 180, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(61, 156, 240, 0.22);
}

.turn-announce.is-others .turn-announce-kicker {
  color: #9cc9f5;
  text-shadow: 0 0 18px rgba(61, 156, 240, 0.45);
}

.turn-announce.is-others .turn-announce-title {
  text-shadow: 0 0 20px rgba(61, 156, 240, 0.3);
}

.turn-announce.is-others .turn-announce-sub {
  color: #8b9bb4;
}

/* Final round: shared gold treatment so every player notices */
.turn-announce.is-final {
  background: rgba(28, 16, 4, 0.82);
}

.turn-announce.is-final .turn-announce-card {
  background:
    radial-gradient(ellipse 95% 75% at 50% 0%, rgba(240, 193, 75, 0.48), transparent 58%),
    linear-gradient(165deg, #4a3210 0%, #2a1c0a 50%, #120c06 100%);
  border-color: rgba(240, 193, 75, 0.85);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 56px rgba(240, 193, 75, 0.38);
  animation: turn-pulse 0.9s ease 0.12s both, final-round-glow 1.6s ease-in-out 0.2s 2;
}

.turn-announce.is-final .turn-announce-kicker {
  font-size: 0.9rem;
  letter-spacing: 0.32em;
  color: #f0c14b;
  text-shadow: 0 0 22px rgba(240, 193, 75, 0.65);
}

.turn-announce.is-final .turn-announce-title {
  font-size: clamp(2.1rem, 9vw, 3.1rem);
  letter-spacing: 0.02em;
  color: #fff8e7;
  text-shadow:
    0 0 28px rgba(240, 193, 75, 0.55),
    0 2px 0 rgba(120, 80, 10, 0.35);
}

.turn-announce.is-final .turn-announce-sub {
  color: #e8d5a3;
  font-weight: 600;
}

@keyframes final-round-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08) inset,
      0 20px 60px rgba(0, 0, 0, 0.55),
      0 0 40px rgba(240, 193, 75, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.1) inset,
      0 20px 60px rgba(0, 0, 0, 0.55),
      0 0 72px rgba(240, 193, 75, 0.55);
  }
}

.turn-announce-kicker {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: #6eecc0;
  text-shadow: 0 0 18px rgba(62, 207, 142, 0.55);
  margin-bottom: 0.55rem;
}

.turn-announce-title {
  font-size: clamp(1.75rem, 7vw, 2.5rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  text-shadow: 0 0 24px rgba(62, 207, 142, 0.4);
}

.turn-announce-sub {
  margin-top: 0.65rem;
  font-size: 0.95rem;
  color: #9ed4bc;
  letter-spacing: 0.03em;
}

@keyframes turn-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* —— Idle turn reminder (amber) —— */
.turn-idle-announce {
  position: fixed;
  inset: 0;
  z-index: 290;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4.5rem 1rem 1rem;
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(20, 14, 6, 0.45);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.turn-idle-announce.is-visible {
  opacity: 1;
  visibility: visible;
}

.turn-idle-announce.is-fading {
  opacity: 0;
}

.turn-idle-announce-card {
  text-align: center;
  max-width: min(92vw, 360px);
  width: 100%;
  padding: 1.15rem 1.25rem 1.1rem;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(240, 160, 48, 0.35), transparent 60%),
    linear-gradient(165deg, #3d2a10 0%, #1a2332 100%);
  border: 2px solid rgba(240, 160, 48, 0.65);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.turn-idle-announce-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--warning);
  margin-bottom: 0.35rem;
}

.turn-idle-announce-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.turn-idle-announce-sub {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #e8c98a;
}

/* —— Auto-BANK warning (orange/red) —— */
.turn-autobank-announce {
  position: fixed;
  inset: 0;
  z-index: 295;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: calc(var(--play-actions-h) + 0.5rem);
  background: rgba(30, 10, 8, 0.72);
  backdrop-filter: blur(4px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.turn-autobank-announce.is-visible {
  opacity: 1;
  visibility: visible;
}

.turn-autobank-announce.is-fading {
  opacity: 0;
}

.turn-autobank-announce-card {
  text-align: center;
  max-width: min(92vw, 380px);
  width: 100%;
  padding: 1.5rem 1.35rem 1.35rem;
  border-radius: 22px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 0%, rgba(239, 68, 68, 0.35), transparent 55%),
    linear-gradient(165deg, #4a2010 0%, #1a1520 100%);
  border: 2px solid rgba(248, 113, 113, 0.7);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.turn-autobank-announce-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #fca5a5;
  margin-bottom: 0.35rem;
}

.turn-autobank-announce-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.turn-autobank-announce-time {
  font-size: 3rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #f87171;
  line-height: 1.1;
  margin: 0.25rem 0;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.45);
}

.turn-autobank-announce-sub {
  font-size: 0.9rem;
  color: #e8b4b8;
}

.seat.is-banked .seat-avatar {
  border-color: var(--bank-gold);
  box-shadow: 0 0 0 2px rgba(240, 193, 75, 0.35);
}

.seat-name {
  font-size: 0.65rem;
  font-weight: 600;
  max-width: 4.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  line-height: 1.2;
}

.seat-score {
  font-size: 0.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
  line-height: 1.1;
}

.seat-kick {
  position: absolute;
  top: -0.2rem;
  left: -0.25rem;
  font-size: 0.55rem;
  padding: 0.12rem 0.25rem;
  border-radius: 6px;
  background: rgba(232, 93, 93, 0.9);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
}

@media (min-width: 400px) {
  .play-table {
    grid-template-columns: 6rem minmax(0, 1fr) 6rem;
  }

  .seat-avatar-wrap {
    width: 3.1rem;
    height: 3.1rem;
  }

  .seat-avatar {
    font-size: 0.95rem;
  }

  .seat-name {
    font-size: 0.7rem;
    max-width: 5.5rem;
  }
}

.protected-banner {
  background: rgba(61, 156, 240, 0.15);
  border: 1px solid rgba(61, 156, 240, 0.3);
  color: #9cc9f5;
  border-radius: 10px;
  padding: 0.4rem 0.45rem;
  font-size: 0.68rem;
  text-align: center;
  margin-bottom: 0.4rem;
  min-height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
}

/* Keep layout slot when banner has no content (do not use display:none) */
.protected-banner.is-empty,
.cooldown-banner.is-empty {
  visibility: hidden;
  pointer-events: none;
  border-color: transparent;
  background: transparent;
}

.dice-area {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.5rem 0;
  min-height: 56px;
}

.die {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f5f5f5;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.die.shake {
  animation: shake 0.45s ease;
}

.die.rolling {
  animation: dice-roll 0.12s linear infinite;
  box-shadow: 0 0 16px rgba(61, 156, 240, 0.45);
}

.die.settle {
  animation: dice-settle 0.4s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-12deg) scale(1.05);
  }
  75% {
    transform: rotate(12deg) scale(1.05);
  }
}

@keyframes dice-roll {
  0% {
    transform: rotate(-18deg) scale(1.08);
  }
  50% {
    transform: rotate(18deg) scale(0.96);
  }
  100% {
    transform: rotate(-18deg) scale(1.08);
  }
}

@keyframes dice-settle {
  0% {
    transform: scale(1.2) rotate(-8deg);
  }
  50% {
    transform: scale(0.95) rotate(4deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.roll-effect {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 2.6em;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.roll-effect strong {
  color: var(--bank-gold);
}

.turn-banner {
  text-align: center;
  padding: 0.4rem 0.35rem;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.8rem;
  min-height: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.turn-banner.yours {
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.3);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* —— Fixed play action dock —— */
#screen-play:not(.hidden) {
  display: block;
}

.play-scroll {
  /* Extra room for dock + optional Stand up / sit panel */
  padding-bottom: calc(var(--play-actions-h) + 4.5rem + env(safe-area-inset-bottom, 0px));
}

.play-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  margin: 0;
  padding: 0.45rem 0.85rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  /* Above BANK celebration overlay so BANK stays tappable */
  z-index: 320;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  /* Cap height on small phones so primary row stays on-screen */
  max-height: min(42dvh, 16rem);
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    var(--bg) 78%,
    rgba(15, 20, 25, 0.92) 92%,
    transparent 100%
  );
}

.play-actions-secondary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Chat · Stand up · End game on one row */
.play-actions-tools {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
}

.play-actions-tools .play-tool-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
  padding: 0.45rem 0.4rem;
  font-size: 0.82rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.play-actions-tools .play-tool-btn .chat-unread {
  /* Slightly smaller in the dock tools row */
  min-width: 1.1rem;
  height: 1.1rem;
  font-size: 0.65rem;
}

.play-actions-row {
  display: flex;
  flex-direction: row;
  gap: 0.55rem;
  width: 100%;
  flex: 0 0 auto;
  /* Always the bottom-most control strip */
  margin-top: auto;
}

.play-actions-row .btn-roll,
.play-actions-row .btn-bank {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin: 0;
  font-size: 1.05rem;
  padding: 0.85rem 0.45rem;
}

/* Clearer “not your action right now” state during BANK celebrations */
.play-actions-row .btn-roll:disabled,
.play-actions-row .btn-roll.is-locked,
.play-actions-row .btn-bank:disabled,
.play-actions-row .btn-bank.is-locked {
  background: linear-gradient(160deg, #4a5560, #2f363d);
  color: #9aa3ad;
  opacity: 0.9;
  filter: none;
}

/* Hidden secondary controls must not reserve vertical space */
.play-actions .is-ghost,
.play-actions .hidden {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

.scoreboard h3 {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.score-row.current {
  outline: 1px solid var(--accent);
}

.score-row .score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
}

/* —— Round end / game over —— */
.center-card {
  text-align: center;
}

.center-card h2 {
  color: var(--bank-gold);
}

.round-end-dice-wrap {
  margin: 0.75rem 0 0.5rem;
}

.round-end-dice-wrap.hidden {
  display: none !important;
}

.round-end-dice {
  margin: 0.25rem 0 0.5rem;
}

.round-end-roll-detail {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.round-end-roll-detail strong {
  color: var(--bank-gold);
}

.round-end-cooldown {
  min-height: 1.4em;
  margin: 0.35rem 0 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--warning);
  font-size: 0.95rem;
}

.round-end-cooldown.is-empty {
  visibility: hidden;
}

.round-end-actions {
  margin: 0.85rem 0 0.5rem;
}

.round-end-auto-start {
  margin: 0.85rem 0 0.35rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(61, 156, 240, 0.2), rgba(36, 48, 68, 0.9));
  border: 1px solid rgba(61, 156, 240, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.round-end-auto-start.is-urgent {
  background:
    linear-gradient(160deg, rgba(240, 160, 48, 0.22), rgba(60, 40, 20, 0.9));
  border-color: rgba(240, 160, 48, 0.5);
}

.round-end-auto-start.is-starting {
  background:
    linear-gradient(160deg, rgba(62, 207, 142, 0.22), rgba(20, 48, 36, 0.9));
  border-color: rgba(62, 207, 142, 0.5);
}

.round-end-auto-start-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.round-end-auto-start-time {
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #e8eef7;
  letter-spacing: 0.04em;
}

.round-end-auto-start.is-urgent .round-end-auto-start-time {
  color: var(--warning);
}

.round-end-auto-start.is-starting .round-end-auto-start-time {
  color: var(--success);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ready-panel {
  text-align: left;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ready-panel-title {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Combined ready + score list */
.round-end-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.round-end-player-list li {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
}

.round-end-player-list li:last-child {
  border-bottom: none;
}

.round-end-player-list .ready-icon {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

.round-end-player-list .ready-icon.is-ready {
  background: rgba(62, 207, 142, 0.22);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.45);
}

.round-end-player-list .ready-icon.is-waiting {
  background: rgba(240, 160, 48, 0.15);
  color: var(--warning);
  border: 1px solid rgba(240, 160, 48, 0.4);
}

.round-end-player-list .player-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.round-end-player-list .player-score {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--bank-gold);
  text-align: right;
  min-width: 2.5ch;
}

#round-end-ready-hint {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.winner-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0.5rem 0 1rem;
}

.ranking {
  text-align: left;
  margin: 1rem 0;
}

.ranking li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* —— Room chat —— */
.chat-root {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  z-index: 280;
  pointer-events: none;
  box-sizing: border-box;
}

/* Compact new-message snack near the chat control */
.chat-preview {
  pointer-events: auto;
  position: absolute;
  left: 0.75rem;
  right: auto;
  bottom: 3.35rem;
  max-width: min(18rem, calc(100% - 1.5rem));
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
  background: rgba(22, 30, 42, 0.94);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transform: translateY(0.4rem);
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  font: inherit;
  line-height: 1.3;
}

.chat-preview.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.chat-preview:hover {
  border-color: rgba(61, 156, 240, 0.45);
  background: rgba(28, 38, 54, 0.96);
}

.chat-preview:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-preview-swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 0.35rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  background: #8b9bb4;
}

.chat-preview-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.chat-preview-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview-text {
  font-size: 0.88rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

/* Above play dock tools during active game */
body.play-active .chat-preview {
  left: 0.65rem;
  bottom: calc(var(--play-actions-h) + 0.55rem + env(safe-area-inset-bottom, 0px));
  z-index: 325;
}

/* During play, chat lives in the dock tools row — hide floating FAB */
body.play-active .chat-root {
  bottom: 0;
  top: 0;
  height: 100%;
}

body.play-active .chat-toggle {
  display: none !important;
}

.chat-toggle {
  pointer-events: auto;
  position: absolute;
  left: 0.75rem;
  bottom: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 2;
}

.chat-toggle:hover {
  background: #2c3a52;
}

.chat-toggle[aria-expanded='true'],
.play-actions-tools .play-tool-btn[aria-expanded='true'] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chat-unread {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-panel {
  pointer-events: auto;
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 3.25rem;
  display: flex;
  flex-direction: column;
  max-height: min(55dvh, 22rem);
  background: linear-gradient(165deg, var(--comms-bg-elevated) 0%, var(--comms-bg) 55%, var(--comms-bg-deep) 100%);
  border: 1px solid var(--comms-border);
  border-radius: var(--radius);
  box-shadow: var(--comms-shadow);
  overflow: hidden;
}

/* Sit above tools row + Roll/BANK dock during play */
body.play-active .chat-panel {
  bottom: calc(var(--play-actions-h) + 3.1rem + env(safe-area-inset-bottom, 0px));
  max-height: min(48dvh, 20rem);
  z-index: 330;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(120, 185, 240, 0.18);
  background: rgba(30, 70, 110, 0.55);
  flex: 0 0 auto;
}

.chat-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #b8d4f0;
}

.chat-channel-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid rgba(120, 185, 240, 0.14);
  background: rgba(20, 50, 80, 0.45);
  flex: 0 0 auto;
}

.chat-channel-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8eb4d4;
  margin-right: 0.15rem;
}

.chat-channel-select {
  flex: 1 1 7rem;
  min-width: 0;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 185, 240, 0.28);
  background: rgba(12, 32, 52, 0.85);
  color: #e8f2fc;
}

.chat-channel-action {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 185, 240, 0.28);
  background: rgba(40, 90, 140, 0.45);
  color: #c8e0f8;
  cursor: pointer;
  white-space: nowrap;
}

.chat-channel-action:hover {
  background: rgba(55, 110, 165, 0.55);
}

.chat-leave-action {
  border-color: rgba(220, 120, 120, 0.4);
  color: #f0c8c8;
  background: rgba(100, 40, 40, 0.4);
}

.chat-leave-action:hover {
  background: rgba(130, 50, 50, 0.55);
}

.chat-leave-action.hidden {
  display: none;
}

.chat-invite-card {
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(120, 185, 240, 0.15);
}

.chat-invite-card:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.chat-msg.is-voice-invite {
  border: 1px solid rgba(100, 190, 255, 0.35);
  background: rgba(30, 80, 120, 0.35);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  margin: 0.35rem 0;
}

.chat-voice-invite-actions {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.4rem;
}

.chat-voice-join-btn {
  font-size: 0.78rem !important;
  font-weight: 700;
  padding: 0.35rem 0.75rem !important;
  border-radius: 8px;
  cursor: pointer;
}

.chat-msg.is-system.is-member-left {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0.35rem;
  margin: 0.15rem 0;
  opacity: 0.85;
}

.chat-msg.is-system .chat-system-text {
  font-size: 0.78rem;
  font-style: italic;
  color: #9bb8d4;
}

.chat-msg.is-system .chat-msg-time {
  font-size: 0.68rem;
  color: #7a9ab8;
  flex: 0 0 auto;
}

.chat-people-panel {
  flex: 0 0 auto;
  max-height: min(36dvh, 14rem);
  overflow: auto;
  margin: 0;
  padding: 0.45rem 0.65rem 0.55rem;
  border-bottom: 1px solid rgba(120, 185, 240, 0.14);
  background: rgba(16, 40, 64, 0.72);
}

.chat-people-panel.hidden {
  display: none;
}

.chat-people-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8eb4d4;
  margin: 0.35rem 0 0.35rem;
}

.chat-people-heading:first-child {
  margin-top: 0.1rem;
}

.chat-people-empty {
  font-size: 0.78rem;
  color: #9bb8d4;
  margin: 0.25rem 0;
  line-height: 1.35;
}

.chat-people-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.15rem;
  border-bottom: 1px solid rgba(120, 185, 240, 0.08);
}

.chat-people-row:last-child {
  border-bottom: none;
}

.chat-people-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.chat-people-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e8f2fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-people-name.is-you {
  color: #b8d4f0;
  font-weight: 500;
}

.chat-people-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.3rem;
}

.chat-people-actions button {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 185, 240, 0.3);
  background: rgba(40, 90, 140, 0.45);
  color: #c8e0f8;
  cursor: pointer;
  white-space: nowrap;
}

.chat-people-actions button:hover {
  background: rgba(55, 110, 165, 0.55);
}

.chat-people-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-invite-banner {
  margin: 0.4rem 0.65rem 0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(120, 185, 240, 0.35);
  background: rgba(35, 80, 120, 0.55);
  font-size: 0.78rem;
  color: #d6eafc;
  flex: 0 0 auto;
}

.chat-invite-banner.hidden {
  display: none;
}

.chat-invite-banner .chat-invite-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.chat-invite-banner button {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 185, 240, 0.3);
  cursor: pointer;
}

.chat-invite-banner .btn-accept {
  background: rgba(40, 140, 90, 0.55);
  color: #e8fff2;
}

.chat-invite-banner .btn-decline {
  background: rgba(80, 40, 40, 0.45);
  color: #f8d8d8;
}

.chat-close {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-typing {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem 0.35rem;
  min-height: 1.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-style: italic;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.12);
}

.chat-typing.hidden {
  display: none !important;
}

.chat-typing-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  flex-shrink: 0;
}

.chat-typing-dots span {
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: chat-typing-bounce 1.2s ease-in-out infinite;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing-bounce {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Subtle pulse on chat toggle when someone is typing and panel is closed */
.chat-toggle.is-someone-typing,
.play-actions-tools .play-tool-btn.is-someone-typing {
  box-shadow: 0 0 0 2px rgba(61, 156, 240, 0.45);
}

.chat-empty {
  margin: 0.75rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  max-width: 92%;
  position: relative;
}

.chat-msg.is-self {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.chat-msg-swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.chat-msg-name {
  font-weight: 700;
  color: var(--text);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-msg-role {
  font-weight: 600;
  opacity: 0.75;
}

.chat-msg-time {
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.chat-msg-text {
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  font-size: 0.9rem;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text);
}

.chat-msg.is-self .chat-msg-text {
  background: rgba(61, 156, 240, 0.22);
  outline: 1px solid rgba(61, 156, 240, 0.35);
}

.chat-msg-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.2rem;
  max-width: 100%;
}

.chat-msg.is-self .chat-msg-reactions {
  justify-content: flex-end;
}

.chat-react-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  cursor: pointer;
  opacity: 0.85;
}

.chat-react-btn:hover {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.chat-react-btn.is-mine {
  border-color: rgba(61, 156, 240, 0.5);
  background: rgba(61, 156, 240, 0.18);
  opacity: 1;
}

.chat-react-btn.is-add {
  opacity: 0.55;
  font-size: 0.78rem;
  padding: 0.12rem 0.4rem;
}

.chat-react-btn .chat-react-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chat-react-btn.is-mine .chat-react-count {
  color: var(--text);
}

.chat-react-menu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 0.15rem);
  z-index: 5;
  flex-direction: row;
  gap: 0.2rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.chat-msg.is-self .chat-react-menu {
  left: auto;
  right: 0;
}

.chat-msg.is-react-open .chat-react-menu {
  display: flex;
}

.chat-react-menu button {
  margin: 0;
  padding: 0.25rem 0.35rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.05rem;
  cursor: pointer;
  line-height: 1;
}

.chat-react-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chat-emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.4rem 0.55rem;
  border-top: 1px solid rgba(120, 185, 240, 0.14);
  background: rgba(30, 70, 110, 0.4);
  max-height: 7.5rem;
  overflow-y: auto;
  flex: 0 0 auto;
}

.chat-emoji-picker.hidden {
  display: none !important;
}

.chat-emoji-picker button {
  margin: 0;
  padding: 0.3rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
}

.chat-emoji-picker button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.chat-compose {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(120, 185, 240, 0.16);
  background: rgba(20, 48, 72, 0.75);
  flex: 0 0 auto;
}

.chat-emoji-btn {
  flex: 0 0 auto;
  width: 2.4rem;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.chat-emoji-btn:hover,
.chat-emoji-btn[aria-expanded='true'] {
  border-color: var(--accent);
  background: rgba(61, 156, 240, 0.12);
}

.chat-compose input {
  /* Take almost all horizontal space; button stays compact */
  flex: 1 1 auto;
  width: 0; /* force flex grow to own leftover width in the row */
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
}

.chat-compose input:focus {
  border-color: var(--accent);
}

/* Override .btn-primary { width: 100% } so Send stays a slim control */
.chat-compose .chat-send.btn-primary,
.chat-compose .chat-send {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  margin-top: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
  align-self: stretch;
}

/* —— Room voice —— */
.voice-root {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  /* Above chat-root (280); panel is a separate fixed layer */
  z-index: 286;
  pointer-events: none;
  box-sizing: border-box;
}

body.play-active .voice-root {
  bottom: 0;
  top: 0;
  height: 100%;
}

/* Combined speaker | mute control (lobby FAB + play dock) */
.voice-split {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-elevated);
  color: var(--text);
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: auto;
}

.voice-split-fab {
  pointer-events: auto;
  position: absolute;
  left: 5.75rem;
  bottom: 0.65rem;
  z-index: 5;
  box-shadow: var(--shadow);
}

body.play-active .voice-split-fab {
  display: none !important;
}

.voice-split-dock {
  flex: 1 1 0;
  min-width: 0;
  /* Match play-tool-btn height/look in the dock */
  box-shadow: none;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
}

.play-actions-tools .voice-split-dock {
  background: rgba(255, 255, 255, 0.04);
}

.voice-split-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.5rem 0.7rem;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 0;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.voice-split-menu .voice-speaker-icon,
.voice-split-menu .voice-speaker-icon path {
  pointer-events: none;
}

.voice-split-dock .voice-split-menu {
  padding: 0.45rem 0.65rem;
  flex: 1 1 auto;
}

.voice-split-menu:hover {
  background: rgba(255, 255, 255, 0.06);
}

.voice-split-divider {
  width: 1px;
  align-self: stretch;
  margin: 0.35rem 0;
  background: rgba(255, 255, 255, 0.16);
  flex: 0 0 auto;
}

.voice-split-mute,
button.voice-split-mute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 0.55rem 0 0.45rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  user-select: none;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.voice-split-mute:hover .voice-switch-track {
  border-color: rgba(255, 255, 255, 0.2);
}

.voice-split-mute.is-disabled {
  opacity: 0.55;
  cursor: pointer;
}

.voice-speaker-icon {
  display: block;
  flex-shrink: 0;
}

.voice-split .voice-speaker-off {
  display: none;
}

.voice-split.is-mic-off .voice-speaker-on {
  display: none;
}

.voice-split.is-mic-off .voice-speaker-off {
  display: block;
}

.voice-split.is-in-voice {
  border-color: rgba(61, 156, 240, 0.55);
  box-shadow: 0 0 0 1px rgba(61, 156, 240, 0.25);
}

.voice-split.is-live-mic {
  border-color: rgba(46, 204, 113, 0.65);
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.32);
}

.voice-split-fab.is-live-mic {
  box-shadow: var(--shadow), 0 0 0 2px rgba(46, 204, 113, 0.32);
}

.voice-split-menu[aria-expanded='true'] {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-radius: 999px 0 0 999px;
}

/* Volume lives only inside the Room voice dialog */
.voice-volume {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  cursor: pointer;
}

.voice-volume-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  flex: 0 0 auto;
}

.voice-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  flex: 1 1 auto;
  min-width: 3.5rem;
  cursor: pointer;
}

.voice-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--accent, #3d9cf0);
  border: 2px solid #0f1419;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.voice-volume-slider::-moz-range-thumb {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--accent, #3d9cf0);
  border: 2px solid #0f1419;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.voice-volume-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.15rem 0.75rem 0.6rem;
  min-height: 2.65rem;
  box-sizing: border-box;
}

.voice-volume-panel {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  gap: 0.45rem;
  padding: 0 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
  min-height: 2.45rem;
}

/* Mic on/off switch (button-based) — panel + split controls */
.voice-mic-switch,
button.voice-mic-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  min-height: 2.45rem;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.voice-mic-switch.is-disabled,
.voice-split-mute.is-disabled {
  opacity: 0.55;
  cursor: pointer;
}

.voice-mic-switch-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.1;
  min-width: 2.1rem;
}

.voice-mic-switch-state {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.voice-mic-switch.is-on .voice-mic-switch-state {
  color: #6dcea0;
}

.voice-switch-track {
  position: relative;
  width: 2.35rem;
  height: 1.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.15s ease, border-color 0.15s ease;
  flex: 0 0 auto;
  pointer-events: none;
}

.voice-switch-thumb {
  position: absolute;
  top: 50%;
  left: 0.14rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #c5d0e0;
  transform: translateY(-50%);
  transition: left 0.15s ease, background 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* On state driven by aria-checked / .is-on (no checkbox) */
.voice-mute-btn.is-on .voice-switch-track,
.voice-mute-btn[aria-checked='true'] .voice-switch-track {
  background: rgba(76, 175, 120, 0.35);
  border-color: rgba(76, 175, 120, 0.55);
}

.voice-mute-btn.is-on .voice-switch-thumb,
.voice-mute-btn[aria-checked='true'] .voice-switch-thumb {
  left: calc(100% - 1.1rem);
  background: #6dcea0;
}

.voice-mute-btn:focus-visible .voice-switch-track {
  outline: 2px solid rgba(91, 159, 212, 0.7);
  outline-offset: 2px;
}

.voice-mic-switch:hover .voice-switch-track,
.voice-split-mute:hover .voice-switch-track {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Fixed panel above play dock / chat (own stacking context) */
.voice-panel {
  pointer-events: auto;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 1.3rem);
  max-width: calc(var(--app-max) - 1.3rem);
  bottom: 3.25rem;
  display: flex;
  flex-direction: column;
  max-height: min(50dvh, 18rem);
  background: linear-gradient(165deg, var(--comms-bg-elevated) 0%, var(--comms-bg) 55%, var(--comms-bg-deep) 100%);
  border: 1px solid var(--comms-border);
  border-radius: var(--radius);
  box-shadow: var(--comms-shadow);
  overflow: hidden;
  z-index: 340;
  box-sizing: border-box;
}

body.play-active .voice-panel {
  bottom: calc(var(--play-actions-h) + 0.75rem + env(safe-area-inset-bottom, 0px));
  max-height: min(42dvh, 16rem);
  z-index: 340;
}

.voice-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(120, 185, 240, 0.18);
  background: rgba(30, 70, 110, 0.55);
}

.voice-panel-title {
  font-weight: 800;
  color: #b8d4f0;
  font-size: 0.95rem;
}

.voice-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  border-radius: 8px;
}

.voice-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.voice-status {
  margin: 0;
  padding: 0.55rem 0.75rem 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Join / Leave — far right of the mic + speaker volume row */
.voice-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  padding: 0;
  margin: 0;
  margin-left: auto;
  flex: 0 0 auto;
}

.voice-actions .voice-action-btn {
  /* Beat global .btn-primary / .btn-secondary { width: 100% } */
  width: auto !important;
  flex: 0 0 auto;
  min-width: 4.25rem;
  margin: 0 !important;
  padding: 0 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 10px;
  min-height: 2.45rem;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
}

/* Compact labels on narrow panels — keep one control height */
@media (max-width: 420px) {
  .voice-volume-label {
    font-size: 0.7rem;
  }

  .voice-actions .voice-action-btn {
    min-width: 3.6rem;
    padding: 0 0.65rem;
    font-size: 0.8rem;
  }
}

.voice-peers {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.25rem 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

.voice-peer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.88rem;
}

.voice-peer-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.voice-peer-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-peer-badge {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.voice-peer.is-muted .voice-peer-badge {
  color: #8b9bb4;
}

.voice-peer.is-live .voice-peer-badge {
  color: #2ecc71;
}

.voice-peer.is-connecting .voice-peer-badge {
  color: #f0c14b;
}

.voice-peer.is-failed .voice-peer-badge {
  color: #e74c3c;
}

.voice-peers-empty {
  margin: 0.35rem 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/*  ECHO game chrome  */
.echo-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.25rem;
}
.echo-mode-card {
  background: linear-gradient(145deg, #1a2740 0%, #121a28 100%);
  border: 1px solid #2d3f5c;
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  text-align: center;
  width: min(100%, 280px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.echo-mode-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: #8b9bb4;
  font-weight: 700;
}
.echo-mode-name {
  font-size: 1.65rem;
  font-weight: 800;
  color: #7dcfff;
  margin-top: 0.15rem;
  text-shadow: 0 0 24px rgba(125, 207, 255, 0.35);
}
.echo-mode-blurb {
  font-size: 0.82rem;
  color: #a8b8d0;
  margin-top: 0.35rem;
  line-height: 1.35;
}
.echo-timer {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #e7ecf3;
  min-height: 1.2em;
}
.echo-timer.is-urgent {
  color: #f07178;
  animation: echo-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes echo-pulse {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0.85; transform: scale(1.04); }
}
.echo-status {
  font-size: 0.95rem;
  color: #c5d0e0;
  text-align: center;
  min-height: 1.3em;
}
.echo-lock-meta {
  font-size: 0.8rem;
  color: #8b9bb4;
}
.echo-number-pad {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 0.25rem;
}
@media (max-width: 420px) {
  .echo-number-pad {
    grid-template-columns: repeat(4, 1fr);
  }
}
.echo-num-btn {
  appearance: none;
  border: 2px solid #2d3f5c;
  background: #1a2332;
  color: #e7ecf3;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 12px;
  min-height: 48px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.echo-num-btn:hover:not(:disabled) {
  border-color: #7dcfff;
  background: #243044;
}
.echo-num-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.echo-num-btn.is-selected,
.echo-num-btn.is-locked {
  border-color: #7dcfff;
  background: rgba(125, 207, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(125, 207, 255, 0.4);
}
.echo-num-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.echo-pick-hint {
  text-align: center;
  font-size: 0.8rem;
  color: #8b9bb4;
  margin: 0.35rem 0 0;
  padding: 0 0.5rem;
}
.echo-reveal {
  width: min(100%, 320px);
  background: #141c28;
  border: 1px solid #2d3f5c;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  font-size: 0.85rem;
}
.echo-reveal-head,
.echo-reveal-row {
  display: grid;
  grid-template-columns: 1.4fr 0.5fr 0.5fr 0.6fr;
  gap: 0.35rem;
  align-items: center;
}
.echo-reveal-head {
  color: #8b9bb4;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #2d3f5c;
}
.echo-reveal-row {
  padding: 0.28rem 0;
}
.echo-reveal-swatch {
  display: none;
}
.echo-reveal-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.echo-reveal-pick {
  font-weight: 800;
  color: #7dcfff;
  text-align: center;
}
.echo-reveal-gain {
  text-align: center;
  color: #8b9bb4;
}
.echo-reveal-gain.is-pos {
  color: #3ecf8e;
  font-weight: 700;
}
.echo-reveal-total {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.seat-pick-bubble {
  min-width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #243044;
  border: 1px solid #3d4f6a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #7dcfff;
}
.seat.is-locked .seat-pick-bubble {
  border-color: #7dcfff;
}
.seat-gain {
  color: #3ecf8e;
  font-weight: 700;
  margin-left: 0.25rem;
}
.brand h1 {
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #7dcfff, #c77dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
