/* =========================================
   /css/home-redesign.css
   ========================================= */

:root {
  --bg: #050b1a;
  --panel: rgba(9, 19, 42, 0.82);
  --panel-2: rgba(15, 28, 58, 0.86);

  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(226, 232, 240, 0.78);

  --text: #f8fafc;
  --muted: #b8c3d8;

  --blue: #3b82f6;
  --cyan: #38bdf8;
  --purple: #a855f7;
  --green: #22c55e;
  --yellow: #facc15;
  --orange: #fb923c;
  --red: #f87171;

  --radius: 28px;

  --shadow:
    0 28px 90px rgba(0, 0, 0, 0.42);
}

html,
body {
  background:
    radial-gradient(circle at 12% 8%, rgba(59, 130, 246, 0.25), transparent 28%),
    radial-gradient(circle at 86% 72%, rgba(34, 197, 94, 0.12), transparent 28%),
    linear-gradient(145deg, #050b1a, #071226 55%, #030712);
}

/* =========================================
   GLOBAL LAYOUT
   ========================================= */

.home-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 60px;
  display: grid;
  gap: 24px;
}

.glass-card,
.content-card,
.daily-card,
.cta-card,
.related-card {
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);

  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.13), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015)),
    var(--panel);

  backdrop-filter: blur(18px);

  box-shadow: var(--shadow);
}

.content-card,
.daily-card,
.cta-card,
.related-card {
  padding: 32px;
}

.content-card h2,
.daily-card h2,
.cta-card h2,
.related-card h2 {
  margin-top: 0;
  margin-bottom: 18px;

  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -0.045em;
  line-height: 1;
}

.content-card p,
.daily-card p,
.cta-card p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 16px;
}

/* =========================================
   HERO
   ========================================= */

.hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1.18fr);
  gap: clamp(26px, 4vw, 56px);

  align-items: center;

  padding: clamp(26px, 4vw, 48px);
}

.hero-board-wrap {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.sudoku-device {
  width: min(100%, 360px);

  padding: 14px;

  border-radius: 25px;

  border: 1px solid rgba(226, 232, 240, 0.2);

  background:
    linear-gradient(
      145deg,
      rgba(30, 41, 59, 0.98),
      rgba(15, 23, 42, 0.98)
    );

  box-shadow:
    0 22px 60px rgba(0,0,0,0.36),
    inset 0 1px 0 rgba(255,255,255,0.08);

  cursor: pointer;

  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.sudoku-device:hover {
  transform: translateY(-3px);

  border-color: rgba(56, 189, 248, 0.55);

  box-shadow:
    0 28px 80px rgba(0,0,0,0.46),
    0 0 34px rgba(56,189,248,0.16);
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);

  width: 100%;
  aspect-ratio: 1 / 1;

  border: 3px solid var(--line-strong);
  border-radius: 17px;

  overflow: hidden;

  background: rgba(2, 6, 23, 0.96);
}

.cell {
  display: grid;
  place-items: center;

  border-right: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.12);

  color: #64c7ff;

  font-size: clamp(20px, 3.2vw, 34px);
  font-weight: 900;

  line-height: 1;

  text-shadow: 0 0 16px rgba(56, 189, 248, 0.22);
}

.cell:nth-child(3n) {
  border-right-width: 3px;
  border-right-color: var(--line-strong);
}

.cell:nth-child(9n) {
  border-right: 0;
}

.cell:nth-child(n + 19):nth-child(-n + 27),
.cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom-width: 3px;
  border-bottom-color: var(--line-strong);
}

.cell:nth-child(n + 73) {
  border-bottom: 0;
}

/* thicker 3x3 borders */

.sudoku-grid .cell {
  border-right: 1px solid rgba(15, 23, 42, 0.13);
  border-bottom: 1px solid rgba(15, 23, 42, 0.13);
}

.sudoku-grid .cell:nth-child(3n):not(:nth-child(9n)) {
  border-right: 3px solid rgba(15, 23, 42, 0.32);
}

.sudoku-grid .cell:nth-child(n+19):nth-child(-n+27),
.sudoku-grid .cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 3px solid rgba(15, 23, 42, 0.32);
}

.tap-note {
  margin: 0;

  text-align: center;

  color: var(--muted);

  line-height: 1.5;
}

.kicker {
  display: inline-flex;
  align-items: center;

  padding: 8px 15px;

  border-radius: 999px;

  background:
    linear-gradient(
      90deg,
      rgba(59,130,246,0.45),
      rgba(168,85,247,0.36)
    );

  color: #e0e7ff;

  font-size: 12px;
  font-weight: 900;

  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 18px 0;

  font-size: clamp(58px, 7vw, 96px);

  line-height: 0.88;

  letter-spacing: -0.075em;
}

.subtitle {
  max-width: 780px;

  margin: 0;

  color: #d2d9e8;

  font-size: clamp(20px, 2.1vw, 27px);

  line-height: 1.32;
  font-weight: 500;
}

/* =========================================
   FEATURES
   ========================================= */

.mini-features,
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.mini-features {
  margin: 28px 0;
}

.mini-feature,
.feature-box {
  padding: 20px;

  border-radius: 18px;

  background: rgba(15, 28, 58, 0.52);

  border: 1px solid rgba(148, 163, 184, 0.12);
}

.icon {
  width: 36px;
  height: 36px;

  margin-bottom: 10px;

  color: var(--purple);
}

.mini-feature:nth-child(2) .icon {
  color: var(--blue);
}

.mini-feature:nth-child(3) .icon {
  color: var(--green);
}

.mini-feature h3,
.feature-box h3 {
  margin: 0 0 10px;
}

.mini-feature p,
.feature-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.feature-label {
  display: inline-flex;

  margin-bottom: 12px;
  padding: 6px 12px;

  border-radius: 999px;

  background: rgba(59,130,246,0.18);

  color: #cfe3ff;

  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

/* =========================================
   BUTTONS
   ========================================= */

.hero-actions,
.daily-buttons,
.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  min-height: 54px;

  padding: 14px 24px;

  border-radius: 14px;

  border: 1px solid rgba(148, 163, 184, 0.25);

  background: rgba(15, 23, 42, 0.72);

  color: var(--text);

  text-decoration: none;

  font-weight: 800;

  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

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

  border-color: rgba(96, 165, 250, 0.62);
}

.btn.primary {
  background:
    linear-gradient(
      135deg,
      #2563eb,
      #7c3aed
    );

  border-color: rgba(147, 197, 253, 0.36);

  box-shadow:
    0 16px 42px rgba(59,130,246,0.24);
}

/* =========================================
   QUICK LINKS
   ========================================= */

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;

  margin-top: 22px;
}

.quick-links a,
.related-links a {
  color: #d8b4fe;

  text-decoration: none;

  font-weight: 800;
}

.quick-links a:hover,
.related-links a:hover {
  color: white;
}

/* =========================================
   DAILY
   ========================================= */

.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  gap: 18px;

  margin-bottom: 24px;
}

.daily-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.daily-icon {
  width: 60px;
  height: 60px;

  border-radius: 16px;

  display: grid;
  place-items: center;

  background:
    linear-gradient(
      135deg,
      rgba(124,58,237,0.45),
      rgba(59,130,246,0.18)
    );

  color: #c084fc;
}

.leaderboard-status {
  padding: 10px 14px;

  border-radius: 14px;

  border: 1px solid rgba(148, 163, 184, 0.16);

  background: rgba(15, 23, 42, 0.62);

  color: #dbeafe;

  font-weight: 700;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.score-card {
  padding: 15px;

  border-radius: 14px;

  border: 1px solid rgba(148, 163, 184, 0.18);

  background: rgba(8, 16, 36, 0.66);
}

.score-card h3 {
  margin-top: 0;
}

.score-card ol {
  margin: 0;
  padding-left: 20px;

  color: #dce7f8;

  line-height: 2;
}

.beginner { color: var(--green); }
.easy { color: var(--cyan); }
.medium { color: var(--yellow); }
.hard { color: var(--orange); }
.master { color: #c084fc; }
.insane { color: var(--red); }

/* =========================================
   CTA
   ========================================= */

.cta-card {
  text-align: center;
}

/* =========================================
   MODAL
   ========================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;

  z-index: 1000;

  display: none;
  align-items: center;
  justify-content: center;

  padding: 18px;

  background: rgba(2, 6, 23, 0.72);

  backdrop-filter: blur(14px);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(560px, 100%);

  padding: 28px;

  border-radius: 24px;

  border: 1px solid rgba(148, 163, 184, 0.24);

  background:
    linear-gradient(
      135deg,
      rgba(37, 99, 235, 0.14),
      transparent 34%
    ),
    rgba(9, 19, 42, 0.96);

  box-shadow: var(--shadow);
}

.mode-grid,
.difficulty-grid {
  display: grid;
  gap: 14px;
}

.mode-grid {
  grid-template-columns: repeat(3, 1fr);
}

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

.mode-card {
  min-height: 200px;

  padding: 18px;

  border-radius: 16px;

  border: 1px solid rgba(148, 163, 184, 0.18);

  background: rgba(15, 28, 58, 0.72);

  color: var(--text);

  cursor: pointer;
}

.mode-card strong {
  display: block;
  margin-bottom: 10px;
}

.mode-card span {
  color: #d7deec;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 14px;

  margin-top: 22px;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 1200px) {

  .leaderboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }

}

@media (max-width: 980px) {

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

  .mini-features,
  .feature-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 700px) {

  .home-shell {
    width: calc(100% - 20px);
    padding-top: 10px;
  }

  .hero,
  .content-card,
  .daily-card,
  .cta-card,
  .related-card,
  .modal {
    padding: 20px;
  }

  .leaderboard-grid,
  .mode-grid,
  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .daily-head {
    flex-direction: column;
  }

  .hero h1 {
    font-size: 54px;
  }

}

/* DAILY LEADERBOARD FIX */

.daily-card {
  width: 100%;
  padding: 26px !important;
}

.leaderboard-grid {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch;
}

.score-card {
  min-height: 176px;
  padding: 15px !important;
  border-radius: 14px !important;
  background: rgba(8, 16, 36, 0.66) !important;
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
}

.score-card h3 {
  margin: 0 0 14px !important;
  font-size: 17px !important;
}

.score-card ol {
  margin: 0 !important;
  padding-left: 20px !important;
  color: #dce7f8 !important;
  font-size: 14px !important;
  line-height: 2.05 !important;
}

.score-card li {
  white-space: nowrap !important;
}

.score-card li span,
.score-card .leaderboard-time {
  float: right;
  color: #dce7f8;
  font-weight: 700;
}

.score-card .leaderboard-mistakes,
.score-card .mistakes {
  display: none !important;
}

.daily-buttons {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 14px !important;
  margin-top: 24px !important;
}

.daily-buttons .btn {
  display: flex !important;
  justify-content: center;
  align-items: center;
  text-align: center;
}

@media (max-width: 1050px) {
  .leaderboard-grid,
  .daily-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  .leaderboard-grid,
  .daily-buttons {
    grid-template-columns: 1fr !important;
  }

  .score-card li {
    white-space: normal !important;
  }
}
/* Restore normal mobile page scrolling */

html,
body {
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
}

.home-shell,
.page,
.glass-card,
.hero,
.daily-card,
.home-section,
.home-panel,
.home-card,
.home-cta-card,
.related-links-card {
  touch-action: pan-y;
}

.sudoku-device,
.sudoku-grid,
.sudoku-grid * {
  touch-action: manipulation;
}

@media (max-width: 900px) {
  .hero {
    display: flex !important;
    flex-direction: column !important;
  }

  .hero-copy {
    display: contents !important;
  }

  .hero-copy .kicker { order: 1; }
  .hero-copy h1 { order: 2; }
  .hero-copy .subtitle { order: 3; }

  .hero-board-wrap {
    order: 4;
    margin-top: 14px;
  }

  .hero-actions { order: 5; }
  .quick-links { order: 6; }

  .mini-features {
    order: 7;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 24px;
  }

  .sudoku-device {
    max-width: 280px;
  }
}

@media (max-width: 480px) {

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

}
/* =========================================
   Daily Leaderboard Desktop Layout Fix
   ========================================= */

.daily-card {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

.leaderboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

.daily-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.score-card {
  min-height: 150px !important;
}

.score-card ol {
  font-size: 14px !important;
  line-height: 1.8 !important;
}

.score-card li {
  white-space: normal !important;
}

@media (min-width: 1500px) {
  .leaderboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  .daily-buttons {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .leaderboard-grid,
  .daily-buttons {
    grid-template-columns: 1fr !important;
  }
}


/* =========================================
   Daily Leaderboard Inline Buttons
   ========================================= */

.score-card {
  display: flex !important;
  flex-direction: column !important;
}

.score-card ol {
  flex: 1 !important;
}

.score-card-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
  min-height: 42px !important;

  margin-top: 14px !important;
  padding: 10px 14px !important;

  font-size: 0.9rem !important;
  line-height: 1.1 !important;
  text-align: center !important;
}

.daily-buttons {
  display: none !important;
}
/* =========================================
   FINAL Daily Leaderboard Layout Override
   Keep cards readable on normal desktop/laptop
   ========================================= */

.daily-card .leaderboard-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

.daily-card .score-card {
  display: flex !important;
  flex-direction: column !important;
  min-height: 170px !important;
}

.daily-card .score-card ol {
  flex: 1 !important;
}

.daily-card .score-card-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 42px !important;
  margin-top: 14px !important;
  padding: 10px 14px !important;
  font-size: 0.9rem !important;
  text-align: center !important;
}

.daily-card .daily-buttons {
  display: none !important;
}

@media (min-width: 1700px) {
  .daily-card .leaderboard-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 820px) {
  .daily-card .leaderboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 560px) {
  .daily-card .leaderboard-grid {
    grid-template-columns: 1fr !important;
  }
}


/* =========================================
   FINAL OVERRIDE - Homepage Daily Card Width/Layout
   ========================================= */

.home-shell > .daily-card {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.home-shell > .daily-card .leaderboard-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

.home-shell > .daily-card .score-card {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  min-height: 170px !important;
}

.home-shell > .daily-card .score-card ol {
  flex: 1 1 auto !important;
}

.home-shell > .daily-card .score-card-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 42px !important;
  margin-top: 14px !important;
  padding: 10px 14px !important;
  white-space: normal !important;
}

@media (max-width: 820px) {
  .home-shell > .daily-card .leaderboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 560px) {
  .home-shell > .daily-card .leaderboard-grid {
    grid-template-columns: 1fr !important;
  }
}

