:root {
  --bg: #060910;
  --ink: #f2ecdf;
  --muted: #a4acb9;
  --faint: #6e7787;
  --gold: #e6c583;
  --gold-strong: #c79a49;
  --gold-deep: #8f6724;
  --teal: #7fe7d1;
  --red: #ff7d72;
  --panel: rgba(10, 15, 24, 0.72);
  --panel-strong: rgba(9, 13, 21, 0.9);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  user-select: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: default;
}

input {
  user-select: text;
}

.hidden {
  display: none !important;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
  z-index: 0;
}

.scene-shade {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 6, 12, 0.88) 0%, rgba(3, 6, 12, 0.42) 46%, rgba(3, 6, 12, 0.22) 72%, rgba(3, 6, 12, 0.52) 100%),
    radial-gradient(circle at 72% 35%, rgba(5, 8, 14, 0) 0%, rgba(5, 8, 14, 0.32) 68%, rgba(4, 6, 11, 0.7) 100%);
  transition: background 0.6s ease, opacity 0.6s ease;
}

body[data-screen="lobby"] .scene-shade {
  background:
    linear-gradient(180deg, rgba(3, 6, 12, 0.75) 0%, rgba(3, 6, 12, 0.16) 24%, rgba(3, 6, 12, 0.28) 70%, rgba(3, 6, 12, 0.82) 100%),
    linear-gradient(90deg, rgba(3, 6, 12, 0.45), rgba(3, 6, 12, 0.05) 50%, rgba(3, 6, 12, 0.45));
}

body[data-screen="game"] .scene-shade {
  background:
    linear-gradient(180deg, rgba(3, 6, 12, 0.82) 0%, rgba(3, 6, 12, 0.05) 20%, rgba(3, 6, 12, 0) 68%, rgba(3, 6, 12, 0.62) 100%),
    radial-gradient(circle at 50% 50%, rgba(4, 7, 12, 0) 45%, rgba(4, 7, 12, 0.38) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ------------------------------------------------------------------ *
 * Shared pieces
 * ------------------------------------------------------------------ */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}

.primary-btn,
.ghost-btn,
.side-btn,
.action-btn,
.text-btn,
.icon-btn {
  pointer-events: auto;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.primary-btn {
  position: relative;
  padding: 13px 22px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0d9a3, #c99a4c 58%, #a9792e);
  color: #1b1206;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(201, 154, 76, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #f8e7bc, #d6a95b 58%, #b78536);
  box-shadow: 0 14px 40px rgba(201, 154, 76, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.primary-btn:disabled {
  opacity: 0.4;
  transform: none;
}

.primary-btn.danger-btn {
  background: linear-gradient(135deg, #ff9a90, #d34b42 60%, #a72c27);
  color: #fff4f1;
  box-shadow: 0 10px 30px rgba(211, 75, 66, 0.2);
}

.ghost-btn {
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(230, 197, 131, 0.36);
}

.ghost-btn.small {
  padding: 8px 12px;
  font-size: 9px;
}

.ghost-btn.tiny,
.primary-btn.tiny {
  padding: 7px 12px;
  font-size: 9px;
  border-radius: 7px;
}

.text-btn {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
}

.text-btn:hover {
  color: var(--gold);
  border-bottom-color: rgba(230, 197, 131, 0.4);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 16px;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  color: var(--gold);
  border-color: rgba(230, 197, 131, 0.35);
}

.icon-btn .sound-off {
  display: none;
}

.icon-btn.muted .sound-on {
  display: none;
}

.icon-btn.muted .sound-off {
  display: inline;
}

.panel {
  pointer-events: auto;
  background: linear-gradient(160deg, rgba(15, 21, 32, 0.84), rgba(7, 11, 18, 0.74));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span,
.name-field > span {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.field input,
.name-field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
  color: var(--ink);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.field input:focus,
.name-field input:focus {
  border-color: rgba(230, 197, 131, 0.5);
  background: rgba(0, 0, 0, 0.36);
}

.field input::placeholder,
.name-field input::placeholder {
  color: #59616f;
}

/* ------------------------------------------------------------------ *
 * Boot
 * ------------------------------------------------------------------ */

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(28, 39, 60, 0.55), rgba(4, 6, 11, 0.96) 62%),
    #04060b;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.boot.done {
  opacity: 0;
  visibility: hidden;
}

.boot-mark {
  position: relative;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
}

.boot-knight {
  font-family: var(--serif);
  font-size: 52px;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(230, 197, 131, 0.45);
  transform: translateY(-2px);
}

.boot-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(230, 197, 131, 0.18);
  border-top-color: var(--gold);
  animation: spin 1.6s linear infinite;
}

.boot-ring::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(230, 197, 131, 0.1);
  border-bottom-color: rgba(230, 197, 131, 0.55);
  animation: spin 2.4s linear infinite reverse;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.boot-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 44px;
  letter-spacing: 0.03em;
}

.boot-title span {
  color: var(--gold);
}

.boot-sub {
  margin: 4px 0 36px;
  font-size: 9px;
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: var(--faint);
}

.boot-bar {
  width: min(280px, 60vw);
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

#boot-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #8f6724, var(--gold));
  box-shadow: 0 0 14px rgba(230, 197, 131, 0.6);
  transition: width 0.35s ease;
}

.boot-status {
  margin: 15px 0 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.boot-tip {
  position: absolute;
  bottom: 38px;
  margin: 0;
  font-size: 11px;
  color: #5d6675;
  letter-spacing: 0.03em;
}

/* ------------------------------------------------------------------ *
 * Home
 * ------------------------------------------------------------------ */

.home-screen {
  display: flex;
  flex-direction: column;
  padding: 22px 42px 16px;
  overflow: auto;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(230, 197, 131, 0.32);
  background: rgba(230, 197, 131, 0.06);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  box-shadow: inset 0 0 24px rgba(230, 197, 131, 0.08);
}

.brand-text {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: 0.02em;
}

.brand-text span {
  color: var(--gold);
}

.topbar-right {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.name-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.name-field input {
  width: 180px;
  padding: 9px 11px;
  font-size: 13px;
}

.home-grid {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 470px);
  gap: 6vw;
  align-items: center;
  padding: 28px 0;
  min-height: 0;
}

.home-hero {
  max-width: 620px;
  padding-left: clamp(0px, 3vw, 46px);
}

.hero-piece-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0;
  height: clamp(92px, 12vh, 150px);
  margin-bottom: 4px;
  pointer-events: none;
}

.hero-piece {
  height: 100%;
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 26px rgba(230, 197, 131, 0.12));
  opacity: 0.95;
}

.hero-piece.dark {
  margin-left: -14px;
  opacity: 0.72;
  transform: scale(0.88);
  transform-origin: bottom;
}

.hero-title {
  margin: 10px 0 18px;
  font-family: var(--serif);
  font-size: clamp(58px, 7.4vw, 108px);
  line-height: 0.87;
  font-weight: 400;
  letter-spacing: -0.03em;
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
}

.hero-title em {
  font-style: italic;
  background: linear-gradient(100deg, #f3dfb0, #d5a653 60%, #9e6e2a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 460px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: #cfd3da;
}

.feature-list span {
  font-family: var(--serif);
  font-size: 11px;
  color: var(--gold);
  border: 1px solid rgba(230, 197, 131, 0.24);
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.hero-note {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--faint);
  font-size: 13px;
}

.rooms-panel {
  display: flex;
  flex-direction: column;
  max-height: min(680px, calc(100vh - 150px));
  padding: 24px 24px 22px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 29px;
  letter-spacing: -0.01em;
}

.room-list {
  flex: 1;
  min-height: 150px;
  max-height: 270px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-right: 4px;
  margin-bottom: 18px;
}

.room-list::-webkit-scrollbar,
.moves-list::-webkit-scrollbar {
  width: 4px;
}

.room-list::-webkit-scrollbar-thumb,
.moves-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

.room-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 160px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  color: var(--faint);
}

.room-empty-icon {
  font-family: var(--serif);
  font-size: 30px;
  color: rgba(230, 197, 131, 0.5);
  margin-bottom: 3px;
}

.room-empty p {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 17px;
}

.room-empty small {
  font-size: 10px;
  letter-spacing: 0.06em;
}

.room-card {
  position: relative;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.027);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.room-card:hover {
  border-color: rgba(230, 197, 131, 0.24);
  background: rgba(255, 255, 255, 0.045);
}

.room-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.room-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-code-small {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--gold);
  opacity: 0.75;
  flex-shrink: 0;
}

.room-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 7px 0 11px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.room-meta .count-white,
.room-meta .count-black {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.piece-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.piece-dot.white {
  background: #f5eeda;
  box-shadow: 0 0 7px rgba(245, 238, 218, 0.7);
}

.piece-dot.black {
  background: #59616e;
  border: 1px solid #9aa3b1;
}

.room-phase {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b9c0cb;
}

.room-phase.playing {
  background: rgba(127, 231, 209, 0.1);
  color: var(--teal);
}

.room-phase.countdown {
  background: rgba(230, 197, 131, 0.12);
  color: var(--gold);
}

.room-phase.ended {
  background: rgba(255, 125, 114, 0.1);
  color: var(--red);
}

.room-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.room-actions button {
  flex: 1;
  min-width: 70px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #d9dde4;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.room-actions button:hover {
  border-color: rgba(230, 197, 131, 0.4);
  color: var(--gold);
  background: rgba(230, 197, 131, 0.07);
}

.room-actions button.join-white {
  border-color: rgba(245, 238, 218, 0.22);
}

.room-actions button.join-black {
  border-color: rgba(120, 132, 152, 0.35);
}

.room-actions button.spectate {
  color: var(--faint);
}

.create-form {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.create-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.create-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  white-space: nowrap;
}

.create-head .rule {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid var(--line);
}

.segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.active {
  background: rgba(230, 197, 131, 0.14);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(230, 197, 131, 0.22);
}

.create-form .primary-btn {
  width: 100%;
  margin-top: 2px;
}

.home-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding-top: 12px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555e6d;
}

.home-foot .dot {
  color: #3a4150;
}

#home-status {
  color: #6f7988;
}

/* ------------------------------------------------------------------ *
 * Lobby
 * ------------------------------------------------------------------ */

.lobby-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 38px 16px;
}

.lobby-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  pointer-events: auto;
}

.lobby-title {
  text-align: center;
}

.lobby-title h2 {
  margin: 3px 0 4px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.01em;
}

.room-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid rgba(230, 197, 131, 0.18);
  background: rgba(230, 197, 131, 0.05);
  color: var(--gold);
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.room-code:hover {
  background: rgba(230, 197, 131, 0.12);
}

.copy-glyph {
  letter-spacing: 0;
  font-size: 10px;
  opacity: 0.65;
}

.lobby-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--faint);
  text-align: right;
}

.status-pill {
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid rgba(230, 197, 131, 0.2);
  background: rgba(230, 197, 131, 0.06);
  color: var(--gold);
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.lobby-grid {
  flex: 1;
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(280px, 380px) minmax(250px, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 0;
}

.team-panel {
  pointer-events: auto;
  position: relative;
  align-self: stretch;
  max-height: min(580px, calc(100vh - 190px));
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(16, 22, 34, 0.82), rgba(7, 11, 18, 0.72));
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.team-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  opacity: 0.7;
}

.white-panel::before {
  background: linear-gradient(90deg, transparent, #f2ecdf, transparent);
}

.black-panel::before {
  background: linear-gradient(90deg, transparent, #7f8ba0, transparent);
}

.team-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.team-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  background: radial-gradient(circle at 50% 65%, rgba(230, 197, 131, 0.12), rgba(0, 0, 0, 0.25));
  border: 1px solid var(--line);
}

.team-icon img {
  height: 62px;
  width: auto;
  mix-blend-mode: screen;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.black-panel .team-icon {
  background: radial-gradient(circle at 50% 65%, rgba(129, 150, 180, 0.12), rgba(0, 0, 0, 0.3));
}

.team-head h3 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1;
}

.team-count {
  margin-left: auto;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 16px;
  color: var(--muted);
}

.player-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 2px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 110px;
}

.player-list::-webkit-scrollbar {
  width: 3px;
}

.player-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.022);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.player-row.you {
  border-color: rgba(230, 197, 131, 0.2);
  background: rgba(230, 197, 131, 0.055);
}

.player-avatar {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 12px;
  color: #e7dfcf;
}

.black-panel .player-avatar {
  background: linear-gradient(145deg, rgba(120, 135, 160, 0.2), rgba(255, 255, 255, 0.02));
  color: #aeb9c9;
}

.player-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #dfe3e9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-tag {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

.player-ready {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  font-size: 9px;
  color: transparent;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.player-ready.on {
  background: rgba(127, 231, 209, 0.16);
  border-color: rgba(127, 231, 209, 0.55);
  color: var(--teal);
  box-shadow: 0 0 10px rgba(127, 231, 209, 0.16);
}

.player-host {
  color: var(--gold);
  font-size: 11px;
  flex-shrink: 0;
}

.player-empty {
  padding: 14px 4px;
  font-size: 11px;
  color: var(--faint);
  font-style: italic;
  font-family: var(--serif);
}

.side-btn {
  margin-top: 8px;
  width: 100%;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.side-btn:hover {
  border-color: rgba(230, 197, 131, 0.38);
  color: var(--gold);
  background: rgba(230, 197, 131, 0.06);
}

.side-btn.active {
  border-color: rgba(230, 197, 131, 0.3);
  background: rgba(230, 197, 131, 0.08);
  color: var(--gold);
}

.lobby-center {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 10px 0;
}

.ready-orbit {
  position: relative;
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
}

.ready-orbit::before,
.ready-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.ready-orbit::before {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ready-orbit::after {
  inset: 9px;
  border: 1px dashed rgba(230, 197, 131, 0.18);
  animation: spin 28s linear infinite;
}

.ready-btn {
  width: 158px;
  height: 158px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 35%, rgba(230, 197, 131, 0.2), rgba(230, 197, 131, 0.03) 58%),
    rgba(9, 14, 22, 0.78);
  border: 1px solid rgba(230, 197, 131, 0.34);
  box-shadow: 0 0 0 7px rgba(230, 197, 131, 0.03), 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 36px rgba(230, 197, 131, 0.05);
  color: var(--gold);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.ready-btn:hover:not(:disabled) {
  transform: scale(1.025);
  background:
    radial-gradient(circle at 50% 35%, rgba(230, 197, 131, 0.3), rgba(230, 197, 131, 0.06) 58%),
    rgba(9, 14, 22, 0.82);
  box-shadow: 0 0 0 9px rgba(230, 197, 131, 0.05), 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 0 50px rgba(230, 197, 131, 0.1);
}

.ready-btn:disabled {
  opacity: 0.36;
}

.ready-btn.is-ready {
  border-color: rgba(127, 231, 209, 0.55);
  color: var(--teal);
  background:
    radial-gradient(circle at 50% 35%, rgba(127, 231, 209, 0.22), rgba(127, 231, 209, 0.03) 58%),
    rgba(9, 14, 22, 0.82);
  box-shadow: 0 0 0 7px rgba(127, 231, 209, 0.04), 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 42px rgba(127, 231, 209, 0.08);
}

.ready-btn.locked {
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--faint);
}

#ready-label {
  font-family: var(--serif);
  font-size: 23px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
}

.ready-sub {
  max-width: 110px;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.ready-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.lobby-note {
  max-width: 320px;
  min-height: 34px;
  text-align: center;
}

.lobby-note p {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--faint);
}

.spectators-box {
  width: min(300px, 100%);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.spectators-head {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 7px;
}

.spectator-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 20px;
}

.spectator-chip {
  padding: 4px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  font-size: 9px;
  color: var(--muted);
}

.lobby-hint {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4f5867;
}

/* ------------------------------------------------------------------ *
 * In-game HUD
 * ------------------------------------------------------------------ */

.game-screen {
  pointer-events: none;
}

.game-top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  padding: 16px 22px 34px;
  background: linear-gradient(180deg, rgba(3, 6, 12, 0.82), rgba(3, 6, 12, 0.35) 55%, transparent);
  pointer-events: none;
}

.team-strip {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 410px;
  padding-top: 4px;
  pointer-events: auto;
}

.white-strip {
  justify-content: flex-end;
}

.black-strip {
  justify-content: flex-start;
}

.turn-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 22px;
  flex-shrink: 0;
}

.turn-pill {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.turn-pill.your-turn {
  color: var(--gold);
}

.turn-sub {
  font-size: 8px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}

.team-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.68);
  backdrop-filter: blur(10px);
  font-size: 10px;
  color: #cdd3dc;
  max-width: 150px;
}

.team-chip .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-chip.current {
  border-color: rgba(230, 197, 131, 0.5);
  color: var(--gold);
  box-shadow: 0 0 18px rgba(230, 197, 131, 0.13), inset 0 0 12px rgba(230, 197, 131, 0.05);
}

.team-chip.current::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  flex-shrink: 0;
}

.team-chip .crown {
  color: var(--gold);
  font-size: 9px;
}

.team-chip .you {
  color: var(--teal);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-left {
  position: absolute;
  left: 22px;
  top: 88px;
  bottom: 88px;
  width: 218px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.role-badge {
  align-self: flex-start;
  pointer-events: auto;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid rgba(245, 238, 218, 0.28);
  background: rgba(7, 11, 18, 0.66);
  backdrop-filter: blur(10px);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ede6d5;
}

.role-badge.black-team {
  border-color: rgba(140, 154, 177, 0.4);
  color: #aeb9c9;
}

.role-badge.spectator {
  border-color: rgba(127, 231, 209, 0.35);
  color: var(--teal);
}

.role-badge.your-turn {
  border-color: rgba(230, 197, 131, 0.55);
  color: var(--gold);
  box-shadow: 0 0 16px rgba(230, 197, 131, 0.12);
}

.moves-panel {
  pointer-events: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.62);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.moves-toggle {
  display: none;
  padding: 9px 12px;
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.moves-list {
  flex: 1;
  overflow-y: auto;
  padding: 9px 11px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 10px;
  line-height: 1.9;
  color: #aeb6c2;
}

.move-pair {
  display: flex;
  gap: 8px;
}

.move-no {
  width: 22px;
  flex-shrink: 0;
  color: #59616f;
}

.move-san {
  min-width: 52px;
  padding: 0 4px;
  border-radius: 3px;
}

.move-san.latest {
  background: rgba(230, 197, 131, 0.12);
  color: var(--gold);
}

.moves-empty {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--faint);
  font-style: italic;
}

.game-actions {
  position: absolute;
  right: 22px;
  top: 88px;
  display: flex;
  gap: 6px;
  pointer-events: none;
}

.action-btn {
  pointer-events: auto;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.66);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.action-btn:hover {
  color: var(--ink);
  border-color: rgba(230, 197, 131, 0.35);
}

.action-btn.danger:hover {
  color: var(--red);
  border-color: rgba(255, 125, 114, 0.4);
}

.action-btn:disabled {
  opacity: 0.32;
}

.draw-banner {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(230, 197, 131, 0.3);
  background: rgba(9, 14, 22, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  font-size: 11px;
  color: #e1e4ea;
  pointer-events: auto;
}

.draw-actions {
  display: flex;
  gap: 6px;
}

.crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  opacity: 0.85;
  mix-blend-mode: screen;
}

.crosshair span::before,
.crosshair span::after {
  content: "";
  position: absolute;
  background: rgba(255, 245, 225, 0.85);
  box-shadow: 0 0 6px rgba(255, 230, 180, 0.6);
}

.crosshair span::before {
  left: 50%;
  top: 0;
  width: 1px;
  height: 7px;
  transform: translateX(-50%);
}

.crosshair span::after {
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 7px;
  transform: translateX(-50%);
}

.crosshair i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(230, 197, 131, 0.9);
}

.target-label {
  position: fixed;
  left: 50%;
  top: calc(50% + 22px);
  transform: translateX(-50%);
  z-index: 5;
  padding: 4px 9px;
  border-radius: 5px;
  background: rgba(5, 9, 15, 0.68);
  backdrop-filter: blur(6px);
  font-family: "Consolas", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #e8dcc2;
  pointer-events: none;
  white-space: nowrap;
}

.game-bottom {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 20px 18px;
  background: linear-gradient(0deg, rgba(3, 6, 12, 0.72), transparent);
  pointer-events: none;
}

.game-hint {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #c3cad4;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.look-hint,
.spectator-note {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #77808f;
  text-align: center;
}

.spectator-note {
  color: var(--teal);
  opacity: 0.7;
}

/* ------------------------------------------------------------------ *
 * Countdown
 * ------------------------------------------------------------------ */

.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(4, 7, 12, 0.42) 0%, rgba(4, 7, 12, 0.78) 70%);
  backdrop-filter: blur(2px);
}

.countdown-inner {
  text-align: center;
  animation: countdownPop 0.5s ease both;
}

@keyframes countdownPop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.countdown-number {
  font-family: var(--serif);
  font-size: clamp(110px, 20vw, 200px);
  line-height: 0.9;
  color: var(--gold);
  text-shadow: 0 0 60px rgba(230, 197, 131, 0.35), 0 0 140px rgba(230, 197, 131, 0.16);
  margin: 10px 0;
}

.countdown-sub {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------ *
 * Modals
 * ------------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, 0.74);
  backdrop-filter: blur(9px);
  pointer-events: auto;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 50% 0%, rgba(230, 197, 131, 0.08), transparent 55%),
    linear-gradient(160deg, rgba(17, 23, 35, 0.97), rgba(7, 11, 18, 0.98));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-card h2 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.modal-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}

.promotion-card {
  width: min(520px, 100%);
}

.promotion-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin: 6px 0 18px;
}

.promotion-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px 9px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.promotion-choice:hover {
  border-color: rgba(230, 197, 131, 0.5);
  background: rgba(230, 197, 131, 0.07);
  transform: translateY(-2px);
}

.promotion-choice img {
  height: 64px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: screen;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

.promotion-choice span {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.result-card {
  width: min(520px, 100%);
  text-align: center;
}

.result-card .eyebrow {
  margin-bottom: 2px;
}

.result-card h2 {
  font-size: 47px;
  margin: 6px 0 8px;
}

.result-card .modal-copy {
  font-size: 14px;
}

.result-teams {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 4px;
}

.result-team {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.result-team.winner {
  border-color: rgba(230, 197, 131, 0.4);
  background: rgba(230, 197, 131, 0.06);
  box-shadow: 0 0 24px rgba(230, 197, 131, 0.08);
}

.result-team .side {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}

.result-team .names {
  font-size: 11px;
  line-height: 1.5;
  color: #d6dae1;
}

.result-note {
  margin: 16px 0 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.result-card .modal-actions {
  justify-content: center;
}

/* ------------------------------------------------------------------ *
 * Toasts & connection
 * ------------------------------------------------------------------ */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(340px, calc(100vw - 30px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 14, 22, 0.94);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
  color: #dde1e8;
  font-size: 11px;
  line-height: 1.45;
  animation: toastIn 0.25s ease both;
}

.toast::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(230, 197, 131, 0.6);
}

.toast.error::before {
  background: var(--red);
  box-shadow: 0 0 8px rgba(255, 125, 114, 0.6);
}

.toast.success::before {
  background: var(--teal);
  box-shadow: 0 0 8px rgba(127, 231, 209, 0.6);
}

.toast.leaving {
  animation: toastOut 0.25s ease both;
}

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

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(14px);
  }
}

.connection-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 11, 0.72);
  backdrop-filter: blur(8px);
}

.connection-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 30px 44px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 12, 20, 0.94);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.connection-spinner {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 50%;
  border: 1px solid rgba(230, 197, 131, 0.16);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}

.connection-card p {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
}

.connection-card small {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* ------------------------------------------------------------------ *
 * Responsive
 * ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .home-grid {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 420px);
    gap: 4vw;
  }

  .hero-title {
    font-size: clamp(52px, 7vw, 82px);
  }
}

@media (max-width: 980px) {
  .home-screen {
    padding: 18px 24px 14px;
    overflow-y: auto;
  }

  .home-grid {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 26px;
    padding: 22px 0;
  }

  .home-hero {
    max-width: 640px;
    padding-left: 0;
  }

  .hero-piece-wrap {
    height: 86px;
  }

  .hero-copy {
    max-width: 600px;
  }

  .feature-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 9px 18px;
  }

  .feature-list li {
    font-size: 10px;
  }

  .rooms-panel {
    max-height: none;
  }

  .room-list {
    max-height: 300px;
  }

  .lobby-screen {
    padding: 16px 22px;
    overflow-y: auto;
  }

  .lobby-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    padding-bottom: 20px;
  }

  .lobby-center {
    grid-column: 1 / -1;
    order: -1;
    padding: 8px 0 2px;
  }

  .ready-orbit {
    width: 158px;
    height: 158px;
  }

  .ready-btn {
    width: 132px;
    height: 132px;
  }

  #ready-label {
    font-size: 19px;
  }

  .team-panel {
    max-height: 430px;
    padding: 17px;
  }

  .game-left {
    display: none;
  }
}

@media (max-width: 700px) {
  .home-screen {
    padding: 14px 14px 10px;
  }

  .topbar {
    gap: 10px;
  }

  .name-field input {
    width: 124px;
  }

  .brand-text {
    font-size: 18px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
    font-size: 20px;
  }

  .hero-piece-wrap {
    height: 64px;
  }

  .hero-title {
    font-size: 48px;
    margin-bottom: 14px;
  }

  .hero-copy {
    font-size: 12px;
    line-height: 1.65;
    margin-bottom: 18px;
  }

  .feature-list span {
    width: 21px;
    height: 21px;
    font-size: 9px;
  }

  .hero-note {
    font-size: 11px;
  }

  .rooms-panel {
    padding: 18px;
    border-radius: 16px;
  }

  .panel-head h2 {
    font-size: 24px;
  }

  .home-foot {
    flex-wrap: wrap;
    gap: 5px;
    font-size: 8px;
  }

  .lobby-screen {
    padding: 12px 12px 18px;
    gap: 12px;
  }

  .lobby-top {
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .lobby-title {
    text-align: right;
  }

  .lobby-title h2 {
    font-size: 22px;
  }

  .lobby-status {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .lobby-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .lobby-center {
    grid-column: auto;
  }

  .team-panel {
    max-height: 340px;
    min-height: 220px;
  }

  .team-head h3 {
    font-size: 23px;
  }

  .player-list {
    min-height: 70px;
  }

  .lobby-hint {
    font-size: 8px;
    line-height: 1.6;
  }

  .game-top {
    gap: 6px;
    padding: 10px 10px 28px;
  }

  .team-strip {
    max-width: 34vw;
    gap: 4px;
    overflow: hidden;
    flex-wrap: nowrap;
  }

  .team-chip {
    padding: 3px 7px;
    font-size: 9px;
    max-width: 100%;
  }

  .team-chip .name {
    max-width: 62px;
  }

  .team-chip .crown,
  .team-chip .you {
    display: none;
  }

  .turn-block {
    padding: 4px 8px;
  }

  .turn-pill {
    font-size: 12px;
  }

  .turn-sub {
    font-size: 7px;
  }

  .game-actions {
    top: 62px;
    right: 10px;
    gap: 4px;
  }

  .action-btn {
    padding: 6px 8px;
    font-size: 8px;
  }

  .draw-banner {
    top: 62px;
    width: calc(100vw - 24px);
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
  }

  .game-bottom {
    padding: 16px 12px 12px;
  }

  .game-hint {
    font-size: 9px;
  }

  .look-hint,
  .spectator-note {
    font-size: 8px;
  }

  .modal-card {
    padding: 22px;
    border-radius: 15px;
  }

  .modal-card h2 {
    font-size: 27px;
  }

  .result-card h2 {
    font-size: 36px;
  }

  .promotion-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-teams {
    flex-direction: column;
  }

  .toasts {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
  }

  .boot-tip {
    bottom: 22px;
    padding: 0 20px;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .hero-title {
    font-size: 41px;
  }

  .hero-piece-wrap {
    display: none;
  }

  .home-hero .eyebrow {
    margin-top: 8px;
  }

  .name-field > span {
    display: none;
  }

  .name-field input {
    width: 118px;
  }

  .team-chip .name {
    max-width: 48px;
  }

  .game-hint {
    font-size: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}


