.listenWritePanel{
    margin-bottom:28px;
}

body.stage2ListenWriteActive .box > :not(.storyNav):not(.stage2LearningFlow):not(#listenWritePanel){
    display:none!important;
}

body.stage2ListenWriteActive #listenWritePanel{
    display:block!important;
}

.stage2ListenWriteBack{
    margin:0 0 12px;
    padding:9px 13px;
    border:1px solid #b8cfdf;
    border-radius:10px;
    background:#fff;
    color:#244f6d;
    cursor:pointer;
    font:inherit;
    font-weight:700;
}

.stage2ListenWriteBack:hover,
.stage2ListenWriteBack:focus-visible{
    border-color:#1769aa;
    outline:2px solid rgba(23,105,170,.18);
}

.listenWriteHero{
    display:flex;
    align-items:center;
    gap:13px;
    margin-bottom:12px;
    padding:15px 17px;
    border:1px solid #cfe2ff;
    border-radius:18px;
    background:linear-gradient(135deg,#eef7ff,#f7fbff 58%,#fff8de);
}

.listenWriteHeroIcon{
    display:grid;
    flex:0 0 50px;
    width:50px;
    height:50px;
    place-items:center;
    border-radius:17px;
    background:#1769aa;
    box-shadow:0 8px 18px rgba(23,105,170,.2);
    font-size:25px;
}

.listenWriteHero span{
    color:#1769aa;
    font-size:12px;
    font-weight:800;
    letter-spacing:.06em;
    text-transform:uppercase;
}

.listenWriteHero h3{
    margin:2px 0 3px;
    color:#173c59;
    font-size:clamp(21px,3vw,28px);
}

.listenWriteHero p{
    margin:0;
    color:#4d6577;
    font-size:14px;
    line-height:1.35;
}

.listenWriteProgress{
    margin:0 2px 11px;
}

.listenWriteProgress > div:first-child{
    display:flex;
    justify-content:space-between;
    margin-bottom:7px;
    color:#52616d;
    font-size:13px;
}

.listenWriteProgressTrack{
    overflow:hidden;
    height:8px;
    border-radius:999px;
    background:#dce8ef;
}

.listenWriteProgressTrack i{
    display:block;
    width:0;
    height:100%;
    border-radius:inherit;
    background:linear-gradient(90deg,#1976bd,#37a36b);
    transition:width .25s ease;
}

.listenWriteCard{
    padding:clamp(16px,3vw,24px);
    border:1px solid #d8e4ea;
    border-radius:20px;
    background:#fff;
    box-shadow:0 10px 28px rgba(38,70,89,.1);
}

.listenWriteSentenceNo{
    display:inline-flex;
    padding:5px 10px;
    border-radius:999px;
    background:#e9f4ff;
    color:#1769aa;
    font-size:12px;
    font-weight:800;
}

.listenWriteInstruction{
    margin:10px 0 11px;
    color:#445b6a;
    line-height:1.5;
}

.listenWriteInputRow{
    display:block;
}

.listenWriteInputRow input{
    min-width:0;
    width:100%;
    min-height:54px;
    padding:12px 16px;
    border:2px solid #bfd1dc;
    border-radius:14px;
    background:#fbfdff;
    color:#17364b;
    font:inherit;
    font-size:17px;
    font-weight:600;
    line-height:1.35;
}

.listenWriteInputRow input:focus{
    border-color:#1976bd;
    outline:3px solid rgba(25,118,189,.13);
}

.listenWriteInputRow input.is-correct{
    border-color:#299461;
    background:#f1fff7;
}

.listenWriteInputRow input.is-wrong{
    border-color:#d37461;
    background:#fff8f5;
}

.listenWritePlayback{
    display:flex;
    align-items:center;
    gap:8px;
    margin-top:8px;
}

.listenWritePlay{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    min-width:142px;
    min-height:42px;
    padding:8px 16px;
    border:0;
    border-radius:11px;
    background:#1769aa;
    box-shadow:0 5px 13px rgba(23,105,170,.22);
    color:#fff;
    cursor:pointer;
    font:inherit;
    font-size:14px;
    font-weight:700;
    line-height:1.2;
}

.listenWriteSlow{
    border:1px solid #9bbfd6;
    background:#eef7fc;
    box-shadow:none;
    color:#25546f;
}

.listenWriteSlow.is-speaking{
    color:#fff;
}

.listenWritePlay span{font-size:18px}
.listenWritePlay.is-speaking{animation:listenWritePulse .85s ease-in-out infinite alternate}

@keyframes listenWritePulse{
    to{transform:scale(1.035);background:#0d568f}
}

.listenWriteControls,
.listenWriteNextRow{
    display:flex;
    flex-wrap:wrap;
    gap:9px;
    margin-top:11px;
}

.listenWriteControls{
    margin-top:15px;
    padding-top:12px;
    border-top:1px solid #e2ebf0;
}

.listenWriteControls button,
.listenWriteNextRow button,
.listenWriteFinish button{
    min-height:43px;
    padding:9px 15px;
    border-radius:11px;
    font:inherit;
    font-size:14px;
    font-weight:700;
    line-height:1.2;
    cursor:pointer;
}

.listenWriteMic,
.listenWriteReveal{
    border:1px solid #b9cad4;
    background:#f5fafc;
    color:#345568;
}

.listenWriteMic.is-listening{
    border-color:#d94343;
    background:#fff0f0;
    color:#b32727;
}

.listenWriteCheck,
.listenWriteNext,
.listenWriteFinish button{
    border:1px solid #1976bd;
    background:#1976bd;
    color:#fff;
}

.listenWriteCheck{margin-left:auto}
.listenWriteNext{margin-left:auto}

.listenWriteFeedback{
    min-height:24px;
    margin:11px 0 0;
    color:#506674;
    font-weight:700;
    line-height:1.45;
}

.listenWriteFeedback.is-success{color:#187747}
.listenWriteFeedback.is-error{color:#b44635}

.listenWriteWordResult{
    display:flex;
    flex-wrap:wrap;
    gap:7px;
    margin-top:12px;
    padding:12px;
    border-radius:12px;
    background:#f5f8fa;
}

.listenWriteWordResult span{
    padding:5px 8px;
    border-radius:8px;
    font-size:14px;
    font-weight:800;
}

.listenWriteWordResult .is-match{background:#d9f5e6;color:#17643e}
.listenWriteWordResult .is-missed{background:#ffe1dc;color:#a3392b;text-decoration:underline dotted}

.listenWriteFinish{
    padding:34px 20px;
    border:1px solid #b9e0c9;
    border-radius:20px;
    background:#f2fff7;
    text-align:center;
}

.listenWriteFinish > span{
    display:grid;
    width:58px;
    height:58px;
    margin:0 auto 10px;
    place-items:center;
    border-radius:50%;
    background:#278f5e;
    color:#fff;
    font-size:28px;
}

.listenWriteFinish h3{margin:0;color:#185b3d}
.listenWriteFinish p{color:#466357}

.srOnly{
    position:absolute!important;
    overflow:hidden!important;
    width:1px!important;
    height:1px!important;
    margin:-1px!important;
    padding:0!important;
    border:0!important;
    clip:rect(0,0,0,0)!important;
    white-space:nowrap!important;
}

@media (max-width:700px){
    .listenWritePanel{margin-bottom:18px}
    .listenWriteHero{align-items:flex-start;gap:10px;padding:12px 13px;border-radius:15px}
    .listenWriteHeroIcon{width:43px;height:43px;flex-basis:43px;border-radius:13px;font-size:21px}
    .listenWriteHero span{font-size:10px;letter-spacing:.045em}
    .listenWriteHero h3{margin-top:1px;font-size:18px;line-height:1.2}
    .listenWriteHero p{font-size:13px;line-height:1.3}
    .listenWriteProgress{margin-bottom:9px}
    .listenWriteCard{padding:14px;border-radius:16px}
    .listenWriteInstruction{margin:8px 0 9px;font-size:14px;line-height:1.35}
    .listenWriteInputRow input{font-size:16px}
    .listenWritePlayback{margin-top:7px}
    .listenWritePlayback{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
    .listenWritePlay{min-width:0;min-height:40px;padding:7px 10px}
    .listenWriteControls{display:grid;grid-template-columns:1fr;gap:7px;margin-top:14px;padding-top:11px}
    .listenWriteCheck{margin-left:0}
    .listenWriteControls button{width:100%;min-height:41px}
}
