/* ================================================================
   KIDS SIKHO — LAYOUT POLISH (homepage)
   Loaded after index.html's inline <style>, so these rules win.
   Goals: fit every screen, calmer sizes, app-like mobile layout.
   ================================================================ */

/* ── Age / class bar: was sticky at top:62px, which slid under the
      taller header (≈115px desktop, ≈209px mobile). Keep it in flow. ── */
.global-age-bar { position: relative; top: auto; }

/* ── Voice on/off chip in the header (added by common.js) ── */
.platform-stats .voice-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50px; padding: 6px 12px;
  font-family: inherit; font-size: 0.85rem; font-weight: 800;
  color: #fff; white-space: nowrap; cursor: pointer; line-height: 1.1;
}
.platform-stats .voice-toggle:hover { background: rgba(255, 255, 255, 0.34); }
.platform-stats .voice-toggle.is-muted { background: rgba(15, 23, 42, 0.32); }
.voice-toggle:focus-visible,
.nav-tab-btn:focus-visible,
.global-age-btn:focus-visible { outline: 3px solid #1D4ED8; outline-offset: 2px; }

/* ── Pet buddy card (markup was renamed; old CSS targeted .pet-mascot-stage) ── */
.pet-buddy-left { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1 1 260px; }
.pet-avatar-wrap {
  position: relative; width: 76px; height: 76px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 50%; border: 3px solid #FDE68A;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); cursor: pointer;
}
.pet-avatar-face { font-size: 44px; line-height: 1; user-select: none; }
.pet-hat-layer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 26px; line-height: 1; pointer-events: none;
}
.pet-info { min-width: 0; }
.pet-speech {
  position: relative; display: inline-block;
  background: #fff; color: #334155; font-weight: 700; font-size: 0.92rem;
  padding: 8px 14px; border-radius: 16px; margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.pet-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #1E293B; }
.pet-name-row strong { font-size: 1.05rem; }
.pet-badge-level {
  background: #F59E0B; color: #fff; font-size: 0.72rem; font-weight: 800;
  padding: 3px 10px; border-radius: 999px;
}
.pet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pet-actions button, .pet-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 2px solid #FCD34D; color: #92400E;
  border-radius: 999px; padding: 8px 14px;
  font-family: inherit; font-size: 0.85rem; font-weight: 800; cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.pet-actions button:hover { background: #FFFBEB; transform: translateY(-1px); }

/* ── Laptops / small desktops: slightly calmer scale ── */
@media (max-width: 1100px) {
  .greeting-left h1 { font-size: 1.55rem; }
}

/* ================================================================
   PHONES & SMALL TABLETS
   ================================================================ */
@media (max-width: 760px) {
  /* Header: one compact block, scrolls away; tabs move to a bottom bar */
  .platform-header { position: relative; }
  .platform-header-inner { padding: 10px 12px 8px; gap: 8px; }
  .platform-brand { font-size: 1.1rem; }
  .platform-brand .brand-avatar { font-size: 1.4rem; }
  .platform-stats {
    width: 100%; margin-left: 0; gap: 6px;
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; padding-bottom: 2px;
  }
  .platform-stats::-webkit-scrollbar { display: none; }
  .platform-stats > * { flex-shrink: 0; }
  .stat-chip, .platform-stats .voice-toggle { padding: 5px 10px; font-size: 0.78rem; }
  .platform-stats .voice-toggle .vt-label { display: none; }

  /* Bottom tab bar — thumb-friendly, always visible, like a real app */
  .platform-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
    width: auto; max-width: none; order: initial;
    display: flex; justify-content: space-around; gap: 0;
    background: #fff; border-radius: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid #E2E8F0;
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.10);
  }
  .nav-tab-btn {
    flex: 1 1 0; min-width: 0;
    flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border-radius: 12px;
    font-size: 0.68rem; font-weight: 800; color: #64748B;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .nav-tab-btn > span:first-child { font-size: 1.3rem; line-height: 1; }
  .nav-tab-btn:hover { transform: none; background: #F8FAFC; color: #334155; }
  .nav-tab-btn.active { background: #F3E8FF; color: #6D28D9; box-shadow: none; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

  /* Age bar: chips only, smaller */
  .global-age-bar { padding: 6px 10px; }
  .global-age-label { display: none; }
  .global-age-btn { padding: 6px 12px; font-size: 0.8rem; border-width: 1.5px; }
  .global-age-btn .btn-emoji { font-size: 1rem; }

  /* Headings & hero cards */
  .greeting-hero { padding: 16px 18px; border-radius: 18px; margin-bottom: 16px; gap: 12px; }
  .greeting-left h1 { font-size: 1.3rem; line-height: 1.25; }
  .greeting-left p { font-size: 0.92rem; }
  .daily-goal-pill { padding: 8px 14px; font-size: 0.82rem; }
  .age-hub-title { font-size: 1.15rem; }
  .section-headline h2 { font-size: 1.1rem; }

  /* Subject cards: 2 per row instead of one huge card per screen */
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
  .subject-card { padding: 14px 10px; border-radius: 16px; border-width: 2px; }
  .subject-card .subj-icon { font-size: 2rem; margin-bottom: 4px; }
  .subject-card .subj-name { font-size: 1rem; }
  .subject-card .subj-topics { font-size: 0.72rem; line-height: 1.35; }
  .subject-card:hover { transform: none; }

  /* Filter chip rows: one swipeable line instead of 5–6 wrapped rows */
  .filter-tabs, .age-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; padding-bottom: 4px;
  }
  .filter-tabs::-webkit-scrollbar, .age-tabs::-webkit-scrollbar { display: none; }
  .filter-tabs > *, .age-tabs > * { flex-shrink: 0; }

  /* Pet card + quick launch */
  .pet-buddy-card { padding: 14px 16px; border-radius: 18px; margin-bottom: 16px; }
  .pet-avatar-wrap { width: 60px; height: 60px; }
  .pet-avatar-face { font-size: 34px; }
  .pet-hat-layer { font-size: 20px; top: -11px; }
  .pet-speech { font-size: 0.82rem; padding: 6px 10px; }
  .quick-launch-grid { gap: 10px; margin-bottom: 16px; }

  /* Language switch first in the chip row so it's never scrolled off-screen */
  .platform-stats .lang-toggle { order: -1; }

  /* Teacher lesson: small avatar beside the name, board takes the space */
  .teacher-section { padding: 14px; border-radius: 18px; margin-bottom: 18px; border-width: 2px; }
  .teacher-stage { gap: 12px; }
  .teacher-avatar-box {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; min-height: 0; text-align: left;
  }
  .teacher-graphic { width: 64px; height: 64px; flex-shrink: 0; margin: 0; }
  .teacher-svg { width: 64px; height: 64px; }
  .blackboard { border-width: 8px; padding: 14px; min-height: 0; border-radius: 16px; }
  .chalk-header { font-size: 0.95rem; flex-wrap: wrap; gap: 4px; }
  .chalk-footer { justify-content: center; }
  .chalk-btn { padding: 7px 12px; font-size: 0.8rem; }
}

@media (max-width: 380px) {
  .nav-tab-btn { font-size: 0.62rem; }
  .nav-tab-btn > span:first-child { font-size: 1.15rem; }
  .subject-card .subj-topics { display: none; }
}

/* Subject cards: 6 in a row on desktop, 3 + 3 on tablets (no lonely last card) */
@media (min-width: 1000px) {
  .subject-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .subject-card { padding: 18px 12px; }
  .subject-card .subj-icon { font-size: 2.5rem; }
  .subject-card .subj-name { font-size: 1.1rem; }
}
@media (min-width: 761px) and (max-width: 999px) {
  .subject-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
