/* Math Brain Boost: screen-size tweaks and lite mode. */

/* Short phones (e.g. 320x568, 360x640): tighter spacing. */
@media (max-height: 680px) {
  .mascot { width: 84px; height: 84px; }
  .brand { font-size: 1.8rem; }
  .tagline { display: none; }
  .rank-card { padding: 9px 12px; margin: 8px 0; }
  .btn.big { min-height: 52px; font-size: 1.1rem; }
  .home-actions { gap: 8px; }
  .row2 { gap: 8px; }
  .opt { min-height: 54px; }
  .q-card { padding: 10px 12px 12px; min-height: 96px; }
  .play-body { gap: 8px; }
  .answers { gap: 8px; }
  .options { gap: 8px; }
  .timer { margin: 2px 0 6px; }
  .level-grid { gap: 6px; padding: 8px 0; }
  .res-stars img { width: 48px; height: 48px; }
  .res-stars img:nth-child(2) { width: 58px; height: 58px; }
  .res-score b { font-size: 2.4rem; }
}
@media (max-width: 340px) {
  :root { --gutter: 12px; }
  .brand { font-size: 1.65rem; }
  .row2 .btn { font-size: .86rem; gap: 5px; }
  .row2 .ic { width: 20px; height: 20px; }
  .rank-stats { font-size: .82rem; gap: 2px 10px; }
  .opt { font-size: 1.05rem; }
  .icon-btn { width: 44px; height: 44px; }
  .seg button { min-width: 48px; }
  .home-pill { padding: 0 9px 0 8px; gap: 4px; font-size: .84rem; }
  .lang-swap { font-size: .84rem; padding: 0 11px 0 9px; }
}

/* Landscape phones: question on the left, answers on the right; home in two columns. */
@media (orientation: landscape) and (max-height: 560px) {
  #settings .scroll { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-content: start; }
  #settings .set-note, #settings .about { grid-column: 1 / -1; }
  #app { max-width: 980px; }
  .screen { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
  .topbar { min-height: 46px; margin-bottom: 4px; }
  .icon-btn { width: 44px; height: 44px; }
  #home { display: none; }
  #home.active { display: grid; grid-template-columns: 1fr 1.1fr; grid-template-rows: auto 1fr auto; column-gap: 18px; align-content: center; }
  .home-top { grid-column: 1; grid-row: 1; }
  .rank-card { grid-column: 1; grid-row: 2; align-self: start; }
  .home-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .credit { grid-column: 1 / span 2; grid-row: 3; margin-top: 4px; }
  .mascot { width: 64px; height: 64px; }
  .brand { font-size: 1.6rem; }
  .tagline { display: none; }
  .btn.big { min-height: 48px; font-size: 1.05rem; }
  .play-body { flex-direction: row; gap: 14px; }
  .q-card { flex: 1.1; min-height: 0; }
  .answers { flex: 1; justify-content: center; }
  .opt { min-height: 52px; }
  .q-text { font-size: clamp(1.3rem, 4.2vw, 2rem); }
  .q-text.long { font-size: clamp(1rem, 2.8vw, 1.35rem); }
  .q-text.xlong { font-size: clamp(.95rem, 2.4vw, 1.15rem); }
  .level-grid { grid-template-columns: repeat(10, 1fr); grid-auto-rows: minmax(48px, 1fr); }
  .sheet { max-width: 640px; max-height: 94%; }
  .res-stars img { width: 42px; height: 42px; }
  .res-stars img:nth-child(2) { width: 50px; height: 50px; transform: none; }
  .res-score b { font-size: 2.1rem; }
}

/* Tablets and desktop. */
@media (min-width: 700px) and (min-height: 700px) {
  #app { max-width: 600px; }
  .screen { padding-top: 22px; padding-bottom: 22px; }
  .modal { align-items: center; }
  .sheet { max-width: 560px; border-radius: 26px; }
  .q-text { font-size: 2.5rem; }
  .opt { min-height: 74px; font-size: 1.5rem; }
}
@media (hover: hover) {
  .opt:hover { border-color: rgba(255, 255, 255, .55); background: var(--glass-strong); }
  .lvl:not(.locked):hover, .trick-card:hover, .world-tab:hover { border-color: rgba(255, 255, 255, .45); }
  .btn:hover { filter: brightness(1.06); }
}

/* Lite mode (low-end phones, data saver, or chosen in Settings): no blur, glows, animations or confetti. Glass becomes
 * flat translucent panels, which are far cheaper to draw. */
.lite *, .lite *::before, .lite *::after { animation: none !important; transition: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.lite body::before { animation: none; inset: 0; }
.lite body::after { display: none; }
.lite .rank-card, .lite .lesson, .lite .q-card, .lite .opt, .lite .lvl, .lite .pill, .lite .score-pill, .lite .info-row, .lite .trick-card, .lite .set-row, .lite .about,
.lite .res-grid div, .lite .res-q, .lite .world-tab, .lite .btn.soft, .lite .btn.hint, .lite .icon-btn, .lite .lang-swap, .lite .home-pill { background: rgba(40, 34, 96, .88); box-shadow: none; border-color: rgba(255, 255, 255, .16); }
.lite .icon-btn.map-btn { background: #2563eb; }
.lite .lvl.locked { background: rgba(40, 34, 96, .4); }
.lite .opt.right { background: #166534; } .lite .opt.wrong { background: #9f1239; }
.lite .btn { box-shadow: none; } .lite .btn::after, .lite .opt::after, .lite .q-card::before, .lite .home-top::before, .lite .rank-card::before, .lite .lesson::before, .lite .world-head::after { display: none; }
.lite .q-text, .lite .score-pill b, .lite .fb-head { text-shadow: none; }
.lite .timer i, .lite .rank-bar i, .lite .dots i { box-shadow: none !important; }
.lite .mascot, .lite .res-stars img, .lite .res-score b { filter: none; }
.lite .sheet { background: #241d5c; }
.lite .modal, .lite .loading { background: rgba(6, 5, 22, .8); }
.lite .confetti { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
