:root {
  color-scheme: dark;
  --bg: #070b20;
  --surface: #101735;
  --surface-light: #18234a;
  --text: #f7f8fb;
  --muted: #9ca9cd;
  --accent: #28a8ff;
  --accent-strong: #0878f9;
  --gold: #f8c94f;
  --green: #53e0c1;
  --danger: #ff7b7b;
  --line: rgba(135, 158, 224, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(35, 61, 133, 0.34), transparent 32rem),
    linear-gradient(180deg, #090d26 0%, var(--bg) 58%, #090621 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100svh;
}

button {
  font: inherit;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(100%, 680px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 14px calc(24px + var(--safe-bottom));
}

.screen {
  animation: appear 0.25s ease both;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.center-card {
  min-height: calc(100svh - 44px);
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.center-card h1 {
  margin: 18px 0 5px;
  font-family: Georgia, serif;
  font-size: 38px;
}

.center-card p,
.hint {
  color: var(--muted);
}

.brand-mark,
.error-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 23px;
  border: 1px solid rgba(245, 185, 68, 0.4);
  color: var(--accent);
  background: rgba(245, 185, 68, 0.06);
  font-weight: 800;
}

.error-icon {
  color: var(--danger);
  border-color: rgba(255, 123, 123, 0.35);
  background: rgba(255, 123, 123, 0.08);
  font-size: 32px;
}

.topbar,
.game-header,
.lobby-card > header,
.combos-section > header,
.sheet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 4px 0 0;
  font-family: Georgia, serif;
  font-size: 40px;
}

.topbar h1 small {
  display: block;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.icon-button,
.sheet header button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
}

.hero-dice {
  min-height: 210px;
  display: grid;
  place-items: center;
  color: #eef3f7;
  font-size: 72px;
  letter-spacing: -14px;
  text-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
}

.lobby-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, var(--surface-light), var(--surface));
}

.lobby-card > header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.player-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.player {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #304966;
  color: #e6effa;
  font-size: 12px;
  font-weight: 800;
}

.player-name {
  flex: 1;
  font-weight: 700;
}

.host-tag {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.hint {
  margin: 17px 0;
  text-align: center;
  font-size: 11px;
}

.primary-button,
.secondary-button,
.roll-button {
  width: 100%;
  min-height: 60px;
  border-radius: 19px;
  font-weight: 800;
}

.primary-button,
.roll-button {
  border: 0;
  background: linear-gradient(135deg, #ffd578, var(--accent));
  color: #33230a;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 21px;
}

.secondary-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--surface-light);
  color: var(--text);
}

.game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 9px;
  min-height: 48px;
  margin-bottom: 10px;
  align-items: center;
}

.game-logo {
  position: relative;
  justify-self: center;
  font-family: Georgia, serif;
  font-size: clamp(24px, 7vw, 29px);
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(138, 160, 255, 0.28);
}

.game-logo i {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 13px;
  font-style: normal;
}

.header-spacer {
  width: 42px;
}

.game-header > div {
  display: flex;
  gap: 8px;
  justify-self: end;
}

.game-header .header-left {
  justify-self: start;
}

.chat-button,
.stats-button {
  display: none;
}

.chat-button small,
.stats-button small {
  display: block;
  font-size: 7px;
}

.score-button {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 14, 40, 0.7);
  color: var(--muted);
  font-size: 12px;
}

.score-button b {
  margin-left: 8px;
  color: var(--gold);
}

.player-rail {
  display: grid;
  grid-auto-columns: 78px;
  grid-auto-flow: column;
  gap: 8px;
  justify-content: safe center;
  padding: 5px 2px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.player-rail::-webkit-scrollbar {
  display: none;
}

.player-card {
  width: 78px;
  padding: 8px 5px 7px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(22, 31, 70, 0.92), rgba(8, 13, 36, 0.92));
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.player-card.active {
  border-color: #25c8ff;
  box-shadow: 0 0 0 2px rgba(0, 174, 255, 0.2), 0 0 24px rgba(0, 174, 255, 0.36);
  transform: translateY(-2px);
}

.player-card-avatar {
  width: 35px;
  height: 35px;
  margin: 0 auto 4px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 22%, #111831);
  color: #42b8ff;
  font-size: 10px;
  font-weight: 900;
  box-shadow: inset 0 0 12px color-mix(in srgb, currentColor 24%, transparent);
}

.player-card-avatar.tone-1 { color: #ff6479; }
.player-card-avatar.tone-2 { color: #71df63; }
.player-card-avatar.tone-3 { color: #ae6cff; }
.player-card-avatar.tone-4 { color: #ffc64d; }
.player-card-avatar.tone-5 { color: #54dfd3; }

.player-card small,
.player-card strong {
  display: block;
}

.player-card small {
  max-width: 100%;
  overflow: hidden;
  color: #d9e1ff;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-card strong {
  margin-top: 2px;
  color: #fff;
  font-size: 16px;
}

.player-card.me strong {
  color: var(--gold);
}

@media (max-width: 430px) {
  .game-header > div {
    gap: 5px;
  }

  .game-header .score-button,
  .game-header .icon-button {
    width: 38px;
    height: 38px;
  }

  .score-button {
    padding: 0;
  }

  .score-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .score-button b {
    margin: 0;
  }
}

.turn-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  width: min(100%, 310px);
  min-height: 58px;
  margin: 4px auto 0;
  padding: 9px 14px;
  border: 1px solid rgba(34, 177, 255, 0.75);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(5, 62, 112, 0.75), rgba(7, 18, 49, 0.9));
  box-shadow: 0 0 24px rgba(0, 145, 255, 0.17);
  cursor: pointer;
}

.turn-banner span,
.turn-banner strong {
  display: block;
}

.turn-banner span {
  color: #55d6ff;
  font-size: 11px;
  font-weight: 700;
}

.turn-banner strong {
  margin-top: 3px;
  font-size: 13px;
}

.turn-banner.waiting {
  border-color: rgba(138, 151, 203, 0.34);
  background: rgba(12, 18, 45, 0.82);
}

.table-area {
  min-height: 285px;
  margin: 12px -14px 0;
  padding: 38px 18px 21px;
  border: 1px solid rgba(108, 90, 255, 0.18);
  border-radius: 46% 46% 22px 22px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(74, 49, 126, 0.62), transparent 44%),
    radial-gradient(ellipse at 50% 54%, #211c4d 0%, #101631 54%, #080c21 76%);
  box-shadow: inset 0 24px 50px rgba(37, 47, 104, 0.25);
}

.dice-surface {
  display: contents;
}

.dice-tray {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.die {
  width: 56px;
  height: 56px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 4%, #e9eafb 56%, #bbb9d4 100%);
  box-shadow: inset -5px -6px 8px rgba(51, 45, 92, 0.22), 0 13px 21px rgba(0, 0, 0, 0.5);
}

.die.locked {
  transform: translateY(-8px);
  box-shadow: 0 0 0 3px #20c8ff, 0 0 22px rgba(32, 200, 255, 0.5), 0 16px 24px rgba(0, 0, 0, 0.4);
}

.pip {
  width: 8px;
  height: 8px;
  position: absolute;
  border-radius: 50%;
  background: #182333;
}

.p1 { left: 10px; top: 10px; }
.p2 { left: 23px; top: 10px; }
.p3 { right: 10px; top: 10px; }
.p4 { left: 10px; top: 23px; }
.p5 { left: 23px; top: 23px; }
.p6 { right: 10px; top: 23px; }
.p7 { left: 10px; bottom: 10px; }
.p8 { left: 23px; bottom: 10px; }
.p9 { right: 10px; bottom: 10px; }

.roll-button {
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid #52c9ff;
  background: linear-gradient(180deg, #159cff, #0756d5);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 25px rgba(0, 92, 255, 0.35);
}

.roll-button:disabled {
  opacity: 0.45;
  filter: grayscale(0.7);
}

.roll-button.timer-warning:not(:disabled) {
  border-color: #ff9d6c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 25px rgba(255, 97, 80, 0.42);
}

.roll-button > b {
  font-size: 26px;
}

.roll-button span,
.roll-button small {
  display: block;
  text-align: left;
}

.roll-button small {
  margin-top: 3px;
  opacity: 0.65;
  font-size: 10px;
}

.combos-section > header {
  margin: 16px 0 10px;
}

.combos-section h2 {
  margin: 0;
  font-size: 15px;
}

.bonus-badge {
  padding: 5px 8px;
  border: 1px solid rgba(245, 185, 68, 0.25);
  border-radius: 15px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.combo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.combo-card {
  min-height: 65px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.combo-card:disabled {
  opacity: 0.38;
}

.combo-symbol {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-light);
  color: var(--accent);
  font-weight: 800;
}

.combo-copy {
  min-width: 0;
  flex: 1;
}

.combo-copy strong,
.combo-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-copy strong {
  font-size: 10px;
}

.combo-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.combo-points {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.combo-points.zero { color: var(--muted); }
.combo-points.negative { color: var(--danger); }
.combo-points.success { color: var(--green); }

.finish-screen {
  min-height: calc(100svh - 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.trophy {
  width: 100px;
  height: 100px;
  margin-bottom: 24px;
  display: grid;
  place-items: center;
  border-radius: 30px;
  background: linear-gradient(145deg, #ffe5a1, #e9a52a);
  color: #3c2808;
  font-size: 58px;
}

.final-scores {
  width: 100%;
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.close-app-button {
  margin-top: 10px;
  border-color: rgba(255, 123, 123, 0.28);
  color: var(--danger);
}

.final-chat-button {
  margin-top: 10px;
}

.final-row {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.sheet {
  width: min(100% - 16px, 680px);
  max-height: 88svh;
  margin: auto auto 0;
  padding: 18px 18px calc(24px + var(--safe-bottom));
  border: 1px solid var(--line);
  border-radius: 26px 26px 0 0;
  background: #152238;
  color: var(--text);
}

.sheet::backdrop {
  background: rgba(4, 9, 16, 0.75);
}

.sheet h2 {
  margin: 0;
  font-size: 20px;
}

.required-sheet {
  width: min(100% - 24px, 440px);
  margin: auto;
  padding: 27px 22px calc(24px + var(--safe-bottom));
  border-radius: 27px;
  text-align: center;
}

.required-sheet p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.required-sheet strong {
  color: var(--text);
}

.bot-connect-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(40, 168, 255, 0.5);
  border-radius: 22px;
  background: rgba(40, 168, 255, 0.12);
  font-size: 31px;
  box-shadow: 0 0 28px rgba(40, 168, 255, 0.2);
}

.bot-connect-status {
  min-height: 20px;
  margin: 13px 0 0;
  font-size: 11px !important;
}

.score-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 11px;
}

.score-table th,
.score-table td {
  padding: 9px 7px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

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

.total-row {
  color: var(--accent);
  font-weight: 800;
}

.score-value {
  font-weight: 800;
}

.score-value.positive,
.score-value.success {
  color: var(--green);
}

.score-value.negative {
  color: var(--danger);
}

.history-list {
  max-height: 65svh;
  margin-top: 16px;
  overflow-y: auto;
}

.history-entry {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.history-entry span {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.history-entry strong {
  font-size: 13px;
  line-height: 1.45;
}

.history-entry.current {
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  padding: 14px 10px;
  border: 1px solid rgba(97, 211, 156, 0.2);
  border-radius: 14px;
  background: #17323a;
}

.history-entry.current span,
.history-entry.current strong {
  color: var(--green);
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.menu-button,
.header-timer {
  visibility: hidden;
}

.header-timer {
  min-width: 74px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  font-weight: 800;
}

.compact-sheet {
  width: min(100% - 24px, 430px);
}

.menu-actions,
.design-options {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.menu-actions button,
.design-option {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.settings-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 18px 0;
  padding: 4px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.05);
}

.settings-tab {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.settings-tab.active {
  background: var(--surface-light);
  color: var(--text);
}

.setting-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.setting-row span,
.setting-row small,
.design-option span,
.design-option small {
  display: block;
}

.setting-row small,
.design-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.setting-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.design-option {
  justify-content: flex-start;
  gap: 13px;
}

.design-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(40, 168, 255, 0.18);
}

.design-preview {
  width: 54px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 11px;
}

.classic-preview {
  background: radial-gradient(circle at 50% 50%, #33265f, #091027 70%);
}

.wood-preview {
  background:
    linear-gradient(90deg, transparent 48%, rgba(94, 47, 18, 0.18) 50%, transparent 52%),
    linear-gradient(160deg, #f0bd78, #a96832);
}

.table-preview {
  background:
    linear-gradient(90deg, transparent 31%, rgba(93, 195, 255, 0.8) 32% 34%, transparent 35% 52%, rgba(213, 74, 255, 0.8) 53% 55%, transparent 56%),
    repeating-linear-gradient(0deg, #101b4a 0 5px, #25366a 6px 7px);
}

/* The second design is fully scoped so the original theme remains unchanged. */
html[data-design="wood"] body {
  background: #243d3a;
  color: #14345a;
}

html[data-design="wood"] .app-shell {
  background:
    repeating-linear-gradient(2deg, transparent 0 39px, rgba(103, 55, 24, 0.09) 40px, transparent 42px),
    linear-gradient(90deg, rgba(255, 244, 206, 0.12), transparent 28%, rgba(111, 57, 24, 0.08) 70%, transparent),
    linear-gradient(160deg, #e8b771, #c98243 58%, #a96030);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.36);
}

html[data-design="wood"] .game-header {
  color: #fff;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.38);
}

html[data-design="wood"] .menu-button {
  visibility: visible;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(22, 67, 66, 0.76);
  color: #fff;
  font-size: 21px;
}

html[data-design="wood"] .header-timer {
  visibility: visible;
  display: flex;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(22, 67, 66, 0.76);
  color: #fff;
}

html[data-design="wood"] .game-header .score-button,
html[data-design="wood"] .game-header #soundButton,
html[data-design="wood"] .game-header #rulesButton {
  display: none;
}

html[data-design="wood"] .game-logo {
  font-family: Georgia, serif;
  font-size: 30px;
}

html[data-design="wood"] .player-rail {
  justify-content: safe center;
  padding: 8px 2px 13px;
}

html[data-design="wood"] .player-card {
  width: 82px;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(30, 51, 64, 0.76);
  color: #fff;
  box-shadow: 0 5px 14px rgba(66, 35, 18, 0.25);
}

html[data-design="wood"] .player-card.viewed {
  border-color: #ffe282;
  box-shadow: 0 0 0 2px rgba(255, 226, 130, 0.42), 0 7px 18px rgba(66, 35, 18, 0.35);
}

html[data-design="wood"] .player-card.active .player-card-avatar {
  box-shadow: 0 0 0 3px #37c9ff, 0 0 18px #37c9ff;
}

html[data-design="wood"] .player-card small,
html[data-design="wood"] .player-card strong,
html[data-design="wood"] .player-card.me strong {
  color: #fff;
}

html[data-design="wood"] .turn-banner {
  display: none;
}

html[data-design="wood"] .table-area {
  min-height: 276px;
  margin-top: 2px;
  padding-top: 31px;
  border: 8px solid #bd793e;
  border-radius: 36px;
  background:
    linear-gradient(rgba(69, 39, 22, 0.25), rgba(69, 39, 22, 0.25)),
    radial-gradient(ellipse at center, #704c35, #38281f 72%);
  box-shadow:
    inset 0 0 0 3px #efbf7b,
    inset 0 13px 26px rgba(0, 0, 0, 0.34),
    0 9px 20px rgba(83, 42, 19, 0.34);
}

html[data-design="wood"] .table-area .hint {
  color: rgba(255, 255, 255, 0.72);
}

html[data-design="wood"] .roll-button {
  border: 2px solid #5ed3ff;
  border-radius: 28px;
  background: linear-gradient(180deg, #12b6ee, #0879d5 58%, #0758b4);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 6px 0 #064f93, 0 10px 22px rgba(22, 57, 88, 0.38);
}

html[data-design="wood"] .combos-section {
  margin: 14px -5px 0;
  padding: 14px 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: rgba(248, 252, 255, 0.94);
  box-shadow: 0 8px 24px rgba(83, 42, 19, 0.28);
}

html[data-design="wood"] .combos-section h2 {
  color: #14345a;
}

html[data-design="wood"] .combo-list {
  gap: 4px 12px;
}

html[data-design="wood"] .combo-card.wood-combo {
  min-height: 45px;
  padding: 5px 3px;
  border: 0;
  border-bottom: 1px solid rgba(22, 61, 101, 0.13);
  border-radius: 0;
  background: transparent;
  color: #163d68;
  opacity: 1;
}

html[data-design="wood"] .wood-combo .combo-symbol {
  width: 29px;
  height: 29px;
  border-radius: 7px;
  background: #edf3f8;
  color: #174d80;
}

html[data-design="wood"] .wood-combo .combo-copy strong {
  font-size: 11px;
}

html[data-design="wood"] .wood-combo .combo-copy small {
  display: none;
}

html[data-design="wood"] .wood-combo .combo-points {
  color: #194d83;
}

html[data-design="wood"] .wood-combo.eligible {
  margin: 1px 0;
  padding: 5px 7px;
  border: 1px solid #009ee9;
  border-radius: 10px;
  background: #e5f8ff;
  box-shadow: 0 0 12px rgba(0, 158, 233, 0.35);
}

html[data-design="wood"] .wood-combo:not(.eligible):not(.filled) {
  color: #7c91a5;
}

html[data-design="wood"] .wood-combo .combo-points.negative {
  color: #d94d4d;
}

html[data-design="wood"] .wood-combo .combo-points.success,
html[data-design="wood"] .wood-combo .combo-points.available,
html[data-design="wood"] .wood-combo .combo-points.recorded {
  color: #0878b7;
}

/* Compact scorecard layout for the wooden design. */
html[data-design="wood"] .app-shell {
  padding: calc(8px + var(--safe-top)) 9px calc(12px + var(--safe-bottom));
}

html[data-design="wood"] .game-header {
  min-height: 42px;
  margin-bottom: 3px;
}

html[data-design="wood"] .game-logo {
  font-size: 27px;
}

html[data-design="wood"] .player-rail {
  gap: 6px;
  padding: 4px 1px 8px;
}

html[data-design="wood"] .player-card {
  width: 72px;
  min-height: 74px;
  padding: 5px 4px;
  border-radius: 15px;
}

html[data-design="wood"] .player-card-avatar {
  width: 31px;
  height: 31px;
  margin-bottom: 2px;
}

html[data-design="wood"] .player-card strong {
  font-size: 14px;
}

html[data-design="wood"] .table-area {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html[data-design="wood"] .dice-surface {
  min-height: 126px;
  display: block;
  padding: 12px 10px 5px;
  border: 7px solid #bd793e;
  border-radius: 28px;
  background:
    linear-gradient(rgba(69, 39, 22, 0.2), rgba(69, 39, 22, 0.2)),
    radial-gradient(ellipse at center, #704c35, #38281f 72%);
  box-shadow:
    inset 0 0 0 3px #efbf7b,
    inset 0 10px 20px rgba(0, 0, 0, 0.3),
    0 6px 14px rgba(83, 42, 19, 0.3);
}

html[data-design="wood"] .dice-tray {
  min-height: 72px;
  gap: 7px;
}

html[data-design="wood"] .die {
  width: 50px;
  height: 50px;
  border-radius: 14px;
}

html[data-design="wood"] .die .pip {
  width: 7px;
  height: 7px;
}

html[data-design="wood"] .die .p1 { left: 9px; top: 9px; }
html[data-design="wood"] .die .p2 { left: 21px; top: 9px; }
html[data-design="wood"] .die .p3 { right: 9px; top: 9px; }
html[data-design="wood"] .die .p4 { left: 9px; top: 21px; }
html[data-design="wood"] .die .p5 { left: 21px; top: 21px; }
html[data-design="wood"] .die .p6 { right: 9px; top: 21px; }
html[data-design="wood"] .die .p7 { left: 9px; bottom: 9px; }
html[data-design="wood"] .die .p8 { left: 21px; bottom: 9px; }
html[data-design="wood"] .die .p9 { right: 9px; bottom: 9px; }

html[data-design="wood"] .table-area .hint {
  margin: 3px 0 1px;
  font-size: 9px;
}

html[data-design="wood"] .roll-button {
  min-height: 50px;
  max-width: 286px;
  margin: 9px auto 6px;
  border-radius: 24px;
}

html[data-design="wood"] .roll-button > b {
  font-size: 21px;
}

html[data-design="wood"] .combos-section {
  margin: 5px 0 0;
  padding: 8px 9px 13px;
  border-radius: 18px;
}

html[data-design="wood"] .combos-section > header {
  margin: 0 3px 5px;
  min-height: 23px;
}

html[data-design="wood"] .combos-section h2 {
  max-width: 70%;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design="wood"] .bonus-badge {
  padding: 3px 6px;
  font-size: 9px;
}

html[data-design="wood"] .combo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.wood-score-column {
  min-width: 0;
}

.wood-score-row {
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 0;
  border-bottom: 1px solid rgba(22, 61, 101, 0.12);
  background: transparent;
  color: #173e68;
  text-align: left;
  opacity: 1;
}

.wood-score-row.school-row {
  grid-template-columns: 23px minmax(0, 1fr) auto;
}

.wood-die-icon {
  color: #173e68;
  font-size: 19px;
  line-height: 1;
}

.wood-score-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wood-score-row .combo-points {
  min-width: 20px;
  color: #174d80;
  font-size: 13px;
  text-align: right;
}

.wood-score-row.eligible {
  margin: 2px 0;
  padding: 3px 5px;
  border: 1px solid #009ee9;
  border-radius: 8px;
  background: #dff7ff;
  box-shadow: 0 0 8px rgba(0, 158, 233, 0.28);
}

.wood-score-row:not(.eligible):not(.filled) {
  color: #7d91a4;
}

.wood-score-row .combo-points.negative {
  color: #d94d4d;
}

.wood-score-row .combo-points.success,
.wood-score-row .combo-points.available,
.wood-score-row .combo-points.recorded {
  color: #0878b7;
}

.wood-score-separator {
  height: 5px;
  display: block;
  border-bottom: 1px solid rgba(22, 61, 101, 0.2);
}

.wood-total-row {
  min-height: 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 3px 0;
  color: #14345a;
  font-size: 11px;
}

.wood-total-row b {
  font-size: 13px;
}

/* Third design: compact four-player table with controls at the bottom. */
html[data-design="table"] body {
  background: #0b0825;
}

html[data-design="table"] .app-shell {
  padding: calc(8px + var(--safe-top)) 8px calc(10px + var(--safe-bottom));
  background:
    radial-gradient(circle at 50% 22%, rgba(76, 33, 149, 0.5), transparent 34rem),
    linear-gradient(160deg, #111847, #130a35 58%, #080718);
}

html[data-design="table"] #gameScreen {
  height: calc(100svh - var(--safe-top) - var(--safe-bottom) - 18px);
  min-height: calc(100svh - var(--safe-top) - var(--safe-bottom) - 18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html[data-design="table"] .game-header {
  min-height: 48px;
  margin-bottom: 5px;
  color: #fff;
}

html[data-design="table"] .menu-button,
html[data-design="table"] .chat-button,
html[data-design="table"] .stats-button {
  visibility: visible;
  display: grid;
  place-items: center;
  border-color: rgba(127, 143, 255, 0.5);
  background: rgba(13, 17, 55, 0.82);
  color: #fff;
}

html[data-design="table"] .chat-button,
html[data-design="table"] .stats-button {
  width: 46px;
  height: 46px;
  padding: 3px;
  font-size: 16px;
}

html[data-design="table"] .game-header .score-button,
html[data-design="table"] .game-header #soundButton,
html[data-design="table"] .game-header #rulesButton {
  display: none;
}

html[data-design="table"] .game-header .header-timer {
  width: 48px;
  height: 46px;
  visibility: visible;
  display: grid;
  place-items: center;
  border: 1px solid rgba(127, 143, 255, 0.5);
  border-radius: 14px;
  background: rgba(13, 17, 55, 0.82);
  color: #dff7ff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

html[data-design="table"] .game-logo {
  color: #fff;
  font-size: 27px;
}

html[data-design="table"] .player-rail,
html[data-design="table"] .turn-banner {
  display: none;
}

html[data-design="table"] .combos-section {
  order: 1;
  min-height: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(62, 181, 255, 0.72);
  border-radius: 18px;
  background: rgba(7, 17, 53, 0.94);
  box-shadow: 0 0 22px rgba(34, 105, 255, 0.25);
  overflow: hidden;
}

html[data-design="table"] .combos-section > header {
  display: none;
}

html[data-design="table"] .combo-list {
  min-height: 0;
  flex: 1;
  display: block;
}

.table-scorecard {
  width: 100%;
  height: 100%;
  border-spacing: 0;
  table-layout: fixed;
  color: #eaf2ff;
  font-size: 12px;
}

.table-scorecard th,
.table-scorecard td {
  height: 25px;
  padding: 0;
  border-right: 1px solid rgba(101, 137, 220, 0.2);
  border-bottom: 1px solid rgba(101, 137, 220, 0.22);
  text-align: center;
}

.table-scorecard th:first-child {
  width: 31%;
  padding-left: 7px;
  text-align: left;
}

.table-scorecard tbody th i {
  width: 19px;
  display: inline-block;
  color: #b7d8ff;
  font-size: 14px;
  font-style: normal;
}

.table-scorecard .section-start > * {
  border-top: 4px solid rgba(6, 11, 35, 0.95);
}

.table-scorecard thead th {
  height: 60px;
  padding: 3px 2px;
  border-bottom-color: rgba(104, 173, 255, 0.65);
}

.table-player-head {
  background: rgba(24, 39, 91, 0.75);
}

.table-player-head.tone-0 { background: rgba(7, 105, 190, 0.72); }
.table-player-head.tone-1 { background: rgba(174, 30, 91, 0.66); }
.table-player-head.tone-2 { background: rgba(15, 130, 85, 0.66); }
.table-player-head.tone-3 { background: rgba(108, 40, 169, 0.7); }

.table-player-head.active {
  box-shadow: inset 0 0 0 2px #21c5ff, inset 0 0 18px rgba(33, 197, 255, 0.42);
}

.table-avatar {
  width: 37px;
  height: 37px;
  margin: 0 auto 2px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #5dd8ff;
  border-radius: 50%;
  color: #fff;
  background: rgba(8, 20, 57, 0.72);
  font-size: 10px;
}

.table-avatar img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
}

.table-avatar img.unavailable {
  display: none;
}

.table-avatar.speaking img,
.table-avatar.speaking > span {
  display: none;
}

.table-avatar.speaking::after {
  content: "🔊";
  font-size: 20px;
}

.table-player-head small,
.table-player-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-player-head small {
  font-size: 9px;
}

.table-player-head strong {
  font-size: 11px;
}

.table-scorecard .active-column {
  background: rgba(22, 114, 184, 0.18);
}

.table-score-value {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #eaf2ff;
  font-size: 12px;
}

.table-score-value.eligible {
  background: rgba(22, 180, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px #2acbff;
}

.table-score-value.negative { color: #ff7186; }
.table-score-value.success,
.table-score-value.available { color: #68efcf; }
.table-score-value.recorded { color: #fff; }

.table-scorecard tfoot th,
.table-scorecard tfoot td {
  height: 34px;
  border-top: 4px solid rgba(6, 11, 35, 0.95);
  border-bottom: 0;
  color: #fff;
  font-size: 12px;
}

html[data-design="table"] .table-area {
  order: 2;
  min-height: 0;
  margin: 7px 0 0;
  padding: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 7px;
  border: 0;
  border-radius: 0;
  background: none;
}

.table-turn-status {
  display: none;
}

html[data-design="table"] .table-turn-status {
  width: 100%;
  min-height: 44px;
  padding: 5px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(88, 164, 255, 0.45);
  border-radius: 13px;
  background: rgba(8, 20, 57, 0.76);
  color: #dceaff;
  text-align: left;
}

html[data-design="table"] .table-turn-status span {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design="table"] .table-turn-status strong {
  color: #64dcff;
  font-size: 11px;
  white-space: nowrap;
}

html[data-design="table"] .dice-surface {
  min-width: 0;
  flex: 1 1 calc(100% - 93px);
  display: block;
  padding: 8px 7px 4px;
  border: 1px solid rgba(69, 189, 255, 0.55);
  border-radius: 23px;
  background: rgba(8, 20, 57, 0.9);
}

html[data-design="table"] .dice-tray {
  min-height: 58px;
  gap: 5px;
}

html[data-design="table"] .die {
  width: 47px;
  height: 47px;
  border-radius: 12px;
}

html[data-design="table"] .die .pip {
  width: 6px;
  height: 6px;
}

html[data-design="table"] .die .p1 { left: 9px; top: 9px; }
html[data-design="table"] .die .p2 { left: 20px; top: 9px; }
html[data-design="table"] .die .p3 { right: 9px; top: 9px; }
html[data-design="table"] .die .p4 { left: 9px; top: 20px; }
html[data-design="table"] .die .p5 { left: 20px; top: 20px; }
html[data-design="table"] .die .p6 { right: 9px; top: 20px; }
html[data-design="table"] .die .p7 { left: 9px; bottom: 9px; }
html[data-design="table"] .die .p8 { left: 20px; bottom: 9px; }
html[data-design="table"] .die .p9 { right: 9px; bottom: 9px; }

html[data-design="table"] .table-area .hint {
  display: none;
}

html[data-design="table"] .roll-button {
  width: 86px;
  min-width: 86px;
  min-height: 86px;
  margin: 0;
  flex-direction: column;
  gap: 2px;
  border-radius: 43px;
  border: 2px solid #55cfff;
  background: radial-gradient(circle at 50% 25%, #8d4fff, #2744d8 62%, #102474);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html[data-design="table"] .roll-button.holding {
  transform: scale(0.96);
  box-shadow: 0 0 20px rgba(85, 207, 255, 0.48);
}

html[data-design="table"] .roll-button > b {
  font-size: 0;
}

html[data-design="table"] .roll-button > b::before {
  content: "🎙";
  font-size: 24px;
}

html[data-design="table"] .roll-button span,
html[data-design="table"] .roll-button small {
  text-align: center;
}

html[data-design="table"] .roll-button span {
  font-size: 11px;
}

html[data-design="table"] .roll-button span > strong {
  display: block;
  font-size: 12px;
  line-height: 1.12;
}

html[data-design="table"] .roll-button small {
  display: none;
}

html[data-design="table"] .roll-button.recording {
  border-color: #ff7186;
  background: radial-gradient(circle at 50% 25%, #ff6682, #c82061 62%, #69133c);
  box-shadow: 0 0 26px rgba(255, 70, 111, 0.55);
}

.chat-messages {
  min-height: 180px;
  max-height: 55svh;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.chat-message {
  max-width: 86%;
  padding: 9px 11px;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
}

.chat-message.mine {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: rgba(28, 111, 174, 0.28);
}

.chat-message strong,
.chat-message span {
  display: block;
}

.chat-voice {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(40, 168, 255, 0.38);
  border-radius: 12px;
  background: rgba(40, 168, 255, 0.13);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.chat-message strong {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 10px;
}

.chat-message span {
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 7px;
}

.chat-form input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.chat-form button {
  border: 0;
  border-radius: 14px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 18px;
}

.stats-player-row {
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.stats-player-row div strong,
.stats-player-row div small {
  display: block;
}

.stats-player-row div small,
.stats-player-row p {
  color: var(--muted);
  font-size: 10px;
}

.stats-player-row b {
  color: var(--accent);
  font-size: 20px;
}

.stats-player-row p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
}

@media (max-height: 760px) {
  html[data-design="table"] .table-scorecard th,
  html[data-design="table"] .table-scorecard td {
    height: 22px;
  }

  html[data-design="table"] .table-scorecard thead th {
    height: 50px;
  }

  html[data-design="table"] .table-scorecard tfoot th,
  html[data-design="table"] .table-scorecard tfoot td {
    height: 29px;
  }

  html[data-design="table"] .table-turn-status {
    min-height: 38px;
  }

  html[data-design="table"] .roll-button {
    width: 78px;
    min-width: 78px;
    min-height: 78px;
    border-radius: 39px;
  }

  html[data-design="table"] .dice-tray {
    min-height: 50px;
  }
}

@media (max-width: 370px) {
  html[data-design="table"] .dice-tray {
    gap: 3px;
  }

  html[data-design="table"] .die {
    width: 44px;
    height: 44px;
  }

  html[data-design="table"] .die .p1 { left: 8px; top: 8px; }
  html[data-design="table"] .die .p2 { left: 18px; top: 8px; }
  html[data-design="table"] .die .p3 { right: 8px; top: 8px; }
  html[data-design="table"] .die .p4 { left: 8px; top: 18px; }
  html[data-design="table"] .die .p5 { left: 18px; top: 18px; }
  html[data-design="table"] .die .p6 { right: 8px; top: 18px; }
  html[data-design="table"] .die .p7 { left: 8px; bottom: 8px; }
  html[data-design="table"] .die .p8 { left: 18px; bottom: 8px; }
  html[data-design="table"] .die .p9 { right: 8px; bottom: 8px; }
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 36px);
  padding: 11px 15px;
  border-radius: 14px;
  background: var(--text);
  color: #172234;
  font-size: 12px;
  font-weight: 700;
}

@media (min-width: 560px) {
  .app-shell {
    padding-right: 28px;
    padding-left: 28px;
  }

  .table-area {
    margin-right: -28px;
    margin-left: -28px;
  }

  .combo-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}