@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap");

:root {
  --bg: #080c1e;
  --bg-deep: #0d1329;
  --bg-soft: rgba(20, 26, 50, 0.94);
  --panel: rgba(19, 24, 44, 0.92);
  --panel-strong: rgba(15, 20, 38, 0.98);
  --panel-light: rgba(27, 33, 59, 0.92);
  --line: rgba(145, 149, 255, 0.18);
  --line-strong: rgba(134, 118, 255, 0.35);
  --text: #f7f8ff;
  --muted: #b4bbd8;
  --muted-soft: #7d86ad;
  --accent: #6c5cff;
  --accent-strong: #8f6dff;
  --accent-soft: rgba(108, 92, 255, 0.22);
  --success: #38c977;
  --success-soft: rgba(56, 201, 119, 0.2);
  --warning: #f0c252;
  --danger: #ff7f96;
  --shadow: 0 28px 60px rgba(2, 5, 18, 0.52);
  --red: #d63852;
  --yellow: #e7b11d;
  --green: #2c9c51;
  --green-dark: #1f7c48;
  --blue: #2f68d7;
  --special: #5c4f87;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(87, 71, 210, 0.24), transparent 26%),
    radial-gradient(circle at 90% 10%, rgba(36, 124, 255, 0.18), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(133, 56, 214, 0.14), transparent 24%),
    linear-gradient(135deg, #070b18 0%, #0b1022 48%, #151030 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 28%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 2px,
      transparent 2px,
      transparent 16px
    );
  pointer-events: none;
}

.orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.75;
}

.orb--one {
  top: 4rem;
  left: -4rem;
  width: 18rem;
  height: 18rem;
  background: rgba(94, 72, 255, 0.24);
}

.orb--two {
  right: 4rem;
  top: 10rem;
  width: 16rem;
  height: 16rem;
  background: rgba(42, 108, 255, 0.2);
}

.orb--three {
  bottom: 3rem;
  right: 18rem;
  width: 14rem;
  height: 14rem;
  background: rgba(86, 221, 165, 0.14);
}

.app-shell {
  width: min(1560px, calc(100% - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 24px;
  min-height: calc(100vh - 48px);
  padding: 26px 24px 22px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(9, 14, 30, 0.98), rgba(10, 16, 34, 0.94));
  border: 1px solid rgba(132, 120, 255, 0.18);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding-top: 6px;
}

.brand-fan {
  position: relative;
  width: 160px;
  height: 138px;
}

.brand-card {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 50px;
  height: 74px;
  margin-left: -25px;
  border-radius: 14px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.brand-card--green {
  background: linear-gradient(180deg, #2faa63, #1f7e49);
  transform: translateX(-54px) rotate(-24deg);
}

.brand-card--green-dark {
  background: linear-gradient(180deg, #38b56d, #228958);
  transform: translateX(-28px) rotate(-14deg);
}

.brand-card--blue {
  background: linear-gradient(180deg, #3c78e5, #2656b8);
  transform: translateX(0) rotate(-3deg);
}

.brand-card--red {
  background: linear-gradient(180deg, #ea4f62, #bb2c47);
  transform: translateX(28px) rotate(10deg);
}

.brand-card--yellow {
  background: linear-gradient(180deg, #f2cb3b, #da9f10);
  transform: translateX(56px) rotate(24deg);
}

.brand-wordmark {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 4.8vw, 4rem);
  line-height: 0.88;
  letter-spacing: -0.06em;
  text-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}

.brand-subtitle {
  letter-spacing: 0.34em;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.92);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.08rem;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item.is-active,
.nav-item:hover {
  color: var(--text);
  background: linear-gradient(180deg, rgba(109, 91, 255, 0.18), rgba(56, 45, 125, 0.2));
  border-color: rgba(108, 92, 255, 0.45);
  transform: translateY(-1px);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1rem;
}

.sidebar-spacer {
  flex: 1;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #7f61ff, #5b42df);
  box-shadow: 0 10px 20px rgba(92, 76, 221, 0.36);
}

.profile-card strong {
  display: block;
  font-size: 1.18rem;
}

.profile-state {
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(56, 201, 119, 0.16);
}

.side-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-button {
  min-height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tool-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(108, 92, 255, 0.4);
  background: rgba(255, 255, 255, 0.07);
}

.main-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.topbar-copy h1 {
  margin: 8px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.6rem, 5.4vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: #9ba7d4;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
}

.subtitle,
.status-note,
.turn-hint,
.selection-summary,
.round-result,
.feature-card p,
.summary-subtitle {
  color: var(--muted);
  line-height: 1.6;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-action,
.button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(41, 46, 76, 0.96), rgba(28, 32, 56, 0.96));
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.top-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 127, 150, 0.12);
}

.pill.is-live::before {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(56, 201, 119, 0.16);
}

.top-action:hover,
.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(108, 92, 255, 0.36);
  box-shadow: 0 12px 24px rgba(8, 10, 24, 0.34);
}

.hero-panel {
  position: relative;
  min-height: 128px;
  overflow: visible;
}

.hero-glow {
  position: absolute;
  inset: 10px 0 auto 24%;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 66%);
  filter: blur(24px);
}

.hero-cards {
  position: absolute;
  right: 8%;
  top: -24px;
  width: 340px;
  height: 180px;
}

.hero-card {
  position: absolute;
  bottom: 0;
  width: 96px;
  height: 138px;
  border-radius: 22px;
  border: 5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.32);
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  text-shadow: -2px 2px 0 rgba(0, 0, 0, 0.48), 2px -2px 0 rgba(0, 0, 0, 0.32);
}

.hero-card--red {
  background: linear-gradient(180deg, #d63852, #8f1f39);
  left: 10px;
  transform: rotate(-20deg);
}

.hero-card--blue {
  background: linear-gradient(180deg, #356fd9, #22479f);
  left: 90px;
  transform: rotate(-10deg);
}

.hero-card--green {
  background: linear-gradient(180deg, #31a45a, #1e6d3d);
  left: 170px;
  transform: rotate(2deg);
}

.hero-card--yellow {
  background: linear-gradient(180deg, #f1c62f, #d59608);
  left: 250px;
  transform: rotate(12deg);
}

.preboard-stage {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(310px, 0.95fr);
  gap: 18px;
}

.stage-main {
  min-width: 0;
}

.stage-card,
.summary-panel,
.board,
.side-panel {
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(17, 23, 43, 0.96), rgba(12, 18, 36, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stage-card,
.summary-panel,
.board,
.side-panel {
  padding: 26px 28px;
}

.stage-card h2,
.stage-card h3,
.summary-panel h3,
.board h2,
.board h3,
.feature-card h3 {
  margin: 0 0 10px;
}

.stage-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.top-gap {
  margin-top: 16px;
}

.entry-stack,
.stats-grid,
.summary-panel,
.input-group,
.phase-list,
.log-list,
.meld-area,
.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.entry-panel,
.spotlight-card,
.feature-card,
.presence-item,
.phase-item,
.log-entry,
.player-zone,
.hidden-hand,
.meld-group {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.entry-panel,
.spotlight-card,
.feature-card,
.presence-item,
.phase-item,
.log-entry,
.player-zone,
.hidden-hand,
.meld-group {
  padding: 18px;
}

.entry-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.entry-panel--success {
  background: linear-gradient(180deg, rgba(34, 129, 78, 0.16), rgba(17, 34, 31, 0.4));
  border-color: rgba(56, 201, 119, 0.24);
}

.entry-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.code-badge {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(108, 92, 255, 0.14);
  color: #aa92ff;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.divider-row {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted-soft);
}

.divider-row::before,
.divider-row::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.divider-row span {
  letter-spacing: 0.16em;
}

.input-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.text-input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}

.text-input::placeholder {
  color: rgba(180, 187, 216, 0.52);
}

.inline-actions,
.round-actions,
.action-cluster,
.phase-badges,
.card-row,
.hand,
.stacked-backs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 13px 18px;
  border-radius: 16px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.button--wide {
  width: 100%;
  justify-content: center;
}

.button--primary {
  background: linear-gradient(180deg, #705dff, #4f3ef0);
  border-color: rgba(142, 118, 255, 0.64);
}

.button--secondary {
  background: linear-gradient(180deg, rgba(43, 49, 82, 0.98), rgba(28, 33, 58, 0.98));
}

.button--success {
  background: linear-gradient(180deg, #3cbf70, #1f8f4e);
  border-color: rgba(79, 218, 132, 0.42);
}

.button--large {
  min-width: 190px;
  min-height: 60px;
  font-size: 1.08rem;
  font-weight: 700;
}

.summary-panel {
  gap: 20px;
  min-height: 100%;
}

.summary-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-grid {
  gap: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stat-row span {
  color: var(--muted);
}

.stat-row strong {
  text-align: right;
}

.status-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(108, 92, 255, 0.18);
  color: #b29dff;
}

.presence-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.presence-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.presence-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(58, 201, 118, 0.92), rgba(30, 136, 76, 0.9));
}

.presence-avatar.is-empty {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.presence-meta strong {
  display: block;
}

.presence-meta span {
  color: var(--muted);
  font-size: 0.92rem;
}

.presence-flag {
  color: #76f3a8;
  font-weight: 600;
}

.presence-flag.is-offline {
  color: var(--muted-soft);
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(108, 92, 255, 0.16);
  color: #b79dff;
  font-size: 1.7rem;
  flex: 0 0 auto;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.spotlight-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  justify-content: space-between;
}

.spotlight-label {
  color: var(--muted-soft);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
}

.room-code {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  letter-spacing: 0.12em;
}

.share-link {
  color: #a89eff;
  word-break: break-all;
}

.game-shell {
  display: block;
}

.board-stage {
  display: grid;
  grid-template-columns: minmax(0, 2.15fr) minmax(300px, 0.92fr);
  gap: 18px;
}

.board {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.board-head,
.player-zone__header,
.meld-group__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.88fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.player-zone {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

.player-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
  color: var(--muted);
}

.center-table {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pile-stack {
  display: grid;
  gap: 14px;
}

.pile {
  min-height: 172px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at top, rgba(112, 93, 255, 0.12), transparent 60%);
}

.pile--deck::before {
  content: "";
  width: 86px;
  height: 124px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 60%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.07) 0,
      rgba(255, 255, 255, 0.07) 8px,
      rgba(255, 255, 255, 0.02) 8px,
      rgba(255, 255, 255, 0.02) 16px
    ),
    linear-gradient(180deg, #2f335d, #161b36);
}

.hidden-hand {
  min-height: 146px;
}

.hand {
  min-height: 170px;
}

.card {
  width: 90px;
  min-height: 128px;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(10, 14, 27, 0.7);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 245, 252, 0.94));
  color: #151625;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.18);
}

button.card {
  cursor: pointer;
  font: inherit;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border-top: 8px solid transparent;
}

.card--red::before {
  border-top-color: var(--red);
}

.card--yellow::before {
  border-top-color: var(--yellow);
}

.card--green::before {
  border-top-color: var(--green);
}

.card--blue::before {
  border-top-color: var(--blue);
}

.card--wild::before,
.card--skip::before {
  border-top-color: var(--special);
}

.card__value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.card__label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card--small {
  width: 72px;
  min-height: 104px;
  padding: 8px;
  border-radius: 17px;
}

.card--back {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 60%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06) 0,
      rgba(255, 255, 255, 0.06) 8px,
      rgba(255, 255, 255, 0.02) 8px,
      rgba(255, 255, 255, 0.02) 16px
    ),
    linear-gradient(180deg, #384170, #1c2347);
}

.card--back::before {
  border-top-color: rgba(255, 255, 255, 0.55);
}

.card.is-selected {
  transform: translateY(-7px);
  outline: 3px solid rgba(125, 214, 255, 0.72);
}

.phase-item.is-current {
  background: linear-gradient(180deg, rgba(109, 91, 255, 0.22), rgba(255, 255, 255, 0.04));
  border-color: rgba(143, 109, 255, 0.36);
}

.phase-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.74rem;
}

.phase-badge--self {
  background: rgba(108, 92, 255, 0.18);
  color: #b7a1ff;
}

.phase-badge--other {
  background: rgba(56, 201, 119, 0.15);
  color: #8bf3b2;
}

.game-sidebar {
  gap: 18px;
}

.error-text {
  color: #ff9db0;
}

.success-text {
  color: #88f0b1;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(5, 9, 19, 0.68), rgba(7, 10, 24, 0.82)),
    radial-gradient(circle at top, rgba(112, 93, 255, 0.16), transparent 40%);
  backdrop-filter: blur(16px);
}

.modal-card {
  width: min(860px, 100%);
  max-height: min(88vh, 980px);
  overflow: auto;
  padding: 28px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(18, 24, 45, 0.98), rgba(12, 17, 34, 0.98));
  border: 1px solid rgba(140, 129, 255, 0.22);
  box-shadow: 0 32px 70px rgba(4, 8, 20, 0.6);
}

.modal-card--rules {
  width: min(1080px, 100%);
}

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

.modal-head h2 {
  margin: 6px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.06em;
  line-height: 0.96;
}

.modal-close {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.modal-close:hover {
  transform: translateY(-1px);
  border-color: rgba(108, 92, 255, 0.36);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-body--rules {
  gap: 22px;
}

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

.rule-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rule-section--hero {
  background:
    radial-gradient(circle at top right, rgba(111, 93, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.03));
}

.rule-section--full {
  grid-column: 1 / -1;
}

.rule-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.rule-list li + li {
  margin-top: 6px;
}

.rules-phase-list,
.stats-stack {
  display: grid;
  gap: 10px;
}

.rules-phase-item,
.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rules-phase-item strong,
.stats-row strong {
  color: var(--text);
}

.rules-phase-item span,
.stats-row span {
  color: var(--muted);
}

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

.setting-choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-height: 116px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.setting-choice:hover {
  transform: translateY(-2px);
  border-color: rgba(108, 92, 255, 0.36);
  background: rgba(255, 255, 255, 0.07);
}

.setting-choice strong {
  font-size: 1.1rem;
}

.setting-choice span {
  color: var(--muted);
  line-height: 1.5;
}

.setting-choice.is-active {
  background: linear-gradient(180deg, rgba(108, 92, 255, 0.24), rgba(63, 52, 154, 0.22));
  border-color: rgba(135, 113, 255, 0.52);
  box-shadow: 0 14px 30px rgba(28, 24, 74, 0.32);
}

.hidden {
  display: none !important;
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .preboard-stage,
  .board-stage,
  .feature-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .topbar,
  .board-head,
  .player-zone__header,
  .meld-group__header,
  .entry-panel__head,
  .modal-head,
  .rules-phase-item,
  .stats-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .table-layout,
  .start-grid,
  .rules-grid,
  .setting-grid {
    grid-template-columns: 1fr;
  }

  .hero-cards {
    position: relative;
    right: auto;
    top: 0;
    margin-top: 12px;
    width: 300px;
    height: 170px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 16px, 100%);
    margin: 12px auto 22px;
  }

  .sidebar,
  .stage-card,
  .summary-panel,
  .board,
  .side-panel,
  .modal-card {
    padding: 20px;
    border-radius: 24px;
  }

  .overlay-backdrop {
    padding: 12px;
  }

  .side-tools {
    grid-template-columns: 1fr 1fr;
  }

  .feature-card,
  .presence-item {
    padding: 16px;
  }

  .card,
  .card--small {
    width: 72px;
    min-height: 104px;
  }

  .card__value {
    font-size: 1.6rem;
  }
}
