/* ──────────────────────────────────────────────────────────────
   Desktop layout  (loaded last — overrides everything below)

   Breakpoints:
     768px  — tablet: font + spacing bumps only (no layout change)
     900px  — desktop: left sidebar replaces bottom nav
     1200px — wide desktop: expanded grids and sidebar
   ────────────────────────────────────────────────────────────── */


/* ══════════════════════════════════════════════════════════════
   SIDEBAR BRAND — hidden on mobile, shown only on desktop
══════════════════════════════════════════════════════════════ */
.sidebar-brand { display: none; }


/* ══════════════════════════════════════════════════════════════
   768px+ — TABLET TYPOGRAPHY & SPACING BUMPS
   (No layout shift — just readability improvements.)
══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  /* Section headings */
  .sec-title { font-size: 22px; }
  .sec-sub   { font-size: 14px; }

  /* Letter cards */
  .lcard     { padding: 14px 8px 12px; border-radius: 16px; }
  .l-big     { font-size: 28px; }
  .l-sm      { font-size: 17px; }
  .l-emoji   { font-size: 22px; margin: 3px 0; }
  .l-word    { font-size: 11px; }

  /* Word cards */
  .wcard     { padding: 18px 14px 34px; border-radius: 20px; }
  .w-emoji   { font-size: 42px; margin-bottom: 8px; }
  .w-en      { font-size: 16px; }

  /* Game cards */
  .gcard       { min-height: 160px; border-radius: 22px; }
  .g-title     { font-size: 15px; }
  .g-desc      { font-size: 12px; }

  /* Arena */
  .arena-q      { font-size: clamp(72px, 9vw, 100px); }
  .arena-prompt { font-size: clamp(20px, 2.5vw, 28px); }
  .opt          { font-size: clamp(24px, 4vw, 36px); padding: 18px 12px; min-height: 68px; }
  .opt.word-opt { font-size: 17px; }

  /* Stat cards */
  .stat-num   { font-size: clamp(28px, 3.5vw, 38px); }
  .stat-label { font-size: 12px; }

  /* Me tab */
  .me-name        { font-size: 20px; }
  .me-level-label { font-size: 13px; }

  /* Toast */
  .toast { font-size: 14px; }

  /* Btn */
  .btn { padding: 12px 24px; font-size: 16px; }
}


/* ══════════════════════════════════════════════════════════════
   900px+ — FULL DESKTOP LAYOUT
   Left sidebar replaces bottom nav. Content fills the rest.
══════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {

  /* ── 1. Body: light pastel desktop background ── */
  body {
    display: block;
    align-items: initial;
    justify-content: initial;
    min-height: 100vh;
    background:
      radial-gradient(circle at 15% 20%, rgba(245,220,255,0.7) 0%, transparent 45%),
      radial-gradient(circle at 85% 80%, rgba(210,230,255,0.7) 0%, transparent 50%),
      radial-gradient(circle at 88% 8%,  rgba(255,240,200,0.6) 0%, transparent 38%),
      linear-gradient(135deg, #f5f0ff 0%, #fff8fb 50%, #edf4ff 100%) !important;
    background-attachment: fixed;
  }
  body::before, body::after { display: none !important; }
  .grain  { display: none !important; }
  .aurora { display: none !important; }
  #ptrIndicator { display: none !important; }

  /* Hide the thin XP bar — XP is shown inside section header on desktop */
  .top-xp-bar { display: none !important; }

  /* ── 2. App shell — reserve space for the fixed sidebar ── */
  .app {
    width: 100%;
    max-width: none;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    background: transparent;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 0 0 48px 260px;
    box-sizing: border-box;
  }

  /* ── 3. Sections: clean content column ── */
  .section {
    max-width: 1060px;
    margin: 0 auto;
    padding: 32px 36px 48px;
  }

  .sec-head { padding: 0 0 20px; }
  .sec-title { font-size: 26px; }

  /* ── 4. SIDEBAR — repurposed bottom-nav ── */
  .bottom-nav {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    right: auto !important;
    transform: none !important;
    width: 260px !important;
    max-width: 260px !important;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0 12px 24px;
    border-radius: 0;
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-right: 1px solid rgba(124,91,248,0.10);
    box-shadow: 4px 0 24px rgba(73,54,232,0.07);
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 200 !important;
  }
  .bottom-nav::-webkit-scrollbar { display: none; }

  /* ── 4a. Sidebar brand (logo + app name) ── */
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 4px 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(124,91,248,0.08);
    flex-shrink: 0;
  }
  .sb-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(124,91,248,0.25);
  }
  .sb-brand-text { display: flex; flex-direction: column; gap: 1px; }
  .sb-title {
    font-family: "Nunito", "Baloo 2", sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: #1e1b4b;
    line-height: 1.2;
    letter-spacing: -0.2px;
  }
  .sb-sub {
    font-family: "Nunito", sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    line-height: 1;
  }

  /* ── 4b. Nav section label ── */
  .bottom-nav::before {
    content: "ניווט";
    display: block;
    font-family: "Nunito", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #c4b5fd;
    padding: 14px 4px 6px;
    flex-shrink: 0;
  }

  /* ── 4c. Nav items ── */
  .bottom-nav .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    height: auto;
    min-height: 46px;
    width: 100%;
    color: #4b5563;
    text-align: start;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
    margin-bottom: 2px;
  }

  .bottom-nav .nav-item .nav-indicator { display: none; }

  .bottom-nav .nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin: 0;
    opacity: 0.8;
  }
  .bottom-nav .nav-item .nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .bottom-nav .nav-item .nav-label {
    font-family: "Nunito", "Baloo 2", sans-serif;
    font-size: 15px;
    font-weight: 700;
    display: block;
    margin: 0;
    color: inherit;
    letter-spacing: -0.1px;
  }

  .bottom-nav .nav-item:hover {
    background: rgba(124,91,248,0.06);
    color: #4936e8;
  }
  .bottom-nav .nav-item:hover .nav-icon { opacity: 1; }

  .bottom-nav .nav-item.active {
    background: linear-gradient(135deg, #7c5bf8 0%, #4936e8 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(124,91,248,0.35);
  }
  .bottom-nav .nav-item.active .nav-icon { opacity: 1; }

  /* ── 5. Grids ── */
  .alph-grid {
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    gap: 14px;
  }
  .words-grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 16px;
  }
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
  }
  .stats-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
  .badges-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
  }
  .port-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .port-badges-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }

  /* ── 6. Mascot ── */
  .mascot-container {
    right: 32px !important;
    bottom: 32px !important;
    left: auto !important;
    position: fixed;
    z-index: 50;
  }

  /* ── 7. Card depth — pop off the pastel bg ── */
  :root {
    --shadow-sm:   0 2px 12px rgba(73,54,232,0.08), 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md:   0 6px 24px rgba(73,54,232,0.12), 0 2px 6px rgba(0,0,0,0.07);
    --shadow-card: 0 3px 14px rgba(73,54,232,0.10), 0 0 0 1px rgba(124,91,248,0.12);
  }
  .wcard, .lcard {
    box-shadow: 0 2px 12px rgba(73,54,232,0.09), 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.18s var(--spring);
  }
  .wcard:hover, .lcard:hover {
    box-shadow: 0 8px 28px rgba(73,54,232,0.16), 0 2px 6px rgba(0,0,0,0.07);
    transform: translateY(-3px);
  }
  .gcard {
    box-shadow: 0 2px 12px rgba(73,54,232,0.09), 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.18s var(--spring);
  }
  .gcard:hover {
    box-shadow: 0 8px 28px rgba(73,54,232,0.16), 0 2px 6px rgba(0,0,0,0.07);
    transform: translateY(-3px);
  }
  .pcard {
    border-color: rgba(124,91,248,0.14);
    box-shadow: 0 2px 12px rgba(73,54,232,0.08), 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, transform 0.18s var(--spring);
  }
  .pcard:hover {
    box-shadow: 0 8px 28px rgba(73,54,232,0.18), 0 2px 6px rgba(0,0,0,0.07);
    transform: translateY(-2px);
  }
  .stat-card, .wotd-card, .challenges-card, .challenges-section,
  .lb-preview-card, .lp-card, .team-quest-card, .badges-section,
  .hero-glass-card, .home-hero-row, .ask-foxy-strip, .ndc-card {
    box-shadow: 0 3px 14px rgba(73,54,232,0.09), 0 1px 4px rgba(0,0,0,0.05);
  }

  /* ── 8. Modals — centered dialog instead of bottom-sheet ── */
  .modal-overlay, .lb-overlay, .store-overlay { align-items: center; }
  .modal-sheet, .lb-modal {
    width: 92%;
    max-width: 500px;
    border-radius: 24px;
    border-bottom: 1px solid var(--border);
  }
  .modal-sheet { transform: scale(0.96); }
  .modal-overlay.open .modal-sheet { transform: scale(1); }
  .ai-chat-sheet {
    width: 92%;
    max-width: 560px;
    border-radius: 24px;
  }
  .store-modal {
    border-radius: 24px;
    width: 92%;
    max-width: 560px;
    transform: scale(0.96);
  }
  .store-overlay.open .store-modal { transform: scale(1); }

  /* ── 9. Game arenas ── */
  .arena {
    max-width: 780px;
    margin: 0 auto;
    padding: 32px 36px;
    box-shadow: 0 12px 40px rgba(73,54,232,0.14), 0 4px 12px rgba(0,0,0,0.07);
  }
  .arena-q       { font-size: 112px; margin-bottom: 10px; }
  .arena-prompt  { font-size: 28px;  margin-bottom: 6px; }
  .arena-heb     { font-size: 18px;  margin-bottom: 24px; }
  .opts-grid     { max-width: 540px; gap: 12px; margin-bottom: 20px; }
  .opt           { padding: 20px 14px; font-size: 36px; min-height: 72px; border-radius: 18px; }
  .opt.word-opt  { font-size: 19px; padding: 18px 14px; }
  .arena-score   { font-size: 15px; padding: 7px 16px; }

  /* ── 10. Home section — two-column grid ── */
  #sec-home {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 20px;
    row-gap: 14px;
    align-items: start;
  }

  /* Left column items */
  #sec-home > .home-hero-row,
  #sec-home > .nav-discover-label,
  #sec-home > .nav-discover-grid,
  #sec-home > .ask-foxy-strip,
  #sec-home > .home-strip,
  #sec-home > .app-footer {
    grid-column: 1;
  }

  /* Right column: lesson card, today card, WOTD, seasonal */
  #sec-home > #lessonOfDayCard,
  #sec-home > .today-card-wrap,
  #sec-home > .wotd-card,
  #sec-home > .seasonal-banner {
    grid-column: 2;
  }

  /* Stack right column items vertically */
  #sec-home > #lessonOfDayCard { grid-row: 1; }
  #sec-home > .today-card-wrap { grid-row: 2; }
  #sec-home > .wotd-card       { grid-row: 3; }
  #sec-home > .seasonal-banner { grid-row: 4; }

  /* Home hero row: bigger on desktop */
  .home-hero-row {
    padding: 20px 22px 20px 18px;
    margin-bottom: 0;
    border-radius: 24px;
  }
  .hhr-left {
    width: 130px;
    height: 144px;
  }
  .hhr-fox {
    width: 130px;
    height: 144px;
  }
  .hhr-name {
    font-size: 26px;
    margin-bottom: 8px;
  }
  .hhr-msg { font-size: 14px; }

  /* Discovery grid: 2×2 on desktop */
  .nav-discover-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .nav-discover-label {
    font-size: 14px;
    margin-bottom: 10px;
  }
  .ndc-card { padding: 16px 14px 14px; border-radius: 18px; }
  .ndc-icon-wrap { font-size: 28px; margin-bottom: 6px; }
  .ndc-title { font-size: 16px; }
  .ndc-sub { font-size: 12px; }

  /* Ask Foxy strip */
  .ask-foxy-strip { padding: 14px 18px; border-radius: 18px; }

  /* ── 11. Me section — two-column grid ── */
  #sec-me {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    column-gap: 20px;
    row-gap: 14px;
    align-items: start;
  }

  /* Full-width rows in #sec-me */
  #sec-me > .me-profile,
  #sec-me > .stats-row {
    grid-column: 1 / -1;
  }

  /* Right column */
  #sec-me > .team-quest-card,
  #sec-me > .friend-section-wrap,
  #sec-me > .lb-preview-card,
  #sec-me > .store-home-btn,
  #sec-me > .portfolio-btn,
  #sec-me > .pwa-banner {
    grid-column: 2;
  }

  /* Me profile: horizontal */
  .me-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: 20px;
    background: rgba(255,255,255,0.72);
    border: 1.5px solid rgba(124,91,248,0.12);
    box-shadow: 0 3px 14px rgba(73,54,232,0.08);
  }
  .me-avatar { width: 56px; height: 56px; border-radius: 14px; }
  .me-name   { font-size: 22px; }
  .me-level-label { font-size: 13px; }

  .stat-num   { font-size: clamp(30px, 2.8vw, 40px); }
  .stat-label { font-size: 13px; }

  /* AI teacher button */
  .ai-teacher-btn-title { font-size: 15px; }
  .ai-teacher-btn-sub   { font-size: 12px; }
}


/* ══════════════════════════════════════════════════════════════
   1200px+ — WIDE DESKTOP
══════════════════════════════════════════════════════════════ */
@media (min-width: 1200px) {

  .app { padding-left: 280px; }

  .bottom-nav {
    width: 280px !important;
    max-width: 280px !important;
  }

  .section {
    max-width: 1160px;
    padding: 36px 48px 56px;
  }

  .alph-grid {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 16px;
  }
  .words-grid {
    grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
    gap: 18px;
  }
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
  }
  .badges-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .port-badges-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .sec-title { font-size: 28px; }

  .arena {
    max-width: 840px;
    padding: 36px 48px;
  }
  .arena-q       { font-size: 124px; }
  .arena-prompt  { font-size: 30px; }
  .arena-heb     { font-size: 20px; }
  .opt           { padding: 22px 16px; font-size: 38px; min-height: 78px; }
  .opt.word-opt  { font-size: 21px; }

  #sec-home {
    grid-template-columns: minmax(0, 1fr) 320px;
    column-gap: 24px;
  }
  #sec-me {
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 24px;
  }
}


/* ══════════════════════════════════════════════════════════════
   SIDEBAR AGE AI BADGE — hidden on mobile, shown on desktop
══════════════════════════════════════════════════════════════ */
.sidebar-ageai { display: none; }

@media (min-width: 900px) {
  .sidebar-ageai {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding: 12px 8px 10px;
    border-top: 1px solid rgba(124,91,248,0.08);
    text-decoration: none;
    border-radius: 0;
    transition: background 0.16s;
    flex-shrink: 0;
  }
  .sidebar-ageai:hover {
    background: rgba(124,91,248,0.04);
    border-radius: 12px;
  }
  .sidebar-ageai-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  }
  .sidebar-ageai-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .sidebar-ageai-by {
    font-family: "Nunito", sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.3px;
  }
  .sidebar-ageai-name {
    font-family: "Nunito", sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #1f2937;
    letter-spacing: 0.5px;
  }
}
