/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0e0e12;
  --bg-card: #1a1a24;
  --bg-card-hover: #24243a;
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --accent: #7c5cff;
  --accent-glow: #9b7dff;
  --gotd: #ffd369;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-glow); }

/* === Nav === */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid #222;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-icon {
  width: 1.4em;
  height: 1.4em;
  max-width: 1.4em;
  max-height: 1.4em;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: contain;
}
.nav-links a {
  color: var(--text-muted);
  margin-left: 1.5rem;
  font-size: 0.9rem;
}
.nav-links a:hover { color: var(--text); }

/* === Main & Footer === */
main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid #222;
  margin-top: 3rem;
}

/* === Hero === */
.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 2rem; font-weight: 700; }
.hero-date { color: var(--text-muted); margin-top: 0.5rem; }
.hero-sub { color: var(--text-muted); margin-top: 0.5rem; font-size: 0.95rem; }

/* === Game of the Day (legacy) === */
.game-of-the-day, .gotd-highlight { margin: 2rem 0; }
.game-of-the-day h2, .gotd-highlight h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gotd);
  margin-bottom: 1rem;
}
.gotd-card {
  background: var(--bg-card);
  border: 1px solid #333;
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.gotd-card h3 { font-size: 1.5rem; margin-bottom: 1rem; }

/* === Game Frame === */
.game-frame-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin-bottom: 1rem;
}
.game-frame-large {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-glow); color: #fff; }
.btn-secondary { background: var(--bg-card); border: 1px solid #444; }
.btn-secondary:hover { background: var(--bg-card-hover); }

/* === Game Grid === */
.day-games, .day-page { margin-top: 3rem; }
.day-games h2, .day-page h2 { margin-bottom: 1rem; font-size: 1.2rem; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid #333;
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-height: 100px;
  cursor: pointer;
}
.game-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--text);
}
.game-card.gotd { border-color: var(--gotd); }
.game-card.active {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(124, 92, 255, 0.15);
}
.game-card.active.gotd {
  border-color: var(--gotd);
  box-shadow: 0 0 0 1px var(--gotd), 0 0 12px rgba(255, 211, 105, 0.15);
}
.game-card-title { font-weight: 600; font-size: 1rem; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--gotd);
  color: #000;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-weight: 700;
}
.badge-latest {
  font-size: 0.65rem;
  background: var(--accent);
  color: #fff;
  margin-left: 0.75rem;
  vertical-align: middle;
}

/* === Game Player === */
.game-player { margin-bottom: 1.5rem; }
.game-player-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.game-player-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.game-player-title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* === Game Selector Heading === */
.game-selector-heading {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
}

/* === Day Navigation (prev/next) === */
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.day-nav h1 {
  text-align: center;
  flex: 1;
}
.day-nav-btn {
  min-width: 140px;
}
.day-nav-bottom {
  margin-top: 2rem;
  margin-bottom: 0;
  justify-content: center;
  gap: 1rem;
}

/* === Day Sections (index page) === */
.day-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #222;
}
.day-section-latest {
  border-top: none;
  padding-top: 0;
}
.day-section-date {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
}
.day-section-date a { color: var(--text); }
.day-section-date a:hover { color: var(--accent); }

/* === Archive === */
.archive h1 { font-size: 1.8rem; margin-bottom: 1.5rem; }
.day-list { display: flex; flex-direction: column; gap: 0.75rem; }
.day-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid #333;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.day-card:hover { background: var(--bg-card-hover); border-color: var(--accent); color: var(--text); }
.day-card-date { font-weight: 600; }
.day-card-info { display: flex; align-items: center; gap: 1rem; }
.day-card-gotd { color: var(--gotd); font-weight: 600; }
.day-card-count { color: var(--text-muted); font-size: 0.85rem; }

/* === CTA === */
.cta { text-align: center; margin-top: 2rem; }
.cta-text { color: var(--text-muted); margin-bottom: 0.75rem; }

/* === Full-screen Game Page === */
.game-page-body {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.game-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  min-width: 0;
}
.back-link { color: var(--text-muted); font-size: 0.9rem; flex-shrink: 0; }
.back-link:hover { color: var(--text); }
.game-topbar-title {
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-home {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-home:hover { color: var(--text); }
.topbar-home-text { display: inline; }
.game-frame-full {
  flex: 1;
  width: 100%;
  border: none;
}

/* === Terms Page === */
.terms-page h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.terms-updated { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.terms-page h2 { font-size: 1.1rem; margin-top: 2rem; margin-bottom: 0.5rem; }
.terms-page p { color: var(--text-muted); margin-bottom: 0.75rem; }
.terms-page ul { color: var(--text-muted); margin-left: 1.5rem; margin-bottom: 0.75rem; }
.terms-page li { margin-bottom: 0.25rem; }

/* === Consent Banner === */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid #333;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 1000;
  font-size: 0.85rem;
}
.consent-banner p { color: var(--text-muted); margin: 0; }
.consent-btn { padding: 0.4rem 1.2rem; font-size: 0.8rem; }

/* === Responsive === */
@media (max-width: 900px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .site-nav { padding: 0.75rem 1rem; }
  main { padding: 1.5rem 1rem; }
  .hero h1 { font-size: 1.4rem; }
  .game-grid { grid-template-columns: repeat(2, 1fr); }
  .day-card { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  /* Day navigation: date on top, buttons centered below */
  .day-nav { flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
  .day-nav h1 { order: -1; flex: 0 0 100%; font-size: 1.3rem; margin-bottom: 0.25rem; text-align: center; }
  .day-nav-btn { min-width: auto; font-size: 0.85rem; }

  /* Game topbar: compact layout */
  .game-topbar { gap: 0.5rem; padding: 0.5rem 0.75rem; }
  .game-topbar .badge { font-size: 0.55rem; padding: 0.1rem 0.35rem; margin-top: 0; }
  .topbar-home-text { display: none; }

  /* Taller game iframe so it's playable on phones */
  .game-frame-wrapper { min-height: 50vh; }

  .game-player-header { flex-direction: column; gap: 0.25rem; }
  .consent-banner { flex-direction: column; gap: 0.75rem; text-align: center; padding: 1rem; }
}
