:root {
  color-scheme: dark;
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-elevated: #243044;
  --text: #e8eef7;
  --muted: #8b9bb4;
  --accent: #f0c14b;
  --accent-dim: #c99f2f;
  --danger: #e85d5d;
  --success: #3ecf8e;
  --warning: #f0a030;
  --radius: 16px;
  --app-max: 480px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand h1 {
  font-size: 1.5rem;
  margin: 0;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.home-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: -0.4rem;
}

.home-nav a {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.home-nav a:hover {
  color: var(--accent);
}

.conn-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--muted);
}

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

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

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.card h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select {
  background: var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  color: var(--text);
  font-size: 0.9rem;
}

.row {
  display: flex;
  gap: 0.5rem;
}

.row input {
  flex: 1;
}

.play-tools-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.play-tools-row .btn-secondary {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
  margin-top: 0;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #17140a;
  font-weight: 600;
}

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

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.room-code-box {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-code-label {
  color: var(--muted);
  font-size: 0.75rem;
  margin-right: 0.4rem;
}

.room-code {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.player-row {
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.player-row.is-turn {
  outline: 2px solid var(--success);
}

.player-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.4rem;
}

.badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  margin-left: 0.4rem;
}

.badge.host {
  color: var(--accent);
}

.badge.ready {
  color: var(--success);
}

.lobby-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lobby-actions button {
  flex: 1;
}

.status-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dice-row {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  min-height: 56px;
}

/* Same dice as Bank: white rounded square, dark bold numeral, soft shadow */
.die {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f5f5f5;
  color: #1a1a1a;
  border: none;
  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);
  cursor: pointer;
  user-select: none;
}

.die.is-held {
  box-shadow:
    0 0 0 3px var(--accent),
    0 4px 12px rgba(0, 0, 0, 0.3);
  background: #fff6dd;
}

.die:disabled {
  cursor: default;
}

.die.is-disabled {
  cursor: default;
  opacity: 0.6;
}

.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 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-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rolls-remaining {
  color: var(--muted);
  font-size: 0.85rem;
}

.scorecard-scroll {
  overflow-x: auto;
}

.scorecard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.scorecard th,
.scorecard td {
  padding: 0.35rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.scorecard th:first-child,
.scorecard td:first-child {
  text-align: left;
  color: var(--muted);
}

.scorecard tr.is-section-total td {
  color: var(--muted);
  font-style: italic;
}

.score-cell {
  min-width: 2.4rem;
}

.score-cell.is-open {
  color: var(--muted);
}

.score-cell button {
  width: 100%;
  padding: 0.3rem 0.2rem;
  background: rgba(240, 193, 75, 0.18);
  color: var(--accent);
  font-weight: 600;
}

/* .toast comes from platform-shell/shell-base.css */

.mini-action {
  min-height: 1.75rem;
  margin-right: 0.35rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
}

.vote-kick-banner {
  margin-bottom: 0.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(232, 93, 93, 0.4);
  border-radius: 10px;
  background: rgba(232, 93, 93, 0.1);
  font-size: 0.85rem;
}

.vote-kick-banner p {
  margin: 0 0 0.4rem;
}

.vote-kick-banner .row {
  gap: 0.5rem;
}

.turn-idle-announce {
  position: fixed;
  inset: auto 1rem 4rem auto;
  z-index: 60;
  max-width: min(18rem, calc(100% - 2rem));
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.75rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.turn-idle-announce.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.turn-idle-announce-card {
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(62, 207, 142, 0.45);
  border-radius: 10px;
  background: #102018;
  color: var(--text);
  box-shadow: 0 0.8rem 2rem rgba(0, 0, 0, 0.35);
}

.turn-idle-announce-kicker,
.turn-idle-announce-title {
  margin: 0;
}

.turn-idle-announce-kicker {
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.turn-idle-announce-title {
  margin-top: 0.25rem;
  font-weight: 600;
}
