@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #14111f;
  --surface: #1e1930;
  --surface-2: #271f3d;
  --text: #f1eefb;
  --text-dim: #a79fc2;
  --accent: #ff5d8f;
  --accent-2: #37e6b2;
  --warn: #ffc857;

  --font-display: 'Bricolage Grotesque', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  --radius: 16px;
  --max-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
}

button {
  font-family: inherit;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #1a0e14;
}

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

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover {
  background: #332a4d;
}

/* ---------- Layout shell ---------- */

.site-header-inner,
.site-footer-inner,
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(20, 17, 31, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-2);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #1a0e14;
  font-family: var(--font-display);
  font-weight: 800;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-name--small {
  font-size: 1rem;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav-link {
  color: var(--text-dim);
  font-weight: 600;
}

.site-nav-link:hover {
  color: var(--text);
}

.site-nav--mobile {
  display: none;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--surface-2);
}

.site-nav--mobile .site-nav-link {
  padding: 0.9rem 1.5rem;
}

.site-nav--mobile.is-open {
  display: flex;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 0.4rem;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.site-main {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
  min-height: 60vh;
}

.site-footer {
  border-top: 1px solid var(--surface-2);
  margin-top: 2rem;
}

.site-footer-inner {
  padding-top: 2rem;
  padding-bottom: 2rem;
  color: var(--text-dim);
}

.site-footer-tagline {
  margin: 0.3rem 0;
}

.site-footer-copy {
  font-size: 0.85rem;
  margin: 0;
}

/* ---------- Hero ---------- */

.hero {
  padding: 2rem 0 3rem;
  max-width: 640px;
}

.hero-eyebrow {
  color: var(--accent-2);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  margin-bottom: 1.75rem;
  max-width: 46ch;
}

/* ---------- Invite banner ---------- */

.invite-banner {
  background: var(--surface);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.invite-banner-text,
.invite-banner-sub {
  margin: 0;
}

.invite-banner-sub {
  color: var(--text-dim);
}

/* ---------- Games grid ---------- */

.section-title {
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

.games-section {
  margin-top: 2rem;
}

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

.game-card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.game-card-thumb {
  font-size: 2.2rem;
  line-height: 1;
}

.game-card-icon {
  display: block;
  width: 56px;
  height: 56px;
  background: var(--icon-color, var(--accent-2));
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.game-card-category {
  color: var(--accent-2);
  font-size: 0.8rem;
  font-weight: 700;
}

.game-card-title {
  font-size: 1.15rem;
}

.game-card-desc {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.game-card-cta {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- Game start / layout ---------- */

.game-layout {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.game-start {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.game-start-category {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.85rem;
}

.game-start-title {
  font-size: 1.8rem;
}

.game-start-desc {
  color: var(--text-dim);
  margin: 0;
}

.difficulty-picker {
  border: none;
  padding: 0;
  margin: 0.5rem 0;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.difficulty-picker legend {
  width: 100%;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  padding: 0;
}

.difficulty-picker label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.game-start .btn {
  align-self: flex-start;
}

/* ---------- Result screen ---------- */

.result-screen {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.result-eyebrow {
  color: var(--text-dim);
  margin: 0;
  font-weight: 600;
}

.result-score {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4rem);
  margin: 0;
  color: var(--accent);
}

.result-line {
  margin: 0;
}

.result-line--dim {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.result-share {
  margin-top: 1.5rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.result-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Share ---------- */

.share-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.share-fallback {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.share-ready-label {
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.share-fallback-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.share-copied-note {
  margin: 0.75rem 0 0;
  color: var(--accent-2);
  font-weight: 600;
}

/* ---------- Stats page ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--accent-2);
}

.stat-label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.stats-note {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 1.5rem;
}

/* ---------- Ads ---------- */

.banner-slot {
  width: 100%;
  background: var(--surface);
  border: 1px dashed var(--surface-2);
  border-radius: 12px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
}

.banner-slot-label {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.sponsor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 16, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.sponsor-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sponsor-modal-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sponsor-icon {
  font-size: 2rem;
  color: var(--accent);
}

.sponsor-modal-body p {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
}

.sponsor-close:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Not found ---------- */

.not-found {
  text-align: center;
  padding: 4rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

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

@media (max-width: 640px) {
  .site-nav {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
  .site-nav--mobile {
    display: none;
  }
  .site-nav--mobile.is-open {
    display: flex;
  }
}

/* ---------- About / credits ---------- */

.about-page {
  max-width: 640px;
}

.about-page p {
  color: var(--text-dim);
}

.about-page a,
.site-footer-link {
  color: var(--accent-2);
  text-decoration: underline;
}

.about-h2 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.5rem;
}


/* Difficulty picker */
.dp {
  border: 0;
  padding: 0;
  margin: 0 0 1.25rem;
  min-width: 0;
}

.dp-legend {
  padding: 0;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.dp-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.dp-option {
  position: relative;
  cursor: pointer;
}

/* hide the native radio but keep it focusable/accessible */
.dp-input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.dp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  height: 100%;
  padding: 1rem 0.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 14px;
  transition: transform 0.15s ease, border-color 0.15s ease,
    background 0.15s ease, box-shadow 0.15s ease;
}

.dp-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.dp-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.dp-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.dp-option:hover .dp-card {
  transform: translateY(-2px);
  border-color: var(--accent-2);
}

.dp-input:checked + .dp-card {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(0, 0, 0, 0.25);
}

.dp-input:checked + .dp-card .dp-name {
  color: var(--accent-2);
}

.dp-input:focus-visible + .dp-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .dp-options {
    gap: 0.5rem;
  }
  .dp-card {
    padding: 0.8rem 0.3rem;
  }
  .dp-hint {
    display: none; /* keep cards compact on small phones */
  }
}