/* Responsive polish, touch targets and mobile navigation */
.mobile-menu-toggle { display: none; width: 38px; height: 38px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.04); }
.mobile-menu-toggle span { display: block; width: 18px; height: 1.5px; margin: 4px auto; background: currentColor; transition: transform .2s, opacity .2s; }
.mobile-menu-toggle.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.mobile-menu-toggle.open span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
.mobile-nav { position: fixed; top: 62px; left: 12px; right: 12px; z-index: 19; padding: 9px; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(21,25,35,.92); box-shadow: var(--shadow); backdrop-filter: blur(24px); animation: mobile-menu-in .2s ease both; }
.light .mobile-nav { background: rgba(255,255,255,.92); }
.mobile-nav a { display: block; padding: 13px 14px; color: var(--muted); border-radius: 9px; font-size: 13px; }
.mobile-nav a:hover, .mobile-nav a:active { color: var(--text); background: rgba(255,116,76,.1); }
@keyframes mobile-menu-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .45; }
.math-key, .text-key, .mode-button, .example-chip, .chapter-button, .outline-button, .next-problem { min-height: 40px; touch-action: manipulation; }
.chapter-list { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.solution-content, .chapter-detail, .olympiad-card { overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .topnav { gap: 17px; margin-left: 25px; }
  .top-actions { min-width: auto; }
  .privacy-pill { display: none; }
  .page-shell { padding-left: clamp(18px, 4vw, 40px); padding-right: clamp(18px, 4vw, 40px); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 14px; }
  .mobile-menu-toggle { display: block; order: 2; margin-left: auto; margin-right: 8px; }
  .topbar .top-actions { order: 3; gap: 8px; }
  .topbar .avatar { display: none; }
  .topnav { display: none; }
  .hero h1 { font-size: clamp(3rem, 16vw, 5.2rem); }
  .hero-lede { font-size: 14px; }
  .hero-proof { gap: 12px; justify-content: space-between; }
  .proof-item { gap: 6px; }
  .proof-item span { font-size: 7px; }
  .workspace-section, .curriculum-section, .olympiad-section, .lower-section { padding-bottom: 52px; }
  .section-heading, .olympiad-header { margin-bottom: 18px; }
  .section-heading h2, .olympiad-header h2 { font-size: 31px; }
  .panel-topline { gap: 9px; }
  .panel-index { font-size: 9px; }
  .panel-state, .result-status { font-size: 9px; }
  .mode-switch { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .mode-button { flex: 1 0 auto; white-space: nowrap; }
  .examples-row { margin-bottom: 23px; }
  .example-chip { padding: 7px 9px; }
  .key-row-function { grid-template-columns: repeat(4, 1fr); }
  .key-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .math-key { min-width: 0; font-size: 13px; }
  .keyboard-foot { overflow-x: auto; padding-bottom: 4px; }
  .text-key, .clear-key { flex: 0 0 auto; }
  .solve-button { min-height: 54px; }
  .solution-empty { padding-left: 16px; padding-right: 16px; }
  .answer-main { font-size: clamp(20px, 6vw, 30px); line-height: 1.25; }
  .recognized-equation { overflow-wrap: anywhere; }
  .help-strip { margin-bottom: 20px; }
  .footer { padding-bottom: max(25px, env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
  .brand-copy { display: none; }
  .hero-visual { transform: scale(.78); transform-origin: center top; margin-bottom: -35px; }
  .hero-proof { align-items: flex-start; }
  .proof-divider { display: none; }
  .proof-item strong { font-size: 16px; }
  .proof-item span { max-width: 42px; }
  #equationInput { font-size: 22px; }
  .editor-meta { font-size: 8px; }
  .editor-meta span:first-child { max-width: 185px; }
  .keyboard-caption { display: none; }
}
@media (pointer: coarse) {
  .chapter-button:hover, .math-key:hover { transform: none; }
  .math-key:active, .text-key:active, .solve-button:active { transform: scale(.97); }
}
