/* Shared small-screen study layout; loaded after subject styles. */
.subject-short{display:none}
@media(max-width:760px){
  :root{--muted:#626f65}
  html{scroll-padding-top:16px}
  body{font-size:15px;-webkit-text-size-adjust:100%}
  header{padding:16px;gap:14px;min-height:0;height:auto}
  .brand{font-size:17px;gap:10px;line-height:1.4}
  .logo{font-size:20px;padding:6px 8px;border-radius:9px}
  header .subject-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));width:100%;gap:4px;padding:4px;background:#e9eee5;border-radius:12px;overflow:visible}
  header .subject-nav a{min-height:44px;display:flex;align-items:center;justify-content:center;padding:8px 4px;font-size:13px;line-height:1.4;text-align:center;border-radius:9px}
  header .subject-nav a[aria-current=page]{background:#fff;box-shadow:0 2px 6px #23382f0d}
  .subject-full{display:none}.subject-short{display:inline}
  main{padding:0 16px}
  .intro{display:flex;flex-direction:column;gap:16px;padding:24px 0 20px;align-items:stretch}
  .eyebrow{font-size:10px;letter-spacing:1.2px}
  .intro h1,body:has(#choices) .intro h1{font-size:28px;line-height:1.3;letter-spacing:-.8px;margin:10px 0;overflow-wrap:anywhere}
  .intro h1 br{display:none}
  .intro p{font-size:13px;line-height:1.7;margin:6px 0}
  .intro p br{display:none}
  .summary{width:100%;padding:14px 16px;border-radius:12px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;align-items:center}
  .summary-top{min-width:0;gap:8px;font-size:12px;align-items:center}
  .summary-top>span:first-child{min-width:0;overflow-wrap:anywhere}
  .summary strong{font-size:23px;line-height:1.3;margin:0;white-space:nowrap}
  .summary small{font-size:11px}
  .summary .track{grid-column:1/-1;height:6px}
  .summary p{display:none}
  .chapters{display:flex;gap:10px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scrollbar-width:thin;padding:3px 2px 10px;margin:0 0 16px}
  .chapter-card{flex:0 0 min(72vw,260px);min-width:0;gap:6px;padding:14px 16px;border-radius:12px;scroll-snap-align:start}
  .chapter-card.selected{padding:13px 15px}
  .chapter-card:only-child{flex:1}
  .chapter-card strong{font-size:15px;line-height:1.45;overflow-wrap:anywhere}
  .chapter-card>span:not(.chapter-number){font-size:11px;line-height:1.5}
  .chapter-card small{margin-top:2px;font-size:11px}
  .workspace{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  .workspace>*,.problem{min-width:0}
  aside .aside-title{display:flex;margin:0 2px 8px;gap:8px;font-size:11px}
  aside .aside-title span{font-size:10px;letter-spacing:0}
  aside .tip{display:none}
  #questions{display:flex;gap:7px;overflow-x:auto;overscroll-behavior-x:contain;padding:4px 2px 10px;counter-reset:question;scrollbar-width:thin}
  #questions button{counter-increment:question;min-width:44px;width:44px;min-height:44px;flex:0 0 44px;padding:0;justify-content:center;border:1px solid var(--line);background:#fff;border-radius:10px}
  #questions button>:not(.num){display:none}
  #questions button .num{border:0;background:transparent;border-radius:0;width:auto;height:auto;font-size:0;color:inherit}
  #questions button .num::after{content:counter(question,decimal-leading-zero);font:500 13px 'JetBrains Mono',monospace}
  #questions button.passed{background:#edf5e9;border-color:#c9ddc6;color:#205c41}
  #questions button.active{background:#237c57;border-color:#237c57;color:#fff;box-shadow:0 2px 8px #237c5733}
  .problem{padding:20px 16px;border-radius:14px}
  .problem-top{gap:8px;align-items:flex-start;flex-wrap:wrap;font-size:11px}
  #category{max-width:100%;line-height:1.5;overflow-wrap:anywhere}
  #position{line-height:1.5;padding:6px 0}
  h2,#question-title{font-size:21px;line-height:1.5;letter-spacing:-.4px;margin-top:18px;overflow-wrap:anywhere}
  #question-text,#description{font-size:16px;line-height:1.85;color:var(--ink);margin:14px 0 20px;overflow-wrap:anywhere}
  #choices legend{font-size:13px;line-height:1.6}
  .choice{gap:10px;padding:14px 12px;margin:10px 0;font-size:15px;line-height:1.75;border-radius:10px}
  .choice input{width:20px;height:20px;margin:4px 0 0;flex:0 0 20px}
  .choice b{min-width:18px;font-size:13px}
  .choice>span{overflow-wrap:anywhere}
  textarea,#notes,.numeric-answer,.short-answer{font-size:16px;line-height:1.7;padding:14px;max-width:100%}
  textarea{min-height:190px}
  #notes{min-height:110px}
  pre{font-size:13px;padding:16px;max-width:100%;white-space:pre;overflow-x:auto}
  .answer-label{gap:8px;flex-wrap:wrap;font-size:14px}
  .input-note,.numeric-help{font-size:12px;line-height:1.7;overflow-wrap:anywhere}
  .actions{gap:10px;margin:20px 0;flex-wrap:wrap}
  .primary,.secondary{min-height:46px;font-size:14px;padding:12px 14px;touch-action:manipulation}
  .actions .primary{flex:1 1 150px}
  .actions .secondary{flex:1 1 100px}
  .actions #saved{width:100%;margin:0;font-size:11px;line-height:1.6;text-align:right;overflow-wrap:anywhere}
  .pager{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:10px;padding-top:18px}
  .pager button{text-align:center;padding:12px 8px;font-size:13px}
  .pager #step{font-size:12px;white-space:nowrap}
  details{font-size:14px;padding:0;margin-top:8px}
  details summary{min-height:48px;padding:15px 0;line-height:1.6}
  #solution p,#feedback,.hint,#result{font-size:14px;line-height:1.85;overflow-wrap:anywhere}
  #solution #source,#solution #accepted{font-size:12px}
  .dictionary-toolbar{gap:8px;margin-bottom:16px}
  .dictionary-toggle{min-height:44px;padding:9px 12px;font-size:12px;touch-action:manipulation}
  .dictionary-toolbar>span{flex-basis:100%;font-size:11px;line-height:1.6}
  .dictionary-popup{max-width:calc(100vw - 24px);max-height:60dvh;padding:16px;font-size:15px}
  .dictionary-close{min-width:44px;min-height:44px;top:0;right:0}
  #plot-preview{padding:12px;margin:16px 0}
  footer{padding:24px 0 calc(24px + env(safe-area-inset-bottom,0px));font-size:11px;line-height:1.7;gap:8px}
}
@media(max-width:360px){
  main{padding:0 12px}.problem{padding:18px 12px}
  .summary{grid-template-columns:1fr}.summary strong{font-size:22px}
  .pager{gap:6px}.pager button{font-size:12px}
}
