/* ============================================================
   mv-polish.css — glassmorphism + rounded controls
   ------------------------------------------------------------
   PURELY ADDITIVE. Nothing here overrides a layout, a size, a
   position or a colour that already works; it only softens
   surfaces and rounds corners. Loaded AFTER the base sheets so
   it wins on paint, never on structure.

   Safe-by-design rules used throughout:
   - backdrop-filter is progressive: browsers that lack it simply
     get the solid background underneath, never a washed-out box.
   - @supports gates the glass so a broken filter can't hide text.
   - No `transform`, `filter` or `will-change` on any element that
     is an ancestor of the flip-card or a fixed bar — that is what
     collapsed the flashcard's preserve-3d once already.
   - Radius is applied to LEAF controls only; containers that clip
     children (overflow:hidden) are left alone so nothing gets cut.
   ============================================================ */

:root{
  --mv-gr: 18px;                      /* standard rounded corner  */
  --mv-gr-sm: 12px;
  --mv-gr-lg: 24px;
  --mv-glass-bg: rgba(255,255,255,.62);
  --mv-glass-bd: rgba(255,255,255,.75);
  --mv-glass-shadow: 0 8px 30px rgba(18,48,79,.10), 0 2px 8px rgba(18,48,79,.06);
  --mv-glass-blur: saturate(180%) blur(14px);
}

/* ---------- 1. buttons: rounded, tactile, unchanged size ---------- */
/* Only corner rounding + a subtle lift on hover. No padding, height,
   font-size or display changes, so every existing button keeps its
   exact box and no row re-flows. */
.mvapp .btn,
.mvapp button,
.mvapp .cta,
.mvapp .mini,
.cta,
.btn{
  border-radius: 999px !important;   /* pill; 999px is safe at any height */
}
/* square-ish icon buttons read better as rounded squares */
.mvapp .arw,
.mvapp .mvm-burger,
.mv-qnav,
[class*="icon-btn"]{
  border-radius: var(--mv-gr-sm) !important;
}
/* option rows in a question are wide rectangles, not pills */
.opt,
.option,
.mvapp .opt{
  border-radius: var(--mv-gr-sm) !important;
}
/* inputs keep a squarer corner than buttons or they look like chips */
.mvapp input,
.mvapp textarea,
.mvapp select{
  border-radius: var(--mv-gr-sm) !important;
}

/* ---------- 2. glass surfaces ---------- */
/* @supports means a browser without backdrop-filter gets the original
   solid background — the page never becomes unreadable. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){

  /* the sticky header — the one place glass genuinely reads */
  .hdr.glass,
  .mvapp .hdr,
  .glass{
    background: var(--mv-glass-bg) !important;
    -webkit-backdrop-filter: var(--mv-glass-blur);
    backdrop-filter: var(--mv-glass-blur);
    border-color: var(--mv-glass-bd) !important;
  }

  /* content cards */
  .panel-card.glass,
  .mvapp .panel-card,
  .mvapp .card{
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    backdrop-filter: saturate(150%) blur(10px);
    box-shadow: var(--mv-glass-shadow) !important;
    border-radius: var(--mv-gr) !important;
  }

  /* the bottom app bar — glass over the page content behind it */
  .mvapp-bar{
    background: rgba(255,255,255,.78) !important;
    -webkit-backdrop-filter: var(--mv-glass-blur);
    backdrop-filter: var(--mv-glass-blur);
    border-top-color: rgba(18,48,79,.10) !important;
  }
}

/* If backdrop-filter is unsupported, keep the bar opaque — glass over
   nothing is just a see-through bar you cannot read. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
  .mvapp-bar{ background:#fff !important; }
}

/* ---------- 3. dark mode ---------- */
/* Glass on near-black needs a lighter fill or the text loses contrast. */
html[data-mvtheme="dark"]{
  --mv-glass-bg: rgba(22,29,38,.68);
  --mv-glass-bd: rgba(255,255,255,.10);
  --mv-glass-shadow: 0 8px 30px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.30);
}
html[data-mvtheme="dark"] .mvapp-bar{
  background: rgba(17,24,32,.82) !important;
  border-top-color: rgba(255,255,255,.08) !important;
}
html[data-mvtheme="dark"] .hdr.glass,
html[data-mvtheme="dark"] .glass{
  background: var(--mv-glass-bg) !important;
  border-color: var(--mv-glass-bd) !important;
}

/* ---------- 4. respect reduced-motion / reduced-transparency ---------- */
/* iOS "Reduce Transparency" and the equivalent Windows setting report
   through prefers-reduced-transparency where supported; fall back to a
   solid surface so text never sits on a mottled blur. */
@media (prefers-reduced-transparency: reduce){
  .hdr.glass,.glass,.panel-card.glass,.mvapp .panel-card,.mvapp-bar{
    background:#fff !important;
    -webkit-backdrop-filter:none !important;
    backdrop-filter:none !important;
  }
  html[data-mvtheme="dark"] .hdr.glass,
  html[data-mvtheme="dark"] .glass,
  html[data-mvtheme="dark"] .panel-card.glass,
  html[data-mvtheme="dark"] .mvapp-bar{
    background:#161d26 !important;
  }
}

/* ---------- 5. deliberately NOT touched ---------- */
/* .fc / .fc-swipe / .fc-stage — the flip card lives on preserve-3d.
   Any transform or filter on it or an ancestor flattens it and the
   answer face comes out mirrored (that bug already happened once).
   .mvq-stage, video wrappers and iframes — clipping + rounded corners
   there crops the media instead of decorating it. */
