:root{--app-bg:#fbf7ee;--app-ink:#213449;--app-muted:#53606c;--app-border:#dcd6ca;--app-green:#2f6a52;--app-green-ink:#fff;--app-blue:#213449;--app-blue-ink:#fff;--app-focus:#326585;--app-radius:16px;--app-display:'Fraunces',Georgia,serif}
:root {
    --app-success-ink: #28523f;
    --app-success-bg: #e8f0e4;
    --app-error-ink: #93000a;
    --app-error-bg: #ffdad6;
    --app-error-border: #ba1a1a;
}
html{background:#e9e3d8;color:var(--app-ink);font-family:'Nunito Sans',sans-serif;scrollbar-color:#87908f #fbf7ee}
body{margin:0;min-height:100dvh;font-size:16px;font-weight:600}
::selection{background:#e3edf3;color:#213449}
.app-shell{max-width:450px;width:100%;margin:0 auto;background:var(--app-bg);min-height:100dvh;position:relative;border-inline:1px solid var(--app-border)}
.app-shell h1{font-size:28px;line-height:1.2;font-weight:800;letter-spacing:-.02em}
.app-shell h2{line-height:1.25;font-weight:800}
.app-shell .display-heading{font-family:var(--app-display);font-weight:700;line-height:1.12;text-wrap:balance}
.app-shell .text-gray-400{color:var(--app-muted)}
.app-shell :is(.tabular-nums,.status-badge){font-variant-numeric:tabular-nums}
.app-shell :is(p,h1,h2){overflow-wrap:anywhere}
.app-shell a{ text-underline-offset:3px }
.app-shell :is(button,a,input,select,textarea,summary):focus-visible{outline:2px solid var(--app-focus);outline-offset:3px}
.app-shell :is(input,textarea){caret-color:var(--app-focus)}
.app-shell input::placeholder,.app-shell textarea::placeholder{color:#53606c;opacity:1}
.app-shell input[type=checkbox],.app-shell input[type=radio]{accent-color:#2f6a52;color:#2f6a52}
.app-shell button:disabled{opacity:.55;cursor:not-allowed}
.app-shell :is(.shadow-lg,.shadow-md,.shadow-sm){box-shadow:none}
.skip-link{position:fixed;top:8px;left:8px;z-index:1000;transform:translateY(-150%);padding:12px;background:white;color:#213449;border:2px solid #326585;border-radius:12px}
.skip-link:focus{transform:translateY(0)}
.brand-row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:64px}
.brand{display:inline-flex;align-items:center;gap:10px;min-width:0;text-decoration:none;color:var(--app-ink);font-family:var(--app-display);font-weight:700;letter-spacing:-.025em}
.brand img{width:56px;height:56px;object-fit:contain;flex-shrink:0}
.brand-wordmark{display:flex;flex-direction:column;line-height:1;white-space:nowrap;gap:2px}.brand-wordmark>span{font-size:16px}.brand-wordmark>strong{font-size:30px;font-weight:700}
.brand-large .brand-wordmark>span{font-size:18px}.brand-large .brand-wordmark>strong{font-size:36px}.brand-large img{width:72px;height:72px}
.page-header{padding:8px 24px 16px;background:var(--app-bg);border-bottom:2px solid var(--app-border)}
.page-header h1{font-size:24px;margin-top:8px}
.icon-button{display:inline-flex;justify-content:center;align-items:center;min-width:44px;min-height:44px;color:var(--app-muted);border:2px solid var(--app-border);border-radius:12px;background:#fff}
.icon-button:hover{border-color:var(--app-focus);color:var(--app-focus)}
.auth-page{padding:24px;display:flex;flex-direction:column;gap:24px;min-height:100dvh}
.auth-page>.brand{align-self:flex-start}
.auth-hero{display:grid;grid-template-columns:minmax(0,1fr) 132px;align-items:center;gap:12px}
.auth-hero p{margin-top:12px;color:var(--app-muted);line-height:1.5}
.mascot{object-fit:contain;display:block;max-width:100%;height:auto}
.auth-hero .mascot{width:132px;height:198px}
.entry-page{gap:18px}.entry-hero{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px}.app-shell .entry-hero h1{font-size:34px;max-width:320px}.entry-hero .kitchen-art{width:100%;height:154px;object-fit:contain}.entry-hero p{font-size:15px;line-height:1.5;color:var(--app-muted);max-width:330px}.entry-page .auth-form{gap:12px}.entry-page .text-link{min-height:36px}
.auth-form{display:flex;flex-direction:column;gap:18px}
.field{display:flex;flex-direction:column;gap:8px;font-weight:700;font-size:14px}
.field input,.field select,.field textarea{width:100%;min-width:0;padding:12px 14px;min-height:48px;background:white;color:var(--app-ink);border:2px solid #87908f;border-radius:12px;font:inherit;font-size:16px}
.field small,.help{font-size:13px;font-weight:600;line-height:1.5;color:var(--app-muted)}
.text-link{color:var(--app-focus);text-decoration:underline;font-weight:700;display:inline-flex;align-items:center;justify-content:center;min-height:44px}
.btn,.btn-duo-green,.btn-3d-green,.btn-duo-blue,.btn-3d-blue{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;border-radius:16px;font-weight:800;font-size:14px;text-align:center;padding:12px 16px;transition:background-color .15s,transform .1s;text-decoration:none}
.btn-primary,.btn-duo-green,.btn-3d-green{background:var(--app-green);color:var(--app-green-ink)!important;border-bottom:4px solid #1c4637}
.btn-primary:hover,.btn-duo-green:hover,.btn-3d-green:hover{background:#28523f}
.btn-secondary,.btn-duo-blue,.btn-3d-blue{background:var(--app-blue);color:var(--app-blue-ink)!important;border-bottom:4px solid #122332}
.btn-secondary:hover,.btn-duo-blue:hover,.btn-3d-blue:hover{background:#122332}
.btn-outline{background:white;border:2px solid var(--app-border);color:var(--app-muted)}
.btn-danger{background:white;color:#ba1a1a;border:2px solid #ba1a1a}
.btn:active,.btn-duo-green:active,.btn-3d-green:active,.btn-duo-blue:active,.btn-3d-blue:active{transform:translateY(2px)}
.btn-primary:active,.btn-secondary:active,.btn-duo-green:active,.btn-3d-green:active,.btn-duo-blue:active,.btn-3d-blue:active{border-bottom-width:0;transform:translateY(4px)}
.progress-inner-highlight{box-shadow:inset 0 3px 0 rgba(255,255,255,.3)}
.app-shell :is(button,a).bg-primary-container{color:var(--app-green-ink)}
.app-shell .text-secondary-container{color:var(--app-blue)}
.card-3d{border:2px solid var(--app-border);border-bottom-width:4px;border-radius:16px}
.notice{padding:14px 16px;border:2px solid var(--app-border);border-radius:16px;font-size:14px;line-height:1.5}
.generation-status:not([hidden]){display:flex;gap:12px;align-items:flex-start;background:#e3edf3;color:#213449}.generation-status>i{margin-top:4px}.generation-status p{margin-top:4px}
.notice-error{background:#ffdad6;border-color:#ba1a1a;color:#93000a}
.notice-success{background:#e8f0e4;border-color:#2f6a52;color:#28523f}
.status-badge{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:6px 10px;font-size:12px;font-weight:800;background:#e8f0e4;color:#28523f}
.status-pending{background:#fff0d5;color:#784900}.status-neutral{background:#efe9df;color:var(--app-muted)}
.pending-page{align-items:center;text-align:center;gap:20px}.pending-page .mascot{width:160px;height:220px}.pending-page .brand{align-self:flex-start}
.pending-page h1{font-size:28px}.pending-page .btn{width:100%}
.access-steps{width:100%;text-align:left;display:grid;gap:14px;padding:20px;border:2px solid var(--app-border);background:white;border-radius:16px}
.access-steps li{display:flex;gap:12px;align-items:center}.access-steps .material-symbols-outlined{color:#28523f}.access-steps li:last-child .material-symbols-outlined{color:#784900}
.bottom-nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,450px);display:flex;justify-content:space-around;background:var(--app-bg);border-top:2px solid var(--app-border);padding:8px 4px max(8px,env(safe-area-inset-bottom));z-index:50}
.bottom-nav a{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:52px;min-width:48px;gap:4px;font-size:11px;font-weight:800;color:var(--app-muted);border-radius:12px}
.bottom-nav a[aria-current=page]{color:#28523f;background:#e8f0e4}.bottom-nav .material-symbols-outlined{font-size:24px}
.app-content{padding:24px 24px 112px;display:flex;flex-direction:column;gap:24px}
.welcome-row{display:flex;align-items:center;gap:16px}.welcome-row .mascot{width:96px;height:144px;flex-shrink:0}.welcome-row p{margin-top:8px;color:var(--app-muted)}
.welcome-actions{display:flex;flex-direction:column;gap:12px}
.chat-brand{padding:4px 20px;background:var(--app-bg);border-bottom:2px solid var(--app-border)}
.chat-layout{height:calc(100dvh - 70px);display:flex;flex-direction:column;min-height:0}
.chat-layout h1{font-size:18px;letter-spacing:0}
.app-shell:has(>.chat-layout){height:100dvh;display:flex;flex-direction:column;overflow:hidden}
.app-shell>.chat-brand{flex-shrink:0}.app-shell>.chat-layout{height:auto;flex:1;min-height:0}
.chat-layout>#chatControls{flex-shrink:0}.chat-layout>#chatContainer{min-height:0}
:is(#chatControls,#finishConversationBtn,#toggleChatControls)[hidden]{display:none}
.chat-control-row{display:flex;align-items:center;justify-content:center;gap:clamp(12px,5vw,32px);margin-inline:auto}
.chat-control-button{width:52px;height:52px;font-size:20px}
.chat-control-button[aria-expanded="true"]{background:#e3edf3;border-color:var(--app-focus);color:var(--app-ink)}
.chat-end-button{background:var(--app-error-bg);border-color:var(--app-error-bg);color:var(--app-error-ink)}
.chat-end-button:hover{border-color:var(--app-error-border);color:var(--app-error-ink)}
#textInput{min-width:0}
.lesson-plan{padding:12px 14px;background:#fff;border:2px solid var(--app-border);border-radius:16px;font-size:13px;line-height:1.5}.lesson-plan summary{cursor:pointer;font-weight:800;min-height:32px}.lesson-plan ul{list-style:disc;padding-left:20px;margin-top:8px}
.conversation-result{padding:18px;border:2px solid var(--app-border);border-radius:16px;background:#fff;color:var(--app-ink);text-align:center;margin-top:16px;overflow-wrap:anywhere}
.conversation-result:focus-visible{outline:2px solid var(--app-focus);outline-offset:2px}.conversation-result h2{font-size:18px;text-wrap:balance}
.result-icon{width:48px;height:48px;border-radius:999px;display:flex;align-items:center;justify-content:center;background:var(--app-blue);color:#fff;margin:0 auto 12px;font-size:22px}
.result-copy{font-size:13px;line-height:1.5;color:var(--app-muted);margin-top:8px}
.result-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:16px 0 8px}.result-metrics.single{grid-template-columns:1fr;max-width:180px;margin-inline:auto}
.result-metrics>div{background:#fff;border:1px solid var(--app-border);border-radius:12px;padding:10px 4px;min-width:0}.result-metrics dt{font-size:11px;font-weight:800;line-height:1.3;color:var(--app-muted)}.result-metrics dd{font-size:22px;font-weight:800;line-height:1.3;margin-top:6px;white-space:nowrap}.result-metrics small{font-size:11px;margin-left:2px}.result-metrics .unrated{font-size:13px;white-space:normal}
.result-level{font-size:12px;font-weight:800;margin:10px 0}.result-objective{border-top:1px solid var(--app-border);padding-top:12px;margin-top:14px;text-align:left}.result-objective h3{font-size:14px;font-weight:800}
.result-criteria { margin-top: 6px; }
.result-criterion {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 10px;
    padding-block: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--criterion-ink, var(--app-muted));
}
.result-criterion + .result-criterion { border-top: 1px solid var(--app-border); }
.result-criterion[data-state="achieved"] {
    --criterion-ink: var(--app-success-ink);
    --criterion-bg: var(--app-success-bg);
}
.result-criterion[data-state="retry"] {
    --criterion-ink: var(--app-error-ink);
    --criterion-bg: var(--app-error-bg);
}
.result-criterion-icon { margin-top: 4px; }
.result-criterion-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}
.result-criterion-heading strong { font-weight: 800; overflow-wrap: anywhere; }
.result-criterion-status {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--criterion-bg, var(--app-bg));
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.result-criterion :is(p, blockquote) {
    font-size: 12px;
    margin-top: 4px;
    color: var(--app-muted);
    overflow-wrap: anywhere;
}
.result-criterion blockquote { font-style: italic; }
@media (max-width: 767px) {
    .result-criterion-heading {
        display: grid;
        justify-items: start;
    }
}
.conversation-avatar{flex:0 0 56px;width:56px;height:56px}.conversation-avatar img{display:block;width:100%;height:100%;object-fit:contain}
.chat-layout>#chatContainer.is-preparing{display:flex;align-items:center;align-items:safe center;justify-content:center}
#loadingStatus{width:100%;margin-top:0}
#loadingStatus [hidden]{display:none!important}
.lesson-preparation{text-align:center;padding:24px 12px;color:var(--app-ink)}
.lesson-preparation .mascot{width:112px;height:168px;margin:0 auto 20px}
.lesson-preparation h2{font-size:24px;line-height:1.25;font-weight:800;text-wrap:balance}
.lesson-preparation p{font-size:15px;line-height:1.5;color:var(--app-muted);margin-top:12px}
.lesson-preparation>.typing-dots{margin-top:24px}
.bot-message{display:flex;align-items:flex-start;gap:10px;min-width:0}
.bot-bubble{flex:0 1 auto;max-width:calc(100% - 66px);width:fit-content}
.bot-message:has(>.replay-button){display:grid;grid-template-columns:56px minmax(0,1fr) auto;gap:10px}
.bot-message:has(>.replay-button) .bot-bubble{max-width:none;width:auto}
.replay-button{align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:48px;padding:8px 4px;color:var(--app-focus);font-size:11px;font-weight:800;border-radius:12px}
.replay-button i{font-size:18px}.replay-button:hover{background:#e3edf3}
.audio-icon{display:inline-flex;align-items:center;justify-content:center;min-width:24px;min-height:32px}
.typing-bubble{display:flex;align-items:center;min-height:56px;padding:16px 20px;background:#fff;border:2px solid var(--app-border);border-radius:16px 16px 16px 0}
.typing-dots{display:inline-flex;align-items:center;gap:6px;height:12px}
.typing-dots>span{width:7px;height:7px;border-radius:50%;background:var(--app-ink);animation:conversation-thinking 1.2s ease-in-out infinite}
.typing-dots>span:nth-child(2){animation-delay:.16s}.typing-dots>span:nth-child(3){animation-delay:.32s}
@keyframes conversation-thinking{0%,60%,100%{transform:translateY(0);opacity:.4}30%{transform:translateY(-4px);opacity:1}}
.general-preparation{display:inline-flex;gap:8px;align-items:center;justify-content:center;color:var(--app-ink);padding:16px 0}.general-preparation+span:not(.sr-only){font-size:14px;font-weight:700}
.feedback-pending{display:flex;gap:10px;align-items:flex-start;max-width:85%;margin-left:auto;padding:12px 14px;border:2px solid var(--app-border);border-radius:16px;background:#e3edf3;color:var(--app-ink);font-size:13px;line-height:1.5}.feedback-pending>i{margin-top:4px}.feedback-pending strong{font-weight:800}.feedback-pending p{font-size:12px;margin-top:4px}.feedback-pending .btn{margin-top:10px;font-size:12px;min-height:40px}
@media(max-width:360px){.bot-message:has(>.replay-button){grid-template-columns:48px minmax(0,1fr) auto;gap:8px}.replay-button{font-size:10px;padding-inline:2px}.bot-message .bot-bubble{padding:10px}.lesson-preparation h2{font-size:22px}}
@media(max-width:360px){.conversation-avatar{flex-basis:48px;width:48px;height:48px}}
.conversation-stage[hidden],.conversation-bubble-speaker{display:none}
.conversation-stage{grid-area:stage;flex:none;min-width:0;padding:10px 12px 0;--scene-height:clamp(138px,30dvh,280px)}
.conversation-stage-frame{position:relative}
.conversation-stage-tools{position:absolute;z-index:25;inset:8px 8px auto;display:flex;align-items:flex-start;justify-content:flex-end;gap:6px;pointer-events:none}
.conversation-stage-tools>*{pointer-events:auto}
.conversation-stage[data-renderer="loading"] .conversation-stage-tools{display:none}
#toggleChatControls:disabled{opacity:.55;cursor:not-allowed}
.stage-situation-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.stage-situation-heading h2{font-size:18px;line-height:1.2}
#stageObjective:not(:empty){font-weight:800;margin-bottom:6px}
#stageLevel{color:#24455c;background:#e3edf3;border-radius:8px;font-weight:800;font-size:13px;padding:4px 8px}
#stageSituation summary{display:grid;place-items:center;min-height:44px;padding-inline:10px;border:2px solid var(--app-border);border-radius:12px;background:#fff;font-size:13px;font-weight:800;color:var(--app-green);cursor:pointer}
#stageSituation summary:hover,#stageSituation[open] summary{border-color:var(--app-green)}
#stageSituation summary::-webkit-details-marker{display:none}
.stage-situation-panel{position:absolute;inset-inline-end:0;top:calc(100% + 6px);width:min(100%,420px);max-height:50dvh;overflow:auto;background:#fff;border:2px solid var(--app-border);border-radius:var(--app-radius);padding:14px;line-height:1.45;font-size:14px}
.stage-situation-panel ul:not(:empty){list-style:disc;padding-inline-start:20px;margin:8px 0}
.conversation-scene{position:relative;isolation:isolate;height:var(--scene-height);overflow:hidden;border:1px solid var(--app-border);border-radius:var(--app-radius);background:#e4d7c2 center / cover no-repeat}
.conversation-scene canvas{position:absolute;inset:0;width:100%;height:100%;visibility:hidden}
.conversation-stage[data-renderer="3d"] canvas{visibility:visible}
.conversation-scene-portrait{position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:auto;height:90%;object-fit:contain;visibility:hidden}
.conversation-stage[data-renderer="static"] .conversation-scene-portrait{visibility:visible}
.conversation-scene-loading{display:none;position:relative;width:auto;height:min(220px,calc(var(--scene-height) - 58px));object-fit:contain}
.conversation-stage:is([data-renderer="loading"],[data-renderer="unavailable"]) .conversation-scene::before{content:"";position:absolute;inset:0;background:var(--app-bg)}
.conversation-stage:is([data-renderer="loading"],[data-renderer="unavailable"]) .conversation-scene-loading{display:block}
.conversation-stage[data-renderer="unavailable"] .conversation-scene-loading{position:absolute;inset:0;margin:auto}
.conversation-stage[data-renderer="loading"] .conversation-scene{display:grid;place-content:center;justify-items:center;gap:10px}
.conversation-stage[data-renderer="loading"] .conversation-scene-name{visibility:hidden}
.conversation-stage[data-renderer="loading"] .conversation-scene-status{position:relative;inset:auto;max-width:100%;background:#fff0d5;color:#784900}
.chat-layout:has(>.conversation-stage[data-renderer="loading"]) #instructionText{visibility:hidden}
.conversation-scene-name,.conversation-scene-status{position:absolute;max-width:calc(100% - 20px);margin:0;padding:5px 10px;border-radius:100px;font-size:12px;line-height:1.25;font-weight:800}
.conversation-scene-name{top:10px;left:10px;max-width:calc(100% - 148px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:#fff;color:var(--app-ink)}
.conversation-scene-status{right:10px;bottom:10px;background:#e8f0e4;color:#28523f}
.conversation-stage[data-phase="speaking"] .conversation-scene-status{background:#28523f;color:#fff}
.chat-layout .conversation-thread-title{font-size:19px;margin:8px 0 0}
.chat-layout:has(>.conversation-stage:not([hidden]))>.chat-settings{display:none}
.chat-layout:has(>.conversation-stage:not([hidden]))>#chatContainer{background:var(--app-bg);padding:6px 12px 12px}
.chat-layout:has(>.conversation-stage:not([hidden])) :is(#chatContainer,#replyPreparation) .conversation-avatar{display:none}
.chat-layout:has(>.conversation-stage:not([hidden])) .bot-message:has(>.replay-button){grid-template-columns:minmax(0,1fr) auto}
.chat-layout:has(>.conversation-stage:not([hidden])) .conversation-bubble-header{display:flex;align-items:center;flex-wrap:wrap;column-gap:12px}
.chat-layout:has(>.conversation-stage:not([hidden])) .conversation-bubble-header>.mb-2{margin-bottom:0}
.chat-layout:has(>.conversation-stage:not([hidden])) .conversation-bubble-speaker{display:block;font-size:13px;font-weight:800}
.chat-layout:has(>.conversation-stage:not([hidden]))>#chatControls{padding-block:12px}
.chat-layout:has(#keyboardPanel:not(.hidden))>.conversation-stage{--scene-height:clamp(95px,20dvh,210px)}
@media(max-height:630px){
    .conversation-stage{--scene-height:clamp(92px,22dvh,145px)}
    .chat-layout .conversation-thread-title{margin-top:4px}
    .chat-layout:has(>.conversation-stage:not([hidden]))>#chatControls{padding:8px 12px}
    .chat-layout:has(>.conversation-stage:not([hidden])) #micButton{width:56px;height:56px;border-radius:16px;font-size:23px}
}
@media(min-width:1024px){
    .app-shell>.chat-layout:has(>.conversation-stage:not([hidden])){grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto auto auto;grid-template-areas:"stage" "thread" "recording" "loading" "error" "controls"}
    .conversation-stage{padding:20px 28px 0;--scene-height:clamp(190px,39dvh,480px)}
    .conversation-scene-name,.conversation-scene-status{font-size:14px;padding:7px 14px}
    .chat-layout .conversation-thread-title{font-size:24px}
    .chat-layout:has(>.conversation-stage:not([hidden]))>#chatContainer{padding:8px 28px 16px}
    .chat-layout:has(>.conversation-stage:not([hidden]))>#chatContainer>div:not(#loadingStatus){max-width:970px}
    .chat-layout:has(>.conversation-stage:not([hidden]))>#chatControls{padding-block:10px}
}
@media(min-width:560px) and (max-width:1023px) and (max-height:600px){
    .app-shell>.chat-layout:has(>.conversation-stage:not([hidden])){grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto auto auto;grid-template-areas:"stage" "thread" "recording" "loading" "error" "controls"}
}
.result-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:18px}.result-actions:has(>a:only-child){grid-template-columns:1fr}.result-goals{list-style:disc;text-align:left;padding-left:20px;margin-top:14px;font-size:13px}
.result-retry { border-color: var(--app-error-border); }
.result-retry h2 { color: var(--app-error-ink); }
.result-retry .result-icon { background: var(--app-error-ink); }
.result-success{background:var(--app-success-bg);border-color:var(--app-green);color:var(--app-success-ink)}.result-success .result-icon{background:var(--app-green)}.result-success .result-copy{color:var(--app-success-ink)}.result-success .result-objective{border-color:var(--app-green)}
@media(max-width:360px){.conversation-result{padding:14px}.result-metrics{gap:5px}.result-metrics dd{font-size:19px}.result-metrics dt{font-size:10px}.result-metrics small{font-size:10px}.result-actions .btn{padding-inline:8px;font-size:12px}}
.onboarding-page{min-height:100dvh}.onboarding-page .page-header{position:sticky;top:0;z-index:20}
.step-progress{display:flex;gap:6px;margin-top:8px}.progress-segment{height:8px;flex:1;border-radius:8px;background:var(--app-border)}.progress-segment.is-filled{background:var(--app-green)}
.onboarding-form{padding:24px 24px 148px}.step-content{display:flex;flex-direction:column;gap:24px}.onboarding-intro{display:flex;align-items:center;gap:20px}.onboarding-intro .mascot{width:96px;height:144px}
.onboarding-page fieldset{min-width:0}.onboarding-page legend{font-size:14px;font-weight:800;margin-bottom:12px}.choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.choice-grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.choice-list{display:flex;flex-direction:column;gap:10px}
.choice{display:flex;align-items:center;gap:10px;padding:14px 12px;background:white;border:2px solid var(--app-border);border-bottom-width:4px;border-radius:16px;cursor:pointer;font-size:14px;min-height:52px}.choice input{width:16px;height:16px;flex-shrink:0}.choice:has(:checked){background:#e8f0e4;border-color:#28523f}.choice:has(:focus-visible){outline:2px solid var(--app-focus);outline-offset:3px}.choice small{display:block;color:var(--app-muted);font-weight:600;font-size:13px;margin-top:4px}.choice .material-symbols-outlined{color:#28523f;flex-shrink:0}
.level-chip{display:flex;align-items:center;justify-content:center;min-width:34px;height:34px;border-radius:10px;background:#efe9df;font-size:13px}.hobby-groups{display:grid;gap:24px}.hobby-tags{display:flex;flex-wrap:wrap;gap:8px}.hobby-tag{border-radius:999px;font-size:13px;padding:10px;min-height:44px}
.onboarding-final{text-align:center;align-items:center}.onboarding-final .mascot{width:160px;height:240px}.onboarding-final p{color:var(--app-muted)}
.onboarding-footer{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,450px);padding:16px 24px max(8px,env(safe-area-inset-bottom));background:white;border-top:2px solid var(--app-border);z-index:30}.onboarding-actions{display:flex;gap:12px}.onboarding-actions #nextBtn{flex:1}.onboarding-footer>.text-link{display:flex;font-size:13px}.onboarding-footer .btn{min-height:48px}
.audio-waveform{display:block;width:calc(100% - 40px);max-width:360px;height:40px}
#recordingStatus{padding-block:4px;min-height:64px}
#recordingStatus .help{font-size:12px}
.brian-dialogue{display:grid;gap:8px;justify-items:center}
.entry-hero .brian-question{font-size:16px;font-weight:800;color:var(--app-green);animation:brian-question 2.4s ease-out both}
.brian-answer{animation:brian-reply .45s .65s cubic-bezier(.16,1,.3,1) both}
.entry-hero .brian-aside{font-size:13px;font-style:italic;animation:brian-reply .4s 1.7s ease-out both}
@keyframes brian-question{0%,45%{color:var(--app-green)}100%{color:var(--app-muted)}}
@keyframes brian-reply{from{opacity:0;clip-path:inset(0 100% 0 0)}to{opacity:1;clip-path:inset(0 0 0 0)}}
.lesson-link{justify-content:flex-start;font-size:14px;font-weight:800;min-height:44px;gap:6px;overflow-wrap:anywhere;text-align:left}
.lesson-link .material-symbols-outlined{font-size:18px;flex-shrink:0}
.admin-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.admin-tabs a{font-size:10px;text-transform:none;letter-spacing:0;display:flex;align-items:center;justify-content:center;min-height:44px;padding:8px 2px}
.cost-report{display:grid;gap:20px}
.cost-filters{display:grid;gap:12px}.cost-filters select{max-width:100%;text-overflow:ellipsis;font-size:14px;padding-inline:10px}
@media(min-width:360px){.cost-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.cost-filters>.btn{grid-column:1/-1}}
.cost-totals{display:grid;grid-template-columns:1fr 1fr;gap:12px;border-block:1px solid var(--app-border);padding-block:16px;font-variant-numeric:tabular-nums}
.cost-totals dt{font-size:12px;color:var(--app-muted);font-weight:700}.cost-totals dd{font-size:21px;font-weight:800;margin-top:8px;overflow-wrap:anywhere}
.cost-figure{margin:0}.cost-figure figcaption{font-weight:800;margin-bottom:12px;font-size:16px}
.cost-chart{display:block;width:100%;background:white;border:1px solid var(--app-border);border-radius:12px}.cost-chart text{fill:var(--app-muted);font-size:10px;font-family:inherit;font-variant-numeric:tabular-nums}
.cost-users{display:grid;gap:16px}.cost-users li>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:14px}.cost-users a{justify-content:flex-start;text-align:left;overflow-wrap:anywhere}.cost-users strong{white-space:nowrap;font-variant-numeric:tabular-nums}
.cost-bar{height:10px;border-radius:999px;background:var(--app-border);overflow:hidden}.cost-bar span{display:block;height:100%;background:var(--app-green);border-radius:inherit}.cost-users .help{margin-top:6px}
.cost-details{font-size:13px;border-top:1px solid var(--app-border);padding-top:12px}.cost-details summary{cursor:pointer;min-height:44px;font-weight:800}.cost-details p{margin-top:10px}
.cost-table{width:100%;font-size:12px;font-variant-numeric:tabular-nums;text-align:left;border-collapse:collapse}.cost-table :is(th,td){padding:10px 4px;border-bottom:1px solid var(--app-border)}.cost-table td{text-align:right}.cost-table thead th:not(:first-child){text-align:right}
.notice-warning{background:#fff0d5;color:#784900;border-color:#b68a3e}
.history-list{list-style:none;padding:0;margin:0;border-top:1px solid var(--app-border)}
.history-entry{display:grid;gap:6px;padding:18px 0;border-bottom:1px solid var(--app-border);text-decoration:none;overflow-wrap:anywhere}
.history-entry>strong{font-size:17px;font-weight:800;color:var(--app-focus)}
.history-entry:hover>strong{text-decoration:underline}
.history-note{display:flex;justify-content:space-between;gap:12px;font-size:14px;font-weight:800;font-variant-numeric:tabular-nums}
.history-note>span{color:var(--app-focus)}
.history-pagination{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.attempt-list{list-style:none;margin:12px 0 0;padding:0;border-top:1px solid var(--app-border)}
.attempt-list a{display:grid;grid-template-columns:minmax(0,1fr) auto 20px;align-items:center;gap:6px;min-height:48px;padding:8px 0;border-bottom:1px solid var(--app-border);font-size:12px;color:var(--app-focus);font-variant-numeric:tabular-nums;text-decoration:none}
.attempt-list a:hover{text-decoration:underline}
.attempt-list .material-symbols-outlined{font-size:18px}
.archived-conversation{overflow-wrap:anywhere}
.archive-context h2,.archive-thread>h2{font-size:22px;font-weight:800;line-height:1.3;margin-bottom:8px}
.archive-context details{margin-top:12px}
.archived-conversation summary{cursor:pointer;font-weight:800;min-height:44px;padding-block:10px}
.archive-summary,.share-panel{border-block:1px solid var(--app-border);padding-block:8px}
.archive-summary p,.share-panel p,.archive-context details p{margin-block:10px}
.archive-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(76px,1fr));gap:8px;padding-block:12px;font-variant-numeric:tabular-nums}
.archive-metrics dt{font-size:12px;color:var(--app-muted)}
.archive-metrics dd{font-weight:800;font-size:18px}
.share-panel form,.share-panel .field{margin-top:14px}
.share-networks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px}
.share-networks .btn{padding:10px 8px}
.archive-thread{display:grid;gap:20px}
.archive-turn{display:grid;gap:12px}
.archive-user{justify-self:end;max-width:90%;background:var(--app-blue);color:white;padding:12px 16px;border-radius:16px 16px 0 16px}
.archive-user>strong,.archive-bot strong{font-size:12px;font-weight:800}
.archive-user p,.archive-bot p{margin-top:6px;white-space:pre-wrap}
.archive-bot{display:flex;gap:12px;align-items:flex-start;min-width:0}
.archive-bot img{width:56px;height:56px;object-fit:contain;flex-shrink:0}
.archive-bot>div{min-width:0;background:white;border:2px solid var(--app-border);border-radius:16px 16px 16px 0;padding:12px 16px}
.archive-feedback{font-size:14px;line-height:1.6}
.archive-feedback p{margin-top:10px}
.archive-feedback summary{color:var(--app-focus)}
.archive-legacy{white-space:pre-wrap;font-size:15px;line-height:1.8}
.auth-joke{font-size:14px;line-height:1.5;color:var(--app-muted)}
.app-shell [hidden]{display:none!important}
@media(max-width:360px){.auth-page,.app-content,.onboarding-form{padding-inline:16px}.page-header{padding-inline:16px}.auth-hero{grid-template-columns:minmax(0,1fr) 105px}.auth-hero .mascot{width:105px;height:158px}.app-shell h1{font-size:26px}.app-shell .entry-hero h1{font-size:30px}.brand-large .brand-wordmark>strong{font-size:32px}.choice-grid.three{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Les parcours mobiles restent la base ; le bureau dispose de son espace de travail. */
.bottom-nav>.nav-brand,.bottom-nav>.nav-desktop-only,.conversation-nav{display:none}
.entry-account,.goal-list,.dashboard-action-block{display:contents}

@media(min-width:768px){
    .app-shell{max-width:960px}
    .app-content{padding:32px 40px 112px}
    .page-header{padding:16px 40px 20px}
    .bottom-nav{width:min(100%,960px)}
    .app-shell:has(>.auth-page){max-width:1120px}
    .auth-page{max-width:620px;margin-inline:auto;padding:40px;gap:24px}
    .entry-page{max-width:none;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:64px;align-content:center;padding:48px}
    .entry-page>.brand{grid-column:1/-1;justify-self:center;margin-bottom:24px}
    .entry-page .entry-hero{grid-column:1;align-self:center;gap:16px}
    .entry-page .entry-account{grid-column:2;display:flex;flex-direction:column;gap:18px;max-width:400px;width:100%;align-self:center;justify-self:center}
    .entry-page .entry-hero .kitchen-art{width:100%;height:auto;max-height:300px}
    .app-shell .entry-hero h1{font-size:40px;max-width:400px}
    .entry-page .entry-hero p{max-width:380px}
    .entry-page .entry-account .auth-form{gap:18px}
    .pending-page .access-steps{max-width:480px}
    .pending-page .btn{max-width:480px}
    .onboarding-form{max-width:760px;margin-inline:auto;padding:32px 40px 0}
    .onboarding-page .page-header{position:static}
    .onboarding-page .choice-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
    .onboarding-page .hobby-groups{grid-template-columns:repeat(2,minmax(0,1fr))}
    .onboarding-footer{position:sticky;left:auto;transform:none;width:100%;margin-top:32px;padding:20px 0;background:var(--app-bg)}
    .onboarding-final{max-width:480px;margin-inline:auto}
    .exit-page{max-width:640px;margin-inline:auto;padding:40px;gap:24px}
    [data-view="pages/profile"]>.app-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
    [data-view="pages/profile"]>.app-content> :is(a,.notice){grid-column:1/-1;justify-self:start}
    [data-view="pages/profile"]>.app-content>section:nth-of-type(1){grid-row:span 2}
    #profileForm{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
    #profileForm>fieldset{padding:20px;border:2px solid var(--app-border);border-radius:16px;background:white}
    #profileForm>fieldset>legend{padding-inline:8px;margin-bottom:0}
    #profileForm>fieldset:nth-of-type(2){grid-column:2;grid-row:1/span 2}
    #profileForm>fieldset:nth-of-type(3){grid-column:1;grid-row:2}
    #profileForm>fieldset:nth-of-type(3)>details{max-width:640px}
    [data-view="pages/profile-edit"]>.app-content>p{max-width:70ch}
    [data-view="pages/profile-edit"] #password{max-width:560px;width:100%}
    [data-view="pages/history"] .history-entry{grid-template-columns:minmax(0,1fr) auto;column-gap:24px;align-items:center;padding:22px 8px}
    .history-entry>.history-note{grid-column:2;grid-row:1/span 3;min-width:150px;align-items:center}
    .history-entry>.help{grid-column:1}
    [data-view="pages/vocabulary-game"]>.app-content{display:grid;grid-template-columns:minmax(240px,.8fr) minmax(0,1.2fr);align-items:start}
    [data-view="pages/vocabulary-game"] .welcome-row{grid-column:1/-1}
    [data-view="pages/vocabulary-game"] #vocabGamePanel{grid-column:2;grid-row:2}
    .archived-conversation{max-width:960px;width:100%;margin-inline:auto}
    .archive-context,.archive-thread{max-width:75ch;width:100%}
    .archive-thread{margin-inline:auto}
    .archive-feedback{max-width:65ch}
    .archive-user{max-width:75%}
    .cost-filters{grid-template-columns:repeat(3,minmax(0,1fr))}
    .cost-filters>.btn{grid-column:auto;align-self:end}
    .admin-tabs{gap:12px}
    .admin-tabs a{font-size:14px;padding:12px}
}

@media(min-width:1024px){
    .app-shell,.app-shell:has(>.auth-page){max-width:none;border-inline:0}
    .app-shell:has(>.bottom-nav){max-width:none;display:grid;grid-template-columns:224px minmax(0,1fr);grid-template-rows:auto 1fr}
    .app-shell>.page-header{grid-column:2;grid-row:1;min-width:0}
    .app-shell>.app-content{grid-column:2;grid-row:2;min-width:0;align-self:start;padding:32px 40px 48px}
    .app-shell>.bottom-nav{grid-column:1;grid-row:1/span 2;position:sticky;top:0;left:auto;bottom:auto;transform:none;width:auto;height:100dvh;align-self:start;display:flex;flex-direction:column;justify-content:flex-start;gap:6px;padding:24px 16px;border-top:0;border-right:1px solid var(--app-border);overflow-y:auto}
    .bottom-nav>a{flex-direction:row;justify-content:flex-start;gap:12px;padding:10px 12px;min-height:48px;font-size:14px;flex-shrink:0}
    .bottom-nav>.nav-desktop-only{display:flex}
    .bottom-nav>.nav-brand{display:flex;align-items:center;gap:10px;padding:0;min-height:64px;margin-bottom:28px;font-family:var(--app-display);color:var(--app-ink);text-decoration:none}
    .nav-brand>img{width:56px;height:56px;object-fit:contain;flex-shrink:0}
    .bottom-nav>.nav-exit{margin-top:auto}
    .bottom-nav>a:hover{background:#efe9df;color:var(--app-ink)}
    .bottom-nav>a[aria-current=page]{background:#e8f0e4;color:#28523f}
    .app-shell:has(>.bottom-nav)>.page-header .brand{display:none}
    .app-shell:has(>.bottom-nav)>.page-header .brand-row{justify-content:flex-end;min-height:32px}
    .app-shell:has(>.bottom-nav)>.page-header{padding:24px 40px 20px}
    .app-shell:has(>.bottom-nav)>.page-header:has(h1) .brand-row{float:right}
    .app-shell:has(>.bottom-nav)>.page-header h1{margin:0;min-height:44px;display:flex;align-items:center;font-size:28px}
    .app-shell>.dashboard-content{--dashboard-offset:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);gap:20px 24px}
    .dashboard-content:has(>.generation-status:not([hidden])),.dashboard-content:has(>#lessonGenerationError:not([hidden])){--dashboard-offset:1}
    .dashboard-content:has(>.generation-status:not([hidden])):has(>#lessonGenerationError:not([hidden])){--dashboard-offset:2}
    .dashboard-content>.dashboard-start{display:contents}
    .dashboard-start>.welcome-row{grid-column:1/-1;grid-row:calc(1 + var(--dashboard-offset));justify-content:space-between;padding-bottom:8px}
    .dashboard-start>.welcome-row>div{max-width:60ch}
    .dashboard-start>.welcome-row .mascot{width:80px;height:120px;margin-inline-end:40px}
    .dashboard-start>.dashboard-action-block{display:flex;flex-direction:column;gap:16px;grid-column:1;grid-row:calc(2 + var(--dashboard-offset))/span 2}
    .dashboard-stats{grid-column:2;grid-row:calc(2 + var(--dashboard-offset))}
    .dashboard-stats>div{padding:16px}
    .dashboard-evolution{grid-column:2;grid-row:calc(3 + var(--dashboard-offset));min-width:0}
    .dashboard-evolution>div>div:last-child{height:200px}
    .dashboard-vocabulary,.dashboard-next{grid-column:1/-1}
    .dashboard-vocabulary>a{max-width:400px}
    .dashboard-content>.generation-status,.dashboard-content>#lessonGenerationError{grid-column:1/-1;grid-row:1}
    .dashboard-content:has(>.generation-status:not([hidden]))>#lessonGenerationError{grid-row:2}
    [data-view="pages/goals"]>.app-content{display:grid;grid-template-columns:minmax(240px,.65fr) minmax(0,1.35fr);align-items:start}
    .goal-create{position:sticky;top:24px}
    .goal-list{display:flex;flex-direction:column;gap:24px;min-width:0}
    [data-view="pages/goals"] :is(.generation-status,#lessonGenerationError){grid-column:1/-1}
    .app-content>.admin-models{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
    .admin-models>div:first-child{grid-column:1/-1}
    .admin-models> :is(#audioPipelineForm,#createModelForm){min-width:0}
    .admin-models>div:not(:first-child){min-width:0}
    .app-content>.admin-prompts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
    .admin-prompts>form{min-width:0}
    .app-content>.admin-users{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
    .admin-users>.notice{grid-column:1/-1}
    .admin-users>details{grid-column:1/-1}
    .app-shell:has(>.chat-layout){height:100dvh;overflow:hidden}
    .app-shell>.chat-brand{display:none}
    .app-shell>.chat-layout{grid-column:2;grid-row:1/span 2;display:grid;height:100dvh;min-width:0;grid-template-columns:248px minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto auto auto;grid-template-areas:"settings thread" "settings recording" "settings loading" "settings error" "settings controls"}
    .chat-layout>.chat-settings{grid-area:settings;padding:32px 20px;border-bottom:0;border-right:1px solid var(--app-border);background:var(--app-bg);overflow-y:auto}
    .chat-settings h1{font-size:22px;line-height:1.3}
    .chat-settings>div:first-child>div:first-child{align-items:flex-start;flex-direction:column;gap:16px}
    .chat-settings>div:nth-child(2){grid-template-columns:minmax(0,1fr);margin-top:24px}
    .chat-settings #initConversationBtn{justify-content:center;min-height:48px;font-size:14px}
    .chat-settings #turnProgress{margin-top:24px;font-size:14px}
    .chat-layout>#chatContainer{grid-area:thread;padding:32px;scroll-padding-block:24px}
    .chat-layout>#recordingStatus{grid-area:recording}
    .chat-layout>#loadingStatus{grid-area:loading}
    .chat-layout>#chatError{grid-area:error}
    .chat-layout>#chatControls{grid-area:controls;padding:20px 32px}
    .chat-layout:has(>.chat-settings.hidden){grid-template-columns:0 minmax(0,1fr)}
    .chat-layout>#chatContainer>div:not(#loadingStatus){max-width:720px;margin-inline:auto}
    .chat-layout #keyboardPanel{padding:20px 32px}
    .chat-layout #keyboardPanel>div{max-width:720px;margin-inline:auto}
    .chat-layout #chatContainer>div:first-child:has(#startLessonBtn){padding-block:24px}
    .chat-layout #chatContainer>div:first-child>#startLessonBtn{max-width:400px}
    .chat-layout #chatContainer>div:first-child>div:has(#startLessonBtn){max-width:520px;padding:32px}
    .chat-layout #chatContainer>div:first-child img.mascot{width:128px!important;height:192px!important}
}

/* En paysage bas, les réglages passent à côté du fil pour garder le micro visible. */
@media(min-width:560px) and (max-width:1023px) and (max-height:600px){
    .app-shell>.chat-layout{display:grid;grid-template-columns:220px minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto auto auto;grid-template-areas:"settings thread" "settings recording" "settings loading" "settings error" "settings controls"}
    .chat-layout>.chat-settings{grid-area:settings;overflow-y:auto;border-bottom:0;border-right:1px solid var(--app-border);padding:16px}
    .chat-settings>div:nth-child(2){grid-template-columns:minmax(0,1fr)}
    .chat-settings #initConversationBtn{justify-content:center;min-height:48px}
    .chat-layout>#chatContainer{grid-area:thread;padding:16px}
    .chat-layout>#recordingStatus{grid-area:recording}
    .chat-layout>#loadingStatus{grid-area:loading}
    .chat-layout>#chatError{grid-area:error}
    .chat-layout>#chatControls{grid-area:controls;padding:8px 16px}
    #chatControls #micButton{width:56px;height:56px;border-radius:16px;font-size:24px}
    #chatControls .chat-control-button{width:48px;height:48px}
    #chatControls #instructionText{margin-top:4px}
    .chat-layout:has(>.chat-settings.hidden){grid-template-columns:0 minmax(0,1fr)}
}
