/* Shared iPhone layout: content flows above navigation and Safari chrome. */
.app-shell {--mc-mobile-nav-clearance:calc(100px + env(safe-area-inset-bottom,0px));}
.ai-message__content :is(p,ul,ol,pre,h3,h4) {margin:0 0 12px;}
.ai-message__content :is(ul,ol) {padding-left:1.4em;}
.ai-message__content li {margin-bottom:6px;line-height:1.6;}
.ai-message__content h3 {font-size:1.1em;line-height:1.4;}
.ai-message__content pre {white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;background:var(--mc-glass-subtle);border-radius:12px;}
.ai-message__content code {font-size:.9em;}
.ai-message__content > :last-child {margin-bottom:0;}
.ai-voice-actions {display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
.app-shell .ai-composer .ai-voice-actions {flex:1 1 auto;min-width:0;}
.app-shell .ai-composer .mc-voice-control [data-voice-start] {min-width:44px;padding:8px 12px;font-size:.8125rem;color:var(--mc-ink);border:1px solid var(--mc-line);background:var(--mc-surface);box-shadow:none;}
.app-shell .ai-composer [data-ai-send] {margin-left:auto;min-width:90px;padding:8px 14px;}
.app-shell .ai-composer .ai-voice-actions:has(.mc-voice-disclosure:not([hidden])) {flex-basis:100%;}
.mc-voice-control {display:grid;gap:8px;min-width:0;}
.mc-voice-control [hidden] {display:none!important;}
.mc-voice-control button,.ai-listen-reply {min-height:44px;min-width:44px;touch-action:manipulation;}
.mc-voice-control button {display:inline-flex;justify-content:center;align-items:center;gap:7px;}
.mc-voice-control svg {width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;}
.mc-voice-disclosure {padding:12px;border:1px solid var(--mc-line);border-radius:14px;background:var(--mc-surface-elevated);font-size:.8125rem;line-height:1.5;}
.mc-voice-disclosure p {margin:0 0 8px;}
.mc-voice-status {margin:0;color:var(--mc-ink-secondary);font-size:.8125rem;line-height:1.5;}
.mc-voice-status:empty {display:none;}
.mc-voice-control[data-voice-state=recording] [data-voice-start] {color:var(--mc-danger);border-color:currentColor;}
.mc-spoken-toggle {display:flex;align-items:center;gap:8px;font-size:.8125rem;min-height:44px;}
.mc-spoken-toggle input {width:18px;height:18px;accent-color:var(--mc-blue);}
.mc-voice-plan-entry {display:grid;gap:10px;padding:16px;border:1px solid var(--mc-line);border-radius:var(--mc-radius-md);background:var(--mc-surface-elevated);}
.mc-voice-plan-entry label {font-weight:650;}
.mc-voice-plan-entry textarea {width:100%;box-sizing:border-box;min-height:68px;max-width:100%;font:inherit;font-size:1rem;padding:12px;border:1px solid var(--mc-line);border-radius:12px;color:var(--mc-ink);background:var(--mc-surface);resize:vertical;}
.mc-voice-plan-entry__actions {display:flex;gap:8px;flex-wrap:wrap;align-items:start;}
@media(max-width:1100px) {
 .app-shell .study-page-header {display:grid;grid-template-columns:minmax(0,1fr);gap:12px;align-items:start;}
 .app-shell .study-page-header > div {min-width:0;}
 .app-shell .study-page-header .page-header__actions {position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px;}
 .app-shell .study-page-header .page-header__actions .mc-button {width:100%;min-width:0;padding:10px 8px;white-space:normal;font-size:.875rem;line-height:1.4;}
 .app-shell .study-page-header .page-header__actions .mc-button span {display:inline;}
 .app-shell .study-page-header .page-header__actions .mc-button svg {flex:none;}
}
@media(max-width:900px) {
 .app-shell .app-main {padding-bottom:calc(var(--mc-mobile-nav-clearance) + 24px);}
 .app-shell[data-active-view=ai] .ai-conversation-card {height:auto;min-height:0;max-height:none;display:flex;flex-direction:column;overflow:visible;}
 .app-shell[data-active-view=ai] .ai-message-list {max-height:min(45dvh,420px);min-height:160px;overflow:auto;overscroll-behavior:contain;}
 .app-shell[data-active-view=ai] .ai-conversation-header {position:static;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;padding:14px;gap:10px;}
 .app-shell[data-active-view=ai] .ai-conversation-header h2 {font-size:1rem;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
 .app-shell[data-active-view=ai] .ai-conversation-header [data-ai-conversation-context],
 .app-shell[data-active-view=ai] .ai-learning-context,.app-shell[data-active-view=ai] .ai-conversation-header .eyebrow {display:none;}
 .app-shell[data-active-view=ai] .ai-composer {position:relative;bottom:auto;z-index:1;order:4;margin:8px 10px 12px;background:var(--mc-surface-elevated);box-shadow:var(--mc-shadow-subtle);}
 .app-shell[data-active-view=ai] .ai-composer textarea {font-size:1rem;min-height:54px;max-height:120px;}
 .app-shell[data-active-view=ai] .ai-composer__bottom {display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;}
 .app-shell[data-active-view=ai] [data-ai-composer-note] {display:none;}
 .app-shell[data-active-view=ai] .ai-verify-note {font-size:.75rem;line-height:1.5;padding:12px 14px;}
 .app-shell[data-active-view=ai] .ai-context-card {padding:14px;gap:8px;}
 .app-shell[data-active-view=ai] .ai-context-card h2 {font-size:1rem;}
 .app-shell[data-active-view=ai] .ai-message {max-width:100%;padding:14px;}
 .app-shell[data-active-view=ai] .ai-message--student {max-width:92%;margin-left:auto;}
 .app-shell[data-active-view=ai] .ai-message--assistant {background:var(--mc-surface-elevated);border-color:var(--mc-line);box-shadow:none;}
 .app-shell[data-keyboard-open=true] .mc-nav--mobile {display:none;}
 .app-shell[data-keyboard-open=true] {--mc-mobile-nav-clearance:12px;}
 .app-shell[data-keyboard-open=true] .ai-composer {position:static;}
}
@media(max-width:360px) {.app-shell .study-page-header .page-header__actions {grid-template-columns:minmax(0,1fr);}}


/* Voice settings use their own surface so the composer keeps its space. */
.mc-tutor-voice-dialog {width:min(480px,calc(100% - 32px));max-height:calc(100dvh - 40px);overflow:auto;box-sizing:border-box;margin:auto;padding:20px;border:1px solid var(--mc-line);border-radius:24px;background:var(--mc-surface-elevated);color:var(--mc-ink);box-shadow:var(--mc-shadow-sheet);}
.mc-tutor-voice-dialog::backdrop {background:rgba(5,14,35,.4);backdrop-filter:blur(6px);}
.mc-tutor-voice-dialog > header {display:flex;justify-content:space-between;align-items:center;gap:16px;}
.mc-tutor-voice-dialog h2 {margin:0;font-size:1.4rem;}
.mc-tutor-voice-dialog button {min-height:44px;}
.mc-tutor-voice__panel {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;margin-top:18px;}
.mc-tutor-voice__panel label {display:grid;gap:6px;min-width:0;font-size:.8125rem;}
.mc-tutor-voice__panel select {width:100%;min-width:0;min-height:44px;padding:8px;border:1px solid var(--mc-line);border-radius:10px;background:var(--mc-surface);color:var(--mc-ink);font:inherit;font-size:1rem;}
.mc-tutor-voice__panel > :is(button,p) {grid-column:1 / -1;}
.mc-tutor-voice__panel > button {justify-self:start;}
.mc-tutor-voice-dialog :is(button,select):focus-visible {outline:3px solid var(--mc-blue);outline-offset:3px;}
@media(max-width:440px) {.mc-tutor-voice__panel {grid-template-columns:minmax(0,1fr);}}

.mc-coda-audio{display:block;width:min(100%,300px);height:36px;margin:8px 0}.mc-coda-preview-player{grid-column:1/-1;min-width:0}.mc-coda-preview-player:empty{display:none}
