/* ============================================================
   DigitalKiddo™ Maths — Mobile App Shell (≤767px ONLY)
   ------------------------------------------------------------
   Turns the registered-user web pages into a friendly, installable
   children's-app experience on phones. EVERYTHING here is scoped to
   ≤767px; desktop and tablet layouts are untouched.

   The mobile components injected by mobile-nav.js (.m-bottom-nav,
   .m-scrim, .m-sheet, #m-dash) exist in the DOM on every width, so
   they are hidden by default here and only revealed inside the
   mobile media query.
   ============================================================ */

/* Hide injected mobile chrome everywhere by default (desktop/tablet). */
.m-bottom-nav,
.m-scrim,
.m-sheet,
.m-filter-btn,
#m-dash { display: none; }

/* ============================================================
   MOBILE ONLY  —  max-width: 767px
   ============================================================ */
@media (max-width: 767px) {

  /* ---- Safe-area + spacing tokens ---- */
  :root {
    --m-pad: 16px;
    --m-nav-h: 60px;
    --m-safe-b: env(safe-area-inset-bottom, 0px);
    --m-gap: 14px;
  }

  /* ---- Kill the desktop shell ---- */
  .app-layout { display: block !important; }
  .sidebar { display: none !important; }
  .kiddo-coach-fab { display: none !important; } /* Coach lives in nav + More */

  html, body { overflow-x: hidden; }

  .main-content {
    padding: var(--m-pad) !important;
    /* clear the fixed bottom nav */
    padding-bottom: calc(var(--m-nav-h) + var(--m-safe-b) + 28px) !important;
    background: var(--surface-2);
    min-height: 100vh;
  }

  /* ==========================================================
     BOTTOM NAVIGATION
     ========================================================== */
  .m-bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    height: calc(var(--m-nav-h) + var(--m-safe-b));
    padding-bottom: var(--m-safe-b);
    background: var(--surface);
    border-top: 1px solid var(--gray-100);
    box-shadow: 0 -6px 24px rgba(45,52,54,0.10);
    justify-content: space-around;
    align-items: stretch;
  }
  .m-nav-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 6px 2px;
    color: var(--gray-600);
    background: none;
    border: none;
    font-family: 'Nunito', sans-serif;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.18s, transform 0.12s;
  }
  .m-nav-item:active { transform: scale(0.9); }
  .m-nav-icon {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.18s;
  }
  .m-nav-label {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .m-nav-item.active { color: var(--primary); }
  .m-nav-item.active .m-nav-icon { transform: translateY(-1px) scale(1.12); }
  /* "You are here" pip */
  .m-nav-item.active::before {
    content: '';
    position: absolute;
    top: 6px;
    width: 26px; height: 3px;
    border-radius: 3px;
    background: var(--primary);
  }
  .m-nav-item { position: relative; }

  /* ==========================================================
     BOTTOM SHEETS (More + child switch) + scrim
     ========================================================== */
  .m-scrim {
    display: block;
    position: fixed; inset: 0;
    z-index: 950;
    background: rgba(20,20,40,0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .m-scrim.open { opacity: 1; pointer-events: auto; }

  .m-sheet {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 960;
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 40px rgba(45,52,54,0.25);
    padding: 8px var(--m-pad) calc(var(--m-safe-b) + 20px);
    max-height: 82vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }
  .m-sheet.open { transform: translateY(0); }
  body.m-sheet-lock { overflow: hidden; }

  .m-sheet-grip {
    width: 40px; height: 5px;
    border-radius: 5px;
    background: var(--gray-200);
    margin: 6px auto 4px;
  }
  .m-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .m-sheet-title { font-size: 1.25rem; margin: 0; }
  .m-sheet-close {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 1rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }
  .m-sheet-close:active { transform: scale(0.9); }

  /* ---- More sheet rows ---- */
  .m-more-group {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
  }
  .m-more-item,
  .m-more-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    background: none;
    color: var(--dark);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
  }
  .m-more-group > *:last-child { border-bottom: none; }
  .m-more-item:active { background: var(--gray-100); }
  .m-more-icon { font-size: 1.4rem; width: 28px; text-align: center; flex-shrink: 0; }
  .m-more-text { flex: 1; min-width: 0; }
  .m-more-chevron { color: var(--gray-400); font-size: 1.5rem; font-weight: 400; }
  .m-more-logout .m-more-text { color: var(--secondary); }

  /* language segmented control inside a row */
  .m-lang-seg {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: 50px;
    padding: 3px;
    gap: 2px;
  }
  .m-lang-btn {
    padding: 6px 14px;
    border-radius: 50px;
    background: none;
    color: var(--gray-600);
    font-size: 0.8rem;
    font-weight: 800;
    min-height: 34px;
  }
  .m-lang-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108,99,255,0.35);
  }

  /* dark-mode switch */
  .m-switch {
    width: 52px; height: 30px;
    border-radius: 50px;
    background: var(--gray-200);
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
  }
  .m-switch.on { background: var(--primary); }
  .m-switch-knob {
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s;
  }
  .m-switch.on .m-switch-knob { transform: translateX(22px); }

  /* ---- Child-switch sheet ---- */
  .m-child-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
  }
  .m-child-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 2px solid transparent;
    text-align: center;
  }
  .m-child-card.active { border-color: var(--primary); background: rgba(108,99,255,0.08); }
  .m-child-card:active { transform: scale(0.97); }
  .m-child-avatar {
    font-size: 2.4rem;
    line-height: 1;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
  }
  .m-child-avatar .dk-avatar-photo {
    width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  }
  .m-child-name { font-weight: 800; font-size: 0.95rem; }
  .m-child-age { font-size: 0.75rem; color: var(--gray-600); }
  .m-child-check {
    position: absolute; top: 8px; right: 8px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: #fff;
    font-size: 0.75rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }
  .m-child-manage {
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border-bottom: none;
  }

  /* ==========================================================
     MOBILE DASHBOARD  (#m-dash, injected top of .main-content)
     Hide the desktop dashboard blocks; show the app-style one.
     ========================================================== */
  #m-dash { display: block; }

  /* Desktop dashboard sections replaced by #m-dash, or moved to
     their own dedicated page (Progress) on mobile. */
  .main-content > .welcome-banner,
  .main-content > .stats-row,
  .main-content > .card:has(#recent-games),
  .main-content > .dash-bottom-grid { display: none !important; }

  #m-dash { display: flex; flex-direction: column; gap: 20px; }

  .m-sec-title {
    font-size: 1.05rem;
    margin: 0 0 10px;
    display: flex; align-items: center; gap: 6px;
  }

  /* ---- Profile header ---- */
  .m-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #6c63ff 0%, #8c6fe6 100%);
    color: #fff;
    box-shadow: 0 10px 26px rgba(108,99,255,0.30);
  }
  .m-profile-avatar {
    font-size: 2.4rem;
    line-height: 1;
    width: 54px; height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .m-profile-avatar .dk-avatar-photo {
    width: 54px; height: 54px; border-radius: 50%; object-fit: cover;
  }
  .m-profile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .m-profile-name {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    line-height: 1.1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .m-profile-meta { display: flex; flex-wrap: wrap; gap: 6px; }
  .m-chip {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 50px;
    background: rgba(255,255,255,0.22);
    white-space: nowrap;
  }
  .m-switch-child {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .m-switch-child:active { transform: scale(0.9) rotate(-20deg); }

  /* ---- Large Continue card ---- */
  .m-continue {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--gray-100);
    color: var(--dark);
    text-decoration: none;
  }
  .m-continue:active { transform: scale(0.98); }
  .m-continue-emoji {
    font-size: 2.6rem;
    line-height: 1;
    width: 64px; height: 64px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .m-continue-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .m-continue-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .m-continue-title,
  .m-continue-body .m-continue-kicker + .m-continue-sub { }
  .m-continue-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.05rem;
    line-height: 1.15;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .m-continue-sub { font-size: 0.85rem; color: var(--gray-600); }
  .m-continue-stars span { font-size: 1rem; }
  .m-star-on { color: var(--accent); }
  .m-star-off { color: var(--gray-200); }
  .m-continue-btn {
    flex-shrink: 0;
    padding: 12px 16px;
    border-radius: 50px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(108,99,255,0.35);
  }

  /* ---- Today's Mission ---- */
  .m-mission-list { display: flex; flex-direction: column; gap: 10px; }
  .m-mission-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--gray-100);
  }
  .m-mission-item.done { border-color: rgba(38,222,129,0.4); background: rgba(38,222,129,0.07); }
  .m-mission-icon { font-size: 1.4rem; width: 30px; text-align: center; }
  .m-mission-label { flex: 1; font-weight: 700; font-size: 0.95rem; }
  .m-mission-item.done .m-mission-label { color: var(--gray-600); text-decoration: line-through; }
  .m-mission-check { font-size: 1.2rem; }

  /* ---- Quick access carousel ---- */
  .m-quick-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding: 2px 2px 8px;
    margin: 0 -2px;
    scrollbar-width: none;
  }
  .m-quick-row::-webkit-scrollbar { display: none; }
  .m-quick-card {
    scroll-snap-align: start;
    flex: 0 0 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--dark);
    text-align: center;
    text-decoration: none;
  }
  .m-quick-card:active { transform: scale(0.95); }
  .m-quick-icon {
    font-size: 1.9rem;
    line-height: 1;
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
  }
  .q-play  .m-quick-icon { background: rgba(38,222,129,0.15); }
  .q-learn .m-quick-icon { background: rgba(108,99,255,0.15); }
  .q-brain .m-quick-icon { background: rgba(253,121,168,0.15); }
  .q-adv   .m-quick-icon { background: rgba(255,159,67,0.18); }
  .q-coach .m-quick-icon { background: rgba(78,205,196,0.18); }
  .m-quick-label { font-size: 0.72rem; font-weight: 800; line-height: 1.15; }

  /* ---- Compact stats ---- */
  .m-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .m-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 4px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  .m-stat-icon { font-size: 1.3rem; }
  .m-stat-value { font-family: 'Fredoka One', cursive; font-size: 1.25rem; color: var(--dark); }
  .m-stat-label { font-size: 0.64rem; font-weight: 800; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.3px; }

  /* ---- Next reward ---- */
  .m-nextbadge-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #fff6d8 0%, #ffe9b0 100%);
    border: 1.5px solid rgba(255,159,67,0.3);
  }
  .m-nextbadge-icon {
    font-size: 2.2rem;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    filter: grayscale(30%);
  }
  .m-nextbadge-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .m-nextbadge-kicker { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--orange); }
  .m-nextbadge-title { font-family: 'Fredoka One', cursive; font-size: 1rem; color: #7a5200; }
  .m-nextbadge-sub { font-size: 0.8rem; color: #9a7333; line-height: 1.25; }

  /* ==========================================================
     REMAINING DASHBOARD CARDS (Continue Playing / Recommended)
     Keep them but make them app-friendly + turn rows into
     horizontal swipe carousels.
     ========================================================== */
  .main-content > .card { margin-bottom: 0 !important; }
  .main-content > .card { border-radius: var(--radius); padding: 16px; }
  .section-header h3 { font-size: 1.05rem; }
  .section-header .btn-sm { padding: 6px 12px; font-size: 0.78rem; }

  .recent-games {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .recent-games::-webkit-scrollbar { display: none; }
  .recent-games > * { flex: 0 0 82%; scroll-snap-align: start; }

  #recommended-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  #recommended-grid::-webkit-scrollbar { display: none; }
  #recommended-grid > * { flex: 0 0 62%; scroll-snap-align: start; }

  /* The Math Adventure promo + review prompt: keep, just tighten */
  .main-content > div[style*="linear-gradient(135deg,#29366f"] {
    margin-bottom: 0 !important;
    padding: 16px !important;
    border-radius: var(--radius) !important;
  }

  /* ==========================================================
     GAMES LIBRARY (games.html)
     ========================================================== */
  /* Search prominent + full width near the top; sort sits beside it. */
  .search-bar-wrap { flex: 1 1 100%; width: 100%; }
  .search-bar-wrap input { width: 100%; }
  .sort-select { min-height: 44px; }

  /* Age filters → horizontally scrollable chips, always reachable. */
  .filter-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 6px;
    margin: 0 -16px 12px;
    padding-left: 16px;
    padding-right: 16px;
    scrollbar-width: none;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 44px;
    border-radius: 50px;
  }

  /* Secondary refine selects live in the Filters sheet on mobile
     (moved there by mobile-nav.js), stacked full-width for easy taps. */
  .m-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    margin-bottom: 12px;
    border-radius: 50px;
    background: var(--surface);
    border: 1.5px solid var(--gray-200);
    color: var(--dark);
    font-family: 'Nunito', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
  }
  .m-filter-btn:active { transform: scale(0.96); }
  #m-filter-sheet .filter-secondary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }
  #m-filter-sheet .sort-select { width: 100%; min-height: 48px; }
  .m-filter-done {
    width: 100%;
    min-height: 50px;
    border-radius: 50px;
    background: var(--primary);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(108,99,255,0.35);
  }
  .m-filter-done:active { transform: scale(0.97); }

  .games-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  /* two columns only when there's a little more room */
  @media (min-width: 480px) {
    .games-grid { grid-template-columns: 1fr 1fr !important; }
  }

  /* ==========================================================
     PROGRESS (progress.html) — sticky segmented tabs
     ========================================================== */
  .pp-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface-2);
    padding: 8px 0;
    margin: 0 -2px 8px;
  }
  .pp-title { font-size: 1.4rem; }
  /* Stack any two-up stat/graph grids into one column */
  .parent-stats-grid,
  .skills-grid,
  .rc-summary-grid { grid-template-columns: 1fr !important; }

  /* ==========================================================
     LEARNING CENTRE (learning.html)
     Already accordion-based (Sifir / Latih Tubi / Years / Worksheets);
     just make search full-width and difficulty pills swipeable.
     ========================================================== */
  .learn-search-wrap { width: 100%; }
  .learn-search-wrap input { width: 100%; min-height: 44px; }
  .filter-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .filter-pills::-webkit-scrollbar { display: none; }
  .filter-pill { flex: 0 0 auto; white-space: nowrap; min-height: 40px; }

  /* ==========================================================
     Generic mobile polish for cards, buttons, forms
     ========================================================== */
  .card { border-radius: var(--radius); }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }

  /* Convert wide tables to horizontal scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }

  /* ==========================================================
     MODALS → BOTTOM SHEETS
     App.showModal() renders .modal-overlay > .modal, centred on
     desktop. On phones that reads as a cramped floating box, so
     we re-anchor it to the bottom edge as a near-full-screen
     sheet that slides up. Structure/JS untouched — the existing
     .open class still drives it; we only re-point the transform.
     ========================================================== */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 22px var(--m-pad) calc(var(--m-safe-b) + 22px);
    max-height: 90dvh;
    /* slide up from the bottom instead of scaling from the centre */
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 -12px 40px rgba(0,0,0,0.3);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  /* Grip affordance so it reads as a draggable sheet */
  .modal::before {
    content: '';
    display: block;
    width: 40px; height: 5px;
    border-radius: 5px;
    background: var(--gray-200);
    margin: -6px auto 14px;
  }
  .modal-close { top: 14px; right: 14px; width: 40px; height: 40px; }
  .modal-icon { font-size: 3rem; margin-bottom: 0.6rem; }
  /* Primary actions sit low and full-width — one-handed reach */
  .modal .btn { width: 100%; }
  .modal .modal-actions,
  .modal .result-actions { display: flex; flex-direction: column; gap: 10px; }

  /* ==========================================================
     REVIEW MANAGEMENT console (admin-reviews.html)
     Standalone page (no app shell / no bottom nav) — it keeps its
     own "← Back to Dashboard" button. Here we just make the
     desktop-width console usable one-handed on a phone.
     ========================================================== */
  .rv-admin-wrap { padding: var(--m-pad); }
  .rv-admin-header { gap: 12px; margin-bottom: 16px; }
  .rv-admin-header h1 { font-size: 1.3rem; }
  .rv-admin-header .btn { width: 100%; }

  /* 5 stats: 2 per row rather than a squeezed auto-fit strip */
  .rv-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .rv-stat { padding: 12px 14px; border-radius: var(--radius-sm); }
  .rv-stat-val { font-size: 1.4rem; }
  .rv-stat-lbl { font-size: 0.66rem; }

  /* Toolbar → stacked full-width controls with 44px targets */
  .rv-toolbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; margin-bottom: 16px; }
  .rv-toolbar input[type="search"],
  .rv-toolbar select { width: 100%; min-width: 0; min-height: 44px; }
  .rv-toolbar .rv-toolbar-spacer { display: none; }
  .rv-toolbar .btn { width: 100%; min-height: 44px; }

  /* Review cards + their action buttons */
  .rv-admin-card { padding: 14px; border-radius: var(--radius-sm); }
  .rv-admin-card-top { gap: 8px; }
  .rv-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .rv-admin-actions .btn { flex: 1 1 calc(50% - 4px); min-height: 42px; }

  /* ==========================================================
     Dark-mode adjustments for injected mobile chrome
     ========================================================== */
  html.dark-mode .m-nextbadge-card {
    background: linear-gradient(135deg, #3a3320 0%, #2c2618 100%);
    border-color: rgba(255,159,67,0.25);
  }
  html.dark-mode .m-nextbadge-icon { background: rgba(255,255,255,0.12); }
  html.dark-mode .m-nextbadge-title { color: #ffd98a; }
  html.dark-mode .m-nextbadge-sub { color: #c9a86a; }
  html.dark-mode .m-bottom-nav { box-shadow: 0 -6px 24px rgba(0,0,0,0.4); }

  /* Extra-tight refinements for the smallest phones (≤360px) */
  @media (max-width: 360px) {
    .m-continue { gap: 10px; padding: 14px 12px; }
    .m-continue-emoji { width: 52px; height: 52px; font-size: 2.1rem; }
    .m-continue-btn { padding: 10px 12px; font-size: 0.82rem; }
    .m-profile-name { font-size: 1.15rem; }
    .m-stat-value { font-size: 1.1rem; }
    .m-stat-label { font-size: 0.58rem; }
  }
}

/* ============================================================
   Floating tools buttons (Learning Centre: Working Space +
   Calculator) must clear the fixed bottom nav — and must stay
   stacked relative to EACH OTHER, not collapse onto one spot.
   Their stock mobile offsets (ws 96px / calc 156px) were tuned
   to sit above the old Kiddo Coach FAB, which the mobile shell
   hides; so we re-base both on the nav height and keep the same
   ~60px separation. Rules live outside the main mobile block so
   they can carry !important over the component stylesheets.
   ============================================================ */
@media (max-width: 767px) {
  .ws-fab {
    bottom: calc(var(--m-nav-h) + var(--m-safe-b) + 16px) !important;
    z-index: 890 !important;
  }
  .calc-fab {
    bottom: calc(var(--m-nav-h) + var(--m-safe-b) + 84px) !important;
    z-index: 890 !important;
  }
  /* NOTE: .ws-panel / .calc-panel are z-index 2050 fixed sheets — they
     intentionally cover the nav while open (near-full-screen dialog).
     Do NOT pad them; their flex/grid internals are tuned to fill the
     sheet and padding shrinks the canvas / keypad rows. */
}
