/* ==========================================================================
   Grid Collection — unified stylesheet
   Shared by index.html (+ every generated /<lang>/index.html) and the legal
   pages (support / privacy-policy / terms-of-service, and their localized
   versions). Single source of truth for all page styling.

   Language-specific overrides live at the bottom, applied via html[lang="…"].
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-primary: #ff6b35;
  --color-secondary: #004e89;
  --color-background: #1a1a2e;
  --color-surface: #16213e;
  --color-surface-alt: #0f3460;
  --color-text: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.7);
  --color-text-muted: rgba(255, 255, 255, 0.5);
  --color-cell-active: #2a2a4e;
  --color-cell-filled: #ff6b35;
  --color-cell-passive: #0d0d1a;
  --color-success: #10b981;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--color-background);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
}

nav {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-primary);
}

/* Hero Section */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  padding: 4rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-content {
  flex: 1;
  max-width: 500px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

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

.store-badges {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.store-badge {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition:
    transform 0.3s,
    opacity 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.store-badge img {
  width: 160px;
}

.store-badge:hover {
  transform: scale(1.2);
  opacity: 0.9;
}

.store-badge--soon {
  position: relative;
}

.store-badge--soon img {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.badge-ribbon {
  position: absolute;
  top: -8px;
  right: -6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Phone Mockup */
.hero-mockup {
  flex-shrink: 0;
}

.phone-frame {
  width: 280px;
  height: 560px;
  background: #000;
  border-radius: 40px;
  padding: 12px;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: var(--color-background);
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

.mock-title {
  font-size: 0.9rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Mini 5x5 grid demo */
.mock-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 180px;
}

.mock-cell {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.mock-cell.active {
  background: var(--color-cell-active);
  color: var(--color-text);
}

.mock-cell.passive {
  background: var(--color-cell-passive);
}

.mock-cell.filled {
  background: var(--color-cell-filled);
  color: white;
}

.mock-cell.highlight {
  background: var(--color-cell-active);
  border: 2px dashed var(--color-primary);
}

/* Section */
.section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.section h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--color-text);
  text-align: center;
}

/* Features Grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-surface-alt);
  border-radius: 12px;
  padding: 1.5rem;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(255, 107, 53, 0.15);
}

.feature-card h3 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.feature-card p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

/* How to Play - 3 Steps */
.how-to-play {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.step-card {
  background: var(--color-surface);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 auto 1rem;
}

.step-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.step-description {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

/* Step Grid Demos */
.step-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: fit-content;
  margin: 0 auto;
}

.step-cell {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  background: var(--color-cell-active);
}

.step-cell.active {
  background: var(--color-cell-filled);
}

.step-cell.filled {
  background: var(--color-surface-alt);
  color: white;
}

.step-cell.highlight {
  background: var(--color-cell-active);
  border: 2px dashed var(--color-primary);
}

.step-cell.passive {
  background: var(--color-cell-passive);
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.3s;
}

footer a:hover {
  color: var(--color-primary);
}

.footer-links {
  margin-bottom: 0.5rem;
}

.footer-links a {
  margin: 0 0.75rem;
}

/* Responsive */
@media (max-width: 900px) {
  .hero {
    flex-direction: column-reverse;
    text-align: center;
    gap: 2rem;
  }

  .hero-stats {
    justify-content: center;
  }

  .store-badges {
    justify-content: center;
  }

  .how-to-play {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2.5rem;
  }

  nav {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .phone-frame {
    width: 240px;
    height: 480px;
  }

  .mock-grid {
    width: 160px;
  }

  .mock-cell {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

.lang-select {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-surface-alt);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

/* ---- Playable demo ---- */
.demo {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.demo-subtitle {
  color: var(--color-text-secondary);
  margin-bottom: 1.25rem;
}

.demo-tabs {
  display: inline-flex;
  gap: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-alt);
  border-radius: 12px;
  padding: 0.3rem;
  margin-bottom: 0.5rem;
}

.demo-tab {
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.demo-tab.active {
  background: var(--color-primary);
  color: #fff;
}

.demo-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(360px, 84vw);
  margin: 1.4rem auto;
}

.demo-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: #21213a; /* passive */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 5.5vw, 24px);
  font-weight: 800;
  color: #fff;
  border: none;
  cursor: default;
  font-family: inherit;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
}

.demo-cell.is-active {
  background: #2a2a4e;
  cursor: pointer;
}

.demo-cell.is-move {
  background: #2a2a4e;
  box-shadow: inset 0 0 0 3px var(--color-primary);
  cursor: pointer;
}

.demo-cell.is-filled {
  background: linear-gradient(160deg, #1a6aac, #004e89);
}

.demo-cell.is-current {
  background: linear-gradient(160deg, #ff6b35, #e85a28);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3),
    0 0 22px rgba(255, 107, 53, 0.5);
}

.demo-cell.is-active:hover,
.demo-cell.is-move:hover {
  transform: scale(1.05);
}

.demo-cell.shake {
  animation: demoShake 0.3s;
}

@keyframes demoShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.demo-status {
  min-height: 1.6em;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.demo-status.win {
  color: var(--color-primary);
}

.demo-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.demo-btn {
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--color-surface-alt);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.demo-btn:hover:not(:disabled) {
  background: var(--color-surface-alt);
}

.demo-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.demo-cta {
  margin-top: 1.4rem;
}

.demo-cta a {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #ff6b35, #e85a28);
  box-shadow: 0 10px 26px rgba(255, 107, 53, 0.32);
}

/* ==========================================================================
   Legal / article pages (support, privacy-policy, terms-of-service)
   Scoped to .content so the article typography never leaks onto the landing
   page, which uses its own scoped headings (.hero h1, .section h2, …).
   ========================================================================== */
.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.content h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--color-primary);
}

.content h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.content p {
  margin-bottom: 1rem;
  color: var(--color-text-secondary);
}

.content ul {
  list-style-type: disc;
  margin-left: 2rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-secondary);
}

.content li {
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Language-specific overrides
   The bundled Inter font has no CJK / Devanagari glyphs, so for those locales
   we prepend platform system fonts that do. Applied via the <html lang="…">
   attribute that build-i18n.mjs writes on every generated page.
   ========================================================================== */
html[lang="hi"] body {
  font-family:
    "Inter", "Noto Sans Devanagari", "Nirmala UI", -apple-system,
    BlinkMacSystemFont, sans-serif;
}

html[lang="zh-Hans"] body {
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    "Noto Sans SC", sans-serif;
}

html[lang="zh-Hant"] body {
  font-family:
    "Inter", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC",
    "Noto Sans TC", sans-serif;
}

html[lang="ja"] body {
  font-family:
    "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Meiryo", "Noto Sans JP", sans-serif;
}

html[lang="ko"] body {
  font-family:
    "Inter", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
    sans-serif;
}
