﻿:root {
  --bg-0: #06080f;
  --bg-1: #0a0f1f;
  --text-main: #e8f2ff;
  --text-dim: #90a6c3;
  --line: #1f2d4d;
  --accent: #39ff14;
  --accent-glow: color-mix(in srgb, var(--accent) 70%, #ffffff 30%);
  --danger: #ff4d6d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Rajdhani", sans-serif;
  color: var(--text-main);
  opacity: 0;
  transition: opacity 0.55s ease;
  background:
    radial-gradient(circle at 12% 18%, #1f304f 0%, transparent 30%),
    radial-gradient(circle at 84% 10%, #1c1140 0%, transparent 28%),
    radial-gradient(circle at 35% 80%, #102c48 0%, transparent 34%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1) 65%, #080b15);
}

body.page-ready {
  opacity: 1;
}

h1,
h2,
h3,
h4 {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.04em;
}

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

.site-header {
  width: min(1400px, calc(100% - 2rem));
  margin: 1.2rem auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(9, 13, 27, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-wrap h1 {
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  margin: 0;
}

.brand-icon {
  font-size: 1.3rem;
}

.top-nav {
  display: flex;
  gap: 0.6rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font-family: "Orbitron", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffffff 45%));
  color: #06070f;
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 55%, transparent);
}

.btn-outline {
  background: rgba(8, 13, 26, 0.65);
  color: var(--text-main);
  border-color: color-mix(in srgb, var(--accent) 48%, #3f5e90 52%);
}

.card-surface {
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--accent) 28%);
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(6, 11, 24, 0.92), rgba(13, 20, 38, 0.9));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.home-layout,
.game-layout,
.leaderboard-layout {
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto 2rem;
}

.hero-panel {
  padding: 2.1rem;
  animation: fade-rise 0.7s ease;
}

.eyebrow {
  margin: 0;
  color: var(--accent-glow);
  letter-spacing: 0.2em;
  font-size: 0.78rem;
}

.hero-panel h2 {
  margin: 0.65rem 0;
  font-size: clamp(1.6rem, 3.2vw, 3rem);
}

.hero-panel p {
  margin: 0;
  color: var(--text-dim);
  font-size: 1.14rem;
}

.meta-row {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.game-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.72rem;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, #406090 48%);
  border-radius: 999px;
  color: var(--accent-glow);
  font-family: "Orbitron", sans-serif;
  font-size: 0.8rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 13, 26, 0.62);
  color: var(--text-main);
  padding: 0.35rem 0.78rem;
  font-family: "Orbitron", sans-serif;
  font-size: 0.73rem;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.filter-btn.active {
  border-color: color-mix(in srgb, var(--accent) 70%, #8ca7cf 30%);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-glow);
}

.games-grid {
  margin-top: 1.3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border-color: color-mix(in srgb, var(--line) 50%, var(--accent) 50%);
  overflow: hidden;
  min-height: 370px;
  animation: fade-rise 0.65s ease both;
  transition: transform 0.2s ease, box-shadow 0.22s ease;
}

.game-card:hover {
  transform: scale(1.04);
  box-shadow:
    0 24px 40px rgba(0, 0, 0, 0.45),
    0 0 26px color-mix(in srgb, var(--accent) 48%, transparent);
}

.game-card.hidden {
  display: none;
}

.game-card-content {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
}

.game-thumb {
  width: 100%;
  height: 140px;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line) 62%);
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 20%, #0f1731 80%), #070d1a);
}

.game-thumb svg,
.game-thumb canvas,
.game-thumb img {
  width: 100%;
  height: 100%;
  display: block;
}

.badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.category-chip {
  display: inline-flex;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.new-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, #8ea8d2 30%);
  color: var(--accent-glow);
  font-size: 0.7rem;
  font-family: "Orbitron", sans-serif;
}

.game-card h3 {
  margin: 0;
  font-size: 1.07rem;
}

.game-card p {
  margin: 0;
  color: var(--text-dim);
  min-height: 2.8rem;
  font-size: 1rem;
}

.game-shell {
  padding: 1rem;
  border-color: color-mix(in srgb, var(--line) 45%, var(--accent) 55%);
}

.game-shell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.game-shell-head h2 {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
}

.game-status {
  margin: 0;
  color: var(--text-dim);
  text-align: right;
}

.game-root {
  margin-top: 0.9rem;
  min-height: 360px;
}

.game-controls {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

canvas {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, #425677 42%);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(60px, 1fr));
  gap: 0.7rem;
}

.memory-card {
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--line) 58%, var(--accent) 42%);
  border-radius: 12px;
  background: rgba(8, 16, 34, 0.92);
  color: var(--text-main);
  font-size: 1.55rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}

.memory-card:hover {
  transform: scale(1.03);
}

.memory-card.revealed,
.memory-card.matched {
  background: color-mix(in srgb, var(--accent) 22%, #101936 78%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 58%, #7f9fcb 42%);
}

.quiz-wrap {
  display: grid;
  gap: 0.8rem;
}

.quiz-question {
  margin: 0;
  font-size: 1.2rem;
}

.quiz-options {
  display: grid;
  gap: 0.55rem;
}

.quiz-option {
  text-align: left;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 13, 26, 0.7);
  color: var(--text-main);
  cursor: pointer;
}

.quiz-option.correct {
  border-color: #33d17a;
  background: rgba(11, 45, 28, 0.75);
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: rgba(60, 13, 26, 0.75);
}

.timer-bar {
  width: 100%;
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(20, 28, 48, 0.8);
}

.timer-bar > span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), #ffffff);
  transition: width 1s linear;
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 0.55rem;
  max-width: 360px;
}

.ttt-cell {
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--line) 55%, var(--accent) 45%);
  border-radius: 10px;
  background: rgba(8, 13, 26, 0.75);
  color: var(--text-main);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  cursor: pointer;
}

.ttt-cell:disabled {
  opacity: 0.8;
  cursor: default;
}

.mode-switch {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mode-switch button.active {
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 46%, transparent);
  border-color: color-mix(in srgb, var(--accent) 72%, #8ea7cf 28%);
}

.spinwheel-wrap {
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}

.spinwheel-board {
  position: relative;
  width: min(420px, 100%);
}

.spinwheel-pointer {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 0;
  border-bottom: 28px solid #ffe08a;
  filter: drop-shadow(0 0 8px rgba(255, 224, 138, 0.6));
  z-index: 2;
}

.spinwheel-canvas {
  width: 100%;
  max-width: 420px;
}

.spinwheel-result {
  margin: 0.35rem 0 0;
  min-height: 2.2rem;
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.375rem, 3.4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--spin-result-color, #f8fbff);
  text-shadow:
    0 0 8px color-mix(in srgb, var(--spin-result-color, #f8fbff) 65%, transparent),
    0 0 18px color-mix(in srgb, var(--spin-result-color, #f8fbff) 40%, transparent);
}

.spinwheel-result .segment-name {
  color: var(--spin-result-color, #f8fbff);
}

.spinwheel-result.is-celebrating {
  animation:
    spinwheel-result-pop 460ms ease,
    spinwheel-result-pulse 1.1s ease 460ms 2;
}

.spinwheel-result.is-celebrating .segment-name {
  animation: spinwheel-name-flash 320ms steps(2, end) 3;
}

.ludo-wrap {
  display: grid;
  gap: 0.8rem;
}

.ludo-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.ludo-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ludo-token-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 15, 30, 0.8);
  color: var(--text-main);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

.ludo-token-btn.active {
  border-color: color-mix(in srgb, var(--accent) 70%, #8ca6ce 30%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 42%, transparent);
}

.chess-layout {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(220px, 1fr);
  gap: 1rem;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.chess-cell {
  aspect-ratio: 1;
  border: none;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.chess-cell.light {
  background: #f1e0b9;
  color: #2e2721;
}

.chess-cell.dark {
  background: #7f5f3f;
  color: #f8edd0;
}

.chess-cell.selected {
  box-shadow: inset 0 0 0 3px #4dd2ff;
}

.chess-cell.target {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 70%, #ffffff 30%);
}

.chess-history {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 26, 0.65);
  padding: 0.8rem;
  max-height: 480px;
  overflow: auto;
}

.chess-history h4 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.chess-history-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}

.g2048-wrap {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.g2048-board {
  width: min(420px, 100%);
  background: rgba(15, 22, 40, 0.88);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
}

.g2048-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.g2048-tile {
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  background: rgba(32, 40, 63, 0.9);
}

.g2048-tile[data-value="0"] {
  color: transparent;
}

.g2048-tile[data-value="2"] { background: #fef4e8; color: #2e2420; }
.g2048-tile[data-value="4"] { background: #ffd8a8; color: #2e2420; }
.g2048-tile[data-value="8"] { background: #ffb576; color: #2e2420; }
.g2048-tile[data-value="16"] { background: #fb923c; color: #1e150f; }
.g2048-tile[data-value="32"] { background: #f97316; color: #1e150f; }
.g2048-tile[data-value="64"] { background: #ea580c; color: #fff4ec; }
.g2048-tile[data-value="128"] { background: #fdba74; color: #2e2420; }
.g2048-tile[data-value="256"] { background: #fb7185; color: #2e2420; }
.g2048-tile[data-value="512"] { background: #f472b6; color: #2e2420; }
.g2048-tile[data-value="1024"] { background: #e879f9; color: #2e2420; }
.g2048-tile[data-value="2048"] { background: #c084fc; color: #1f1534; box-shadow: 0 0 16px rgba(192, 132, 252, 0.8); }

.whack-wrap {
  display: grid;
  gap: 0.8rem;
}

.whack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 0.6rem;
  width: min(390px, 100%);
}

.whack-hole {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: radial-gradient(circle at 50% 35%, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.6));
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.whack-hole .mole {
  position: absolute;
  inset: 18% 18% 8% 18%;
  border-radius: 40% 40% 45% 45%;
  background: #8b5a3c;
  transform: translateY(100%);
  transition: transform 0.16s ease;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

.whack-hole.active .mole {
  transform: translateY(0);
}

.flappy-wrap,
.breakout-wrap {
  display: grid;
  gap: 0.7rem;
  justify-items: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 15, 0.75);
  display: grid;
  place-items: center;
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(420px, calc(100% - 2rem));
  padding: 1rem;
}

.modal-card h3 {
  margin-top: 0;
}

.modal-summary {
  color: var(--text-dim);
}

.score-form {
  display: grid;
  gap: 0.55rem;
}

.score-form label {
  color: var(--text-dim);
}

.score-form input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: rgba(8, 13, 26, 0.92);
  color: var(--text-main);
  outline: none;
}

.modal-actions {
  margin-top: 0.3rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.leaderboard-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: grid;
  gap: 0.5rem;
  width: min(340px, calc(100% - 2rem));
}

.toast {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 26, 0.94);
  color: var(--text-main);
  padding: 0.7rem 0.8rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.toast.success {
  border-color: #33d17a;
}

.toast.error {
  border-color: var(--danger);
}

.lb-card {
  padding: 0.85rem;
}

.lb-card h3 {
  margin-top: 0;
  font-size: 1rem;
}

.lb-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
}

.lb-row span:last-child {
  color: var(--accent-glow);
  font-weight: 700;
}

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

@keyframes spinwheel-result-pop {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spinwheel-result-pulse {
  0% {
    text-shadow:
      0 0 8px color-mix(in srgb, var(--spin-result-color, #f8fbff) 55%, transparent),
      0 0 18px color-mix(in srgb, var(--spin-result-color, #f8fbff) 35%, transparent);
  }
  50% {
    text-shadow:
      0 0 14px color-mix(in srgb, var(--spin-result-color, #f8fbff) 85%, transparent),
      0 0 30px color-mix(in srgb, var(--spin-result-color, #f8fbff) 60%, transparent);
  }
  100% {
    text-shadow:
      0 0 8px color-mix(in srgb, var(--spin-result-color, #f8fbff) 55%, transparent),
      0 0 18px color-mix(in srgb, var(--spin-result-color, #f8fbff) 35%, transparent);
  }
}

@keyframes spinwheel-name-flash {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .chess-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-shell-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-status {
    text-align: left;
  }

  .memory-grid {
    grid-template-columns: repeat(4, minmax(50px, 1fr));
  }

  .hero-panel {
    padding: 1.4rem;
  }
}
