:root {
  --purple: #6c5ce7;
  --purple-dark: #4834d4;
  --text: #2d3436;
  --text-muted: #636e72;
  --bg: #ffffff;
  --bg-muted: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --max-content: 680px;
  --game-width: 500px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header--play {
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--purple);
}

.site-logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.site-logo__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--purple);
  text-decoration: none;
}

/* Nav link color must not override primary CTA text. */
.site-nav a.btn-primary {
  color: #fff;
  margin-left: 4px;
}

.site-nav a.btn-primary:hover {
  color: #fff;
  background: var(--purple-dark);
}

.site-footer {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--purple);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--purple);
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--purple-dark);
  color: #fff !important;
}

.site-nav__play {
  padding: 10px 22px;
  font-size: 0.9375rem;
}

.btn-secondary {
  background: transparent;
  color: var(--purple);
  border: 2px solid var(--purple);
}

.btn-secondary:hover {
  background: rgba(108, 92, 231, 0.08);
  color: var(--purple);
}

.container {
  width: min(100% - 32px, var(--max-content));
  margin-inline: auto;
}

/* Play page — full-bleed Flutter host (no card chrome) */
.play-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-muted);
}

.play-page .site-footer {
  flex-shrink: 0;
}

.play-main {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-muted);
}

#game-host {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#game-host flt-glass-pane,
#game-host flutter-view {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}

flt-glass-pane {
  touch-action: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-family: var(--font);
  z-index: 5;
}

#loading .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(108, 92, 231, 0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 640px) {
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 24px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  }

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

  .site-header {
    position: relative;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: block;
  }
}
