/* MH Studio: shared brand colours, mobile-first learning controls. */
:root {
  --mh-bg: #3E2619;
  --mh-card: #5C3A28;
  --mh-cream: #E6CFA8;
  --mh-gold: #CBA77C;
  --mh-muted: #C9B08C;
  --mh-border: rgba(230,207,168,.18);
  --mh-border-strong: rgba(230,207,168,.34);
  --mh-ink-on-cream: #3E2619;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --motion: cubic-bezier(.22,1,.36,1);
  color-scheme: dark;
}
[hidden] { display: none !important; }
#dictForm[hidden], #viewDict .chip-row[hidden] { display: none !important; }
button, .badge-pos, .badge-ok, .badge-live, .lex-def-primary, .lex-def-secondary,
.lex-quote-en, .lex-quote-ar, .saved-compact-meaning, .surface-card p { overflow-wrap: anywhere; }
.badge-pos, .badge-ok, .badge-live { max-width: 100%; }
.mh-nav-inner { flex-wrap: wrap; }
.lex-card .practice-title { font-size: 20px; line-height: 28px; direction: inherit; text-align: start; letter-spacing: normal; }
.practice-notice { color: var(--ink-2); margin: 16px 0 0; }
#wordDetailBackdrop:has(.spell-box) { background: var(--bg-page); align-items: flex-start; }
/* Keep dialogs inside the visible area when the on-screen keyboard opens (values set from visualViewport). */
.backdrop { top: var(--vv-top, 0px); bottom: auto; height: var(--vv-height, 100dvh); }
.modal-panel { max-height: calc(var(--vv-height, 100dvh) - 32px) !important; }
.spell-box { scroll-margin: 24px; }
.saved-compact-card { cursor: pointer; }
.saved-chevron { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 44px; }
/* Named typography styles, including aliases for the original app classes. */
.heading-1, .mh-hero-title { font-size: 48px; line-height: 1; font-weight: 600; }
.heading-3 { font-size: 36px; line-height: 40px; font-weight: 600; }
.heading-4, .mh-sec-h2, .lex-word { font-size: 30px; line-height: 36px; font-weight: 600; }
.heading-6, .mh-feature-title { font-size: 20px; line-height: 28px; font-weight: 600; }
.title-3 { font-size: 16px; line-height: 24px; font-weight: 500; }
.body-3, .lex-def-primary { font-size: 16px; line-height: 24px; font-weight: 400; }
.body-6, .mh-sec-sub, .mh-hero-lead, .mh-feature-desc, .lex-def-secondary,
.lex-quote-en, .lex-quote-ar { font-size: 14px; line-height: 20px; font-weight: 400; }
.button-md { font-size: 16px; line-height: 24px; font-weight: 600; }
.button-sm { font-size: 14px; line-height: 20px; font-weight: 600; }
.caption-4 { font-size: 12px; line-height: 16px; font-weight: 500; }
html { background: var(--mh-bg); scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }
html, body, html[lang="en"], html[lang="en"] body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--mh-bg);
}
body { min-height: 100svh; }
.font-en, .mh-brand-text, .mh-stat-val, .tab-badge, .level-btn, .badge-lvl,
.lex-word, .accent-tag, .accent-ipa, .slow-pill, .lex-def-secondary,
.lex-quote-en, .saved-compact-word, .stat-num, .mh-feature-num,
.mh-email-pill, .word-chip { font-family: inherit; }
button, input, label, a { touch-action: manipulation; }
button, input, .container, .stack, .studio-body, .lex-card, .surface-card,
.level-deck, .saved-compact-card, .settings-grid > *, .lex-top > *,
.phonetic-strip > *, .spell-input-row > * { min-width: 0; }
button, input { max-width: 100%; }
button { font-weight: 600; }
button, a, label[for] { -webkit-tap-highlight-color: rgba(230,207,168,.15); }
button, .mh-btn-primary, .mh-btn-outline, .saved-compact-card {
  transition: color 300ms var(--motion), background-color 300ms var(--motion), opacity 300ms var(--motion), transform 500ms var(--motion);
}
button:not(:disabled):hover, label[for]:hover { filter: brightness(1.12); }
button:not(:disabled):active, .mh-btn-primary:active, .mh-btn-outline:active { transform: scale(.98); }
:focus-visible, .text-input:focus-visible {
  outline: 2px solid var(--mh-cream); outline-offset: 4px;
}
button:disabled { opacity: .6; cursor: wait; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.container { max-width: 1120px; padding-inline: 16px; }
.skip-link { position: fixed; z-index: 100; top: 8px; inset-inline-start: 8px; transform: translateY(-150%); padding: 12px 16px; border-radius: 8px; background: var(--mh-cream); color: var(--mh-bg); }
.skip-link:focus { transform: none; }
.mh-navbar { top: 8px; margin: 8px auto 0; width: calc(100% - 32px); max-width: 1088px; background: rgba(46,28,18,.94); border: 1px solid var(--mh-border); border-radius: 16px; }
.mh-nav-inner { height: auto; min-height: 64px; padding-block: 8px; gap: 12px; }
.mh-brand { gap: 8px; }
.mh-nav-svg { width: 32px; height: 32px; flex: none; }
.mh-brand-text { font-size: 14px; line-height: 20px; font-weight: 700; letter-spacing: .14em; white-space: nowrap; }
.mh-nav-link { font-size: 14px; line-height: 20px; padding: 12px; font-weight: 500; }
.mh-lang-pill { padding: 4px; border-radius: 9999px; flex-shrink: 0; }
.mh-lang-btn { min-height: 44px; padding: 8px 12px; font-size: 14px; line-height: 20px; font-weight: 600; }
.mh-hero { padding: 40px 0 24px; }
.mh-hero-svg { display: none; }
.mh-eyebrow { font-size: 12px; line-height: 16px; font-weight: 500; padding: 8px 12px; margin-bottom: 16px; }
.mh-hero-title { max-width: 680px; margin-inline: auto; background: linear-gradient(to right,#fff,#9b9b9b); background-clip: text; -webkit-background-clip: text; color: transparent; }
.mh-hero-lead { max-width: 680px; margin-top: 16px; color: var(--mh-muted); }
.mh-hero-ctas { margin-top: 24px; gap: 12px; }
.mh-btn-primary, .mh-btn-outline, .next-batch-btn {
  height: auto; min-height: 44px; padding: 8px 12px; font-size: 16px; line-height: 24px; font-weight: 600; border-radius: 9999px; white-space: normal; text-align: center;
}
#heroCtaSecondaryEl { border: 0; background: none; color: var(--mh-muted); font-size: 14px; line-height: 20px; }
.hero-proof { font-size: 12px; line-height: 16px; color: var(--mh-muted); margin: 12px 0 0; }
.mh-stats-row { margin-top: 24px; gap: 12px; }
.mh-stat-box { background: var(--mh-card); padding: 12px; border-radius: 16px; }
.mh-stat-val { font-size: 18px; line-height: 28px; font-weight: 600; }
.mh-stat-lbl { font-size: 12px; line-height: 16px; margin-top: 4px; }
.mh-section { padding: 32px 0; }
.mh-kicker { font-size: 12px; line-height: 16px; font-weight: 500; white-space: normal; }
.mh-kicker-row { margin-bottom: 12px; }
.mh-sec-sub { margin-top: 8px; }
.studio-shell { margin-top: 24px; border-radius: 24px; box-shadow: none; overflow: visible; background: var(--bg-page); }
.studio-topbar { padding: 12px; border: 0; border-radius: 24px 24px 0 0; gap: 12px; }
.studio-tabs { gap: 4px; flex: 1; }
.studio-tab-btn { min-height: 44px; padding: 8px 12px; gap: 8px; font-size: 14px; line-height: 20px; font-weight: 600; border-radius: 12px; }
.tab-badge { min-width: 16px; height: 16px; padding: 0 4px; font-size: 12px; line-height: 16px; font-weight: 500; }
.studio-tools { gap: 8px; }
.streak-chip { height: 44px; padding: 8px; font-size: 14px; line-height: 20px; border-radius: 12px; }
.icon-btn, .mini-play-btn { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; }
.studio-body { padding: 16px; }
.stack { gap: 16px; }
.level-deck { padding: 16px; border-radius: 16px; gap: 12px; }
.level-deck-top { gap: 16px; }
.cefr-pills { gap: 8px; }
.level-btn { padding: 8px 12px; min-height: 44px; font-size: 14px; line-height: 20px; font-weight: 600; border-radius: 8px; }
.level-btn span.lvl-sub { font-size: 12px; line-height: 16px; }
.stream-meta-bar { gap: 12px; padding-top: 12px; font-size: 12px; line-height: 16px; }
.stream-meta-bar > div { flex-wrap: wrap; }
.daily-dots { font-size: 14px; line-height: 20px; gap: 4px; }
.dot-seg { width: 16px; height: 4px; }
.text-link-btn { min-height: 44px; font-size: 12px; line-height: 16px; padding: 8px 0; }
.lexicon-grid { gap: 16px; align-items: start; }
.lex-card { min-width: 0; border: 1px solid var(--border-strong); border-radius: 16px; padding: 16px; transition: transform 500ms var(--motion); }
.lex-card.is-saved { border-color: var(--success); }
.lex-card:hover { transform: none; box-shadow: none; }
.lex-top { align-items: start; gap: 8px; }
.lex-badges { gap: 4px; padding-top: 8px; }
.badge-lvl, .badge-pos, .badge-live, .badge-ok { font-size: 12px; line-height: 16px; font-weight: 500; padding: 4px 8px; border-radius: 4px; }
.lex-save-btn { min-height: 44px; height: auto; padding: 8px; font-size: 14px; line-height: 20px; font-weight: 600; border-radius: 8px; flex-shrink: 0; }
.lex-word { margin: 16px 0 0; letter-spacing: -.02em; overflow-wrap: anywhere; }
.phonetic-strip { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; margin-top: 16px; }
.accent-pill { min-width: 0; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 8px; display: grid; grid-template-columns: 24px minmax(0,1fr) 16px; gap: 8px; text-align: start; }
.accent-tag { font-size: 12px; line-height: 16px; font-weight: 600; }
.accent-ipa { font-size: 14px; line-height: 20px; font-weight: 400; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.slow-pill { width: 100%; height: auto; min-height: 44px; padding: 8px 12px; font-size: 14px; line-height: 20px; font-weight: 500; border-radius: 8px; }
.slow-pill { direction: rtl; }
html[lang="en"] .slow-pill { direction: ltr; }
.lex-meaning-area { margin-top: 16px; padding-top: 16px; gap: 12px; }
.lex-def-primary { font-size: 16px !important; line-height: 24px; }
.lex-def-secondary { color: var(--ink-2); }
.lex-quote { padding: 8px; border: 1px solid var(--border); border-radius: 8px; gap: 8px; }
.lex-quote-ar { margin-top: 8px; }
.lex-quote-en { font-style: normal; }
.spell-toggle { margin-top: 16px; min-height: 44px; padding: 8px; font-size: 14px; line-height: 20px; font-weight: 500; border-radius: 8px; gap: 8px; text-align: start; }
.spell-toggle > span { min-width: 0; }
.spell-toggle svg { flex: none; }
.spell-box { padding: 8px; border-radius: 8px; margin-top: 8px; }
.spell-box > p:first-child { font-size: 14px !important; line-height: 20px; }
.spell-input-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin-top: 12px; }
.spell-input-row input { grid-column: 1/-1; width: 100%; }
.text-input { min-width: 0; width: 100%; height: 48px !important; font-size: 16px; line-height: 24px; padding: 8px 12px; border-radius: 8px; scroll-margin-block: 96px; }
.btn-primary-sm, .btn-ghost-sm { height: auto !important; min-height: 44px; padding: 8px 12px !important; font-size: 14px; line-height: 20px; font-weight: 600; border-radius: 8px; white-space: normal; }
.spell-box [data-spell-feedback] { font-size: 14px !important; line-height: 20px; min-height: 20px !important; margin-top: 8px !important; }
.next-batch-btn { min-height: 48px; }
.saved-grid { gap: 12px; }
#viewSaved > div:first-child > div:last-child { flex: 1 1 240px !important; min-width: 0; }
.saved-compact-card { padding: 12px; border-radius: 16px; }
.saved-detail-button { border: 0; background: none; color: inherit; font: inherit; text-align: start; padding: 0; min-height: 44px; cursor: pointer; }
.saved-compact-word { font-size: 18px; line-height: 28px; font-weight: 600; flex-wrap: wrap; overflow-wrap: anywhere; }
.saved-compact-meaning { font-size: 14px; line-height: 20px; white-space: normal; }
.surface-card { padding: 16px; border-radius: 16px; }
.settings-row { padding-block: 12px; gap: 12px; font-size: 14px; line-height: 20px; }
.settings-grid { gap: 16px; grid-template-columns: minmax(0,1.1fr) minmax(0,.9fr); }
.stat-num { font-size: 24px; line-height: 32px; font-weight: 600; }
.stat-lbl { font-size: 12px; line-height: 16px; }
.stats-grid { gap: 8px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.stat-tile { padding: 12px 8px; }
.chip-row { gap: 8px; }
.word-chip { min-height: 44px; font-size: 14px; line-height: 20px; padding: 8px 12px; }
.skeleton-card { padding: 16px; border-radius: 16px; background: var(--bg-surface); border: 1px solid var(--border); }
.skeleton-line { height: 16px; margin: 12px 0; border-radius: 4px; background: var(--bg-subtle-2); animation: skeleton-pulse 1.5s var(--motion) infinite; }
.skeleton-line:nth-child(2) { width: 70%; height: 32px; }
.skeleton-line:last-child { width: 85%; }
@keyframes skeleton-pulse { 50% { opacity: .4; } }
.mh-grid-4 { gap: 16px; margin-top: 24px; }
.mh-feature-card { padding: 24px; border-radius: 16px; }
.mh-feature-num { font-size: 12px; line-height: 16px; font-weight: 600; margin-bottom: 12px; color: var(--mh-cream); }
.mh-feature-desc { margin-top: 12px; }
.mh-contact-card { padding: 24px; border-radius: 16px; gap: 16px; }
.mh-email-pill { padding: 12px; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.mh-footer { padding: 24px 0 32px; margin-top: 24px; }
.mh-footer-inner { font-size: 14px; line-height: 20px; gap: 16px; }
.mh-scroll-top { width: 44px; height: 44px; bottom: 16px; left: 16px; }
.mh-scroll-top { opacity: 0; pointer-events: none; transition: opacity 300ms var(--motion); }
.mh-scroll-top.is-visible { opacity: 1; pointer-events: auto; }
body.modal-open .mh-scroll-top, body:has(.text-input:focus) .mh-scroll-top { opacity: 0; pointer-events: none; }
html[lang="en"] .mh-scroll-top { right: 16px; }
.backdrop { padding: 16px; background: rgba(0,0,0,.7); overscroll-behavior: contain; }
.modal-panel { max-height: calc(100dvh - 32px); overscroll-behavior: contain; padding: 16px; border-radius: 24px; scroll-padding: 16px; }
body.modal-open { overflow: hidden; }
.modal-panel .lex-card { border: 0; padding: 0 !important; }
.track-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.track-card { min-height: 48px; padding: 12px 8px; font-size: 14px; line-height: 20px; }
#musicVolumeSlider { min-height: 44px; }
.toast { max-width: calc(100% - 32px); bottom: max(24px,env(safe-area-inset-bottom)); transition: opacity 300ms var(--motion),transform 500ms var(--motion); }
.toast-pill { font-size: 14px; line-height: 20px; font-weight: 500; white-space: normal; text-align: center; padding: 12px 16px; border-radius: 16px; }
.tagline-section { padding: 48px 0; }
.tagline-text { max-width: 680px; margin: 0; color: var(--mh-cream); }
.tagline-word { opacity: .3; transition: opacity 500ms var(--motion); }
.tagline-word.is-visible { opacity: 1; }
.eq-bar { animation: none !important; height: 12px; transform-origin: bottom; animation: eq-scale 700ms var(--motion) infinite !important; }
@keyframes eq-scale { 50% { transform: scaleY(.3); } }
.eq-bar:nth-child(2) { animation-delay: 150ms !important; }
.eq-bar:nth-child(3) { animation-delay: 300ms !important; }
.speaking-active { animation-timing-function: var(--motion); }
@media (max-width: 980px) { .lexicon-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 820px) {
  .mh-nav-inner { min-height: 56px; }
  .mh-nav-links { display: none; }
  .studio-tabs { width: auto; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .studio-tools { width: auto; justify-content: end; }
  .studio-tab-btn { padding: 8px; gap: 4px; }
  .level-deck { padding: 12px; }
  .cefr-pills { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); width: 100%; gap: 4px; }
  .level-btn { padding: 8px 4px; }
  .level-btn span.lvl-sub { display: none; }
  .studio-body { padding: 12px; }
  .mh-grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 660px) {
  .mh-navbar { width: calc(100% - 16px); }
  .mh-navbar .container { padding-inline: 8px; }
  .mh-brand-text { font-size: 12px; line-height: 16px; letter-spacing: .1em; }
  .mh-lang-btn { padding: 8px; }
  .mh-hero { padding: 32px 0 16px; }
  .mh-hero-title { font-size: 36px; line-height: 40px; }
  .mh-eyebrow { margin-bottom: 12px; }
  .mh-hero-lead { margin-top: 12px; }
  .mh-hero-ctas { margin-top: 16px; }
  .mh-stats-row { display: none; }
  .mh-section { padding: 24px 0; }
  .mh-sec-h2 { font-size: 24px; line-height: 32px; }
  .studio-shell { margin-top: 16px; border-radius: 16px; }
  .studio-topbar { border-radius: 16px 16px 0 0; padding: 8px; }
  .studio-tabs { width: 100%; flex-basis: 100%; gap: 4px; }
  .studio-tab-btn { flex-direction: column; font-size: 12px; line-height: 16px; min-height: 64px; position: relative; }
  .studio-tab-btn svg { width: 20px !important; height: 20px !important; }
  .tab-badge { position: absolute; top: 4px; inset-inline-end: 4px; }
  .studio-tools { width: 100%; justify-content: space-between; }
  .studio-body { padding: 8px; }
  .lexicon-grid, .saved-grid, .settings-grid { grid-template-columns: minmax(0,1fr); }
  #viewSaved > div:first-child > div:last-child { flex-basis: 100% !important; max-width: none !important; }
  .lex-card { padding: 16px; }
  .lex-word { font-size: 30px; line-height: 36px; }
  .stream-meta-bar > div { width: 100%; justify-content: space-between; gap: 4px !important; }
  #infiniteTagEl { display: none; }
  .stream-meta-bar { gap: 4px; }
  .text-link-btn { min-height: 44px; }
  .next-batch-btn { width: 100%; }
  .mh-grid-4, .mh-contact-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .mh-feature-card, .mh-contact-card { padding: 16px; }
  .mh-feature-title { font-size: 18px; line-height: 28px; }
  .mh-footer-inner { justify-content: center; text-align: center; }
  .mh-footer-links { gap: 12px; justify-content: center; }
  .tagline-section { padding: 32px 0; }
  .tagline-text { font-size: 30px; line-height: 36px; }
  #dictForm { display: grid !important; grid-template-columns: minmax(0,1fr) auto; align-items: start; }
  #dictSearchBtnEl { min-height: 48px; }
  .backdrop { padding: 8px; }
  .modal-panel { max-height: calc(var(--vv-height, 100dvh) - 16px) !important; padding: 16px; border-radius: 16px; }
}
@media (max-width: 480px) {
  .cefr-pills { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tagline-word { opacity: 1; }
}
