/* ============================================================
   Word Shaker – Shared Design System
   Used by: index.html, daily/index.html
   ============================================================ */

/* ------------------------------------------------------------
   CSS Custom Properties
   ------------------------------------------------------------ */
:root {
  --bg: #050505;
  --surface: #1a1a1a;
  --border: #252525;
  --gold: #fbbf24;
  --gold-icon: #ecbf3a;
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --rank-gold: #fbbf24;
  --rank-silver: #c0c0c0;
  --rank-bronze: #cd7f32;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;
  --radius: 12px;
  --radius-pill: 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

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

img {
  max-width: 100%;
}

/* ------------------------------------------------------------
   Navigation
   ------------------------------------------------------------ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--text);
}

.nav-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--gold);
}

/* Hamburger – hidden on desktop, shown on mobile */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: none;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: 0.3s;
}

/* ------------------------------------------------------------
   Section Containers
   ------------------------------------------------------------ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 20px;
}

.section-title {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 12px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 48px;
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.2s;
}

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

.card-icon {
  color: var(--gold);
  font-size: 2rem;
  margin-bottom: 12px;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn-primary {
  background: var(--gold);
  color: #050505;
  border-radius: var(--radius-pill);
  padding: 12px 32px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  display: inline-block;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #e5ac1c;
  color: #050505;
}

/* ------------------------------------------------------------
   Feature Grid
   ------------------------------------------------------------ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ------------------------------------------------------------
   Screenshot Carousel
   ------------------------------------------------------------ */
.carousel-wrapper {
  position: relative;
}

.carousel {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  display: flex;
  gap: 20px;
  padding: 20px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.carousel-item {
  flex-shrink: 0;
  scroll-snap-align: center;
  width: 280px;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.carousel-arrow:hover {
  background: var(--border);
}

.carousel-prev {
  left: -20px;
}

.carousel-next {
  right: -20px;
}

/* ------------------------------------------------------------
   Phone Frame
   ------------------------------------------------------------ */
.phone-frame {
  border: 3px solid #333;
  border-radius: 32px;
  overflow: hidden;
  background: #000;
}

.phone-frame img {
  width: 100%;
  display: block;
}

/* ------------------------------------------------------------
   Scoring Tiles
   ------------------------------------------------------------ */
.scoring-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

.tile {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--gold);
  color: #050505;
  font-weight: bold;
  border-radius: 8px;
}

.tile-letter {
  font-size: 18px;
  line-height: 1;
}

.tile-value {
  font-size: 11px;
  line-height: 1;
}

.scoring-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.scoring-tab {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.scoring-tab.active {
  background: var(--gold);
  color: #050505;
  border-color: var(--gold);
}

.scoring-multiplier {
  margin-top: 32px;
}

.multiplier-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
}

.scoring-example {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------
   Steps Grid
   ------------------------------------------------------------ */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.step {
  text-align: center;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold);
  color: #050505;
  font-weight: bold;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--gold-icon);
}

/* ------------------------------------------------------------
   Review Cards
   ------------------------------------------------------------ */
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  padding: 24px;
  border-radius: var(--radius);
}

.review-text {
  font-style: italic;
  margin: 12px 0;
  line-height: 1.7;
}

.review-stars {
  color: var(--gold);
  font-size: 18px;
}

.review-author {
  color: var(--text-muted);
  font-size: 14px;
}

/* ------------------------------------------------------------
   Store Badges
   ------------------------------------------------------------ */
.store-badges {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.badge-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.store-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
}

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

.qr-code {
  width: 120px;
  height: 120px;
}

.qr-label {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

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

.store-badges-large .store-badge {
  height: 80px;
}

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero {
  padding-top: 120px;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: 3.5rem;
  line-height: 1.2;
  margin-bottom: 24px;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-screenshot {
  flex-shrink: 0;
  width: 300px;
}

.gold {
  color: var(--gold);
}

/* ------------------------------------------------------------
   Download CTA
   ------------------------------------------------------------ */
.download-cta {
  text-align: center;
  padding: 80px 20px;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.footer {
  background: var(--surface);
  padding: 32px 20px;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-copy {
  color: var(--text-muted);
  font-size: 14px;
}

/* ------------------------------------------------------------
   Responsive – Tablet (≤1024px)
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ------------------------------------------------------------
   Responsive – Mobile (≤768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(5, 5, 5, 0.95);
    padding: 20px;
    flex-direction: column;
    gap: 16px;
  }

  .nav-links.open {
    display: flex;
  }

  .hamburger {
    display: block;
  }

  .hero-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-text h1 {
    font-size: 2.5rem;
  }

  .hero-screenshot {
    width: 240px;
  }

  .store-badges {
    flex-direction: column;
    align-items: center;
  }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .hide-mobile {
    display: none;
  }
}

/* ==========================================================================
   Leaderboard Page Styles
   ========================================================================== */

/* Loading spinner */
.loading { text-align: center; padding: 40px; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error and empty states */
.error-msg, .empty-msg { text-align: center; padding: 40px; color: var(--text-muted); }
.error-msg .btn-primary { margin-top: 16px; }

/* Leaderboard controls */
.leaderboard-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.lang-select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 8px; font-size: 14px;
}

/* Table enhancements */
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th {
  text-transform: uppercase; font-size: 12px; color: var(--text-muted);
  padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--border);
}
.leaderboard-table td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
.leaderboard-table tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.leaderboard-table tr.rank-1 td { color: var(--rank-gold); }
.leaderboard-table tr.rank-2 td { color: var(--rank-silver); }
.leaderboard-table tr.rank-3 td { color: var(--rank-bronze); }
.trophy { margin-right: 4px; }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* Load more */
.load-more { display: block; margin: 24px auto; }

/* Share section */
.share-section { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.share-section h3 { margin-bottom: 8px; }
.share-text { color: var(--text-muted); margin-bottom: 12px; }
.btn-small { padding: 8px 20px; font-size: 14px; }

/* Back link */
.nav-back { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.nav-back:hover { color: var(--gold); }
