:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-soft: #0b1220;
  --panel: rgba(15, 19, 29, 0.88);
  --panel-strong: rgba(17, 22, 36, 0.96);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f7fb;
  --text-muted: #9aa6bb;
  --text-soft: #6f7b91;
  --accent: #7c6cff;
  --accent-2: #4fb8ff;
  --success: #2bd4a7;
  --danger: #ff6b8b;
  --board-light: #ecdbbf;
  --board-dark: #71502e;
  --board-light-sel: #f6eaa7;
  --board-dark-sel: #b78a3e;
  --board-glow: rgba(124, 108, 255, 0.33);
  --capture-dot: rgba(10, 12, 18, 0.45);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 15%, rgba(124, 108, 255, 0.18), transparent 32%),
    radial-gradient(circle at 85% 20%, rgba(79, 184, 255, 0.14), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(43, 212, 167, 0.08), transparent 25%),
    linear-gradient(180deg, #05070c 0%, #070b12 40%, #05070a 100%);
  color: var(--text);
}

body {
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 92%);
  opacity: 0.2;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  pointer-events: none;
}

.orb-a {
  width: 360px;
  height: 360px;
  left: -120px;
  top: -80px;
  background: rgba(124, 108, 255, 0.28);
}

.orb-b {
  width: 260px;
  height: 260px;
  right: -80px;
  top: 120px;
  background: rgba(79, 184, 255, 0.22);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 35%, rgba(255, 255, 255, 0.45) 0 1px, transparent 1.5px),
    radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.5px);
  background-size: 40px 40px;
}

button,
input {
  font: inherit;
}

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

button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(124, 108, 255, 0.9);
  outline-offset: 2px;
}

.shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  position: relative;
  z-index: 1;
}

.card {
  background: linear-gradient(180deg, rgba(18, 23, 36, 0.9), rgba(12, 15, 22, 0.92));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.2);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.85fr);
  gap: 20px;
  padding: 24px;
}

.hero-copy {
  padding: 12px 6px 12px 8px;
}

.eyebrow,
.label,
.meta-kicker,
.capture-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--text-soft);
}

.hero h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.2rem, 4.2vw, 4.9rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
  max-width: 11ch;
}

.hero p {
  margin: 0;
  max-width: 60ch;
  color: var(--text-muted);
  font-size: 1.03rem;
  line-height: 1.7;
}

.hero p strong {
  color: var(--text);
  font-weight: 700;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, #7c6cff 0%, #5c54ea 48%, #4fb8ff 100%);
  box-shadow: 0 12px 30px rgba(92, 84, 234, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 18px 40px rgba(92, 84, 234, 0.38);
}

.btn-secondary,
.btn-tertiary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover,
.btn-tertiary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

.session-card {
  background: rgba(8, 11, 18, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: calc(var(--radius-xl) - 4px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.session-card__top,
.panel-head,
.session-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.session-code {
  margin-top: 6px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

.field {
  display: grid;
  gap: 8px;
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row input {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 0 14px;
  min-height: 46px;
}

.field-row input::placeholder {
  color: var(--text-soft);
}

.seat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.seat-button {
  min-height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
}

.seat-white {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.seat-black {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.seat-spectator {
  color: var(--text-muted);
}

.seat-button:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
}

.session-meta {
  align-items: center;
  padding-top: 6px;
  gap: 12px;
}

.invite-link {
  display: block;
  max-width: min(100%, 380px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 8px;
  color: #d9e1ff;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 10px 12px;
  border-radius: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill-muted {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.pill-accent {
  color: #e6e9ff;
  background: rgba(124, 108, 255, 0.16);
  border-color: rgba(124, 108, 255, 0.24);
}

.pill-danger {
  color: #ffd6df;
  background: rgba(255, 107, 139, 0.12);
  border-color: rgba(255, 107, 139, 0.2);
}

.pill-success {
  color: #d9fff5;
  background: rgba(43, 212, 167, 0.12);
  border-color: rgba(43, 212, 167, 0.2);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-top: 20px;
}

.board-panel,
.sidebar-card {
  padding: 18px;
}

.panel-head {
  margin-bottom: 16px;
  align-items: center;
}

.panel-head h2,
.panel-head h3 {
  margin: 6px 0 0;
  line-height: 1.05;
}

.panel-head h2 {
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.panel-head.compact h3 {
  font-size: 1.15rem;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.board-shell {
  display: grid;
  place-items: center;
  padding: 10px 6px 4px;
}

.board {
  --cell: min(7.2vw, 76px);
  width: calc(var(--cell) * 8);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 24px 50px rgba(0, 0, 0, 0.38),
    0 0 0 14px rgba(124, 108, 255, 0.04),
    0 0 90px rgba(124, 108, 255, 0.14);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  user-select: none;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.cell:hover {
  filter: brightness(1.03);
}

.cell.light {
  background: linear-gradient(180deg, #f0dec0 0%, #ead3ae 100%);
}

.cell.dark {
  background: linear-gradient(180deg, #7c5832 0%, #6e4c2b 100%);
}

.cell.selected.light {
  background: linear-gradient(180deg, #fff0af 0%, #f6d56e 100%);
}

.cell.selected.dark {
  background: linear-gradient(180deg, #d5a14c 0%, #b77d32 100%);
}

.cell.last-move {
  box-shadow: inset 0 0 0 100vmax rgba(124, 108, 255, 0.12);
}

.cell.move::after,
.cell.capture::after {
  content: '';
  position: absolute;
  inset: auto;
  pointer-events: none;
}

.cell.move::after {
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: var(--capture-dot);
  box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.05);
}

.cell.capture::after {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.05), 0 0 22px rgba(255, 255, 255, 0.1);
}

.piece {
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  line-height: 1;
  transform: translateY(-1px);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.08));
}

.piece.white {
  color: #fbfbfb;
}

.piece.black {
  color: #101214;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 4px rgba(0, 0, 0, 0.18);
}

.sidebar {
  display: grid;
  gap: 20px;
  align-content: start;
}

.muted {
  margin: 10px 0 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.capture-grid {
  display: grid;
  gap: 12px;
}

.capture-box {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.capture-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 30px;
  align-items: center;
  font-size: 1.25rem;
}

.move-log {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.move-log li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.move-log .move-label {
  color: var(--text);
  font-weight: 700;
}

.move-log .move-time {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

.grow {
  min-height: 0;
}

@media (max-width: 1180px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .board {
    --cell: min(9.7vw, 72px);
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 100vw);
    padding-top: 12px;
  }

  .hero,
  .board-panel,
  .sidebar-card {
    padding: 16px;
  }

  .hero h1 {
    font-size: clamp(2rem, 10vw, 3.6rem);
    max-width: none;
  }

  .session-card__top,
  .session-meta,
  .panel-head,
  .panel-head.compact,
  .field-row {
    flex-direction: column;
    align-items: stretch;
  }

  .seat-row {
    grid-template-columns: 1fr;
  }

  .board {
    --cell: min(12vw, 48px);
    width: calc(var(--cell) * 8);
    border-radius: 20px;
  }

  .piece {
    font-size: clamp(1.6rem, 8vw, 2.7rem);
  }

  .status-stack {
    justify-content: flex-start;
  }
}
