:root {
  --logo-black: #030303;
  --logo-white: #ffffff;
  --logo-blue: #40a8e0;
  --logo-blue-dark: #126a98;
  --logo-coral: #ff6a5e;
  --logo-coral-dark: #c72b25;
  --felt: #0a5216d5;
  --felt-dark: #1180245e;
  --ink: #11181d;
  --muted: #647984;
  --panel:  #1180245e;
  --panel-edge: rgba(20, 124, 37, 0.836);
  --side-panel:  #bfcde6d5;
  --cell: rgb(13, 102, 28);
  --cell-edge:rgba(20, 124, 37, 0.836);
  --shadow: rgba(0, 0, 0, 0.34);
  --red: #d94f45;
  --blue: #58b8ea;
  --black-tile: #050505;
  --gold: #eebb13;
  --board-gap: 5px;
  --side-panel-width: 16rem;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100dvh;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--logo-black) 0%, #061823 52%, #170908 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}

body.lobby-page {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='58' height='74' viewBox='0 0 58 74'%3E%3Crect x='4' y='4' width='50' height='66' rx='6' ry='6' fill='%230b6f20' stroke='%231f8f34' stroke-width='1.2'/%3E%3C/svg%3E"),
    radial-gradient(circle at 18% 22%, rgba(20, 126, 39, 0.55) 0%, rgba(10, 82, 22, 0) 52%),
    radial-gradient(circle at 82% 78%, rgba(12, 96, 31, 0.48) 0%, rgba(10, 82, 22, 0) 50%),
    linear-gradient(160deg, #0b5d1c 0%, #0a5216 42%, #084914 100%);
  background-size: 58px 74px, auto, auto, auto;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  height: auto;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--logo-blue);
  color: #031117;
  cursor: pointer;
  font-weight: 700;
  min-height: 2.4rem;
  padding: 0.45rem 0.8rem;
}

#forfeitButton {
  background: var(--logo-coral);
  color: #2b0503;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.55;
}

input {
  border: 1px solid var(--logo-blue);
  border-radius: 6px;
  background: var(--logo-white);
  min-height: 2.4rem;
  padding: 0.45rem 0.7rem;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
}

.content-layout {
  display: grid;
  gap: 0;
  grid-template-columns: var(--side-panel-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.app-shell.prejoin .content-layout {
  filter: grayscale(1) brightness(0.65);
  opacity: 0.85;
}

.logo-splash {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 220ms ease;
  z-index: 10;
}

.logo-splash.is-visible {
  opacity: 1;
}

.logo-splash-image {
  display: block;
  height: min(48vw, 340px);
  max-width: min(82vw, 700px);
  object-fit: contain;
  width: auto;
}

.confirm-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 20;
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-modal-backdrop {
  background: rgba(3, 3, 3, 0.30);
  inset: 0;
  position: absolute;
}

.confirm-modal-panel {
  background: var(--side-panel);
  border: 2px solid var(--logo-blue);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  display: grid;
  gap: 1rem;
  max-width: min(90vw, 30rem);
  padding: 1.15rem 1.1rem 1rem;
  position: relative;
  width: 100%;
}

.confirm-modal-message {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  white-space: pre-line;
}

.confirm-modal-actions {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.confirm-modal-actions button {
  border-color: transparent;
  width: 100%;
}

.player-settings-modal {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 19;
}

.player-settings-modal[hidden] {
  display: none;
}

.player-settings-modal-panel {
  background: var(--side-panel);
  border: 2px solid var(--logo-blue);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  display: grid;
  gap: 0.9rem;
  max-width: min(90vw, 22rem);
  min-height: 0;
  pointer-events: auto;
  padding: 0.9rem 1rem 1rem;
  position: fixed;
  width: 100%;
}

.player-settings-modal-body {
  align-content: start;
  display: grid;
  gap: 0.9rem;
}

.rules-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 21;
}

.rules-modal[hidden] {
  display: none;
}

.rules-modal-backdrop {
  background: rgba(3, 3, 3, 0.55);
  inset: 0;
  position: absolute;
}

.rules-modal-panel {
  background: var(--side-panel);
  border: 2px solid var(--logo-blue);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  display: grid;
  gap: 0.75rem;
  max-height: min(92vh, 980px);
  max-width: min(96vw, 1220px);
  padding: 0.8rem;
  position: relative;
  width: fit-content;
}

.rules-modal-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.rules-close-button {
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
}

.rules-modal-image-wrap {
  align-items: center;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid #9fcde7;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  max-height: min(78vh, 860px);
  max-width: min(94vw, 1160px);
  overflow: auto;
  padding: 0.25rem;
}

.rules-modal-image {
  display: block;
  height: auto;
  max-height: min(76vh, 830px);
  max-width: min(92vw, 1120px);
  object-fit: contain;
  width: auto;
}

.rules-modal-actions {
  align-items: center;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: auto 1fr auto;
}

.rules-page-label {
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

.topbar {
  align-items: center;
  background: linear-gradient(180deg, #090909, var(--logo-black));
  border-bottom: 2px solid var(--cell-edge);
  box-shadow: 0 4px 16px var(--shadow);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: var(--side-panel-width) minmax(0, 1fr);
  padding: 0.45rem 1rem 0.55rem;
  position: relative;
  z-index: 3;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.25rem;
  letter-spacing: 0;
}

.brand-title {
  line-height: 0;
}

.topbar-brand {
  display: flex;
  justify-content: left;
  padding-top: 0.1rem;
}

.brand-logo {
  display: block;
  object-fit: contain;
  width: 350px;
}

.topbar-main {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  justify-content: center;
  min-height: 100%;
  min-height: 50px;
  position: relative;
}

.topbar-rules {
  position: absolute;
  right: 0;
  top: 0;
}

h2 {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.turn-status,
.rack-header p,
.draw-count {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.turn-status {
  color: #ffd6d1;
  font-weight: 700;
}

.turn-status[hidden] {
  display: none;
}

.turn-banner {
  align-items: center;
  background: #39ff14;
  border: 2px solid #0a9f12;
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(57, 255, 20, 0.5), 0 0 18px rgba(57, 255, 20, 0.75);
  color: #062400;
  display: flex;
  font-size: 1.3rem;
  font-weight: 900;
  justify-content: center;
  letter-spacing: 0.14em;
  margin: 0 auto;
  max-width: min(100%, 32rem);
  min-height: 3rem;
  padding: 0.2rem 0.9rem;
  text-align: center;
  text-transform: uppercase;
  width: 100%;
}

.turn-banner.is-win {
  background: linear-gradient(180deg, #fff7c7, #eeab3f);
  border-color: #9a5d09;
  box-shadow: 0 0 0 2px rgba(238, 171, 63, 0.4), 0 0 18px rgba(238, 171, 63, 0.55);
  color: #432700;
}

.turn-banner.is-solo {
  background: linear-gradient(180deg, #ffff8f, #ffd43b);
  border-color: #9a7a00;
  box-shadow: 0 0 0 2px rgba(255, 212, 59, 0.45), 0 0 18px rgba(255, 212, 59, 0.55);
  color: #3f2f00;
}

.turn-banner[hidden] {
  display: none;
}

.winner-action-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.15rem auto 0.2rem;
  max-width: min(100%, 32rem);
  width: 100%;
}

.winner-action-bar button {
  min-height: 2.1rem;
}

.join-form,
.action-bar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
}

.join-form {
  justify-content: center;
}

.join-form.is-hidden {
  display: none;
}

.top-controls {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.table-action-bar {
  justify-content: flex-end;
}

.player-settings-action-bar {
  display: grid;
  gap: 0.5rem;
  justify-content: stretch;
  position: static;
  width: 100%;
}

.player-settings-action-bar button {
  border-color: transparent;
  width: 100%;
}

.self-player-actions-field {
  display: grid;
  gap: 0.5rem;
}

.leave-table-button {
  width: 100%;
}

.side-panel {
  background: var(--side-panel);
  border-right: 1px solid var(--panel-edge);
  box-shadow: 4px 0 18px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  grid-row: 1 / span 2;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
  position: relative;
  z-index: 1;
}

.sidebar-footer-link-wrap {
  margin-top: auto;
  padding-top: 0.35rem;
  text-align: center;
}

.sidebar-footer-link {
  color: #0f5f89;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.side-panel h2 {
  display: none;
}

.draw-section {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
}

.turn-log-section + .draw-section {
  margin-top: -1.2rem;
}

.turn-log-section {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
}

.turn-log {
  align-content: start;
  display: grid;
  gap: 0.25rem;
  margin-top: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding-right: 0.15rem;
}

.turn-log-empty {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.turn-log-entry {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #c8e9fb;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
}

.turn-log-line {
  align-items: baseline;
  color: #20333d;
  display: flex;
  flex-wrap: nowrap;
  font-size: 0.84rem;
  gap: 0.55rem;
  line-height: 1.3;
  overflow: hidden;
}

.turn-log-player {
  background: var(--player-rack-bg, var(--logo-white));
  border: 1px solid var(--player-rack-border, #c8e9fb);
  border-radius: 4px;
  color: var(--player-rack-fg, var(--ink));
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.1;
  padding: 0.08rem 0.35rem;
  white-space: nowrap;
}

.turn-log-tiles {
  color: #20333d;
  font-size: 0.84rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-log-tile {
  font-weight: 800;
}

.turn-log-tile-red {
  color: var(--red);
}

.turn-log-tile-black {
  color: var(--black-tile);
}

.turn-log-tile-blue {
  color: var(--blue);
}

.turn-log-tile-gold {
  color: var(--gold);
}

.turn-log-tile-wild {
  color: #ff4fe1;
}

.chat-section {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
}

.table-name-display-section {
  display: grid;
  gap: 0.35rem;
}

.table-open-banner {
  align-items: center;
  background: #FFFF33;
  border: 1px solid #000;
  border-radius: 4px;
  color: #000;
  display: flex;
  font-size: 0.72rem;
  font-weight: 800;
  justify-content: center;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.45rem;
  text-transform: uppercase;
  width: 100%;
}

.sidebar-table-name {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #c8e9fb;
  border-radius: 6px;
  color: #20333d;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  margin: 0;
  padding: 0.45rem 0.55rem;
  text-align: center;
  word-break: break-word;
}

.chat-history {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #c8e9fb;
  border-radius: 6px;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  grid-auto-rows: max-content;
  margin-top: 0;
  min-height: 8rem;
  max-height: 12rem;
  overflow-y: auto;
  padding: 0.55rem 0.6rem;
}

.chat-empty,
.chat-line {
  color: #20333d;
  font-size: 0.84rem;
  line-height: 1.35;
  margin: 0;
}

.chat-empty {
  color: var(--muted);
}

.chat-sender {
  background: var(--player-rack-bg, var(--logo-white));
  border: 1px solid var(--player-rack-border, #c8e9fb);
  border-radius: 4px;
  color: var(--player-rack-fg, var(--ink));
  display: inline-block;
  font-weight: 800;
  line-height: 1.1;
  padding: 0.08rem 0.35rem;
  white-space: nowrap;
}

.chat-form {
  margin-top: 0.6rem;
}

.chat-input {
  width: 100%;
}

.players-list,
.validation-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.board-status-section {
  display: none;
}

.player-row {
  background: var(--player-rack-bg, var(--logo-white));
  border: 1px solid var(--player-rack-border, #c8e9fb);
  border-radius: 6px;
  display: grid;
  gap: 0.45rem;
  grid-template-columns: minmax(0, 1fr);
  padding: 0.55rem 0.6rem;
  color: var(--player-rack-fg, var(--ink));
}

.player-row.is-clickable {
  cursor: pointer;
}

.player-row.is-clickable:focus-visible {
  outline: 2px solid rgba(57, 255, 20, 0.7);
  outline-offset: 2px;
}

.player-row.forfeited {
  opacity: 0.72;
}

.player-identity {
  display: grid;
  gap: 0.35rem;
  justify-self: stretch;
  min-width: 0;
  width: 100%;
}

.player-row.active {
  font-weight: 800;
}

.player-row.active-you {
  border-color: #0a9f12;
  box-shadow:
    0 0 0 3px rgba(57, 255, 20, 0.6),
    0 0 0 10px rgba(57, 255, 20, 0.2),
    0 0 38px rgba(57, 255, 20, 0.95),
    0 0 68px rgba(57, 255, 20, 0.5);
}

.player-row.active-other {
  border-color: #d4b700;
  box-shadow:
    0 0 0 3px rgba(255, 242, 0, 0.65),
    0 0 0 10px rgba(255, 242, 0, 0.22),
    0 0 38px rgba(255, 242, 0, 0.98),
    0 0 68px rgba(255, 242, 0, 0.55);
}

.player-name {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.player-forfeited-badge {
  background: rgba(255, 106, 94, 0.14);
  border: 1px solid rgba(255, 106, 94, 0.5);
  border-radius: 999px;
  color: #8e1e17;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem;
  text-transform: uppercase;
}

.player-name-row {
  align-items: start;
  display: grid;
  gap: 0.28rem;
  grid-template-columns: minmax(0, 1fr);
}

.game-master-banner {
  background: #000;
  box-sizing: border-box;
  border-radius: 4px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 800;
  justify-self: stretch;
  justify-content: space-between;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.45rem;
  text-transform: uppercase;
  width: 100%;
}

.disconnected-banner {
  background: #fff;
  box-sizing: border-box;
  border-radius: 4px;
  color: #c40000;
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  justify-self: stretch;
  justify-content: center;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.45rem;
  text-transform: uppercase;
  width: 100%;
  border: 1px solid #c40000;
}

.play-again-banner {
  background: #FFFF33;
  border: 1px solid #000;
  border-radius: 4px;
  color: #000;
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  justify-self: stretch;
  justify-content: center;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.45rem;
  text-transform: uppercase;
  width: 100%;
}

.lobby-shell {
  --lobby-left-col-width: 380px;
  margin: 0 auto;
  max-width: 1240px;
  padding: 1rem;
}

.lobby-logo {
  height: auto;
  max-width: 100%;
  width: auto;
}

.lobby-top-row,
.lobby-bottom-row {
  align-items: start;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: var(--lobby-left-col-width) minmax(340px, 1fr);
}

.lobby-top-row {
  margin-bottom: 0.9rem;
}

.lobby-hero {
  align-items: center;
  display: flex;
  justify-content: flex-start;
  min-height: 100%;
  width: var(--lobby-left-col-width);
}

.lobby-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #c8e9fb;
  border-radius: 10px;
  padding: 0.9rem;
  position: relative;
}

.lobby-card h2 {
  background: linear-gradient(135deg, #4aa9dc, #2f8cc0);
  border-radius: 7px;
  color: #ffffff;
  display: block;
  letter-spacing: 0.06em;
  margin: -0.45rem -0.45rem 0.375rem;
  padding: 0.5rem 0.7rem;
  text-transform: uppercase;
}

.lobby-welcome {
  align-items: center;
  color: #f1fbff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 0.35rem 0.2rem;
  position: relative;
  text-align: center;
}

.lobby-welcome-line {
  font-size: 3.6rem;
  font-weight: 700;
  margin: 0;
}

.lobby-welcome-actions {
  display: flex;
  gap: 0.6rem;
  position: absolute;
  right: 0.2rem;
  top: 0.2rem;
}

.lobby-form {
  display: grid;
  gap: 0.6rem;
}

.lobby-form label {
  display: grid;
  gap: 0.2rem;
}

.lobby-inline-link {
  background: transparent;
  border: 0;
  color: var(--logo-blue-dark);
  display: inline;
  font-weight: 700;
  margin: 0.55rem 0 0;
  min-height: 0;
  padding: 0;
  text-decoration: underline;
}

.lobby-logged-in {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  justify-content: flex-start;
}

.lobby-register-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 30;
}

.lobby-register-modal-backdrop {
  background: rgba(0, 0, 0, 0.35);
  inset: 0;
  position: fixed;
}

.lobby-register-modal-panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #c8e9fb;
  border-radius: 10px;
  max-width: 520px;
  padding: 0.9rem;
  position: relative;
  width: min(92vw, 520px);
}

#createTableModal .lobby-register-modal-panel {
  max-width: 650px;
  min-height: 300px;
  width: min(92vw, 650px);
}

.lobby-register-modal-panel h2 {
  background: linear-gradient(135deg, #4aa9dc, #2f8cc0);
  border-radius: 7px;
  color: #ffffff;
  display: block;
  letter-spacing: 0.06em;
  margin: -0.45rem -0.45rem 0.6rem;
  padding: 0.5rem 0.7rem;
  text-transform: uppercase;
}

.lobby-register-modal-actions {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.create-table-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 11.2rem;
}

.create-table-form > label:first-of-type {
  align-self: center;
  margin: 0.25rem 0 0.35rem;
  width: 50%;
}

.create-table-form #createTableName {
  text-align: center;
}

.create-table-choices {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 0.78fr);
}

.create-table-choice-card {
  border: 2px solid #3f96c7;
  border-radius: 12px;
  display: grid;
  gap: 0.6rem;
  grid-template-rows: 2.2rem 1fr;
  min-height: 8.7rem;
  height: 8.7rem;
  padding: 0.55rem 0.55rem 1.3rem;
}

.create-table-choice-card h3 {
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
  white-space: nowrap;
  align-self: center;
  text-align: center;
}

.create-table-max-players-wrap {
  align-self: end;
  display: grid;
  gap: 0.2rem;
  justify-self: center;
  width: max-content;
}

.create-table-max-players-row {
  align-items: center;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 94px auto;
  min-height: 2.5rem;
}

.create-table-max-players-label {
  font-size: 1rem;
  line-height: 1;
  white-space: nowrap;
  justify-self: start;
  text-align: left;
}

.create-table-form #createTableMaxPlayers {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  text-align: center;
  width: 100%;
}

.create-table-form #createTableMaxPlayers::-webkit-inner-spin-button,
.create-table-form #createTableMaxPlayers::-webkit-outer-spin-button {
  margin: 0;
  opacity: 1;
}

.create-table-max-players-row button,
.create-table-solo-card button {
  height: 2.5rem;
  min-height: 2.5rem;
  min-width: 8.8rem;
  padding: 0.45rem 0.8rem;
  white-space: nowrap;
  width: 10rem;
}

.create-table-max-players-row button {
  justify-self: start;
  white-space: nowrap;
}

.create-table-solo-card {
  align-content: end;
  justify-items: center;
}

.create-table-solo-card button {
  align-self: end;
  max-width: 8.8rem;
}

.create-table-or {
  color: transparent;
  font-size: 0rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-top: 0;
  user-select: none;
}

.create-table-cancel-row {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 0.55rem;
}

.create-table-cancel-row .lobby-inline-link {
  margin-top: 0;
}

.lobby-status {
  font-weight: 700;
  min-height: 1.2rem;
}

.lobby-status.is-error {
  color: #c40000;
}

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

.lobby-list li {
  margin: 0.25rem 0;
}

.lobby-table {
  background: var(--felt);
  border: 2px solid var(--felt);;
  border-radius: 8px;
  color: #f1fbff;
  margin: 0;
  padding: 0.6rem;
}

.lobby-tables {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lobby-table h3 {
  margin: 0 0 0.25rem;
}

.lobby-table p {
  margin: 0.2rem 0;
}

.lobby-table-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.4rem 0 0.65rem;
}

.lobby-player-badge {
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  display: inline-block;
  font-weight: 700;
  line-height: 1.1;
  padding: 0.2rem 0.45rem;
}

.lobby-player-slot-open {
  border: 2px dotted #adb1b4;
  border-radius: 6px;
  color: #adb1b4;
  display: inline-block;
  font-weight: 700;
  line-height: 1.1;
  padding: 0.2rem 0.45rem;
}

.lobby-join-button {
  width: 100%;
}

.lobby-table-open-banner {
  align-items: center;
  background: #FFFF33;
  border: 1px solid #000000;
  border-radius: 4px;
  color: #000000;
  display: flex;
  font-size: 0.72rem;
  font-weight: 800;
  justify-content: center;
  letter-spacing: 0.08em;
  margin: 0 0 0.45rem;
  padding: 0.28rem 0.45rem;
  text-transform: uppercase;
  width: 100%;
}

#createTableButton {
  margin-top: 0.3rem;
}

.lobby-top-player-badge {
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  display: inline-block;
  font-weight: 700;
  line-height: 1.1;
  min-width: 4.8rem;
  margin-right: 0.35rem;
  padding: 0.18rem 0.4rem;
  text-align: center;
  align-self: center;
}

.lobby-top-player-wins {
  align-items: center;
  background: #000000;
  border-radius: 4px;
  color: #ffffff;
  display: inline-flex;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  margin-right: 0.35rem;
  min-width: 4.8rem;
  min-height: 1.676rem;
  justify-content: center;
  padding: 0.18rem 0.7rem;
  white-space: nowrap;
}

.lobby-top-player-wins-star {
  color: #ffea00;
  font-size: 1rem;
}

#topPlayers .lobby-top-player-wins span:last-child {
  font-size: 1rem;
}

#topPlayers li {
  align-items: center;
  display: grid;
  gap: 0.4rem;
  grid-template-columns: 6.2rem 5rem minmax(6.4rem, 1fr);
}

.lobby-top-player-games {
  text-align: left;
  white-space: nowrap;
}

#topPlayers .lobby-top-player-badge {
  margin-right: 0;
}

#welcomeNameBadge {
  display: inline-block;
  font-size: 4.95rem;
  letter-spacing: 0.01em;
  margin-top: 0.5rem;
  padding: 0.5rem 1.2rem;
}

.lobby-guest-upsell {
  color: #f1fbff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0.75rem auto 0;
  max-width: 44rem;
  text-align: center;
}

.lobby-guest-create-account {
  margin-top: 0.6rem;
}

.lobby-settings-color-label {
  align-items: start;
}

.lobby-settings-color-grid {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 0.25rem;
}

.lobby-settings-color-option {
  border: 2px solid #0f3a4f;
  border-radius: 6px;
  cursor: pointer;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
}

.lobby-settings-color-option.is-selected {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #0f3a4f;
}

.lobby-welcome .lobby-status {
  margin-top: 1.2rem;
  min-height: 1.2rem;
  text-align: center;
}

@media (max-width: 720px) {
  .lobby-tables {
    grid-template-columns: 1fr;
  }
}

.lobby-leaderboard-card {
  display: block;
}

.game-master-banner-title {
  flex: 1 1 auto;
  text-align: center;
}

.player-rack-icons {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.24rem;
  min-height: 1.6rem;
}

.player-rack-tile {
  background: linear-gradient(145deg, #fffdf7, #f1eadc 78%, #cbbd9f 100%);
  border: 1px solid #a99776;
  border-radius: 3px;
  box-shadow: 0 2px 0 #897b60;
  display: block;
  height: 1.6rem;
  width: 1rem;
}

.draw-pile-icons {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.24rem;
  margin-top: 0.45rem;
}

.max-players-control {
  margin-top: 0.9rem;
}

.rack-color-control,
.sound-effects-control,
.debug-control,
.gm-player-actions-control,
.max-players-control {
  display: grid;
  gap: 0.9rem;
}

.debug-field {
  display: grid;
  gap: 0.35rem;
}

.debug-label {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.debug-buttons {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sound-effects-field {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  justify-content: flex-start;
}

.sound-effects-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #9fcde7;
  border-radius: 10px;
  display: inline-flex;
  justify-content: center;
  min-height: 2.5rem;
  min-width: 2.8rem;
  padding: 0.25rem 0.45rem;
}

.sound-effects-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.sound-effects-volume {
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.45rem;
  width: 100%;
}

.sound-effects-volume-label {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  min-width: 5.2rem;
}

.sound-effects-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    to right,
    #40a8e0 0%,
    #40a8e0 var(--slider-pct, 0%),
    rgba(255, 255, 255, 0.9) var(--slider-pct, 0%),
    rgba(255, 255, 255, 0.9) 100%
  );
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  height: 0.9rem;
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 0;
}

.sound-effects-volume-slider::-webkit-slider-runnable-track {
  background: transparent;
  border-radius: 999px;
  height: 0.34rem;
}

.sound-effects-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: #4a5a63;
  border: 2px solid #2a363d;
  border-radius: 999px;
  height: 0.9rem;
  margin-top: -0.29rem;
  width: 0.9rem;
}

.sound-effects-volume-slider::-moz-range-track {
  background: rgba(255, 255, 255, 0.9);
  border: 0;
  border-radius: 999px;
  height: 0.34rem;
}

.sound-effects-volume-slider::-moz-range-progress {
  background: #40a8e0;
  border: 0;
  border-radius: 999px;
  height: 0.34rem;
}

.sound-effects-volume-slider::-moz-range-thumb {
  background: #4a5a63;
  border: 2px solid #2a363d;
  border-radius: 999px;
  height: 0.9rem;
  width: 0.9rem;
}

.gm-player-actions-field {
  display: grid;
  gap: 0.55rem;
}

.gm-player-actions-label {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gm-player-actions-buttons {
  display: grid;
  gap: 0.5rem;
}

.gm-remove-player-button {
  background: var(--logo-coral);
  color: #2b0503;
}

.max-players-field {
  display: grid;
  gap: 0.35rem;
}

.gm-table-settings-row {
  align-items: end;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.gm-table-settings-row .table-name-control {
  min-width: 0;
}

.gm-table-settings-row .max-players-control {
  min-width: 5.9rem;
}

.gm-table-settings-row .max-players-field {
  gap: 0.2rem;
}

.gm-table-settings-row .max-players-hint {
  display: none;
}

.gm-table-settings-row .max-players-input {
  min-height: 2.5rem;
  width: 100%;
}

.table-name-field {
  display: grid;
  gap: 0.35rem;
}

.table-name-label {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-name-input {
  min-height: 2.5rem;
  width: 100%;
}

.rack-color-control-field {
  display: grid;
  gap: 0.35rem;
}

.rack-color-label {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: none;
}

.rack-color-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(3.4rem, 1fr));
}

.rack-color-option {
  align-items: center;
  border-radius: 14px;
  display: grid;
  gap: 0;
  justify-items: center;
  min-height: 2.5rem;
  padding: 0.4rem;
  width: 100%;
}

.rack-color-option.is-selected {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.92),
    0 0 0 6px rgba(57, 255, 20, 0.6),
    0 0 24px rgba(57, 255, 20, 0.65);
  transform: translateY(-1px);
}

.rack-color-option:focus-visible {
  outline: 2px solid rgba(57, 255, 20, 0.8);
  outline-offset: 2px;
}

.max-players-label {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.max-players-input {
  appearance: textfield;
  border-radius: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.2rem;
  text-align: center;
  width: 100%;
}

.max-players-input::-webkit-inner-spin-button,
.max-players-input::-webkit-outer-spin-button {
  margin: 0;
}

.max-players-stepper {
  align-items: stretch;
  display: inline-grid;
  grid-template-columns: auto auto auto;
  justify-content: start;
  width: fit-content;
}

.max-players-step-button {
  border-radius: 0;
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0;
}

.max-players-stepper > :first-child {
  border-bottom-left-radius: 8px;
  border-top-left-radius: 8px;
}

.max-players-stepper > :last-child {
  border-bottom-right-radius: 8px;
  border-top-right-radius: 8px;
}

.max-players-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.draw-pile-tile {
  background: linear-gradient(145deg, #fffdf7, #f1eadc 78%, #cbbd9f 100%);
  border: 1px solid #a99776;
  border-radius: 3px;
  box-shadow: 0 2px 0 #897b60;
  display: block;
  height: 1.6rem;
  width: 1rem;
}

.player-trophies {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: flex-start;
  min-height: 1.2rem;
}

.trophy-icon {
  display: block;
  background: black;
  fill: #ecfd01;
  filter: drop-shadow(1px 1px 0 #000000);
  height: 1.05rem;
  width: 1.05rem;
}

.board-health {
  border-radius: 6px;
  font-weight: 700;
  margin-top: 0.7rem;
  padding: 0.55rem 0.6rem;
}

.board-health.valid {
  background: #e1f5ff;
  color: var(--logo-blue-dark);
}

.board-health.invalid {
  background: #ffe4e1;
  color: var(--logo-coral-dark);
}

.validation-list li {
  background: var(--logo-white);
  border-left: 3px solid var(--logo-coral);
  border-radius: 4px;
  color: #381514;
  font-size: 0.85rem;
  line-height: 1.3;
  padding: 0.5rem 0.6rem;
}

.validation-list:empty {
  display: none;
}

.play-surface {
  background: linear-gradient(145deg, var(--felt), var(--felt-dark));
  min-height: 0;
  overflow: auto;
  padding: 0;
  perspective: 1200px;
}

.board-scroll {
  min-height: 0;
  perspective: 1200px;
}

.board-frame {
  min-height: 100%;
  min-width: max-content;
  padding: var(--board-gap);
}

.board-grid {
  display: grid;
  gap: var(--board-gap);
  grid-auto-columns: 48px;
  grid-auto-rows: 62px;
}

.board-cell {
  align-items: center;
  background: var(--cell);
  border: 1px solid var(--cell-edge);
  border-radius: 5px;
  display: flex;
  justify-content: center;
  min-height: 62px;
  min-width: 48px;
  position: relative;
}

.board-cell.origin::after {
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  content: "";
  height: 0.5rem;
  opacity: 0.55;
  position: absolute;
  width: 0.5rem;
}

.board-cell.drop-target {
  outline: 2px solid #39FF14;
  outline-offset: 1px;
}

.board-cell.drop-target-group {
  outline: 2px dashed #39FF14;
  outline-offset: -1px;
}

.tile.tile-preview {
  opacity: 0.5;
  pointer-events: none;
}

.rack-band {
  flex-shrink: 0;
  background: var(--felt);
  padding: 0.75rem 1rem 1rem;
}

.rack-layout {
  align-items: stretch;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: auto minmax(0, 1fr);
}

.rack-action-bar {
  align-content: start;
  align-items: stretch;
  display: grid;
  column-gap: 0.5rem;
  row-gap: 1.9rem;
  justify-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rack-action-bar button {
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.button-icon {
  display: inline-block;
  height: 2.5rem;
  width: 2.5rem;
  object-fit: contain;
}

#drawButton,
#endTurnButton {
  min-height: 3.6rem;
}

.rack-header {
  align-items: baseline;
  color: var(--logo-white);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.rack-header p {
  color: #ffe9e6;
}

.rack {
  background: var(--rack-bg, transparent);
  border: 1px solid var(--rack-border, transparent);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(10, 48px);
  gap: var(--board-gap);
  grid-auto-rows: 62px;
  align-content: start;
  justify-content: start;
  min-height: 134px;
  overflow: visible;
  padding: 0.7rem;
  width: 100%;
}

.rack-cell {
  align-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.36);
  border-radius: 5px;
  display: flex;
  justify-content: center;
  min-height: 62px;
  min-width: 0;
  position: relative;
  width: 100%;
}

.rack-cell.drop-target {
  outline: 2px solid #39FF14;
  outline-offset: 1px;
}

.tile {
  align-items: center;
  background: linear-gradient(145deg, #fffdf7, #f1eadc 76%, #cbbd9f 100%);
  border: 1px solid #a99776;
  border-radius: 7px;
  box-shadow:
    inset -3px -4px 0 rgba(94, 73, 39, 0.16),
    inset 2px 2px 0 rgba(255, 255, 255, 0.75),
    0 4px 0 #897b60,
    0 9px 11px rgba(0, 0, 0, 0.24);
  color: var(--logo-black);
  cursor: grab;
  display: grid;
  flex: 0 0 auto;
  grid-template-rows: 1fr auto;
  height: 58px;
  justify-items: center;
  min-width: 44px;
  padding: 0.3rem 0.25rem 0.2rem;
  position: relative;
  user-select: none;
  width: 44px;
}

.tile:active {
  cursor: grabbing;
}

.tile.selected {
  outline: 3px solid #39FF14;
  outline-offset: 2px;
  transform: translateY(-2px);
}

.tile.invalid {
  border-color: var(--logo-coral);
  box-shadow:
    inset -3px -4px 0 rgba(94, 73, 39, 0.16),
    inset 2px 2px 0 rgba(255, 255, 255, 0.75),
    0 4px 0 #897b60,
    0 9px 11px rgba(0, 0, 0, 0.24),
    0 0 0 3px rgba(255, 106, 94, 0.95),
    0 0 18px 7px rgba(255, 106, 94, 0.72);
}

.tile-number {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

.tile-color {
  border-radius: 999px;
  height: 0.35rem;
  width: 1.6rem;
}

.tile-red .tile-number {
  color: var(--red);
}

.tile-red .tile-color {
  background: var(--red);
}

.tile-blue .tile-number {
  color: var(--blue);
}

.tile-blue .tile-color {
  background: var(--blue);
}

.tile-black .tile-number {
  color: var(--black-tile);
}

.tile-black .tile-color {
  background: var(--black-tile);
}

.tile-gold .tile-number {
  color: var(--gold);
}

.tile-gold .tile-color {
  background: var(--gold);
}

.tile-wild {
  --wild-star-cutout: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50 4L58 34L80 20L66 42L96 50L66 58L80 80L58 66L50 96L42 66L20 80L34 58L4 50L34 42L20 20L42 34Z'/%3E%3C/svg%3E");
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.55), transparent 28%),
    rgb(241, 4, 170); 
  border-color: #7e005e;
}

.tile-wild::before {
  background: rgba(38, 0, 31, 0.5);
  content: "";
  height: 24px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  -webkit-mask-image: var(--wild-star-cutout);
  mask-image: var(--wild-star-cutout);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}

.tile-wild .tile-number,
.tile-wild .tile-color {
  opacity: 0;
}

.empty-rack {
  color: #d8f1ff;
  font-weight: 700;
  padding: 0 0.4rem;
}

@media (max-width: 850px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-brand {
    justify-content: center;
  }

  .top-controls {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .join-form,
  .action-bar,
  .table-action-bar {
    justify-content: flex-start;
  }

  .content-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .side-panel {
    border-right: 0;
    border-bottom: 1px solid var(--panel-edge);
    display: grid;
    grid-row: auto;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  }

  .rack-layout {
    grid-template-columns: 1fr;
  }

  .play-surface {
    padding: 0;
  }
}
