:root {
  --bg: #07080a;
  --bg-elevated: #0e1014;
  --ink: #e8ebe6;
  --muted: #8b9388;
  --line: rgba(200, 255, 61, 0.14);
  --accent: #c8ff3d;
  --accent-dim: #8fb82a;
  --accent-soft: rgba(200, 255, 61, 0.12);
  --danger: #ff5a3c;
  --font-display: "Syne", sans-serif;
  --font-body: "Work Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.55;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(200, 255, 61, 0.08), transparent 55%),
    radial-gradient(900px 600px at -10% 40%, rgba(60, 90, 40, 0.18), transparent 50%),
    linear-gradient(180deg, #0a0c0f 0%, var(--bg) 40%, #050607 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

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

.grid-glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 20%, black, transparent 75%);
  opacity: 0.35;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
}

.nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav a {
  transition: color 0.25s var(--ease);
}

.nav a:hover {
  color: var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  min-height: calc(100vh - 5rem);
  padding: 1rem 1.5rem 3rem;
}

.hero-kicker {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dim);
  opacity: 0;
  animation: rise 0.8s var(--ease) 0.1s forwards;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4.5rem, 14vw, 8.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-shadow: 0 0 60px rgba(200, 255, 61, 0.15);
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.2s forwards;
}

.hero-line {
  margin: 1.25rem 0 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.1rem;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.35s forwards;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.5s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease),
    color 0.25s var(--ease);
}

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

.btn-primary {
  background: var(--accent);
  color: #0a0c08;
}

.btn-primary:hover {
  background: #d6ff66;
}

.btn-ghost {
  border-color: rgba(232, 235, 230, 0.2);
  color: var(--ink);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-stage {
  opacity: 0;
  animation: rise 1s var(--ease) 0.4s forwards;
}

.crt {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #040506;
  border: 1px solid rgba(200, 255, 61, 0.22);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 0 80px rgba(200, 255, 61, 0.04);
}

.crt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04),
    transparent 20%,
    transparent 80%,
    rgba(0, 0, 0, 0.25)
  );
}

.crt-scan {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  animation: scan-drift 8s linear infinite;
  opacity: 0.45;
}

#playfield {
  display: block;
  width: 100%;
  height: 100%;
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section-head {
  margin-bottom: 2.5rem;
  max-width: 36rem;
}

.section-head h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.game-group + .game-group {
  margin-top: 2.75rem;
}

.game-group-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(232, 235, 230, 0.08);
}

.game-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 0.35rem;
  border-bottom: 1px solid rgba(232, 235, 230, 0.08);
  transition: background 0.25s var(--ease), padding 0.25s var(--ease);
}

.game-row:hover {
  background: var(--accent-soft);
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.game-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.game-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.game-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(200, 255, 61, 0.35);
  padding: 0.3rem 0.55rem;
}

.about-panel {
  max-width: 40rem;
  padding: 1.75rem 0 0;
  border-top: 1px solid rgba(200, 255, 61, 0.2);
}

.about-panel p {
  margin: 0;
  font-size: 1.2rem;
  color: #c5cbc0;
}

.contact .btn {
  margin-top: 0.25rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid rgba(232, 235, 230, 0.06);
}

.footer-start {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
}

.crystal-ball-link {
  display: block;
  line-height: 0;
}

.crystal-ball {
  width: 56px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 10px rgba(160, 110, 255, 0.45));
  transition: transform 0.25s var(--ease), filter 0.25s var(--ease);
}

.crystal-ball-link:hover .crystal-ball {
  transform: translateY(-4px) scale(1.08);
  filter: drop-shadow(0 0 16px rgba(190, 150, 255, 0.85));
}

.footer-mark {
  color: var(--accent-dim);
  padding-bottom: 0.35rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan-drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(12px);
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 2rem;
  }

  .hero-stage {
    order: -1;
  }

  .game-row {
    grid-template-columns: 2.5rem 1fr auto;
  }

  .game-meta {
    display: none;
  }
}

@media (max-width: 600px) {
  .nav {
    gap: 1rem;
  }

  .nav a:last-child {
    display: none;
  }

  .brand {
    font-size: clamp(3.8rem, 22vw, 5.5rem);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .game-row {
    grid-template-columns: 2rem 1fr;
    gap: 0.5rem 0.85rem;
  }

  .game-tag {
    grid-column: 2;
    justify-self: start;
  }
}

/* —— Play page (single game) —— */
.play-page .grid-glow {
  mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, black, transparent 75%);
}

.play {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.play-head {
  text-align: center;
  max-width: 28rem;
}

.play-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1;
}

.play-hint {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.play-crt {
  width: min(100%, 720px);
  aspect-ratio: 500 / 310;
}

.play-crt.wide {
  width: min(100%, 960px);
  aspect-ratio: 900 / 480;
}

.play-crt.square {
  width: min(100%, 720px);
  aspect-ratio: 1;
}

.play-crt.tall {
  width: min(100%, 840px);
  aspect-ratio: 800 / 700;
}

.play-crt.factory {
  width: min(100%, 960px);
  aspect-ratio: 1200 / 800;
}

.play-crt.fortune {
  width: min(100%, 800px);
  aspect-ratio: 800 / 600;
}

.play-crt #game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* —— UNO —— */
.uno-play {
  align-items: stretch;
  width: min(100%, 1100px);
}

.uno-play .play-head {
  align-self: center;
}

.uno-status {
  min-height: 1.4em;
  margin: 0;
  text-align: center;
  color: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.uno-page .btn:disabled {
  opacity: 0.45;
  transform: none;
  cursor: default;
}

.uno-panel {
  width: min(100%, 32rem);
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(200, 255, 61, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.uno-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.uno-field span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.uno-field input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(232, 235, 230, 0.16);
  background: #07080a;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
}

.uno-field input:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.uno-field input#uno-code {
  font-family: var(--font-mono);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.uno-menu-actions,
.uno-lobby-actions,
.uno-join-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.uno-join-row {
  align-items: flex-end;
}

.uno-field-grow {
  flex: 1;
  min-width: 10rem;
}

.uno-code-block {
  text-align: center;
}

.uno-code-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.uno-code-display {
  margin: 0.35rem 0 0.9rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.uno-code-actions,
.uno-lobby-actions {
  justify-content: center;
}

.uno-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.uno-seat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border: 1px dashed rgba(232, 235, 230, 0.14);
  color: var(--muted);
  font-size: 0.95rem;
}

.uno-seat.filled {
  border-style: solid;
  border-color: rgba(200, 255, 61, 0.28);
  color: var(--ink);
  background: var(--accent-soft);
}

.uno-seat-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

.uno-table {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1rem 1rem 1.4rem;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(200, 255, 61, 0.08), transparent 55%),
    #0a0d09;
  border: 1px solid rgba(200, 255, 61, 0.16);
}

.uno-table-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.uno-room-chip,
.uno-turn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.uno-turn {
  margin: 0;
  text-align: center;
  color: var(--ink);
}

.uno-opponents {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-height: 6.5rem;
}

.uno-opp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 7rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid transparent;
}

.uno-opp.turn {
  border-color: rgba(200, 255, 61, 0.45);
  background: var(--accent-soft);
}

.uno-opp.away {
  opacity: 0.45;
}

.uno-opp-cards {
  display: flex;
  height: 4.4rem;
}

.uno-opp-cards .uno-card {
  margin-left: -1.55rem;
}

.uno-opp-cards .uno-card:first-child {
  margin-left: 0;
}

.uno-opp-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.uno-center {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.6rem;
  padding: 0.5rem 0 0.25rem;
}

.uno-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.uno-pile.disabled {
  cursor: default;
  opacity: 0.7;
}

.uno-pile-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.uno-color-pip {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.uno-color-pip[data-color="Red"] { background: #d7263d; }
.uno-color-pip[data-color="Blue"] { background: #1d6fb8; }
.uno-color-pip[data-color="Green"] { background: #2a9d4a; }
.uno-color-pip[data-color="Yellow"] { background: #f0c808; }

.uno-hand {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.6rem 0.2rem 0.9rem;
}

.uno-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.uno-card {
  position: relative;
  flex: 0 0 auto;
  width: 72px;
  height: 108px;
  border-radius: 9px;
  border: 3px solid #f3f1ea;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  color: #f7f4ec;
  font-family: var(--font-display);
  overflow: hidden;
}

button.uno-card {
  cursor: pointer;
  padding: 0;
}

.uno-card.mini {
  width: 38px;
  height: 56px;
  border-width: 2px;
}

.uno-card.dim {
  opacity: 0.42;
  cursor: default;
}

.uno-card.playable {
  opacity: 1;
  transform: translateY(-8px);
  box-shadow:
    0 0 0 2px var(--accent),
    0 14px 28px rgba(0, 0, 0, 0.5);
}

.uno-red { background: #c41e3a; }
.uno-blue { background: #1b6ca8; }
.uno-green { background: #218a3e; }
.uno-yellow { background: #e2b607; color: #1c1a12; }
.uno-wild { background: #161616; }

.uno-card-corner {
  position: absolute;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.uno-card-tl { top: 5px; left: 6px; }
.uno-card-br { right: 6px; bottom: 5px; transform: rotate(180deg); }

.uno-card.mini .uno-card-corner,
.uno-card.mini .uno-card-oval {
  display: none;
}

.uno-card-oval {
  position: absolute;
  inset: 18px 10px;
  border-radius: 50%;
  background: #f3f1ea;
  display: grid;
  place-items: center;
}

.uno-card-glyph {
  font-size: 1.55rem;
  font-weight: 800;
  color: inherit;
  mix-blend-mode: multiply;
}

.uno-yellow .uno-card-glyph { color: #e2b607; }
.uno-red .uno-card-glyph { color: #c41e3a; }
.uno-blue .uno-card-glyph { color: #1b6ca8; }
.uno-green .uno-card-glyph { color: #218a3e; }

.uno-wild-oval {
  background: #111;
  overflow: hidden;
}

.uno-wild-quad {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.uno-wild-quad .r { background: #c41e3a; }
.uno-wild-quad .y { background: #e2b607; }
.uno-wild-quad .b { background: #1b6ca8; }
.uno-wild-quad .g { background: #218a3e; }

.uno-wild-oval .uno-card-glyph {
  position: relative;
  z-index: 1;
  color: #fff;
  mix-blend-mode: normal;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.uno-back {
  background:
    radial-gradient(circle at 50% 50%, rgba(200, 255, 61, 0.18), transparent 55%),
    #14180f;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: inherit;
}

.uno-back-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.uno-card.mini .uno-back-mark {
  font-size: 0.48rem;
}

.uno-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 1rem;
}

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

.uno-modal-card {
  width: min(100%, 22rem);
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(200, 255, 61, 0.25);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.uno-modal-card p {
  margin: 0;
}

.uno-win-text {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
}

.uno-color-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  width: 100%;
}

.uno-color-btn {
  height: 3.2rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.uno-color-btn.red { background: #c41e3a; }
.uno-color-btn.blue { background: #1b6ca8; }
.uno-color-btn.green { background: #218a3e; }
.uno-color-btn.yellow { background: #e2b607; }

.uno-color-btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 700px) {
  .uno-card {
    width: 60px;
    height: 90px;
  }

  .uno-card-oval {
    inset: 16px 8px;
  }

  .uno-card-glyph {
    font-size: 1.25rem;
  }

  .uno-join-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .hero-kicker,
  .brand,
  .hero-line,
  .hero-actions,
  .hero-stage {
    opacity: 1;
  }
}
