.study-icons { position: absolute; inset: 0 auto auto 0; width: 0; height: 0; overflow: hidden; pointer-events: none }
.studio-shell { grid-template-rows: minmax(0,1fr); overflow: hidden }
.study-choice svg, .composer-row svg, .icon-control svg, .source-chip svg, .study-primary svg,
.listen-message svg, .voice-mark svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor;
  stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none }

.study-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; margin: 1.2rem 0 }
.study-choice { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .85rem;
  min-height: 6.25rem; padding: .9rem .85rem; text-align: start; border: 1px solid #bdcec5;
  border-radius: 1.05rem; background: #fff; color: var(--ink); transition: border-color .16s, background .16s, box-shadow .16s }
.study-choice:hover, .study-choice[aria-pressed=true] { border-color: #3c736b; background: #eff7f1; box-shadow: 0 2px 12px #174d4614 }
.study-choice.guided { border-color: #b7cec3; background: #e4f0e9 }
.study-choice.guided:hover { border-color: #3c736b; background: #dceae2 }
.choice-mark { width: 2.65rem; height: 2.65rem; display: grid; place-items: center; border-radius: .8rem;
  background: #ecf3f0; color: #185954 }
.guided .choice-mark { background: #20534d; color: #e8f8ed }
.choice-copy { display: grid; gap: .18rem }
.choice-copy strong { font-size: 1.05rem; line-height: 1.55 }
.choice-copy span { color: #465d57; font-size: .84rem; line-height: 1.65 }
.study-choice .choice-arrow { width: 1rem; height: 1rem; color: #3c7066 }
.room-mode { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; padding-bottom: .5rem; margin-bottom: .5rem }
.room-mode > span { background: #e6efea; color: #28554d; padding: .28rem .7rem; border-radius: .5rem; font-size: .78rem; font-weight: 650 }
.room-mode button { min-height: 44px; border: 0; padding: .35rem .5rem; background: transparent; color: var(--accent); font-size: .85rem }
.room-mode button:hover { text-decoration: underline }
.message-copy { white-space: pre-wrap; unicode-bidi: plaintext }
.formula { unicode-bidi: isolate; display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  white-space: nowrap; vertical-align: middle; padding: .12em .2em }
.formula math { font-size: 1.08em; font-family: math }
.formula-block { display: block; width: fit-content; max-width: 100%; margin: .3rem 0; padding: .45rem .75rem;
  border-radius: .6rem; background: #f0f4f1; font-size: 1.12em }
.math-bold { font-weight: bold }
.math-italic { font-style: italic }
.listen-message { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; margin-top: .4rem;
  padding: .2rem .55rem; border: 0; border-radius: .55rem; background: #e7f0eb; color: #2c5c53; font-size: .77rem }
.listen-message:hover, .listen-message[aria-pressed=true] { background: #d5e8dd }
.listen-message svg { width: .9rem; height: .9rem }
.activity-actions { margin-block: .65rem .35rem }
.activity-actions button { font-size: .83rem; background: #fafffa }
.activity-note { color: #25574e; font-size: .86rem }
#current-step { background: #e9f2ed; border-inline-start-color: #52877b }

#composer { display: grid; gap: .2rem; padding: .48rem .62rem .56rem; border-radius: 1.1rem; border-color: #a9bfb4 }
#composer:focus-within { box-shadow: 0 0 0 2px #adcdc1; border-color: #487e72 }
#composer textarea { width: 100%; min-height: 2.65rem; padding: .42rem .5rem; font-size: 1rem; border-radius: .55rem }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: .35rem;
  border-top: 1px solid #e6ede7; padding-top: .35rem }
.composer-tools { display: flex; flex-wrap: wrap; gap: .2rem; min-width: 0 }
.tool-control { display: inline-flex; justify-content: center; align-items: center; gap: .34rem; min-width: 44px; min-height: 44px;
  padding: .3rem .6rem; border: 1px solid transparent; border-radius: .65rem; background: transparent; color: #375a53; font-size: .83rem }
.tool-control:hover { background: #ecf4ef; border-color: #d2e2d9 }
.tool-control svg { height: 1.13rem; width: 1.13rem }
#send { display: inline-flex; align-items: center; justify-content: center; flex: none; gap: .5rem; min-height: 44px; padding: .36rem .85rem }
#send svg { height: 1.03rem; width: 1.03rem; transform: scaleX(-1) }
.selected-sources, .formula-draft { display: flex; align-items: center; flex-wrap: wrap; gap: .28rem; padding-inline: .25rem }
.source-chip { display: inline-flex; align-items: center; gap: .36rem; min-height: 36px; max-width: 100%; overflow-wrap: anywhere;
  padding: .2rem .5rem; background: #eaf3ec; color: #23574e; border: 1px solid #d3e3d9; border-radius: .5rem; font-size: .76rem }
.source-chip:hover { background: #dfeae2 }
.source-chip svg { width: .85rem; height: .85rem }
.formula-draft { display: flex; flex-wrap: nowrap; max-height: 5rem; overflow: auto; direction: ltr }
.formula-draft .formula { flex: 0 0 auto; margin: 0; padding: .25rem .5rem; background: #eef5f0; border-radius: .4rem }
.formula-chip { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: .12rem .45rem;
  border: 1px solid #d6e5da; border-radius: .52rem; background: #eef5f0; color: var(--accent) }
.formula-chip:hover { border-color: #81a99a }
.formula-chip svg { width: .92rem; height: .92rem; fill: none; stroke: currentColor; stroke-width: 1.7 }
.ink-attachment { display: inline-flex; justify-self: start; align-items: center; max-width: 100%; gap: .1rem; border-radius: .6rem;
  padding: .16rem .3rem; background: #f0f5f1; border: 1px solid #d7e4dc }
.ink-attachment button, .sent-drawing { display: flex; gap: .45rem; align-items: center; min-height: 44px; border: 0; border-radius: .5rem;
  color: var(--accent); background: transparent; padding: .2rem .45rem; font-size: .83rem }
.ink-attachment button:hover, .sent-drawing:hover { background: #e1ede5 }
.icon-control { justify-content: center; min-width: 44px }
#ink-thumb { width: 2.2rem; height: 1.65rem; object-fit: contain; border: 1px solid #d6e3db; border-radius: .25rem; background: white }
.sent-drawing { align-items: flex-start; flex-direction: column; margin: .4rem 0; padding: .45rem; text-align: start }
.sent-drawing img:not([src]) { display: none }
.sent-drawing img { width: min(18rem,100%); object-fit: contain; border-radius: .55rem; background: white }
#ink-full { display: block; width: 100%; max-height: 70dvh; object-fit: contain; background: white; border-radius: .55rem }

.study-dialog { width: min(34rem,calc(100% - 1.2rem)); padding: 1.2rem; color: var(--ink) }
.study-dialog .dialog-head { margin-bottom: .85rem; gap: .4rem }
.study-dialog .dialog-head h2 { font-size: 1.18rem }
.study-dialog .dialog-head button { padding-inline: .75rem; font-size: .85rem }
.study-dialog label, .study-dialog legend { font-weight: 620 }
.study-dialog label small { margin-inline-start: .25rem; font-weight: 400 }
.study-dialog :is(input:not([type=radio]),textarea,select) { font-size: 1rem; border-color: #b2c8bd; background: #f9fcf9 }
.study-dialog select { display: block; width: 100%; min-height: 46px; margin: .25rem 0 .75rem; padding: .45rem .55rem;
  border: 1px solid #b2c8bd; border-radius: .6rem; font: inherit; color: var(--ink) }
.study-dialog .study-primary { display: flex; justify-content: center; align-items: center; gap: .65rem; width: 100%; margin-top: .8rem }
.study-primary svg { height: 1.1rem; width: 1.1rem }
.study-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem }
.study-fields input, .study-dialog input[type=date] { min-height: 46px }
.field-note { color: #4e645d; font-size: .81rem; line-height: 1.65 }
.field-note:empty { display: none }
.source-modes { display: grid; gap: .1rem; margin: .3rem 0 .6rem; border: 1px solid #d5e1d9;
  border-radius: .7rem; padding: .2rem .7rem .45rem }
.source-modes label { display: flex; align-items: center; gap: .5rem; min-height: 42px; font-weight: 500; cursor: pointer }
.source-links { margin-top: .85rem }
.source-links button { font-size: .82rem }

#science-dialog { width: min(39rem,calc(100% - 1.2rem)) }
.science-subjects, .science-groups { display: flex; gap: .25rem; flex-wrap: wrap }
.science-subjects { display: grid; grid-template-columns: repeat(3,1fr); padding: .25rem; border-radius: .75rem; background: #eaf2ed }
.science-subjects button, .science-groups button { min-height: 44px; padding: .25rem .5rem; border: 1px solid transparent;
  border-radius: .55rem; color: #345a52; background: transparent; font: inherit; font-size: .86rem }
.science-subjects button[aria-pressed=true], .science-groups button[aria-pressed=true] {
  background: #fff; border-color: #b5cec0; font-weight: 700; color: #164e46 }
.science-subjects button:hover, .science-groups button:hover { border-color: #9ebcaf }
.science-groups { margin: .3rem 0 .45rem; gap: .1rem }
.science-edit-head, .science-hints { display: flex; align-items: center; justify-content: space-between; gap: .3rem }
.science-edit-head { margin: .4rem 0 .2rem }
.science-edit-head button, .science-hints button { font-size: .77rem; padding-inline: .5rem }
.science-hints { margin-top: .25rem; justify-content: flex-end }
.science-hints p { flex: 1; margin: 0 }
.science-editor { display: flex; align-items: center; min-height: 5.1rem; max-height: 10rem; overflow: auto;
  padding: .65rem; background: #f7fbf8; border: 1px solid #c4d9ce; border-radius: .75rem;
  font: 1.38rem/1.2 math, Georgia, serif; color: #194a43; cursor: text }
.science-editor:has(+ input:focus) { outline: 2px solid #659e8e; outline-offset: 2px }
.sci-sequence { display: inline-flex; align-items: center; min-width: .85em; min-height: 1.45em; vertical-align: middle; flex: none }
.sci-slot { min-width: 1.2em; justify-content: center; padding: .08em .18em; border: 1px solid #c4d9cd; border-radius: .23em; background: #fff }
.sci-slot.active { background: #e1f1e9; border-color: #498979 }
.sci-caret { align-self: center; height: 1em; width: 2px; background: #277961; border-radius: 2px }
.sci-placeholder { color: #618376; font-size: .8em }
.sci-token { display: inline-block; padding: .05em }
.sci-shape { display: inline-grid; grid-auto-columns: max-content; align-items: center; justify-items: center; margin: .04em; flex: none }
.sci-frac { grid-auto-flow: row; gap: .16em }
.sci-frac > :first-child { position: relative; margin-bottom: .08em }
.sci-frac > :first-child::after { content: ""; position: absolute; bottom: -.22em; left: -.17em; right: -.17em;
  border-bottom: 1.5px solid currentColor }
.sci-frac > .sci-slot { width: 100% }
.sci-power,.sci-sub { grid-template-columns: auto auto; align-items: center }
.sci-power > :last-child, .sci-sub > :last-child { font-size: .72em }
.sci-power > :last-child { transform: translateY(-50%) }
.sci-sub > :last-child { transform: translateY(46%) }
.sci-root,.sci-sqrt,.sci-round,.sci-brackets,.sci-absolute { grid-auto-flow: column }
.sci-sqrt > :last-child,.sci-root > :last-child { border-top: 1.5px solid #346760 }
.sci-root > :first-child { align-self: start; font-size: .62em }
.sci-radical { font-size: 1.38em; margin-inline-end: -.08em }
.sci-accent { line-height: .5; font-size: .83em }
.sci-overset > :first-child { font-size: .68em }
.science-keys { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: .28rem }
.science-keys button { min-height: 44px; min-width: 0; padding: .12rem; border: 1px solid #dae6dc; border-radius: .47rem;
  background: #f4f8f4; color: #204e44; font: 1rem math, Georgia, serif; overflow-wrap: anywhere }
.science-keys button:hover { border-color: #6d9b8d; background: #e4f0e7 }
.science-keys .structure-key { background: #dfefe6; border-color: #c4dbce }
.science-keys.examples { grid-template-columns: 1fr }
.science-keys.examples button { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem;
  padding: .3rem .6rem; font: .86rem Vazirmatn, sans-serif }
.science-keys.examples .formula { order: 2 }
#science-input.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0 }

#ink-dialog { width: min(43rem,calc(100% - 1.2rem)) }
.ink-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; margin: .5rem 0 }
.ink-toolbar .actions { gap: .25rem }
.ink-toolbar .quiet { font-size: .77rem; padding-inline: .48rem }
.ink-toolbar .quiet[aria-pressed=true] { color: #1d554b; background: #dceee4; border-color: #83a99d }
.ink-colors { display: flex; gap: .08rem }
.ink-colors button { width: 44px; height: 44px; background: white; border: 1px solid transparent; border-radius: .6rem; display: grid; place-items: center }
.ink-colors button::after { content: ""; width: .9rem; aspect-ratio: 1; display: block; background: #173e43; border-radius: 50% }
.ink-colors button[data-ink=blue]::after { background: #245ea4 }
.ink-colors button[data-ink=red]::after { background: #a83649 }
.ink-colors button[aria-pressed=true] { background: #eaf3ed; border-color: #95b4a7 }
#ink-canvas { width: 100%; max-height: min(50dvh,420px); aspect-ratio: 16 / 11; display: block; touch-action: none; cursor: crosshair;
  background: #fff; border: 1px solid #abc1b5; border-radius: .72rem; box-shadow: inset 0 0 0 4px #edf3ee }
.voice-stage { display: grid; justify-items: center; gap: .6rem; padding: .85rem; border: 1px solid #d3e4dc;
  background: #edf6ef; border-radius: .9rem; text-align: center }
.voice-mark { width: 3.2rem; height: 3.2rem; display: grid; place-items: center; border-radius: 50%; color: #1b5850; background: #d9ece2 }
.voice-mark svg { width: 1.5rem; height: 1.5rem }
.voice-stage p { margin: 0; font-size: .87rem }
#voice-dialog[data-phase=listening] .voice-mark { color: #983846; background: #f1dfe2; box-shadow: 0 0 0 5px #f5e8e8 }
#voice-dialog[data-phase=playing] .voice-mark { color: #14574e; background: #cbe7d7; box-shadow: 0 0 0 5px #e3f3e9 }
#voice-dialog .voice-error { color: var(--red); font-size: .85rem; margin-block: .65rem }
#voice-dialog .voice-error:empty { display: none }
.voice-setup { margin-top: .85rem }
.voice-setup label { display: flex; align-items: flex-start; gap: .5rem; padding: .35rem 0; cursor: pointer }
.voice-setup input { margin-top: .45rem }
.voice-controls { margin-top: .8rem }
.voice-controls .button { flex: 1 }
#voice-dialog audio { width: 100%; margin-top: .8rem; display: block }
.voice-transcript { margin-top: .85rem }
.voice-transcript ol { display: grid; gap: .45rem; max-height: min(30dvh,15rem); overflow: auto;
  padding: .25rem; margin: 0; list-style: none }
.voice-transcript li { max-width: 95%; padding: .4rem .6rem; border: 1px solid #d8e5db; border-radius: .62rem; overflow-wrap: anywhere }
.voice-transcript [data-speaker=learner] { justify-self: end; background: #e9f4ec }
.voice-transcript strong { color: var(--accent); font-size: .79rem }
.voice-transcript p { margin: 0; white-space: pre-wrap }
#voice-dialog [data-voice=use] { margin-top: .45rem }

@media(max-width: 600px) {
  .study-choice { gap: .5rem; padding: .65rem .55rem; min-height: 5.4rem; border-radius: .8rem }
  .study-choice .choice-arrow { display: none }
  .choice-mark { width: 2rem; height: 2rem; border-radius: .58rem }
  .choice-mark svg { width: 1rem; height: 1rem }
  .choice-copy strong { font-size: .87rem }
  .choice-copy span { font-size: .73rem }
  .study-choices { gap: .4rem; margin: 1rem 0 }
  .study-dialog, #science-dialog, #ink-dialog { max-width: none; width: 100%; margin: auto 0 0;
    max-height: 94dvh; padding: .85rem .8rem max(.9rem,env(safe-area-inset-bottom)); border-radius: 1.15rem 1.15rem 0 0 }
  .study-dialog .dialog-head { margin-bottom: .62rem; padding-bottom: .4rem }
  .study-dialog .dialog-head h2 { font-size: 1.08rem }
  .tool-control { padding-inline: .42rem; font-size: .79rem }
  .science-groups button { padding-inline: .42rem; font-size: .77rem }
}
@media(max-width: 420px) {
  .composer-tools { gap: .1rem }
  .tool-control { flex-direction: column; gap: .12rem; min-width: 47px; padding: .25rem .15rem; font-size: .64rem; line-height: 1.3 }
  .tool-control svg { width: 1.23rem; height: 1.23rem }
  #send { padding-inline: .65rem }
  .science-keys { gap: .22rem }
  .ink-toolbar .quiet { padding-inline: .37rem; font-size: .72rem }
}
@media(max-width: 355px) {
  .study-choice { grid-template-columns: 1fr; gap: .3rem; align-content: start }
  .choice-copy { gap: .1rem }
}
@media(prefers-reduced-motion: reduce) {
  .study-choice { transition: none }
}

.study-feature-entry {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  min-height: 61px;
  margin-block: .8rem;
  padding: .55rem .8rem;
  text-align: start;
  color: #214e48;
  background: #edf5ef;
  border: 1px solid #b9d2c4;
  border-radius: .75rem;
}
.study-feature-entry:hover { background: #e4f0e8; border-color: #7fae9a; }
.study-feature-entry > span { display: grid; gap: .1rem; }
.study-feature-entry > span > span { color: #4b655d; font-size: .86rem; }
.study-feature-entry svg, .study-feature h3 svg {
  width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
#study-features { width: min(50rem, calc(100% - 1.25rem)); padding: clamp(.9rem, 3vw, 1.55rem); }
#study-features .study-features-head {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  background: white;
}
.study-features-head p { color: #38675c; font-size: .88rem; font-weight: 680; margin: 0 0 .25rem; }
#study-features .study-features-head h2 { font-size: clamp(1.28rem, 3.1vw, 1.95rem); line-height: 1.5; }
.study-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.study-feature {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: .45rem;
  padding: .9rem;
  border: 1px solid #cbdcd1;
  border-radius: .75rem;
  background: #fafcf9;
}
.study-feature h3 {
  display: flex; align-items: center; gap: .45rem; color: #204d45;
  margin: 0; font-size: 1.05rem; line-height: 1.5;
}
.study-feature p { color: #3e5650; font-size: .94rem; line-height: 1.9; margin: 0; }
.study-feature-lead, .study-feature-account { grid-column: 1 / -1; }
.study-feature-lead { background: #184943; border-color: #184943; }
.study-feature-lead h3, .study-feature-lead p { color: #f1f8ef; }
.study-feature-lead h3 { margin-block-end: .3rem; }
.study-feature-example {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .8rem;
  padding: .55rem .72rem;
  background: #f5f9ec;
  color: #24443b;
  border-radius: .5rem;
  font-size: .87rem;
}
.study-feature-example bdi { font: 1.1rem/1.45 Georgia, serif; }
.study-feature-actions { display: flex; flex-wrap: wrap; gap: .3rem .85rem; }
.study-feature-actions button {
  min-height: 44px; padding: 0 .12rem; color: #1f6153; background: none; border: 0;
  font-weight: 720; text-decoration: underline; text-underline-offset: .23em;
}
.study-feature-lead .study-feature-actions button { color: #e1f5b9; }
.study-feature-actions button:hover { text-decoration-thickness: 2px; }
.study-feature-entry:focus-visible, #study-features button:focus-visible { outline: 2px solid #527e19; outline-offset: 3px; }
.study-feature-lead .study-feature-actions button:focus-visible { outline-color: #e1f5b9; }
.study-feature-status { color: #963d4b; margin: .65rem 0 0; }
.study-feature-status:empty { display: none; }
@media (max-width: 600px) {
  #study-features { width: 100%; }
  .study-feature-grid { grid-template-columns: minmax(0, 1fr); }
}

.study-choice.guided {background:#e4f4ee;border-color:#c3ddcf}
.study-choice:hover,.study-choice[aria-pressed=true] {background:#f0ebfa;border-color:#a995c4}
.study-choice .choice-mark {color:#5841ab;background:#ede8ff}
.study-choice.guided .choice-mark {color:#215943;background:#cde7d8}
.room-mode>span,.formula-block {background:#f1edf8;color:#4e4264}
