:root {
    --bg-deep: #0f172a;
    --bg-main: #131c23;
    --accent-teal: #1db1a0;
    --accent-gold: #fbbf24;
    --text-white: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    color: var(--text-white);
    height: 100vh;
    overflow: hidden;
}

/* Starfield — slow drifting */
#star-field { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: hidden; }
.star { position: absolute; width: 2px; height: 2px; background: white; border-radius: 50%; opacity: 0; animation: starDrift linear infinite; }
.star:nth-child(odd) { animation-direction: reverse; }
@keyframes starDrift {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    15% { opacity: 0.7; transform: translate(8px, -12px) scale(1); }
    50% { opacity: 0.9; transform: translate(-15px, -30px) scale(1.2); }
    85% { opacity: 0.5; transform: translate(5px, -50px) scale(0.8); }
    100% { opacity: 0; transform: translate(0, -60px) scale(0.5); }
}

/* Side Nav */
.side-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 100%; display: flex; justify-content: space-between; padding: 0 10px; pointer-events: none; z-index: 9999; }
.v-btn { width: 60px; height: 100px; background: rgba(0,0,0,0.4); backdrop-filter: blur(10px); border: 2px solid rgba(255,255,255,0.2); border-radius: 16px; cursor: pointer; pointer-events: auto; display: flex; justify-content: center; align-items: center; transition: var(--transition); box-shadow: 0 5px 20px rgba(0,0,0,0.4); }
.v-btn:hover { background: rgba(29,177,160,0.4); border-color: var(--accent-teal); transform: scale(1.1); }
.v-shape { width: 24px; height: 24px; border-right: 6px solid var(--text-white); border-bottom: 6px solid var(--text-white); transition: var(--transition); }
.prev-btn .v-shape { transform: rotate(135deg); margin-left: 8px; }
.next-btn .v-shape { transform: rotate(-45deg); margin-right: 8px; }
.v-btn:hover .v-shape { border-color: var(--accent-gold); }

/* Utility */
@keyframes popIn { 0%{transform:scale(0);opacity:0} 100%{transform:scale(1);opacity:1} }
.v-hidden { opacity: 0 !important; pointer-events: none !important; }
.hidden { display: none !important; }

/* ===== LOADER ===== */
#loading-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(15,23,42,0.95); backdrop-filter: blur(40px); display: flex; justify-content: center; align-items: center; transition: opacity 0.8s ease, visibility 0.8s; }
#loading-overlay.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-content { text-align: center; }
.space-spinner { width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.1); border-top: 4px solid var(--accent-gold); border-radius: 50%; margin: 0 auto 15px; animation: spin 1.2s cubic-bezier(0.5,0,0.5,1) infinite; }
@keyframes spin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
.loader-content p { font-family: 'Bungee Inline', cursive; letter-spacing: 10px; color: var(--accent-gold); font-size: 5rem; animation: pulse 2s infinite, fadeInDelay 0.8s forwards; opacity: 0; visibility: hidden; text-shadow: 0 0 30px rgba(251,191,36,0.4); margin-top: 30px; }
.loader-content p { font-family: 'Bungee Inline Local'; }
html.quack-font-ready .loader-content p { visibility: visible; }
@keyframes fadeInDelay { 0%{opacity:0} 40%{opacity:0} 100%{opacity:1} }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp { from{opacity:0;transform:translateY(30px)} to{opacity:1;transform:translateY(0)} }
@keyframes float { 0%{transform:translateY(0) rotate(0)} 50%{transform:translateY(-10px) rotate(1deg)} 100%{transform:translateY(0) rotate(0)} }
@keyframes pulse-glow { 0%{box-shadow:0 0 0 0 rgba(29,177,160,0.4)} 70%{box-shadow:0 0 0 12px rgba(29,177,160,0)} 100%{box-shadow:0 0 0 0 rgba(29,177,160,0)} }

/* Card transitions */
@keyframes cardFadeOut { 0%{opacity:1;transform:translate(-50%,-50%) scale(1)} 100%{opacity:0;transform:translate(-50%,-50%) scale(0.88)} }
@keyframes cardFadeIn { 0%{opacity:0;transform:translate(-50%,-50%) scale(1.05)} 100%{opacity:1;transform:translate(-50%,-50%) scale(1)} }

/* ===== SPLASH ===== */
#splash-screen { position: fixed; top:0; left:0; width:100%; height:100%; display:flex; flex-direction:column; justify-content:center; align-items:center; z-index:1000; background:transparent; text-align:center; transition: opacity 0.8s ease-out; }
.splash-content { animation: fadeInUp 1s ease-out; position: relative; z-index: 10; }
.logo-large { font-family:'Inter',sans-serif; font-size:4.5rem; font-weight:800; letter-spacing:8px; margin-bottom:20px; color:var(--text-muted); line-height:1; }
.logo-large .serif-name { display:block; font-family:'Monofett',cursive; font-size:10rem; font-weight:400; letter-spacing:2px; margin-top:15px; color:var(--accent-gold); text-shadow:0 0 50px rgba(251,191,36,0.4); }
.parallax-bg { position:absolute; width:100%; text-align:center; font-family:'Monoton',sans-serif; font-size:7vw; font-weight:400; color:rgba(255,255,255,0.08); filter:blur(5px); z-index:2; pointer-events:none; text-transform:uppercase; white-space:nowrap; }
.glow-button { margin-top:40px; padding:22px 65px; font-size:1.8rem; font-weight:800; background-color:var(--accent-teal); color:white; border:none; border-radius:60px; cursor:pointer; touch-action:manipulation; text-transform:uppercase; letter-spacing:2px; transition:var(--transition); animation:pulse-glow 2s infinite; }
.glow-button:hover { transform:scale(1.05); background-color:#24d2bd; }
.splash-mascot { margin-top:30px; animation: float 4s ease-in-out infinite; }
.splash-mascot img { width: 250px; }

/* ===== MAIN INTERFACE ===== */
#main-interface { height:100vh; display:flex; flex-direction:column; background:transparent; animation:fadeInUp 0.8s ease-out; position:relative; z-index:10; }
.glass-header { height:60px; width:100%; backdrop-filter:blur(15px); background:rgba(15,23,42,0.6); border-bottom:1px solid rgba(255,255,255,0.1); display:flex; justify-content:space-between; align-items:center; padding:0 30px; z-index:100; }
.logo-small { font-family:'Playfair Display',serif; font-weight:900; font-size:1.3rem; color:var(--accent-teal); }
.breadcrumb { color:var(--text-muted); font-size:0.85rem; margin-left:15px; }
.u-name { font-weight:800; margin-right:12px; }
.u-date { color:var(--text-muted); font-size:0.75rem; }
.progress-container { width:100%; height:3px; background:rgba(255,255,255,0.05); }
.progress-bar { height:100%; background:linear-gradient(90deg,var(--accent-teal),var(--accent-gold)); box-shadow:0 0 8px var(--accent-teal); transition:width 0.5s ease; }

/* ===== QUESTION CARD ===== */
#task-viewport { flex:1; display:flex; justify-content:center; align-items:center; padding:8px 80px; position:relative; width:100%; overflow:hidden; }

.question-card {
    width: 100%; max-width: 920px;
    background: rgba(30,41,59,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 22px;
    padding: 24px 38px 30px;
    backdrop-filter: blur(25px);
    position: absolute; top: 50%; left: 50%;
    opacity: 0; transform: translate(-50%,-50%) scale(1);
    pointer-events: none; z-index: 1;
    overflow: hidden;
}

.question-card.card-entering { animation: cardFadeIn 0.45s cubic-bezier(0.22,1,0.36,1) forwards; pointer-events: auto; z-index: 2; }
.question-card.card-active { opacity: 1; transform: translate(-50%,-50%) scale(1); pointer-events: auto; z-index: 2; }
.question-card.card-exiting { animation: cardFadeOut 0.35s cubic-bezier(0.55,0,1,0.45) forwards; pointer-events: none; z-index: 1; }

/* Mascot */
.mascot-voice-over { display:flex; align-items:center; gap:18px; margin-bottom:14px; }
.mascot-voice-over img { width:90px; animation:float 3s ease-in-out infinite; flex-shrink:0; }
.speech-bubble { background:#0e7490; color:white; padding:15px 24px; border-radius:20px; font-size:1.1rem; font-weight:600; position:relative; box-shadow:0 6px 25px rgba(14,116,144,0.3); flex:1; }
.speech-bubble::after { content:''; position:absolute; left:-12px; top:50%; transform:translateY(-50%); border-top:10px solid transparent; border-bottom:10px solid transparent; border-right:12px solid #0e7490; }

.question-body { margin-top: 12px; }

/* ===== MULTIPLE CHOICE ===== */
.options-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.option-btn { padding:18px 22px; background:rgba(255,255,255,0.03); border:2px solid rgba(255,255,255,0.1); border-radius:16px; color:var(--text-white); font-size:1.15rem; font-weight:600; text-align:left; cursor:pointer; transition:var(--transition); }
.option-btn:nth-child(1){background:hsla(180,70%,40%,0.35);border-color:hsla(180,70%,50%,0.25)}
.option-btn:nth-child(2){background:hsla(45,80%,45%,0.35);border-color:hsla(45,80%,55%,0.25)}
.option-btn:nth-child(3){background:hsla(280,60%,50%,0.35);border-color:hsla(280,60%,60%,0.25)}
.option-btn:nth-child(4){background:hsla(330,70%,50%,0.35);border-color:hsla(330,70%,60%,0.25)}
.option-btn:hover:not(.locked) { background:rgba(255,255,255,0.08); border-color:var(--accent-teal); transform:translateX(4px); }
.option-btn.selected { border-color:var(--accent-gold) !important; box-shadow:0 0 18px rgba(251,191,36,0.15); background:rgba(251,191,36,0.12) !important; }
.option-btn.correct { border-color:#22c55e !important; background:rgba(34,197,94,0.25) !important; pointer-events:none; }
.option-btn.error { border-color:#ef4444 !important; background:rgba(239,68,68,0.2) !important; pointer-events:none; }
.option-btn.locked { pointer-events:none; opacity:0.85; }
.option-btn.tf-btn { text-align:center; font-size:1.25rem; display:flex; align-items:center; justify-content:center; gap:12px; }
.tf-emoji { font-size:1.9rem; }

/* ===== CHECK BUTTON (universal) ===== */
.check-btn { display:block; margin:16px auto 0; padding:12px 40px; background:var(--accent-teal); color:white; border:none; border-radius:25px; font-size:1.1rem; font-weight:700; cursor:pointer; transition:var(--transition); }
.check-btn:hover { background:#24d2bd; transform:scale(1.05); }
.check-btn:disabled { opacity:0.3; cursor:not-allowed; transform:none; }
.check-result { text-align:center; margin-top:10px; font-size:1.1rem; font-weight:700; min-height:24px; }
.check-result.correct-result { color:#22c55e; }
.check-result.error-result { color:#ef4444; }

/* ===== MATCHING ===== */
.matching-container { position: relative; }
.matching-header { display:flex; justify-content:space-between; margin-bottom:10px; padding:0 5px; }
.matching-header span { font-size:0.85rem; text-transform:uppercase; letter-spacing:2px; color:var(--accent-gold); font-weight:700; }
.matching-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
.match-source,.match-target { display:flex; flex-direction:column; gap:10px; }
.match-item { background:rgba(255,255,255,0.05); border:2px solid rgba(255,255,255,0.1); padding:16px 20px; border-radius:14px; cursor:pointer; transition:var(--transition); font-weight:600; font-size:1.1rem; display:flex; align-items:center; justify-content:center; text-align:center; min-height:75px; }
.match-item:hover { border-color:var(--accent-teal); background:rgba(29,177,160,0.1); }
.match-item.selected { border-color:var(--accent-gold); background:rgba(251,191,36,0.15); box-shadow:0 0 15px rgba(251,191,36,0.1); }
.match-item.matched { opacity:1; pointer-events:none; transform:scale(1.02); font-weight:700; }
.match-item.matched.color-0{background:hsla(180,70%,40%,0.6);border-color:hsla(180,70%,60%,0.8)}
.match-item.matched.color-1{background:hsla(45,80%,45%,0.6);border-color:hsla(45,80%,65%,0.8)}
.match-item.matched.color-2{background:hsla(280,60%,50%,0.6);border-color:hsla(280,60%,70%,0.8)}
.match-item.matched.color-3{background:hsla(330,70%,50%,0.6);border-color:hsla(330,70%,70%,0.8)}
.match-item.matched.color-4{background:hsla(120,50%,45%,0.6);border-color:hsla(120,50%,55%,0.8)}

/* ===== REORDER ===== */
.word-pool { display:flex; flex-wrap:wrap; gap:12px; margin-top:14px; padding:16px; background:rgba(0,0,0,0.2); border-radius:16px; min-height:58px; align-items:flex-start; align-content:flex-start; }
.draggable-word { padding:12px 22px; border-radius:14px; font-weight:700; cursor:pointer; transition:0.25s; color:white; text-shadow:0 1px 2px rgba(0,0,0,0.3); font-size:1.1rem; }
.draggable-word:active { transform:translateY(2px); }
.draggable-word.used { opacity:0.15; filter:grayscale(1); pointer-events:none; }
.drop-sentence { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:14px; padding:14px; border:2px dashed rgba(255,255,255,0.15); border-radius:16px; min-height:55px; background:rgba(0,0,0,0.15); align-items:center; }
.drop-sentence .draggable-word { cursor:pointer; animation:popIn 0.3s ease-out; }

/* ===== ERROR SPOTTER ===== */
.sentence-frame { background:rgba(0,0,0,0.2); border:2px solid rgba(255,255,255,0.1); border-radius:18px; padding:18px 22px; }
.sentence-tokens { display:flex; flex-wrap:wrap; gap:10px; font-size:1.2rem; line-height:1.8; justify-content:center; }
.token { padding:10px 18px; border-radius:14px; cursor:pointer; transition:var(--transition); background:rgba(255,255,255,0.06); border:2px solid rgba(255,255,255,0.1); font-weight:500; user-select:none; font-size:1.15rem; }
.token:hover:not(.locked) { background:rgba(255,255,255,0.12); border-color:rgba(255,255,255,0.25); transform:translateY(-2px); }
.token.selected { border-color:var(--accent-gold); background:rgba(251,191,36,0.15); box-shadow:0 0 12px rgba(251,191,36,0.1); }
.token.correct { background:rgba(34,197,94,0.25); border-color:#22c55e; color:#4ade80; pointer-events:none; }
.token.error { background:rgba(239,68,68,0.2); border-color:#ef4444; color:#fca5a5; pointer-events:none; }
.token.locked { pointer-events:none; }

/* ===== FILL-BLANK ===== */
.fill-blank-frame { background:rgba(0,0,0,0.2); border:2px solid rgba(255,255,255,0.1); border-radius:18px; padding:18px 24px; }
.fill-blank-container { display:flex; align-items:baseline; gap:6px; font-size:1.2rem; flex-wrap:wrap; line-height:2; justify-content:center; }
.blank-slot { display:inline-block; min-width:110px; padding:4px 16px; border-bottom:3px solid var(--accent-teal); text-align:center; color:var(--accent-gold); font-weight:700; transition:var(--transition); border-radius:4px; background:rgba(29,177,160,0.08); font-size:1.15rem; }
.blank-slot.filled { border-color:var(--accent-gold); background:rgba(251,191,36,0.1); animation:popIn 0.3s ease-out; }
.blank-slot.correct-slot { border-color:#22c55e; background:rgba(34,197,94,0.15); }
.blank-slot.error-slot { border-color:#ef4444; background:rgba(239,68,68,0.15); }
.word-choices { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; justify-content:center; }
.word-choice-btn { padding:14px 26px; background:rgba(255,255,255,0.06); border:2px solid rgba(255,255,255,0.15); border-radius:25px; color:var(--text-white); font-size:1.15rem; font-weight:600; cursor:pointer; transition:var(--transition); }
.word-choice-btn:hover:not(.locked) { background:rgba(29,177,160,0.15); border-color:var(--accent-teal); transform:scale(1.05); }
.word-choice-btn.selected { border-color:var(--accent-gold); background:rgba(251,191,36,0.15); }
.word-choice-btn.chosen { opacity:0.3; pointer-events:none; }
.word-choice-btn.correct-choice { background:rgba(34,197,94,0.2); border-color:#22c55e; }
.word-choice-btn.error-choice { background:rgba(239,68,68,0.2); border-color:#ef4444; }
.word-choice-btn.locked { pointer-events:none; }

/* ===== CATEGORIZE ===== */
.categorize-container { display:grid; grid-template-columns:1fr 1fr; gap:18px; margin-top:14px; }
.bucket { background:rgba(255,255,255,0.03); border:3px dashed rgba(255,255,255,0.12); border-radius:20px; padding:16px; min-height:120px; text-align:center; transition:var(--transition); display:flex; flex-direction:column; align-items:center; gap:8px; }
.bucket.drag-over { border-color:var(--accent-teal); background:rgba(29,177,160,0.08); box-shadow:0 0 25px rgba(29,177,160,0.15); }
.bucket h3 { color:var(--text-muted); margin-bottom:6px; font-size:0.95rem; text-transform:uppercase; letter-spacing:2px; width:100%; }
.bucket-items { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; width:100%; }
.bucket-item { padding:8px 16px; background:rgba(29,177,160,0.3); border:1px solid rgba(29,177,160,0.5); border-radius:12px; font-weight:600; font-size:0.95rem; animation:popIn 0.3s ease-out; }
/* Kids version */
.bucket.kids-bucket { min-height:100px; }
.bucket.kids-bucket h3 { font-size:1.15rem; }
.bucket-item.kids-item { padding:10px 18px; font-size:1.05rem; }
.cat-word { padding:14px 24px; border-radius:16px; font-weight:700; cursor:grab; transition:0.2s; color:white; user-select:none; touch-action:none; font-size:1.1rem; }
.cat-word.kids-word { padding:16px 28px; font-size:1.2rem; border-radius:18px; }
.cat-word:active { cursor:grabbing; }
.cat-word.used { opacity:0.15; pointer-events:none; filter:grayscale(1); }
.cat-word.dragging { position:fixed; z-index:9000; opacity:0.9; transform:scale(1.1) rotate(3deg); pointer-events:none; box-shadow:0 10px 40px rgba(0,0,0,0.5); }
@keyframes bounceBack { 0%{transform:scale(1)} 30%{transform:scale(0.8)} 60%{transform:scale(1.1)} 100%{transform:scale(1)} }
.cat-word.bounce-back { animation:bounceBack 0.5s ease; }

/* ===== TRACING ===== */
.trace-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.trace-canvas-wrapper {
    background: #f5f0e8;
    border-radius: 20px;
    padding: 10px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1), 0 10px 30px rgba(0,0,0,0.2);
    border: 3px solid #e5dfd4;
    cursor: crosshair;
    width: 100%;
    max-width: fit-content;
    display: flex;
    justify-content: center;
}

.trace-canvas {
    display: block;
    touch-action: none;
    max-width: 100%;
}
.trace-label { font-size:1rem; color:var(--text-muted); }
.trace-label strong { color:var(--accent-gold); font-size:1.15rem; }
.trace-info { font-size:0.95rem; color:var(--text-muted); text-align:center; }
.trace-info .cn-translation { color:var(--accent-teal); font-weight:600; font-size:1.15rem; }
.trace-status { margin-top:4px; font-size:0.9rem; color:var(--accent-teal); font-weight:600; min-height:20px; }

/* Brush toolbar */
.trace-toolbar { display:flex; gap:8px; align-items:center; justify-content:center; margin-top:4px; }
.brush-btn { width:34px; height:34px; border-radius:50%; border:3px solid rgba(255,255,255,0.2); cursor:pointer; transition:var(--transition); }
.brush-btn:hover { transform:scale(1.15); }
.brush-btn.active { border-color:white; box-shadow:0 0 12px rgba(255,255,255,0.3); transform:scale(1.1); }
.eraser-btn { padding:7px 16px; background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15); border-radius:16px; color:var(--text-white); font-size:0.9rem; cursor:pointer; transition:var(--transition); }
.eraser-btn:hover { background:rgba(239,68,68,0.2); border-color:#ef4444; }

.question-card.card-wide {
    max-width: 1100px;
    width: 95%;
}

/* Story Layout (Side by Side) */
.story-layout {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 30px;
    align-items: start;
    height: 100%;
}

.story-image-container {
    width: 100%;
    height: 100%;
    max-height: 520px;
    background: rgba(0,0,0,0.2);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.clickable-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: var(--transition);
}

.clickable-image:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

.story-layout.no-image {
    grid-template-columns: 1fr;
    max-width: 820px;
    margin: 0 auto;
}

.story-layout.no-image .story-image-container {
    display: none;
}

.reading-text-panel { 
    flex: 1; 
    overflow-y: auto; 
    padding: 22px; 
    background: rgba(0,0,0,0.25); 
    border-radius: 18px; 
    border: 1px solid rgba(255,255,255,0.1); 
    max-height: 520px; 
    line-height: 2; 
    font-size: 1.1rem; 
    position: relative;
    z-index: 10;
}

.story-context-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.story-layout.questions-active .story-image-container {
    max-height: 250px;
}
.reading-text-panel::-webkit-scrollbar { width: 4px; }
.reading-text-panel::-webkit-scrollbar-thumb { background: var(--accent-teal); border-radius: 4px; }

.reading-questions-panel {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    background: rgba(0,0,0,0.25);
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    max-height: 520px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 5;
}
.reading-questions-panel::-webkit-scrollbar { width: 4px; }
.reading-questions-panel::-webkit-scrollbar-thumb { background: var(--accent-gold); border-radius: 4px; }

/* Reading Passage Highlight */
.vocab-highlight { 
    position:relative; 
    cursor:pointer; 
    font-weight:700; 
    color:var(--accent-gold); 
    display:inline-block;
    border-bottom: 2px solid rgba(251, 191, 36, 0.4);
    transition: var(--transition);
}
.vocab-highlight:hover { background: rgba(255, 255, 255, 0.05); }

/* Global Tooltip (Body-attached) */
.global-tooltip {
    position: fixed;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.98);
    color: var(--text-white);
    padding: 10px 22px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(-15px);
    border: 2px solid var(--accent-teal);
    box-shadow: 0 15px 45px rgba(0,0,0,0.7);
    transition: opacity 0.2s ease;
}
.global-tooltip.v-hidden { opacity: 0; }
.vocab-tooltip::after { content:''; position:absolute; top:100%; left:50%; transform:translateX(-50%); border-width:6px; border-style:solid; border-color:rgba(15,23,42,0.95) transparent transparent transparent; }

/* Lightbox Modal */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.92);
    backdrop-filter: blur(15px);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
    cursor: zoom-out;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: popIn 0.4s cubic-bezier(0.17,0.89,0.32,1.28);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 45px;
    height: 45px;
    background: white;
    color: var(--bg-deep);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.lightbox-close:hover { transform: rotate(90deg) scale(1.1); }

@media (max-width: 992px) {
    .story-layout { grid-template-columns: 1fr; }
    .story-image-container { height: 250px; }
    .lightbox-close { top: 10px; right: 10px; width: 35px; height: 35px; font-size: 1.5rem; }
}

.passage-img-wrapper {
    width: 100%;
    height: 280px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.story-image-hero {
    width: 100%;
    height: 420px;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

.story-image-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.passage-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ... existing logic below if any ... */

/* ===== CERTIFICATE COMPLETION ===== */
.completion-view {
    position:fixed; inset:0; display:flex; justify-content:center; align-items:center;
    z-index:3000; background:rgba(15,23,42,0.88); backdrop-filter:blur(25px);
    animation:fadeInUp 0.8s ease-out;
}
.certificate {
    background: linear-gradient(145deg, rgba(30,41,59,0.9), rgba(15,23,42,0.95));
    border: 2px solid rgba(251,191,36,0.3);
    border-radius: 28px;
    padding: 40px 55px;
    text-align: center;
    max-width: 520px;
    width: 90%;
    position: relative;
    box-shadow: 0 0 60px rgba(251,191,36,0.08), 0 25px 50px rgba(0,0,0,0.4);
    animation: fadeInUp 0.6s ease-out 0.2s both;
}
.certificate::before {
    content: '';
    position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
    width: 60%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}
.certificate::after {
    content: '';
    position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
    width: 60%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}
.cert-badge { font-size: 3.5rem; margin-bottom: 10px; animation: float 3s ease-in-out infinite; }
.cert-title {
    font-family: 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-gold);
    margin-bottom: 6px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cert-subtitle { font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 3px; margin-bottom: 18px; }
.cert-student { font-size: 1.8rem; font-weight: 800; color: var(--text-white); margin-bottom: 4px; }
.cert-date { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 22px; }
.cert-divider { width: 80%; height: 1px; background: rgba(255,255,255,0.1); margin: 0 auto 18px; }
.cert-score-row { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.cert-score-num { font-size: 3.2rem; font-weight: 800; color: var(--accent-teal); }
.cert-score-total { font-size: 1.6rem; color: var(--text-muted); font-weight: 400; }
.cert-stars { font-size: 2rem; letter-spacing: 8px; margin-bottom: 12px; filter: drop-shadow(0 0 10px rgba(251,191,36,0.3)); }
.cert-msg { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 25px; }
.cert-btn { padding: 15px 50px; font-size: 1.1rem; font-weight: 800; background: var(--accent-teal); color: white; border: none; border-radius: 40px; cursor: pointer; transition: var(--transition); text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.cert-btn:hover { background: #24d2bd; transform: translateY(-3px); box-shadow: 0 15px 30px rgba(0,0,0,0.3); }

/* Mobile Cert Fix */
@media (max-width: 768px) {
    .certificate { padding: 35px 20px; }
    .cert-title { font-size: 1.8rem; }
    .cert-student { font-size: 1.5rem; }
    .cert-score-num { font-size: 2.8rem; }
    .cert-stars { font-size: 1.5rem; letter-spacing: 4px; }
}



/* ===== MOBILE / TABLET OPTIMIZATIONS ===== */
@media (max-width: 1024px) {
    #task-viewport { padding: 0; overflow: hidden; height: 100vh; width: 100vw; position: relative; }
    .question-card { 
        position: absolute; 
        top: 50%; 
        left: 50%; 
        transform: translate(-50%, -50%); 
        width: 92%; 
        max-width: 850px; 
        padding: 15px 15px 20px; 
        height: auto;
        max-height: 85vh;
        overflow-y: auto;
        margin: 0;
        box-sizing: border-box;
    }
    .story-layout { grid-template-columns: 1fr; gap: 10px; }
    .story-image-hero { height: 160px; min-height: 160px; margin-bottom: 10px; }
    .reading-split { display: flex; flex-direction: column; gap: 15px; }
    .reading-text-panel, .reading-questions-panel { 
        max-height: none !important; 
        height: auto !important;
        overflow: visible !important; 
        padding: 0; 
        border: none;
        background: transparent;
        box-shadow: none;
    }
    .reading-text-panel { font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }
}

@media (max-width: 768px) {
    .side-nav { position: absolute; top: 50%; width: 100%; display: flex; justify-content: space-between; padding: 0; pointer-events: none; z-index: 100; }
    .v-btn { width: 35px; height: 65px; background: rgba(0,0,0,0.5); pointer-events: auto; }


    .option-btn { padding: 18px 15px; font-size: 1rem; }
    .check-btn { width: 100%; padding: 16px; margin-top: 15px; }
    
    .mascot-voice-over img { width: 55px; }
    .speech-bubble { font-size: 0.95rem; }
    
    .matching-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .match-item { min-height: 55px; font-size: 0.85rem; padding: 8px; }
    
    .logo-large { font-size: 2.2rem; }
    .logo-large .serif-name { font-size: 4.5rem; }
    .glow-button { font-size: 1.4rem; padding: 18px 45px; }
    .splash-mascot img { width: 180px; }
}


/* ===== WORD SCRAMBLE (NEW) ===== */
.scramble-container { display: flex; flex-direction: column; align-items: center; gap: 30px; width: 100%; padding: 10px 0; }
.scramble-ghost-word { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.scramble-letter-slot { 
    width: 45px; height: 55px; 
    border-bottom: 3px solid rgba(255,255,255,0.1); 
    display: flex; align-items: center; justify-content: center; 
    font-size: 2.2rem; font-family: 'Kalam', cursive; font-weight: 700;
    color: rgba(255,255,255,0.15); /* Ghost color */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.scramble-letter-slot.filled { 
    color: var(--accent-gold); 
    border-bottom-color: var(--accent-gold); 
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transform: scale(1.1);
}

.scramble-pool { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.scramble-letter-block {
    width: 45px; height: 45px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 700; color: var(--text-white);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}
.scramble-letter-block:hover { transform: translateY(-3px); background: rgba(255,255,255,0.1); border-color: var(--accent-teal); }
.scramble-letter-block:active { transform: translateY(2px); box-shadow: none; }
.scramble-letter-block.used { opacity: 0; pointer-events: none; transform: scale(0.5); }

/* Mobile Scramble Fixes */
@media (max-width: 768px) {
    .scramble-letter-slot { width: 35px; height: 45px; font-size: 1.8rem; }
    .scramble-letter-block { width: 40px; height: 40px; font-size: 1.2rem; }
}

/* ===== TRACING ===== */
.trace-container { display: flex; flex-direction: column; align-items: center; gap: 15px; width: 100%; }
.trace-canvas-wrapper { background: #f5f0e8; border-radius: 20px; padding: 10px; box-shadow: inset 0 2px 10px rgba(0,0,0,0.1), 0 10px 30px rgba(0,0,0,0.2); border: 3px solid #e5dfd4; cursor: crosshair; width: 100%; max-width: fit-content; display: flex; justify-content: center; }
.trace-canvas { display: block; touch-action: none; max-width: 100%; }
.trace-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 20px;
    width: 100%;
}

.color-palette {
    display: flex;
    gap: 15px;
    padding: 10px 25px;
    background: rgba(255,255,255,0.05);
    border-radius: 40px;
    border: 1px solid rgba(255,255,255,0.1);
}

.brush-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.brush-btn:hover, .brush-btn.active {
    transform: scale(1.2);
    border-color: white;
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.eraser-btn {
    cursor: pointer;
    font-size: 3.2rem;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3)) grayscale(0.5);
    line-height: 1;
}

.eraser-btn:hover {
    filter: grayscale(0) contrast(1.2);
    transform: scale(1.15) rotate(-10deg);
}



/* ==========================================================================
   AUDIO PLAYER & COMPACT AUDIO BUTTON CUSTOM STYLES
   ========================================================================== */

.story-audio-player {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.player-btn {
    background: var(--accent-teal);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(29, 177, 160, 0.4);
}

.player-btn:hover {
    background: #24d2bd;
    transform: scale(1.08);
}

.player-time {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 45px;
}

.player-progress-container {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.player-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-teal), var(--accent-gold));
    border-radius: 4px;
    transition: width 0.1s linear;
}

.player-progress-handle {
    width: 14px;
    height: 14px;
    background: var(--accent-gold);
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--accent-gold);
    transition: left 0.1s linear;
}

/* Compact Audio Button */
.compact-audio-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: var(--text-white) !important;
    font-size: 1.1rem !important;
    padding: 8px 14px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: var(--transition) !important;
    outline: none !important;
    margin-left: 10px !important;
    vertical-align: middle !important;
    box-shadow: none !important;
}

.compact-audio-btn:hover {
    background: var(--accent-teal) !important;
    border-color: var(--accent-teal) !important;
    transform: scale(1.05) !important;
}

.compact-audio-btn.playing {
    background: var(--accent-gold) !important;
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 12px var(--accent-gold) !important;
    animation: audioPulse 1.2s infinite ease-in-out !important;
}

@keyframes audioPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Header Mute Button */
.header-mute-btn {
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 1.25rem;
    cursor: pointer;
    margin-right: 15px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    outline: none;
}

.header-mute-btn:hover {
    color: var(--accent-teal);
    transform: scale(1.1);
}

.header-mute-btn.muted-active {
    color: #ef4444;
}



.logo-small#portal-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    padding: 0;
    cursor: pointer;
}
.logo-small#portal-link:focus-visible {
    outline: 3px solid rgba(255, 205, 0, .8);
    outline-offset: 4px;
    border-radius: 4px;
}

/* ========================================================================== */
/* YAYA HOMEWORK — VISUAL V2                                                   */
/* This section intentionally lives only in the independent V2 preview copy.   */
/* ========================================================================== */

@font-face {
    font-family: 'Bungee Inline Local';
    src: url('assets/fonts/bungee-inline-latin.woff2?v=2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: block;
}

:root {
    --v2-ink: #f7fbff;
    --v2-soft: #b7c6d9;
    --v2-panel: rgba(13, 24, 42, .82);
    --v2-line: rgba(255, 255, 255, .11);
    --v2-teal: #38d6c4;
    --v2-gold: #ffd166;
    --v2-purple: #9f8cff;
}

body {
    background:
        radial-gradient(circle at 14% 12%, rgba(33, 196, 176, .14), transparent 31%),
        radial-gradient(circle at 88% 84%, rgba(122, 91, 214, .14), transparent 34%),
        linear-gradient(145deg, #08111e 0%, #101b2e 52%, #07101c 100%);
}

.glass-header {
    height: 68px;
    padding: 0 clamp(18px, 3vw, 48px);
    background: rgba(6, 15, 27, .66);
    border-bottom-color: rgba(255,255,255,.08);
}

.header-left, .header-right { display: flex; align-items: center; }
.logo-small { letter-spacing: -.02em; }
.progress-container { height: 4px; }

#task-viewport {
    padding: 22px 86px 28px;
    align-items: center;
}

.question-card {
    max-width: 960px;
    padding: 22px clamp(24px, 3vw, 42px) 30px;
    border-radius: 30px;
    background: linear-gradient(145deg, rgba(25, 42, 65, .78), rgba(10, 21, 38, .9));
    border: 1px solid var(--v2-line);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .36), inset 0 1px 0 rgba(255,255,255,.06);
    max-height: calc(100vh - 118px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(56,214,196,.6) transparent;
}

.question-card.card-wide { max-width: 1240px; width: min(94%, 1240px); }

.task-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    color: var(--v2-soft);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.task-kind { display: inline-flex; align-items: center; gap: 9px; }
.task-kind i { color: var(--v2-teal); }
.task-count {
    min-width: 60px;
    padding: 7px 11px;
    text-align: center;
    border: 1px solid var(--v2-line);
    border-radius: 999px;
    background: rgba(255,255,255,.04);
    color: #d8e3ef;
    letter-spacing: .04em;
}

.mascot-voice-over { gap: 22px; margin-bottom: 22px; }
.mascot-voice-over img { width: 82px; filter: drop-shadow(0 12px 14px rgba(0,0,0,.28)); }
.speech-bubble {
    min-height: 74px;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(14,116,144,.9), rgba(19,91,119,.92));
    border: 1px solid rgba(125, 231, 235, .2);
    padding: 18px 26px;
    border-radius: 22px;
    font-size: clamp(1.05rem, 1.7vw, 1.35rem);
    line-height: 1.45;
    box-shadow: 0 14px 34px rgba(4, 22, 37, .3);
}

.question-body { margin-top: 0; }
.options-grid { gap: 13px; }
.option-btn {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 17px;
    border-radius: 18px;
    background: rgba(255,255,255,.045) !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    color: var(--v2-ink);
    line-height: 1.38;
}

.option-btn:hover:not(.locked) {
    background: rgba(56, 214, 196, .095) !important;
    border-color: rgba(56, 214, 196, .65) !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,.18);
}

.option-letter {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    background: rgba(255,255,255,.075);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--v2-gold);
    font-size: .9rem;
    font-weight: 900;
}

.option-text { flex: 1; }
.option-btn.selected .option-letter { background: var(--v2-gold); color: #172033; }
.option-btn.correct .option-letter { background: #22c55e; color: white; }
.option-btn.error .option-letter { background: #ef4444; color: white; }

.check-btn {
    min-width: 170px;
    margin-top: 20px;
    padding: 13px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, #21bdaa, #168f85);
    box-shadow: 0 10px 24px rgba(29,177,160,.22);
}

/* Story studio */
.reading-topline { margin-bottom: 10px; }
.story-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}
.story-eyebrow {
    margin-bottom: 5px;
    color: var(--v2-teal);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.story-heading h1 {
    max-width: 800px;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 3vw, 2.65rem);
    line-height: 1.08;
    letter-spacing: -.03em;
}
.level-pill {
    flex: none;
    padding: 9px 14px;
    border: 1px solid rgba(255, 209, 102, .32);
    border-radius: 999px;
    background: rgba(255, 209, 102, .09);
    color: var(--v2-gold);
    font-size: .75rem;
    font-weight: 800;
}
.reading-body { margin: 0; }

.story-layout {
    grid-template-columns: minmax(330px, .78fr) minmax(500px, 1.32fr);
    gap: 20px;
    height: auto;
    align-items: stretch;
}

.story-image-hero {
    position: relative;
    height: auto;
    min-height: 530px;
    margin: 0;
    border-radius: 24px;
    background: linear-gradient(155deg, rgba(56,214,196,.11), rgba(159,140,255,.1));
    border-color: rgba(255,255,255,.1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 20px 45px rgba(0,0,0,.25);
}
.story-image-hero img { object-fit: cover; }
.story-image-caption {
    position: absolute;
    left: 16px;
    bottom: 16px;
    display: inline-flex;
    gap: 7px;
    align-items: center;
    padding: 9px 13px;
    border-radius: 999px;
    background: rgba(4, 12, 23, .75);
    border: 1px solid rgba(255,255,255,.15);
    backdrop-filter: blur(12px);
    color: #eef7ff;
    font-size: .75rem;
    font-weight: 700;
    pointer-events: none;
}

.reading-text-panel {
    max-height: none;
    overflow: visible;
    padding: clamp(20px, 2.4vw, 32px);
    border-radius: 24px;
    background: rgba(5, 14, 27, .48);
    border-color: rgba(255,255,255,.09);
    font-size: 1rem;
    line-height: 1.74;
}
.reader-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: var(--v2-soft);
    font-size: .73rem;
    font-weight: 700;
}
.reader-toolbar span { display: inline-flex; align-items: center; gap: 7px; }
.reader-toolbar i { color: var(--v2-teal); }
.passage-paragraph { color: #e9f0f7; letter-spacing: .005em; }

.vocab-highlight {
    appearance: none;
    padding: 0 2px 1px;
    background: linear-gradient(180deg, transparent 58%, rgba(255,209,102,.17) 58%);
    border: 0;
    border-bottom: 1px dashed rgba(255,209,102,.72);
    border-radius: 3px;
    color: #ffe39a;
    font: inherit;
    font-weight: 750;
    line-height: inherit;
    text-align: inherit;
    vertical-align: baseline;
}
.vocab-highlight:hover, .vocab-highlight:focus-visible {
    outline: none;
    background: rgba(255,209,102,.16);
    color: #fff0bf;
}
.global-tooltip {
    max-width: min(300px, calc(100vw - 28px));
    padding: 10px 15px;
    border: 1px solid rgba(56,214,196,.7);
    border-radius: 11px;
    background: rgba(5,15,28,.97);
    font-size: .92rem;
    line-height: 1.35;
    box-shadow: 0 16px 45px rgba(0,0,0,.5);
}

.vocab-shelf { margin-top: 16px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.08); }
.vocab-shelf > p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
    color: var(--v2-soft);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.vocab-shelf > p i { color: var(--v2-gold); }
.vocab-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.vocab-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 10px;
    background: rgba(255,255,255,.035);
    color: #edf5fb;
    font-size: .78rem;
    line-height: 1.2;
    cursor: pointer;
}
.vocab-chip small { color: #80dcd1; font-size: .68rem; }

.story-audio-player {
    display: block;
    margin-top: 15px;
    padding: 12px 14px;
    border-radius: 17px;
    background: linear-gradient(135deg, rgba(20,50,66,.72), rgba(24,30,54,.76));
    border-color: rgba(118,222,212,.16);
}
.narrator-badge { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.narrator-avatar {
    width: 35px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--v2-teal), #277b9c);
    color: white;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
}
.narrator-badge strong, .narrator-badge small { display: block; }
.narrator-badge strong { font-size: .83rem; }
.narrator-badge small { margin-top: 1px; color: var(--v2-soft); font-size: .67rem; }
.player-controls { display: flex; align-items: center; gap: 11px; }
.player-timeline { flex: 1; min-width: 100px; }
.player-times { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--v2-soft); font-size: .65rem; font-weight: 700; }
.player-btn { width: 45px; height: 45px; flex: 0 0 45px; }
.player-tool-btn {
    position: relative;
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 11px;
    background: rgba(255,255,255,.045);
    color: #dce8f2;
    cursor: pointer;
}
.player-tool-btn:hover { border-color: rgba(56,214,196,.6); color: var(--v2-teal); }
.player-tool-btn small { position: absolute; right: 3px; bottom: 1px; font-size: .48rem; }
.speed-btn { width: 42px; flex-basis: 42px; font-size: .72rem; font-weight: 800; }
.player-progress-container { height: 6px; }
.player-progress-handle { width: 13px; height: 13px; }

/* Reading comprehension */
.story-layout.questions-active { grid-template-columns: minmax(300px, .8fr) minmax(480px, 1.2fr); }
.story-layout.questions-active .story-context-panel { position: sticky; top: 0; align-self: start; }
.story-layout.questions-active .passage-img-wrapper { height: 210px; margin-bottom: 0; }
.story-layout.questions-active .reading-text-panel { max-height: 330px; overflow-y: auto; }
.reading-questions-panel {
    max-height: 610px;
    padding: 20px;
    gap: 14px;
    border-radius: 24px;
    background: rgba(5,14,27,.45);
}
.rq-block { padding: 18px; border: 1px solid rgba(255,255,255,.08); border-radius: 18px; background: rgba(255,255,255,.025); }
.rq-title { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; color: #f3f7fb; font-size: 1rem; font-weight: 750; line-height: 1.45; }
.rq-title > span { flex: 0 0 auto; padding: 4px 7px; border-radius: 7px; background: rgba(255,209,102,.12); color: var(--v2-gold); font-size: .68rem; }
.rq-grid .option-btn { min-height: 54px; padding: 9px 12px !important; font-size: .9rem !important; }
.rq-grid .option-letter { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; font-size: .75rem; }
.rq-check { min-width: 120px; }

@media (max-width: 1024px) {
    #task-viewport { height: auto; padding: 16px 54px 22px; overflow: hidden; }
    .question-card { width: calc(100% - 108px); max-height: calc(100vh - 100px); padding: 20px 24px 26px; }
    .question-card.card-wide { width: calc(100% - 108px); }
    .story-layout { grid-template-columns: minmax(260px, .78fr) minmax(370px, 1.22fr); gap: 16px; }
    .story-image-hero { min-height: 510px; height: auto; margin: 0; }
    .reading-text-panel { padding: 22px; border: 1px solid rgba(255,255,255,.09); background: rgba(5,14,27,.48); font-size: .96rem; }
    .story-layout.questions-active { grid-template-columns: minmax(250px, .7fr) minmax(400px, 1.3fr); }
}

@media (max-width: 760px) {
    body { min-height: 100dvh; }
    .glass-header { height: 58px; padding: 0 15px; }
    .breadcrumb, .u-date { display: none; }
    .u-name { font-size: .83rem; }
    .header-mute-btn { margin-right: 8px; }
    #task-viewport { padding: 10px 10px 18px; align-items: flex-start; }
    .question-card, .question-card.card-wide {
        top: 8px;
        width: calc(100% - 20px);
        max-height: calc(100dvh - 82px);
        padding: 17px 15px 22px;
        border-radius: 22px;
        transform: translate(-50%, 0);
    }
    .question-card.card-active { transform: translate(-50%, 0); }
    @keyframes cardFadeIn { 0%{opacity:0;transform:translate(-50%,12px) scale(.98)} 100%{opacity:1;transform:translate(-50%,0) scale(1)} }
    @keyframes cardFadeOut { 0%{opacity:1;transform:translate(-50%,0) scale(1)} 100%{opacity:0;transform:translate(-50%,-8px) scale(.96)} }
    .side-nav { top: auto; bottom: 16px; padding: 0 8px; }
    .v-btn { width: 40px; height: 52px; border-radius: 13px; }
    .v-shape { width: 17px; height: 17px; border-width: 0 4px 4px 0; }
    .task-topline { margin-bottom: 12px; }
    .mascot-voice-over { gap: 10px; margin-bottom: 17px; }
    .mascot-voice-over img { width: 52px; }
    .speech-bubble { min-height: 58px; padding: 13px 16px; border-radius: 17px; font-size: 1rem; }
    .speech-bubble::after { left: -8px; border-top-width: 7px; border-bottom-width: 7px; border-right-width: 9px; }
    .options-grid { grid-template-columns: 1fr; gap: 9px; }
    .option-btn { min-height: 58px; padding: 10px 12px; border-radius: 15px; font-size: .95rem; }
    .option-letter { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
    .check-btn { width: calc(100% - 76px); min-width: 0; margin-top: 14px; padding: 13px; }

    .story-heading { align-items: flex-start; margin-bottom: 15px; }
    .story-heading h1 { font-size: 1.8rem; }
    .level-pill { padding: 7px 10px; font-size: .65rem; }
    .story-layout, .story-layout.questions-active { display: flex; flex-direction: column; gap: 13px; }
    .story-image-hero { order: 0; width: 100%; min-height: 0; height: clamp(210px, 54vw, 285px); border-radius: 19px; }
    .story-image-hero img { object-fit: cover; }
    .reading-text-panel { order: 1; padding: 18px 16px; border-radius: 19px; font-size: 1rem; line-height: 1.82; }
    .reader-toolbar { font-size: .66rem; }
    .reader-toolbar span:last-child { display: none; }
    .vocab-chip-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
    .vocab-chip { flex: 0 0 auto; }
    .vocab-chip small { display: none; }
    .story-audio-player { margin-top: 18px; padding: 13px; }
    .narrator-badge { margin-bottom: 10px; }
    .player-controls { gap: 8px; }
    .player-tool-btn { width: 34px; flex-basis: 34px; }
    .player-btn { width: 43px; height: 43px; flex-basis: 43px; }

    .story-layout.questions-active .story-context-panel { position: static; display: contents; }
    .story-layout.questions-active .passage-img-wrapper { height: 180px; order: 0; margin: 0; }
    .story-layout.questions-active .story-context-panel .reading-text-panel { max-height: 220px !important; overflow-y: auto !important; order: 1; }
    .reading-questions-panel { order: 2; max-height: none; overflow: visible; padding: 0; border: 0; background: transparent; }
    .rq-block { padding: 14px; }
}

/* Local layout study: artwork, passage and one live question share one screen. */
.question-card.story-combined-card {
    height: min(720px, calc(100dvh - 84px));
    max-height: calc(100dvh - 84px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px clamp(22px, 3vw, 42px) 24px;
}

.story-combined-card .story-heading {
    flex: 0 0 auto;
    min-height: 66px;
    padding-bottom: 12px;
}

.story-heading-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.story-skip-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 999px;
    background: rgba(255, 255, 255, .045);
    color: #a9bac8;
    font: 700 .7rem/1 'Inter', sans-serif;
    letter-spacing: .04em;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.story-skip-btn:hover {
    color: #fff;
    border-color: rgba(98, 218, 204, .45);
    background: rgba(98, 218, 204, .1);
    transform: translateY(-1px);
}

.story-combined-card .reading-body {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 14px;
    overflow: hidden;
}

.story-combined-card .story-flow {
    height: 100%;
    min-height: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    grid-template-rows: minmax(170px, 38%) minmax(0, 62%);
    gap: 14px 18px;
}

.story-combined-card .story-flow .story-image-hero {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 17px;
}

.story-combined-card .story-flow .reading-text-panel {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 17px 15px 17px 2px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(98, 218, 204, .38) transparent;
    font-size: clamp(.91rem, 1.18vw, 1.02rem);
    line-height: 1.68;
}

.story-combined-card .reading-text-panel::-webkit-scrollbar { width: 3px; }
.story-combined-card .reading-text-panel::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.story-combined-card .reading-text-panel::-webkit-scrollbar-track { background: transparent; }
.story-combined-card .reading-text-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, transparent 0%, rgba(98, 218, 204, .42) 18%, rgba(98, 218, 204, .42) 82%, transparent 100%);
}

.story-combined-card .story-question-zone {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 15px 0 0 18px;
    overflow: hidden;
    border-top: 0;
    border-left: 1px solid rgba(255, 255, 255, .075);
}

.story-combined-card #story-question-stage,
.story-combined-card .story-question-card {
    height: 100%;
    min-height: 0;
}

.story-combined-card .story-question-card {
    display: flex;
    flex-direction: column;
}

.story-combined-card .story-question-progress { margin-bottom: 9px; }
.story-combined-card .story-question-card h2 {
    margin-bottom: 12px;
    font-size: clamp(1.05rem, 1.55vw, 1.35rem);
}
.story-combined-card .story-options { gap: 8px; }
.story-combined-card .story-options .option-btn {
    min-height: 48px;
    padding: 10px 12px;
    border-width: 1px;
    border-radius: 12px;
    font-size: .91rem;
}
.story-combined-card .story-question-actions {
    min-height: 44px;
    margin-top: auto;
}
.story-combined-card .story-question-actions .check-btn {
    min-width: 112px;
    padding: 10px 17px;
    font-size: .9rem;
}

@media (max-width: 760px) {
    #task-viewport { padding: 6px 4px; }
    .question-card.story-combined-card {
        width: calc(100% - 10px);
        height: calc(100dvh - 66px);
        max-height: calc(100dvh - 66px);
        padding: 12px 12px 13px;
        border-radius: 17px;
    }
    .story-combined-card .story-heading {
        min-height: 54px;
        padding-bottom: 8px;
    }
    .story-heading h1 { font-size: 1.35rem; }
    .story-eyebrow { margin-bottom: 2px; font-size: .57rem; }
    .story-heading-actions { gap: 7px; }
    .story-skip-btn { padding: 7px 9px; font-size: .62rem; }
    .story-combined-card .reading-body { margin-top: 8px; }
    .story-combined-card .story-flow {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(118px, 25%) minmax(90px, 25%) minmax(0, 50%);
        gap: 7px;
    }
    .story-combined-card .story-flow .story-image-hero {
        grid-column: 1;
        grid-row: 1;
        border-radius: 12px;
    }
    .story-combined-card .story-flow .reading-text-panel {
        grid-column: 1;
        grid-row: 2;
        padding: 9px 7px 9px 1px;
        font-size: .83rem;
        line-height: 1.5;
    }
    .story-combined-card .story-question-zone {
        grid-column: 1;
        grid-row: 3;
        padding: 8px 1px 0;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, .075);
    }
    .story-combined-card .story-question-progress { margin-bottom: 5px; }
    .story-combined-card .story-question-card h2 { margin-bottom: 7px; font-size: .97rem; }
    .story-combined-card .story-options { grid-template-columns: 1fr 1fr; gap: 6px; }
    .story-combined-card .story-options .option-btn {
        min-height: 39px;
        padding: 7px 8px;
        border-radius: 9px;
        font-size: .76rem;
    }
    .story-combined-card .story-question-actions { min-height: 35px; margin-top: 5px; }
    .story-combined-card .story-question-actions .check-result { font-size: .72rem; }
    .story-combined-card .story-question-actions .check-btn {
        min-width: 94px;
        padding: 8px 12px;
        font-size: .76rem;
    }
    .overlay-player { bottom: 5px; }
}

@media (max-width: 390px) {
    .story-heading h1 { font-size: 1.58rem; }
    .story-eyebrow { font-size: .65rem; }
    .level-pill { display: none; }
    .player-tool-btn:first-child { display: none; }
    .question-card, .question-card.card-wide { padding-left: 13px; padding-right: 13px; }
}

/* Story review navigation and a real, compact vertical story scroller. */
.story-combined-card .story-flow .reading-text-panel {
    height: clamp(210px, 39vh, 368px);
    max-height: clamp(210px, 39vh, 368px);
    overflow: hidden;
}
.story-combined-card .reading-text-panel .passage-content {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-y;
}
.story-question-back {
    position: absolute;
    left: 0;
    top: 50%;
    width: 50px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(116,205,229,.42);
    border-radius: 14px;
    background: transparent;
    color: #dff8ff;
    font-size: 1.08rem;
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity .16s ease, background-color .16s ease, transform .16s ease;
}
.story-question-back:hover:not(:disabled) { background: rgba(21,105,104,.38); }
.story-question-back:active:not(:disabled) { transform: translateY(-50%) scale(.9); }
.story-question-back:disabled { visibility: hidden; pointer-events: none; }

@media (max-width: 540px) {
    .story-combined-card .story-flow .reading-text-panel {
        height: min(38vh, 330px);
        max-height: min(38vh, 330px);
    }
    .story-question-back { width: 42px; height: 38px; font-size: .95rem; }
}

/* Certificate v3: one Duolingo-inspired card with one compact result panel. */
.certificate-card {
    position: relative;
    width: min(960px, 100%);
    max-height: calc(100dvh - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: clamp(24px, 4vw, 44px);
    display: flex;
    flex-direction: column;
    gap: clamp(22px, 3vw, 34px);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: clamp(24px, 3.2vw, 36px);
    background: #dff3fa;
    color: #182d3c;
}
.certificate-card::before {
    content: '';
    position: absolute;
    z-index: 0;
    left: 0;
    top: clamp(170px, 24vw, 220px);
    width: 100%;
    height: clamp(155px, 21vw, 205px);
    border-radius: 48% 52% 45% 55% / 42% 38% 62% 58%;
    background: #2b7089;
    opacity: .7;
    transform: rotate(4deg);
    pointer-events: none;
}
.certificate-header,
.certificate-status,
.certificate-main,
.certificate-footer {
    position: relative;
    z-index: 1;
}
.certificate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e7edf0;
}
.certificate-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.certificate-brand img { width: 96px; height: 96px; object-fit: contain; }
.certificate-brand > span { display: grid; gap: 2px; }
.certificate-brand strong { color: #173f53; font-size: 1.08rem; font-weight: 900; letter-spacing: .015em; }
.certificate-brand small,
.certificate-meta time { color: #708590; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.certificate-meta { display: grid; gap: 3px; text-align: right; }
.certificate-meta strong { color: #177f96; font-size: .9rem; font-weight: 900; }

.certificate-status {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    padding: 11px 17px;
    border-radius: 15px;
    background: #d1f1e5;
    color: #116d4d;
    font-size: clamp(.88rem, 1.6vw, 1.05rem);
    font-weight: 950;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.certificate-status i { color: #27a66f; font-size: 1.15em; }
.certificate-result-column { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; }
.certificate-result-column .certificate-status { width: 100%; justify-content: center; }

.certificate-main {
    display: grid;
    grid-template-columns: minmax(0, 1.48fr) minmax(250px, .72fr);
    gap: clamp(22px, 4vw, 38px);
    align-items: center;
}
.certificate-student { display: flex; align-items: center; gap: clamp(22px, 4vw, 38px); min-width: 0; }
.certificate-avatar-wrap { position: relative; flex: 0 0 auto; width: clamp(205px, 27vw, 280px); height: clamp(205px, 27vw, 280px); display: grid; place-items: center; overflow: visible; }
.certificate-avatar { width: 100%; height: 100%; object-fit: contain; }
.certificate-complete { position: absolute; right: 1%; bottom: 5%; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; border: 7px solid #dff3fa; border-radius: 50%; background: #39b97a; color: #fff; font-size: 1rem; }
.certificate-title { min-width: 0; }
.certificate-title p { margin: 0; color: #607580; font-size: clamp(1rem, 2vw, 1.3rem); font-weight: 800; }
.certificate-name-wrap { position: relative; width: fit-content; padding-bottom: clamp(72px, 9vw, 96px); }
.certificate-title h1 { margin: 0; color: #173f53; font: 950 clamp(3.1rem, 7vw, 5.5rem)/.94 'Inter', sans-serif; letter-spacing: -.065em; overflow-wrap: anywhere; }
.certificate-title small { display: block; max-width: 260px; margin-top: 5px; color: #71848d; font-size: .82rem; font-weight: 650; line-height: 1.45; }

.certificate-result { padding: clamp(22px, 3vw, 30px); border-radius: 24px; background: #153f53; color: #fff; }
.certificate-percent-row { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; }
.certificate-percent-row span { color: #b9d2da; font-size: .65rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.certificate-percent-row strong { color: #ffe35b; font-size: clamp(2.3rem, 5vw, 3.5rem); line-height: 1; }
.certificate-progress { height: 12px; margin-top: 21px; overflow: hidden; border-radius: 999px; background: #2b596b; }
.certificate-progress i { display: block; height: 100%; border-radius: inherit; background: #54d9c2; }
.certificate-score { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 10px; margin-top: 24px; }
.certificate-score strong { font-size: 2rem; line-height: 1; }
.certificate-score strong small { color: #83a5b2; font-size: .82rem; }
.certificate-score > span { color: #a8c2cc; font-size: .62rem; font-weight: 800; line-height: 1.25; text-transform: uppercase; }
.certificate-result > p { margin: 17px 0 0; color: #75ead5; font-size: .86rem; font-weight: 900; }

.certificate-footer { position: relative; min-height: 94px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding-top: 23px; border-top: 2px solid #c7e1ea; }
.certificate-teacher small,
.certificate-teacher strong { display: block; }
.certificate-teacher small { color: #84969e; font-size: .58rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.certificate-teacher strong { margin-top: 3px; color: #173f53; font-size: 1rem; }
.certificate-stamp { position: absolute; left: 50%; top: calc(100% - 125px); z-index: 5; width: clamp(145px, 17vw, 174px); height: clamp(145px, 17vw, 174px); object-fit: contain; opacity: .82; transform: translateX(-50%) rotate(-10deg); pointer-events: none; }
.certificate-home,
.certificate-again { min-width: 168px; height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 20px; border: 0; border-radius: 16px; background: #ffd83d; color: #173f53; font-size: .82rem; font-weight: 950; text-transform: uppercase; cursor: pointer; }
.certificate-home { min-width: 112px; background: #b9dfe9; color: #173f53; }
.certificate-home:hover { background: #a9d5e1; }
.certificate-home,
.certificate-again { transition: transform .16s ease, background-color .16s ease; }
.certificate-home:active,
.certificate-again:active { transform: scale(.88); }
.certificate-home i,
.certificate-again i { font-size: 1rem; }
.certificate-again:hover { background: #ffe35b; }

@media (max-width: 720px) {
    .completion-view { display: block; padding: 8px; }
    .certificate-card { max-height: none; min-height: calc(100dvh - 16px); padding: 21px; gap: 20px; border-radius: 23px; }
    .certificate-card::before { left: 0; top: 250px; width: 100%; height: 210px; transform: rotate(7deg) scaleX(1.25); }
    .certificate-main { grid-template-columns: 1fr; }
    .certificate-student { flex-direction: column; text-align: center; }
    .certificate-avatar-wrap { width: min(68vw, 270px); height: min(68vw, 270px); }
    .certificate-title small { margin-inline: auto; }
    .certificate-name-wrap { margin-inline: auto; padding-bottom: 92px; }
    .certificate-stamp { top: calc(100% - 118px); width: 150px; height: 150px; opacity: .78; }
    .certificate-footer { grid-template-columns: 1fr auto auto; min-height: 82px; }
    .certificate-home, .certificate-again { min-width: 52px; padding-inline: 15px; }
}

@media (max-width: 420px) {
    .certificate-header { align-items: flex-start; }
    .certificate-brand small { display: none; }
    .certificate-brand img { width: 72px; height: 72px; }
    .certificate-meta { max-width: 110px; }
    .certificate-home span, .certificate-again span { display: none; }
    .certificate-home, .certificate-again { width: 52px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ========================================================================== */
/* YAYA VISUAL V2.1 — richer shell, compact story audio, unified story quiz    */
/* ========================================================================== */

body::before,
body::after {
    content: '';
    position: fixed;
    width: 44vw;
    height: 44vw;
    min-width: 420px;
    min-height: 420px;
    border-radius: 44% 56% 63% 37% / 48% 42% 58% 52%;
    filter: blur(70px);
    opacity: .19;
    pointer-events: none;
    z-index: 0;
    animation: auroraFloat 18s ease-in-out infinite alternate;
}
body::before {
    left: -15vw;
    top: -20vw;
    background: linear-gradient(135deg, #00d1b2, #1373a7 58%, transparent 75%);
}
body::after {
    right: -18vw;
    bottom: -23vw;
    background: linear-gradient(135deg, transparent 12%, #684adf 48%, #f5a524 95%);
    animation-delay: -8s;
}
@keyframes auroraFloat {
    from { transform: translate3d(-2%, -1%, 0) rotate(-5deg) scale(.95); }
    to { transform: translate3d(5%, 4%, 0) rotate(8deg) scale(1.08); }
}
#star-field::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.22) 0 1px, transparent 1.5px),
        radial-gradient(circle at 75% 18%, rgba(56,214,196,.2) 0 1px, transparent 1.5px),
        radial-gradient(circle at 84% 72%, rgba(255,209,102,.18) 0 1px, transparent 1.5px);
    background-size: 190px 190px, 260px 260px, 330px 330px;
    mask-image: linear-gradient(to bottom, black, transparent 88%);
}

.glass-header {
    height: 72px;
    background: linear-gradient(90deg, rgba(5,15,28,.85), rgba(12,27,45,.68), rgba(5,15,28,.85));
    border-bottom: 1px solid rgba(100,226,211,.12);
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.logo-small#portal-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.brand-mark {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(145deg, #38d6c4, #1b8d94);
    color: #061420;
    font-family: 'Playfair Display', serif;
    font-size: 1.18rem;
    font-weight: 900;
    box-shadow: 0 8px 22px rgba(36,195,181,.2), inset 0 1px rgba(255,255,255,.4);
}
.brand-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.brand-copy strong { color: #f5fbff; font-family: 'Inter', sans-serif; font-size: .86rem; letter-spacing: .16em; }
.brand-copy small { margin-top: 5px; color: #7f96aa; font-family: 'Inter', sans-serif; font-size: .57rem; font-weight: 600; letter-spacing: .035em; }
.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 22px;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 999px;
    background: rgba(255,255,255,.025);
}
.breadcrumb i { font-size: .55rem; color: #536b80; }
.breadcrumb strong { color: #d8e7f1; font-weight: 700; }
.user-info { padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); }

.question-card {
    background:
        linear-gradient(145deg, rgba(24,43,67,.82), rgba(7,18,34,.92)),
        radial-gradient(circle at 10% 0, rgba(56,214,196,.15), transparent 35%);
    border-color: rgba(132, 196, 211, .16);
}
.question-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(115deg, rgba(255,255,255,.035), transparent 35%, transparent 75%, rgba(159,140,255,.035));
}
.question-card > * { position: relative; z-index: 1; }

/* Distinct but calm answer identities. */
.options-grid .option-btn:nth-child(1) { background: linear-gradient(135deg, rgba(25,151,170,.13), rgba(255,255,255,.035)) !important; border-color: rgba(47,194,211,.22) !important; }
.options-grid .option-btn:nth-child(2) { background: linear-gradient(135deg, rgba(238,164,48,.13), rgba(255,255,255,.035)) !important; border-color: rgba(255,194,79,.22) !important; }
.options-grid .option-btn:nth-child(3) { background: linear-gradient(135deg, rgba(138,95,214,.14), rgba(255,255,255,.035)) !important; border-color: rgba(172,130,242,.22) !important; }
.options-grid .option-btn:nth-child(4) { background: linear-gradient(135deg, rgba(213,76,133,.13), rgba(255,255,255,.035)) !important; border-color: rgba(235,108,159,.21) !important; }
.options-grid .option-btn:nth-child(1) .option-letter { color: #66e8ee; background: rgba(25,151,170,.16); border-color: rgba(47,194,211,.3); }
.options-grid .option-btn:nth-child(2) .option-letter { color: #ffd166; background: rgba(238,164,48,.15); border-color: rgba(255,194,79,.3); }
.options-grid .option-btn:nth-child(3) .option-letter { color: #c6a7ff; background: rgba(138,95,214,.17); border-color: rgba(172,130,242,.3); }
.options-grid .option-btn:nth-child(4) .option-letter { color: #ff9ac4; background: rgba(213,76,133,.16); border-color: rgba(235,108,159,.28); }
.options-grid .option-btn:hover:not(.locked) { filter: brightness(1.13); }
.option-btn.selected { filter: brightness(1.18); box-shadow: 0 0 0 2px rgba(255,209,102,.42), 0 12px 26px rgba(0,0,0,.2) !important; }

/* Stronger story title block. */
.reading-topline { padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.07); }
.story-heading {
    align-items: center;
    padding: 9px 0 3px;
}
.story-heading > div { position: relative; padding-left: 17px; }
.story-heading > div::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 2px;
    width: 4px;
    border-radius: 99px;
    background: linear-gradient(to bottom, var(--v2-teal), var(--v2-gold));
    box-shadow: 0 0 18px rgba(56,214,196,.35);
}
.story-eyebrow { letter-spacing: .15em; }
.story-heading h1 { text-shadow: 0 8px 30px rgba(0,0,0,.32); }
.level-pill { background: linear-gradient(135deg, rgba(255,209,102,.15), rgba(255,209,102,.05)); box-shadow: inset 0 1px rgba(255,255,255,.08); }

/* Compact glass audio dock sits over the story artwork. */
.story-image-hero { overflow: hidden; }
.story-image-caption { bottom: 76px; }
.overlay-player {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 8;
    display: block;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 15px;
    background: rgba(5, 15, 27, .62);
    backdrop-filter: blur(15px) saturate(1.25);
    box-shadow: 0 12px 34px rgba(0,0,0,.3);
}
.overlay-player .player-controls { gap: 9px; }
.overlay-player .player-btn { width: 38px; height: 38px; flex-basis: 38px; font-size: .88rem; box-shadow: 0 5px 16px rgba(29,177,160,.25); }
.overlay-player .player-progress-container { height: 5px; }
.overlay-player .player-times { margin: 5px 1px 0; font-size: .57rem; }
.overlay-player .player-tool-btn { width: 35px; height: 33px; flex-basis: 35px; border-radius: 9px; }
.narrator-mini { display: inline-flex; align-items: center; gap: 5px; color: #c3d2df; letter-spacing: .03em; }
.narrator-mini i { color: var(--v2-teal); }

/* Story questions reuse one uncluttered visual shell: art + quiz. */
.story-quiz-layout {
    display: grid;
    grid-template-columns: minmax(290px, .72fr) minmax(540px, 1.28fr);
    gap: 18px;
    align-items: stretch;
}
.story-quiz-visual {
    position: relative;
    min-height: 590px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 24px;
    background: rgba(5,14,27,.45);
    box-shadow: inset 0 1px rgba(255,255,255,.06), 0 18px 42px rgba(0,0,0,.22);
}
.story-quiz-visual > img { width: 100%; height: 100%; object-fit: cover; }
.quiz-visual-label {
    position: absolute;
    left: 16px;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.17);
    border-radius: 13px;
    background: rgba(5,15,27,.68);
    backdrop-filter: blur(14px);
    color: white;
}
.quiz-visual-label span { color: var(--v2-teal); font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.quiz-visual-label strong { font-size: .8rem; }
.story-quiz-layout .reading-questions-panel { max-height: 590px; }

/* Completion certificate */
.completion-view {
    padding: 24px;
    background:
        radial-gradient(circle at 50% 20%, rgba(56,214,196,.14), transparent 38%),
        rgba(3,10,20,.9);
}
.certificate {
    max-width: 650px;
    width: min(94vw, 650px);
    padding: 36px 62px 30px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 4%, rgba(255,209,102,.11), transparent 34%),
        linear-gradient(145deg, #13243a, #091625);
    border: 1px solid rgba(255,209,102,.55);
    border-radius: 8px;
    box-shadow: 0 35px 100px rgba(0,0,0,.55), inset 0 0 0 7px rgba(255,209,102,.035), inset 0 0 0 8px rgba(255,209,102,.12);
}
.certificate::before, .certificate::after { width: 72%; height: 2px; }
.cert-corner { position: absolute; width: 54px; height: 54px; opacity: .8; }
.cert-corner::before, .cert-corner::after { content: ''; position: absolute; background: var(--v2-gold); }
.cert-corner::before { width: 42px; height: 1px; top: 0; left: 0; }
.cert-corner::after { width: 1px; height: 42px; top: 0; left: 0; }
.cert-corner-tl { top: 19px; left: 19px; }
.cert-corner-tr { top: 19px; right: 19px; transform: rotate(90deg); }
.cert-corner-br { bottom: 19px; right: 19px; transform: rotate(180deg); }
.cert-corner-bl { bottom: 19px; left: 19px; transform: rotate(270deg); }
.cert-seal {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 13px;
    border: 1px solid rgba(255,209,102,.75);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,209,102,.18), rgba(255,209,102,.03));
    box-shadow: 0 0 0 5px rgba(255,209,102,.05), 0 0 35px rgba(255,209,102,.12);
}
.cert-seal span { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 900; color: var(--v2-gold); }
.cert-kicker { color: var(--v2-teal); font-size: .65rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.cert-title { margin: 6px 0 0; color: #fff9e9; font-family: 'Playfair Display', serif; font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 900; letter-spacing: -.035em; text-transform: none; }
.cert-subtitle { margin: 0 0 16px; color: #a9b9c9; font-size: .7rem; letter-spacing: .22em; }
.cert-awarded { color: #8195a8; font-family: 'Playfair Display', serif; font-size: .82rem; font-style: italic; }
.cert-student { margin-top: 5px; color: var(--v2-gold); font-family: 'Caveat', cursive; font-size: 2.55rem; line-height: 1; }
.cert-rule { display: flex; align-items: center; gap: 10px; margin: 12px auto; color: var(--v2-gold); font-size: .65rem; }
.cert-rule::before, .cert-rule::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,209,102,.45)); }
.cert-rule::after { transform: scaleX(-1); }
.cert-achievement { color: #f4f8fc; font-size: 1rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cert-score-wrap { margin: 12px auto 5px; }
.cert-score-row { margin: 0; }
.cert-score-num { color: var(--v2-teal); font-size: 2.8rem; }
.cert-score-total { font-size: 1.2rem; }
.cert-score-label { margin-top: -5px; color: #71869a; font-size: .58rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.cert-stars { margin: 8px 0 5px; font-size: 1.35rem; letter-spacing: 5px; }
.cert-msg { margin-bottom: 16px; color: #c4d0dc; font-family: 'Playfair Display', serif; font-size: 1rem; }
.cert-footer { display: flex; justify-content: space-between; gap: 30px; margin: 16px 18px 19px; }
.cert-footer span { min-width: 155px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.17); }
.cert-footer strong, .cert-footer small { display: block; }
.cert-footer strong { color: #edf4f9; font-family: 'Caveat', cursive; font-size: 1.1rem; }
.cert-footer small { margin-top: 2px; color: #71869a; font-size: .55rem; letter-spacing: .12em; text-transform: uppercase; }
.cert-btn { padding: 12px 30px; border-radius: 12px; text-transform: none; font-size: .9rem; box-shadow: 0 12px 26px rgba(29,177,160,.2); }
.cert-btn i { margin-right: 7px; }

@media (max-width: 1024px) {
    .story-quiz-layout { grid-template-columns: minmax(250px, .65fr) minmax(460px, 1.35fr); }
    .story-quiz-visual { min-height: 560px; }
    .story-quiz-layout .reading-questions-panel { max-height: 560px; }
}

@media (max-width: 760px) {
    .glass-header { height: 62px; }
    .brand-mark { width: 31px; height: 31px; }
    .brand-copy small { display: none; }
    .brand-copy strong { font-size: .8rem; }
    .user-info { padding: 6px 8px; background: transparent; border: 0; }
    .story-image-caption { bottom: 69px; }
    .overlay-player { left: 9px; right: 9px; bottom: 9px; padding: 7px 8px; }
    .overlay-player .player-btn { width: 36px; height: 36px; flex-basis: 36px; }
    .overlay-player .speed-btn { width: 33px; flex-basis: 33px; }
    .story-quiz-layout { display: flex; flex-direction: column; gap: 12px; }
    .story-quiz-visual { min-height: 0; height: 240px; flex: 0 0 240px; border-radius: 19px; }
    .story-quiz-layout .reading-questions-panel { max-height: none; }
    .certificate { padding: 30px 25px 24px; }
    .cert-corner { transform: scale(.75); }
    .cert-corner-tr { transform: rotate(90deg) scale(.75); }
    .cert-corner-br { transform: rotate(180deg) scale(.75); }
    .cert-corner-bl { transform: rotate(270deg) scale(.75); }
    .cert-seal { width: 58px; height: 58px; }
    .cert-title { font-size: 2.6rem; }
    .cert-footer { margin-left: 0; margin-right: 0; gap: 12px; }
    .cert-footer span { min-width: 0; flex: 1; }
}

/* ========================================================================== */
/* YAYA VISUAL V2.2 — one-flow reading and a completely new kinetic backdrop  */
/* ========================================================================== */

body {
    background: #07111c;
}
body::before, body::after { display: none; }
#star-field {
    opacity: 1;
    background:
        radial-gradient(circle at 18% 10%, rgba(32, 210, 187, .09), transparent 28%),
        radial-gradient(circle at 82% 88%, rgba(255, 180, 71, .07), transparent 29%),
        linear-gradient(155deg, #07111c 0%, #0b1725 48%, #08131f 100%);
}
#star-field::after { display: none; }
.star { display: none !important; }
.kinetic-grid {
    position: absolute;
    inset: -30%;
    opacity: .24;
    background-image:
        linear-gradient(rgba(108, 184, 190, .1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 184, 190, .1) 1px, transparent 1px);
    background-size: 72px 72px;
    transform: perspective(700px) rotateX(64deg) rotateZ(-18deg) translateY(8%);
    transform-origin: center;
    animation: gridTravel 22s linear infinite;
    mask-image: radial-gradient(ellipse at center, black 0%, rgba(0,0,0,.62) 44%, transparent 76%);
}
.ribbon {
    position: absolute;
    left: -24vw;
    width: 148vw;
    height: 190px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.11);
    transform-origin: center;
    filter: blur(.1px);
}
.ribbon::after {
    content: '';
    position: absolute;
    inset: 18px -4vw;
    border-radius: inherit;
    border: 1px solid rgba(255,255,255,.055);
}
.ribbon-one {
    top: 14%;
    background: linear-gradient(90deg, transparent 5%, rgba(32,210,187,.08) 38%, rgba(83,146,221,.06) 68%, transparent 94%);
    animation: ribbonOne 17s ease-in-out infinite alternate;
}
.ribbon-two {
    top: 47%;
    background: linear-gradient(90deg, transparent, rgba(255,190,87,.065), rgba(159,140,255,.07), transparent);
    animation: ribbonTwo 21s ease-in-out -7s infinite alternate;
}
.ribbon-three {
    top: 76%;
    background: linear-gradient(90deg, transparent, rgba(159,140,255,.05), rgba(32,210,187,.065), transparent);
    animation: ribbonOne 25s ease-in-out -12s infinite alternate-reverse;
}
.halo {
    position: absolute;
    width: 310px;
    height: 310px;
    border: 1px solid rgba(89, 219, 205, .12);
    border-radius: 50%;
    box-shadow: 0 0 70px rgba(37,184,175,.045), inset 0 0 50px rgba(37,184,175,.035);
    animation: haloDrift 16s ease-in-out infinite alternate;
}
.halo::before, .halo::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.06);
}
.halo::before { inset: 34px; }
.halo::after { inset: 78px; }
.halo-one { top: -110px; right: 7%; }
.halo-two { bottom: -150px; left: 5%; transform: scale(1.35); animation-delay: -8s; }
@keyframes gridTravel {
    from { transform: perspective(700px) rotateX(64deg) rotateZ(-18deg) translate3d(0, 0, 0); }
    to { transform: perspective(700px) rotateX(64deg) rotateZ(-18deg) translate3d(72px, 72px, 0); }
}
@keyframes ribbonOne {
    from { transform: rotate(-8deg) translate3d(-3%, -18px, 0) scaleY(.78); }
    to { transform: rotate(5deg) translate3d(4%, 28px, 0) scaleY(1.12); }
}
@keyframes ribbonTwo {
    from { transform: rotate(7deg) translate3d(5%, 24px, 0) scaleY(1.08); }
    to { transform: rotate(-6deg) translate3d(-4%, -26px, 0) scaleY(.8); }
}
@keyframes haloDrift {
    from { translate: -18px -10px; rotate: 0deg; }
    to { translate: 32px 28px; rotate: 18deg; }
}

/* Minimal application chrome. */
.glass-header {
    height: 68px;
    padding: 0 clamp(22px, 3.4vw, 50px);
    background: rgba(7,17,28,.64);
    border-bottom: 1px solid rgba(255,255,255,.07);
    box-shadow: none;
}
.logo-small#portal-link {
    color: #f3f8fb;
    font-family: 'Inter', sans-serif;
    font-size: 1.06rem;
    font-weight: 900;
    letter-spacing: .17em;
}
.student-header-link {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    min-width: 0;
}
.student-header-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex: 0 0 auto;
}
.student-header-ya {
    color: #ffd05e;
    letter-spacing: .08em;
}
.student-header-label {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    white-space: nowrap;
}
.student-header-label #student-name-header {
    letter-spacing: .04em;
}
.header-session-date {
    display: block !important;
    color: #8da2b3;
    font-size: .82rem;
    font-weight: 650;
    letter-spacing: .045em;
    white-space: nowrap;
}
@media (max-width: 720px) {
    .glass-header {
        height: 62px;
        padding: 0 16px;
    }
    .logo-small#portal-link { font-size: .96rem; }
    .student-header-logo { width: 40px; height: 40px; }
    .header-session-date { font-size: .72rem; }
}
.brand-mark, .brand-copy { display: none; }
.breadcrumb {
    margin-left: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #6f8598;
    font-size: .72rem;
    font-weight: 600;
}
.user-info { padding: 0; border: 0; background: transparent; }
.u-name { margin-right: 0; font-size: .78rem; }
.header-mute-btn { margin-right: 12px; font-size: 1rem; color: #8398aa; }
.progress-container { height: 2px; background: rgba(255,255,255,.025); }
.progress-bar { box-shadow: none; }

/* Less furniture around regular tasks. */
.question-card {
    background: rgba(11, 25, 41, .76);
    border-color: rgba(255,255,255,.085);
    box-shadow: 0 28px 90px rgba(0,0,0,.26);
}
.question-card::before { display: none; }
.task-topline { color: #6e879a; }
.task-count { padding: 0; min-width: auto; border: 0; background: transparent; color: #70869a; }
.mascot-voice-over { align-items: center; margin-bottom: 24px; }
.mascot-voice-over img { width: 70px; }
.speech-bubble {
    min-height: 0;
    padding: 3px 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    line-height: 1.35;
}
.speech-bubble::after { display: none; }

/* One absolute reading composition: artwork, passage, then one live question. */
.question-card.story-combined-card {
    max-width: 1060px;
    padding: 25px clamp(22px, 4vw, 54px) 42px;
}
.story-heading {
    align-items: flex-end;
    padding: 0 0 18px;
    margin: 0;
    border-bottom: 1px solid rgba(255,255,255,.075);
}
.story-heading > div { padding-left: 0; }
.story-heading > div::before { display: none; }
.story-eyebrow { margin-bottom: 6px; color: #62dacc; font-size: .66rem; letter-spacing: .15em; }
.story-heading h1 { font-size: clamp(2rem, 3.4vw, 3rem); }
.story-flow { padding-top: 22px; }
.story-flow .story-image-hero {
    width: 100%;
    height: clamp(280px, 37vw, 410px);
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 20px;
    background: #0a1725;
    box-shadow: none;
}
.story-flow .story-image-hero img { object-fit: cover; }
.story-image-caption {
    top: 14px;
    right: 14px;
    bottom: auto;
    left: auto;
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
    border: 0;
    background: rgba(5,15,27,.52);
}
.story-flow .reading-text-panel {
    max-width: 820px;
    margin: 0 auto;
    padding: clamp(28px, 4vw, 46px) 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.02rem, 1.5vw, 1.14rem);
    line-height: 1.92;
}

/* The audio control contains only the three things needed: play, seek, time. */
.overlay-player {
    left: 50%;
    right: auto;
    bottom: 13px;
    width: min(470px, calc(100% - 28px));
    padding: 7px 10px;
    transform: translateX(-50%);
    border: 0;
    border-radius: 999px;
    background: rgba(5,14,24,.48);
    box-shadow: none;
    backdrop-filter: blur(11px);
}
.overlay-player .player-controls { gap: 10px; }
.overlay-player .player-btn {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    background: rgba(255,255,255,.92);
    color: #0b1a28;
    font-size: .72rem;
    box-shadow: none;
}
.overlay-player .player-btn:hover { background: white; }
.overlay-player .player-timeline { display: flex; align-items: center; gap: 9px; }
.overlay-player .player-progress-container { flex: 1; height: 3px; background: rgba(255,255,255,.22); }
.overlay-player .player-progress-handle { width: 9px; height: 9px; border-width: 1px; box-shadow: none; }
.overlay-player .player-times { display: contents; color: rgba(255,255,255,.7); font-size: .54rem; }
.overlay-player .player-times span:first-child { order: -1; min-width: 28px; }
.overlay-player .player-times span:last-child { min-width: 28px; }
.overlay-player .player-tool-btn, .narrator-mini { display: none; }

.story-question-zone {
    max-width: 820px;
    margin: 0 auto;
    padding: 34px 0 4px;
    border-top: 1px solid rgba(255,255,255,.09);
}
#story-question-stage { transition: opacity .18s ease, transform .18s ease; }
#story-question-stage.question-changing { opacity: 0; transform: translateY(8px); }
.story-question-card { width: 100%; }
.story-question-progress { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.story-question-progress > span { color: #71899c; font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.story-question-progress > div { display: flex; gap: 5px; }
.story-question-progress i { width: 20px; height: 3px; border-radius: 9px; background: rgba(255,255,255,.1); }
.story-question-progress i.active { background: var(--v2-gold); }
.story-question-progress i.done { background: var(--v2-teal); }
.story-question-card h2 { margin-bottom: 20px; color: #f4f8fb; font-size: clamp(1.25rem, 2vw, 1.65rem); line-height: 1.35; }
.story-options { grid-template-columns: 1fr 1fr; }
.story-question-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 62px; margin-top: 8px; }
.story-question-actions .check-result { margin: 0; text-align: left; font-size: .88rem; }
.story-question-actions .check-btn { width: auto; min-width: 128px; margin: 0 0 0 auto; }
.story-question-actions .story-next { background: transparent; border: 1px solid rgba(56,214,196,.35); box-shadow: none; color: #8ae5db; }

/* The old two-screen reading composition is intentionally retired in V2.2. */
.story-quiz-layout { display: none; }

@media (max-width: 760px) {
    .glass-header { height: 54px; padding: 0 14px; }
    .breadcrumb { margin-left: 12px; }
    .question-card.story-combined-card {
        width: calc(100% - 18px);
        max-height: calc(100dvh - 68px);
        padding: 20px 15px 32px;
    }
    .story-heading { padding-bottom: 14px; }
    .story-heading h1 { font-size: 1.75rem; }
    .story-flow { padding-top: 15px; }
    .story-flow .story-image-hero { height: 220px; border-radius: 15px; }
    .story-flow .reading-text-panel { padding: 26px 3px 30px; font-size: 1rem; line-height: 1.84; }
    .overlay-player { bottom: 8px; width: calc(100% - 16px); padding: 6px 8px; }
    .story-question-zone { padding: 27px 2px 0; }
    .story-options { grid-template-columns: 1fr; }
    .story-question-progress i { width: 14px; }
    .story-question-actions { align-items: flex-end; }
    .story-question-actions .check-result { max-width: 54%; }
    .story-question-actions .check-btn { width: auto; min-width: 120px; padding: 12px 18px; }
}

/* Final cascade for the local simultaneous-reading prototype. */
.question-card.story-combined-card {
    height: min(720px, calc(100dvh - 84px));
    max-height: calc(100dvh - 84px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px clamp(22px, 3vw, 42px) 24px;
}
.story-combined-card .story-heading { flex: 0 0 auto; min-height: 66px; padding-bottom: 12px; }
.story-combined-card .reading-body { flex: 1 1 auto; min-height: 0; margin-top: 14px; overflow: hidden; }
.story-combined-card .story-flow {
    height: 100%; min-height: 0; padding: 0;
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    grid-template-rows: minmax(170px, 38%) minmax(0, 62%);
    gap: 14px 18px;
}
.story-combined-card .story-flow .story-image-hero {
    grid-column: 1 / -1; grid-row: 1;
    width: 100%; height: 100%; min-height: 0; margin: 0; border-radius: 17px;
}
.story-combined-card .story-flow .reading-text-panel {
    grid-column: 1; grid-row: 2;
    width: 100%; height: 100%; min-height: 0; margin: 0;
    padding: 17px 15px 17px 2px; overflow-y: auto;
    font-size: clamp(.91rem, 1.18vw, 1.02rem); line-height: 1.68;
}
.story-combined-card .story-question-zone {
    grid-column: 2; grid-row: 2;
    width: 100%; height: 100%; min-height: 0; margin: 0;
    padding: 15px 0 0 18px; overflow: hidden;
    border-top: 0; border-left: 1px solid rgba(255,255,255,.075);
}
.story-combined-card #story-question-stage,
.story-combined-card .story-question-card { height: 100%; min-height: 0; }
.story-combined-card .story-question-card { display: flex; flex-direction: column; }
.story-combined-card .story-question-progress { margin-bottom: 9px; }
.story-combined-card .story-question-card h2 { margin-bottom: 12px; font-size: clamp(1.05rem, 1.55vw, 1.35rem); }
.story-combined-card .story-options { grid-template-columns: 1fr 1fr; gap: 8px; }
.story-combined-card .story-options .option-btn { min-height: 48px; padding: 10px 12px; border-width: 1px; border-radius: 12px; font-size: .91rem; }
.story-combined-card .story-question-actions { min-height: 44px; margin-top: auto; }
.story-combined-card .story-question-actions .check-btn { min-width: 112px; padding: 10px 17px; font-size: .9rem; }

@media (max-width: 540px) {
    #task-viewport { padding: 6px 4px; }
    .question-card.story-combined-card {
        width: calc(100% - 10px); height: calc(100dvh - 66px); max-height: calc(100dvh - 66px);
        padding: 12px 12px 13px; border-radius: 17px;
    }
    .story-combined-card .story-heading { min-height: 54px; padding-bottom: 8px; }
    .story-combined-card .story-heading h1 { font-size: 1.35rem; }
    .story-combined-card .story-eyebrow { margin-bottom: 2px; font-size: .57rem; }
    .story-combined-card .reading-body { margin-top: 8px; }
    .story-combined-card .story-flow {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(118px, 25%) minmax(90px, 25%) minmax(0, 50%);
        gap: 7px; padding: 0;
    }
    .story-combined-card .story-flow .story-image-hero { grid-column: 1; grid-row: 1; height: 100%; border-radius: 12px; }
    .story-combined-card .story-flow .reading-text-panel {
        grid-column: 1; grid-row: 2; padding: 9px 7px 9px 1px;
        font-size: .83rem; line-height: 1.5;
    }
    .story-combined-card .story-question-zone {
        grid-column: 1; grid-row: 3; padding: 8px 1px 0;
        border-left: 0; border-top: 1px solid rgba(255,255,255,.075);
    }
    .story-combined-card .story-question-progress { margin-bottom: 5px; }
    .story-combined-card .story-question-card h2 { margin-bottom: 7px; font-size: .97rem; }
    .story-combined-card .story-options { grid-template-columns: 1fr 1fr; gap: 6px; }
    .story-combined-card .story-options .option-btn { min-height: 39px; padding: 7px 8px; border-radius: 9px; font-size: .76rem; }
    .story-combined-card .story-question-actions { min-height: 35px; margin-top: 5px; }
    .story-combined-card .story-question-actions .check-result { max-width: 54%; font-size: .72rem; }
    .story-combined-card .story-question-actions .check-btn { min-width: 94px; padding: 8px 12px; font-size: .76rem; }
    .story-combined-card .overlay-player { bottom: 5px; }
}

/* Glass story canvas: one illustration with compact floating controls. */
.question-card.story-combined-card {
    padding: 0;
    border: 1px solid rgba(190, 228, 238, .22);
    border-radius: 26px;
    background: #091827;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .32);
}
.story-combined-card .story-heading {
    position: absolute;
    z-index: 8;
    top: 18px;
    left: 18px;
    right: 18px;
    width: auto;
    min-height: 0;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 16px;
    background: rgba(7, 20, 34, .32);
    box-shadow: 0 10px 35px rgba(0,0,0,.12);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}
.story-combined-card .story-heading h1 { font-size: clamp(1.25rem, 2vw, 1.75rem); }
.story-combined-card .story-eyebrow { margin-bottom: 2px; font-size: .55rem; }
.story-combined-card .reading-body { height: 100%; margin: 0; }
.story-combined-card .story-flow {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    grid-template-rows: 1fr;
    height: 100%;
    padding: 0;
    gap: 12px;
}
.story-combined-card .story-flow .story-image-hero {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    overflow: hidden;
}
.story-combined-card .story-flow .story-image-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(4,12,22,.04) 0%, rgba(4,12,22,.1) 30%, rgba(4,12,22,.42) 100%);
}
.story-combined-card .story-flow .story-image-hero img { width: 100%; height: 100%; object-fit: cover; }
.story-combined-card .story-image-caption { z-index: 4; top: 84px; right: 18px; }
.story-combined-card .overlay-player {
    z-index: 4;
    left: 18px;
    right: auto;
    bottom: auto;
    top: 84px;
    width: min(390px, calc(100% - 92px));
    transform: none;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(7,20,34,.27);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
}
.story-combined-card .story-flow .reading-text-panel,
.story-combined-card .story-question-zone {
    position: relative;
    z-index: 3;
    align-self: end;
    height: min(52%, 350px);
    min-height: 280px;
    margin: 0 0 18px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 19px;
    background: rgba(7,20,34,.3);
    box-shadow: 0 18px 45px rgba(0,0,0,.15);
    backdrop-filter: blur(25px) saturate(145%);
    -webkit-backdrop-filter: blur(25px) saturate(145%);
}
.story-combined-card .story-flow .reading-text-panel {
    grid-column: 1;
    grid-row: 1;
    margin-left: 18px;
    padding: 18px 17px;
    color: rgba(255,255,255,.94);
}
.story-combined-card .story-question-zone {
    grid-column: 2;
    grid-row: 1;
    margin-right: 18px;
    padding: 16px 17px;
    overflow: hidden;
}
.story-combined-card .story-question-progress > span { color: rgba(224,239,245,.72); }
.story-combined-card .story-question-actions { gap: 8px; }
.story-question-skip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.055);
    color: rgba(236,246,250,.78);
    font: 700 .72rem/1 'Inter', sans-serif;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.story-question-skip:hover {
    color: #fff;
    border-color: rgba(255,255,255,.3);
    background: rgba(255,255,255,.11);
}
.story-combined-card .story-question-actions .story-result:empty { display: none; }

@media (max-width: 540px) {
    .question-card.story-combined-card { padding: 0; border-radius: 19px; }
    .story-combined-card .story-heading { top: 9px; left: 9px; right: 9px; padding: 8px 9px; border-radius: 12px; }
    .story-combined-card .story-heading h1 { font-size: 1.06rem; }
    .story-combined-card .story-image-caption { top: 66px; right: 9px; }
    .story-combined-card .overlay-player { top: 66px; left: 9px; width: calc(100% - 58px); }
    .story-combined-card .story-flow {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1.15fr;
        gap: 7px;
    }
    .story-combined-card .story-flow .reading-text-panel,
    .story-combined-card .story-question-zone {
        align-self: stretch;
        width: auto;
        height: auto;
        min-height: 0;
        margin-left: 9px;
        margin-right: 9px;
        padding: 10px 11px;
        border-radius: 13px;
    }
    .story-combined-card .story-flow .reading-text-panel { grid-column: 1; grid-row: 1; margin-top: 118px; margin-bottom: 0; }
    .story-combined-card .story-question-zone { grid-column: 1; grid-row: 2; margin-top: 0; margin-bottom: 9px; }
    .story-question-skip { padding: 7px 9px; font-size: .64rem; }
}

/* Content-sized glass pieces instead of full-width glass panels. */
.story-combined-card .story-heading {
    align-items: flex-start;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
}
.story-combined-card .story-heading > div:first-child {
    width: fit-content;
    max-width: min(72%, 620px);
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.17);
    border-radius: 15px;
    background: rgba(7,20,34,.31);
    box-shadow: 0 10px 32px rgba(0,0,0,.13);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
    pointer-events: auto;
}
.story-combined-card .story-heading-actions { pointer-events: auto; }
.story-combined-card .story-skip-btn {
    width: 48px;
    height: 42px;
    justify-content: center;
    padding: 0;
    border-color: rgba(119,224,211,.35);
    background: rgba(21,105,104,.38);
    color: #eafffc;
    font-size: 1.08rem;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
}
.story-combined-card .story-flow .reading-text-panel {
    height: auto;
    min-height: 0;
    max-height: min(52%, 350px);
    width: fit-content;
    max-width: calc(100% - 30px);
    justify-self: start;
}
.story-combined-card .story-question-zone {
    height: auto;
    min-height: 0;
    max-height: min(66%, 430px);
    align-self: end;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
}
.story-combined-card #story-question-stage,
.story-combined-card .story-question-card { height: auto; min-height: 0; }
.story-combined-card .story-question-progress {
    width: fit-content;
    margin: 0 0 7px auto;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 999px;
    background: rgba(7,20,34,.28);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
}
.story-combined-card .story-question-progress > span { display: none; }
.story-combined-card .story-question-card h2 {
    width: fit-content;
    max-width: 100%;
    margin: 0 0 7px;
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    background: rgba(7,20,34,.31);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}
.story-combined-card .story-options {
    padding: 9px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 16px;
    background: rgba(7,20,34,.29);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}
.story-combined-card .story-options .option-btn {
    background-color: rgba(10,24,39,.32);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.story-combined-card .story-question-actions {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    min-height: 48px;
    margin-top: 7px;
}
.story-combined-card .story-question-actions .story-result { grid-column: 1; grid-row: 1; }
.story-combined-card .story-question-actions .story-check { grid-column: 2; grid-row: 1; margin: 0; }
.story-combined-card .story-question-actions .story-question-skip {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
}
.story-question-skip {
    width: 50px;
    height: 44px;
    justify-content: center;
    padding: 0;
    border-color: rgba(119,224,211,.35);
    background: rgba(21,105,104,.38);
    color: #eafffc;
    font-size: 1.08rem;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
}

@media (max-width: 540px) {
    .story-combined-card .story-heading > div:first-child { max-width: 70%; padding: 8px 10px; }
    .story-combined-card .story-skip-btn { width: 42px; height: 38px; }
    .story-combined-card .story-flow .reading-text-panel { width: auto; max-width: none; max-height: none; }
    .story-combined-card .story-question-zone { max-height: none; padding: 0; background: transparent; }
    .story-combined-card .story-question-card h2 { padding: 8px 10px; }
    .story-combined-card .story-options { padding: 6px; }
    .story-question-skip { width: 42px; height: 38px; padding: 0; font-size: .95rem; }
}

/* Desktop polish: cooler glass, a little more space, aligned controls. */
@media (min-width: 541px) {
    .question-card.story-combined-card {
        max-width: 1115px;
        height: min(756px, calc(100dvh - 76px));
        max-height: calc(100dvh - 76px);
    }
    .story-combined-card .story-heading { top: 19px; left: 19px; right: 19px; }
    .story-combined-card .story-heading > div:first-child { padding: 11px 15px; }
    .story-combined-card .story-heading h1 { font-size: clamp(1.32rem, 2.1vw, 1.84rem); }
    .story-combined-card .story-flow .reading-text-panel {
        max-height: min(55%, 368px);
        padding: 19px 18px;
        font-size: clamp(.96rem, 1.23vw, 1.07rem);
    }
    .story-combined-card .story-question-zone { max-height: min(69%, 452px); }
    .story-combined-card .story-question-card h2 { font-size: clamp(1.1rem, 1.63vw, 1.42rem); }
    .story-combined-card .story-options .option-btn { min-height: 51px; font-size: .96rem; }
}

.story-combined-card .story-heading > div:first-child,
.story-combined-card .story-flow .reading-text-panel,
.story-combined-card .story-question-progress,
.story-combined-card .story-question-card h2,
.story-combined-card .story-options {
    border-color: rgba(126,194,224,.25);
    background: rgba(8,36,59,.56);
    box-shadow: inset 0 1px 0 rgba(190,230,247,.06), 0 14px 38px rgba(0,8,18,.16);
}
.story-combined-card .story-heading-actions { flex-direction: row-reverse; }
.story-combined-card .story-skip-btn,
.story-question-skip {
    width: 50px;
    height: 44px;
    border-color: rgba(116,205,229,.42);
    background: rgba(13,70,99,.62);
    color: #e9faff;
}
.story-combined-card .story-skip-btn:hover,
.story-question-skip:hover {
    border-color: rgba(155,229,247,.7);
    background: rgba(19,91,124,.78);
}

.story-combined-card .overlay-player {
    width: min(520px, calc(100% - 92px));
    padding: 8px 11px;
    border-color: rgba(126,194,224,.28);
    background: rgba(8,36,59,.58);
}
.story-combined-card .overlay-player .player-controls { gap: 8px; }
.story-combined-card .overlay-player .player-btn {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: .82rem;
}
.story-combined-card .overlay-player .player-tool-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(170,220,238,.2);
    background: rgba(255,255,255,.075);
    color: rgba(239,250,255,.9);
    cursor: pointer;
}
.story-combined-card .story-seek-btn {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: .72rem;
}
.story-combined-card .story-seek-btn span {
    position: absolute;
    font-size: .48rem;
    font-weight: 900;
}
.story-combined-card .story-speed-btn {
    min-width: 42px;
    height: 30px;
    padding: 0 8px;
    border-radius: 999px;
    font: 800 .68rem/1 'Inter', sans-serif;
}
.story-combined-card .overlay-player .player-tool-btn:hover { background: rgba(255,255,255,.14); }

/* Reading refinements: clearer passage, simpler transport and stronger actions. */
.story-combined-card .story-heading { top: 12px; }
.story-combined-card .story-heading-actions { flex-direction: row; }
.story-combined-card .story-eyebrow { display: none; }
.story-combined-card .overlay-player { top: 94px; }
.story-combined-card .story-flow .reading-text-panel {
    font-family: 'Inter', 'Trebuchet MS', sans-serif;
    font-size: clamp(1.01rem, 1.3vw, 1.13rem);
    font-weight: 560;
    line-height: 1.72;
    letter-spacing: .006em;
}
.story-sentence { transition: color .18s ease; }
.story-sentence-0 { color: #f3fbff; }
.story-sentence-1 { color: #dcefff; }
.story-sentence-2 { color: #eee7ff; }
.story-sentence-3 { color: #ddf5ef; }
.story-combined-card .story-question-actions {
    grid-template-columns: 1fr auto auto;
    column-gap: 9px;
}
.story-combined-card .story-question-actions .story-check {
    grid-column: 2;
    min-width: 122px;
    min-height: 44px;
    border: 1px solid rgba(122,224,211,.48);
    background: linear-gradient(135deg, rgba(23,153,139,.96), rgba(19,113,133,.96));
    box-shadow: 0 8px 24px rgba(13,113,124,.28), inset 0 1px 0 rgba(255,255,255,.16);
    color: #f4ffff;
}
.story-combined-card .story-question-actions .story-check:disabled {
    opacity: .62;
    border-color: rgba(126,194,224,.28);
    background: rgba(13,55,79,.72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
    color: rgba(232,247,252,.72);
}
.story-combined-card .story-question-actions .story-question-skip {
    grid-column: 3;
    width: 52px;
    height: 44px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(23,153,139,.9), rgba(19,113,133,.9));
    box-shadow: 0 8px 24px rgba(13,113,124,.24), inset 0 1px 0 rgba(255,255,255,.14);
}
.story-combined-card .story-seek-btn {
    width: 36px;
    height: 36px;
    color: #effbff;
    font-size: .78rem;
}
.story-combined-card .story-seek-btn span { display: none; }

@media (max-width: 540px) {
    .story-combined-card .overlay-player { top: 72px; }
    .story-combined-card .story-flow .reading-text-panel { font-size: .88rem; }
}

/* Every sentence receives a clearly distinct, child-friendly reading colour. */
.story-combined-card .passage-paragraph .story-sentence { color: inherit; }
.story-combined-card .passage-paragraph .story-sentence-0 { color: #f7fbff; }
.story-combined-card .passage-paragraph .story-sentence-1 { color: #86d9ff; }
.story-combined-card .passage-paragraph .story-sentence-2 { color: #ffd58a; }
.story-combined-card .passage-paragraph .story-sentence-3 { color: #d7b8ff; }
.story-combined-card .passage-paragraph .story-sentence-4 { color: #91e6bd; }
.story-combined-card .passage-paragraph .story-sentence-5 { color: #ffb9ce; }
.story-combined-card .passage-paragraph .story-sentence > .sentence-highlight {
    color: inherit;
    border-bottom-color: currentColor;
    background: transparent;
}

/* Stronger sentence separation for the reading and scrolling test. */
.story-combined-card .story-flow .reading-text-panel {
    font-size: clamp(1.08rem, 1.38vw, 1.2rem);
    font-weight: 620;
    line-height: 1.76;
}
.story-combined-card .passage-paragraph .story-sentence-0 { color: #ff9b9b; }
.story-combined-card .passage-paragraph .story-sentence-1 { color: #72c9ff; }
.story-combined-card .passage-paragraph .story-sentence-2 { color: #c7a0ff; }
.story-combined-card .passage-paragraph .story-sentence-3 { color: #70ddb0; }
.story-combined-card .passage-paragraph .story-sentence-4 { color: #ffad78; }
.story-combined-card .passage-paragraph .story-sentence-5 { color: #f38fc8; }

/* Variant B: white letters on selection-like sentence highlights. */
.story-combined-card .passage-paragraph .story-sentence {
    color: #f8fbff;
    padding: .08em .28em .11em;
    border-radius: .28em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    text-shadow: 0 1px 2px rgba(0,0,0,.32);
}
.story-combined-card .passage-paragraph .story-sentence-0 { color: #f8fbff; background: rgba(221,54,73,.68); }
.story-combined-card .passage-paragraph .story-sentence-1 { color: #f8fbff; background: rgba(0,126,184,.7); }
.story-combined-card .passage-paragraph .story-sentence-2 { color: #f8fbff; background: rgba(120,65,190,.7); }
.story-combined-card .passage-paragraph .story-sentence-3 { color: #f8fbff; background: rgba(20,139,86,.7); }
.story-combined-card .passage-paragraph .story-sentence-4 { color: #f8fbff; background: rgba(198,91,30,.72); }
.story-combined-card .passage-paragraph .story-sentence-5 { color: #f8fbff; background: rgba(184,44,119,.7); }
.story-combined-card .passage-paragraph .story-sentence > .sentence-highlight { color: inherit; }

/* Variant B interaction: lighter body text, bold lead word, tap-to-focus sentence. */
.story-combined-card .story-flow .reading-text-panel { font-weight: 480; }
.story-combined-card .passage-paragraph .story-sentence {
    position: relative;
    cursor: pointer;
    transition: font-size .2s ease, top .2s ease, filter .2s ease, box-shadow .2s ease;
}
.story-combined-card .passage-paragraph .story-sentence-lead { font-weight: 760; }
.story-combined-card .passage-paragraph .story-sentence.sentence-active {
    z-index: 5;
    top: -2px;
    font-size: 1.075em;
    filter: saturate(1.18) brightness(1.08);
    box-shadow: 0 7px 18px rgba(0,0,0,.24);
}

/* Stronger and unmistakable A/B/C/D colour identities. */
.story-combined-card .story-options .option-btn:nth-child(1) {
    background: linear-gradient(135deg, rgba(0,150,190,.72), rgba(4,78,111,.72)) !important;
    border-color: rgba(79,220,247,.7) !important;
}
.story-combined-card .story-options .option-btn:nth-child(2) {
    background: linear-gradient(135deg, rgba(218,132,20,.74), rgba(126,70,10,.72)) !important;
    border-color: rgba(255,190,74,.72) !important;
}
.story-combined-card .story-options .option-btn:nth-child(3) {
    background: linear-gradient(135deg, rgba(122,73,205,.76), rgba(67,39,126,.74)) !important;
    border-color: rgba(185,137,255,.72) !important;
}
.story-combined-card .story-options .option-btn:nth-child(4) {
    background: linear-gradient(135deg, rgba(207,55,119,.76), rgba(111,25,68,.74)) !important;
    border-color: rgba(255,116,174,.72) !important;
}

/* One focused sentence: stronger lift, only the story behind it is softly blurred. */
.story-combined-card .passage-paragraph:has(.story-sentence.sentence-active) .story-sentence:not(.sentence-active) {
    opacity: .66;
    filter: blur(1.15px) saturate(.78);
}
.story-combined-card .passage-paragraph .story-sentence.sentence-active {
    z-index: 8;
    top: -3px;
    font-size: 1.13em;
    filter: saturate(1.2) brightness(1.08);
    box-shadow: 0 0 0 4px rgba(153,220,240,.11), 0 8px 22px rgba(0,10,20,.2);
}
.story-combined-card .passage-paragraph .story-sentence {
    transition: font-size .2s ease, top .2s ease, filter .2s ease, opacity .2s ease, box-shadow .2s ease;
}

/* Flat 2D answer colours with a brighter badge from the same colour family. */
.story-combined-card .story-options .option-btn {
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none;
    transform: none !important;
    backdrop-filter: blur(15px) saturate(125%);
    -webkit-backdrop-filter: blur(15px) saturate(125%);
}
.story-combined-card .story-options .option-btn:nth-child(1) {
    background: rgba(0,112,145,.68) !important;
    border-color: rgba(55,214,242,.64) !important;
}
.story-combined-card .story-options .option-btn:nth-child(2) {
    background: rgba(170,88,12,.7) !important;
    border-color: rgba(255,171,55,.66) !important;
}
.story-combined-card .story-options .option-btn:nth-child(3) {
    background: rgba(92,53,166,.7) !important;
    border-color: rgba(177,125,255,.66) !important;
}
.story-combined-card .story-options .option-btn:nth-child(4) {
    background: rgba(164,35,91,.7) !important;
    border-color: rgba(255,102,166,.66) !important;
}
.story-combined-card .story-options .option-btn:nth-child(1) .option-letter {
    color: #baf7ff;
    background: rgba(0,220,255,.34);
    border-color: #45e8ff;
}
.story-combined-card .story-options .option-btn:nth-child(2) .option-letter {
    color: #fff0cf;
    background: rgba(255,150,25,.38);
    border-color: #ffb34f;
}
.story-combined-card .story-options .option-btn:nth-child(3) .option-letter {
    color: #f1e6ff;
    background: rgba(162,88,255,.4);
    border-color: #c393ff;
}
.story-combined-card .story-options .option-btn:nth-child(4) .option-letter {
    color: #ffe0ed;
    background: rgba(255,61,147,.4);
    border-color: #ff82b9;
}

/* The remaining controls use the same flat glass language, without 3D gradients. */
.story-combined-card .story-question-actions .story-check,
.story-combined-card .story-question-actions .story-question-skip,
.story-combined-card .overlay-player .player-btn,
.story-combined-card .overlay-player .player-tool-btn {
    background-image: none;
    box-shadow: none;
}
.story-combined-card .story-question-actions .story-check,
.story-combined-card .story-question-actions .story-question-skip {
    background: rgba(17,112,126,.82);
    border: 1px solid rgba(102,220,224,.5);
}
.story-combined-card .story-question-actions .story-check:disabled {
    background: rgba(13,55,79,.72);
}

/* Strictly flat glass: no glow, depth shadow or raised gradient. */
.story-combined-card .story-heading > div:first-child,
.story-combined-card .overlay-player,
.story-combined-card .story-flow .reading-text-panel,
.story-combined-card .story-question-progress,
.story-combined-card .story-question-card h2,
.story-combined-card .story-options,
.story-combined-card .story-options .option-btn,
.story-combined-card .story-options .option-letter,
.story-combined-card .story-question-actions .story-check,
.story-combined-card .story-question-actions .story-question-skip,
.story-combined-card .overlay-player .player-btn,
.story-combined-card .overlay-player .player-tool-btn {
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none;
}
.story-combined-card .story-heading > div:first-child,
.story-combined-card .overlay-player,
.story-combined-card .story-flow .reading-text-panel,
.story-combined-card .story-question-progress,
.story-combined-card .story-question-card h2,
.story-combined-card .story-options {
    background-color: rgba(8,36,59,.56);
}
.story-combined-card .overlay-player .player-btn,
.story-combined-card .overlay-player .player-tool-btn {
    background-color: rgba(12,52,76,.76);
    border: 1px solid rgba(132,199,220,.3);
    color: #eaf7fb;
}
.story-combined-card .story-options .option-btn:hover:not(.locked) {
    transform: none !important;
    box-shadow: none !important;
    filter: none;
}

/* Stronger tap focus; the surrounding story blur stays unchanged. */
.story-combined-card .passage-paragraph .story-sentence.sentence-active {
    top: -5px;
    font-size: 1.24em;
    filter: saturate(1.16) brightness(1.06);
    box-shadow: none;
}

/* Quiet, narrow story scrollbar with no arrow buttons. */
.story-combined-card .story-flow .reading-text-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(116,187,207,.2) transparent;
}
.story-combined-card .reading-text-panel::-webkit-scrollbar { width: 2px; }
.story-combined-card .reading-text-panel::-webkit-scrollbar-track { background: transparent; }
.story-combined-card .reading-text-panel::-webkit-scrollbar-thumb {
    min-height: 24px;
    border: 0;
    border-radius: 999px;
    background: rgba(116,187,207,.2);
}
.story-combined-card .reading-text-panel::-webkit-scrollbar-button,
.story-combined-card .reading-text-panel::-webkit-scrollbar-button:single-button,
.story-combined-card .reading-text-panel::-webkit-scrollbar-button:start,
.story-combined-card .reading-text-panel::-webkit-scrollbar-button:end {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

/* Cartoon-flat answers: solid fill only, with no glass or luminous border. */
.story-combined-card .story-options .option-btn {
    min-height: 54px;
    border: 0 !important;
    border-radius: 13px;
    background-image: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    color: #fff;
    font-size: 1.04rem;
    font-weight: 700;
}
.story-combined-card .story-options .option-btn:nth-child(1) { background: #147f9e !important; }
.story-combined-card .story-options .option-btn:nth-child(2) { background: #bd6a20 !important; }
.story-combined-card .story-options .option-btn:nth-child(3) { background: #7048ae !important; }
.story-combined-card .story-options .option-btn:nth-child(4) { background: #b83f75 !important; }
.story-combined-card .story-options .option-btn .option-letter {
    border: 0 !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: .85rem;
    font-weight: 900;
}
.story-combined-card .story-options .option-btn:nth-child(1) .option-letter { background: #20b8d8 !important; }
.story-combined-card .story-options .option-btn:nth-child(2) .option-letter { background: #f29a38 !important; }
.story-combined-card .story-options .option-btn:nth-child(3) .option-letter { background: #9a6ee0 !important; }
.story-combined-card .story-options .option-btn:nth-child(4) .option-letter { background: #e5689f !important; }
.story-combined-card .story-options .option-btn:hover:not(.locked) {
    border: 0 !important;
    box-shadow: none !important;
    filter: brightness(1.07) !important;
}

/* Scale sentences above their neighbours without changing the text layout. */
.story-combined-card .passage-paragraph .story-sentence {
    display: inline-block;
    max-width: 100%;
    vertical-align: baseline;
    transform: scale(1);
    transform-origin: left center;
    transition: transform .2s ease, top .2s ease, filter .2s ease, opacity .2s ease;
}
.story-combined-card .passage-paragraph .story-sentence:hover {
    z-index: 7;
    transform: scale(1.16);
}
.story-combined-card .passage-paragraph .story-sentence.sentence-active {
    top: -2px;
    font-size: inherit;
    transform: scale(1.3);
    transform-origin: left center;
}

/* Return to the earlier reflowing sentence focus, with a stronger enlargement. */
.story-combined-card .passage-paragraph .story-sentence {
    display: inline;
    max-width: none;
    vertical-align: baseline;
    transform: none;
    transition: font-size .2s ease, top .2s ease, filter .2s ease, opacity .2s ease;
}
.story-combined-card .passage-paragraph .story-sentence:hover {
    transform: none;
}
.story-combined-card .passage-paragraph .story-sentence.sentence-active {
    top: -4px;
    font-size: 1.34em;
    transform: none;
}

/* Calmer, deeper 2D palette for A/B/C/D. */
.story-combined-card .story-options .option-btn {
    color: #f1f5f6;
}
.story-combined-card .story-options .option-btn:nth-child(1) { background: #285e69 !important; }
.story-combined-card .story-options .option-btn:nth-child(2) { background: #78512e !important; }
.story-combined-card .story-options .option-btn:nth-child(3) { background: #58466f !important; }
.story-combined-card .story-options .option-btn:nth-child(4) { background: #703f53 !important; }
.story-combined-card .story-options .option-btn:nth-child(1) .option-letter { background: #347d8b !important; }
.story-combined-card .story-options .option-btn:nth-child(2) .option-letter { background: #9a6b38 !important; }
.story-combined-card .story-options .option-btn:nth-child(3) .option-letter { background: #756093 !important; }
.story-combined-card .story-options .option-btn:nth-child(4) .option-letter { background: #92546d !important; }
.story-combined-card .story-options .option-btn:hover:not(.locked) {
    filter: brightness(1.04) !important;
}

/* Final reading focus and compact scrollbar tuning. */
.story-combined-card .passage-paragraph:has(.story-sentence.sentence-active) .story-sentence:not(.sentence-active) {
    filter: blur(1.22px) saturate(.78);
}
.story-combined-card .passage-paragraph .story-sentence.sentence-active {
    font-size: 1.41em;
}
.story-combined-card .story-flow .reading-text-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(116,187,207,.14) transparent;
}
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar {
    width: 1px;
    height: 1px;
}
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-track,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-track-piece {
    background: transparent;
}
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-thumb {
    min-height: 18px;
    border: 0;
    border-radius: 999px;
    background: rgba(116,187,207,.14);
}
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button:single-button,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button:vertical,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button:vertical:start,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button:vertical:end,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button:increment,
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-button:decrement {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    background: transparent !important;
}
.story-combined-card .story-flow .reading-text-panel::-webkit-scrollbar-corner {
    display: none;
    background: transparent;
}

/* Replace the operating-system scrollbar with a tiny arrowless indicator. */
.story-combined-card .story-flow .reading-text-panel {
    position: relative;
    overflow: hidden;
}
.story-combined-card .reading-text-panel .passage-content {
    width: 100%;
    height: 100%;
    padding-right: 7px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.story-combined-card .reading-text-panel .passage-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.story-scroll-track {
    position: absolute;
    z-index: 12;
    top: 10px;
    right: 4px;
    bottom: 10px;
    width: 2px;
    border-radius: 999px;
    background: rgba(116,187,207,.045);
    pointer-events: none;
    transition: opacity .18s ease;
}
.story-scroll-track.is-hidden { opacity: 0; }
.story-scroll-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    min-height: 18px;
    border-radius: 999px;
    background: rgba(116,187,207,.22);
    will-change: transform;
}

/* After checking, colour alone explains the result and the arrow becomes the only next action. */
.story-combined-card .story-question-actions .story-check.is-hidden { display: none; }
.story-combined-card .story-question-actions .story-question-skip.ready-next {
    animation: storyNextPulse 1.15s ease-in-out infinite;
}
@keyframes storyNextPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .72; transform: scale(1.07); }
}
.story-combined-card .story-options .option-btn.correct {
    background: #24784f !important;
    color: #f1fff7;
}
.story-combined-card .story-options .option-btn.error {
    background: #9b3e45 !important;
    color: #fff3f3;
}
.story-combined-card .story-options .option-btn.correct .option-letter {
    background: #32a96d !important;
    color: #fff !important;
}
.story-combined-card .story-options .option-btn.error .option-letter {
    background: #ce535d !important;
    color: #fff !important;
}

/* Clear answer-state hierarchy: selected, correct, wrong and untouched. */
.story-combined-card .story-options .option-btn {
    position: relative;
    overflow: hidden;
    transition: opacity .22s ease, filter .22s ease, outline-color .22s ease, background-color .22s ease;
}
.story-combined-card .story-options .option-btn.selected:not(.correct):not(.error) {
    z-index: 2;
    outline: 3px solid rgba(133,231,246,.92);
    outline-offset: 2px;
    filter: brightness(1.22) saturate(1.18) !important;
}
.story-combined-card .story-options .option-btn.locked:not(.correct):not(.error) {
    opacity: .3;
    filter: brightness(.62) saturate(.38) !important;
}
.story-combined-card .story-options .option-btn.correct {
    z-index: 3;
    opacity: 1;
    outline: 2px solid rgba(86,255,168,.88);
    outline-offset: 1px;
    background: #168752 !important;
    box-shadow: 0 0 18px rgba(45,236,137,.64), inset 0 0 13px rgba(129,255,191,.18) !important;
    filter: brightness(1.14) saturate(1.2) !important;
}
.story-combined-card .story-options .option-btn.error {
    z-index: 3;
    opacity: 1;
    outline: 2px solid rgba(255,100,111,.9);
    outline-offset: 1px;
    background: #a72736 !important;
    box-shadow: 0 0 18px rgba(255,69,82,.62), inset 0 0 13px rgba(255,133,140,.16) !important;
    filter: brightness(1.12) saturate(1.18) !important;
}
.story-combined-card .story-options .option-btn.correct::after,
.story-combined-card .story-options .option-btn.error::after {
    content: '';
    position: absolute;
    z-index: 1;
    top: -40%;
    bottom: -40%;
    left: -38%;
    width: 24%;
    transform: skewX(-18deg);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
    animation: answerShine 1.45s ease-in-out infinite;
    pointer-events: none;
}
.story-combined-card .story-options .option-btn > * { position: relative; z-index: 2; }
@keyframes answerShine {
    0% { left: -38%; opacity: 0; }
    20% { opacity: .85; }
    70%, 100% { left: 122%; opacity: 0; }
}

/* Check is centred directly below the answer grid; next stays on the right. */
.story-combined-card .story-question-actions {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    margin-top: 9px;
}
.story-combined-card .story-question-actions .story-result { display: none; }
.story-combined-card .story-question-actions .story-check {
    position: relative;
    min-width: 138px;
    margin: 0;
    background: #16879a;
    border-color: rgba(110,235,240,.72);
    color: #f5ffff;
    transition: opacity .2s ease, filter .2s ease, box-shadow .2s ease;
}
.story-combined-card .story-question-actions .story-check:not(:disabled) {
    filter: brightness(1.18) saturate(1.14);
    box-shadow: 0 0 15px rgba(56,219,224,.46) !important;
    animation: checkReadyPulse 1.5s ease-in-out infinite;
}
.story-combined-card .story-question-actions .story-check:disabled {
    opacity: .48;
    filter: saturate(.55);
}
.story-combined-card .story-question-actions .story-question-skip {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}
.story-combined-card .story-question-actions .story-question-skip.ready-next {
    background: #1596a7;
    border-color: rgba(126,245,247,.82);
    box-shadow: 0 0 17px rgba(50,224,229,.58) !important;
    animation: nextReadyPulse 1.05s ease-in-out infinite;
}
@keyframes checkReadyPulse {
    0%, 100% { filter: brightness(1.12) saturate(1.08); }
    50% { filter: brightness(1.3) saturate(1.2); }
}
@keyframes nextReadyPulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: .78; transform: translateY(-50%) scale(1.1); }
}

/* Final result palette: blue for correct, red for wrong, with a flat scan stripe. */
.story-combined-card .story-options .option-btn.correct {
    outline-color: #5ab5ff;
    background: #176eb5 !important;
    box-shadow: none !important;
    filter: brightness(1.08) saturate(1.12) !important;
}
.story-combined-card .story-options .option-btn.correct .option-letter {
    background: #2398ed !important;
    color: #fff !important;
}
.story-combined-card .story-options .option-btn.error {
    outline-color: #ff7882;
    background: #a72d3c !important;
    box-shadow: none !important;
}
.story-combined-card .story-options .option-btn.error .option-letter {
    background: #d94b58 !important;
}
.story-combined-card .story-options .option-btn.correct::after,
.story-combined-card .story-options .option-btn.error::after {
    top: 0;
    bottom: 0;
    left: -22%;
    width: 12%;
    transform: none;
    background: rgba(117,201,255,.42);
    animation: flatAnswerScan 1.55s ease-in-out infinite;
}
.story-combined-card .story-options .option-btn.error::after {
    background: rgba(255,139,148,.4);
}
@keyframes flatAnswerScan {
    0%, 12% { left: -22%; opacity: 0; }
    25% { opacity: .72; }
    72%, 100% { left: 112%; opacity: 0; }
}

/* Apply the finished A/B/C/D system to every standard multiple-choice task. */
.question-card:not(.story-combined-card) .options-grid .option-btn {
    position: relative;
    overflow: hidden;
    min-height: 58px;
    border: 0 !important;
    border-radius: 14px;
    background-image: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: #f1f5f6;
    font-size: 1.06rem;
    font-weight: 700;
    transition: opacity .22s ease, filter .22s ease, outline-color .22s ease;
}
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(1) { background: #285e69 !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(2) { background: #78512e !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(3) { background: #58466f !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(4) { background: #703f53 !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn .option-letter {
    border: 0 !important;
    box-shadow: none !important;
    color: #fff !important;
    font-weight: 900;
}
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(1) .option-letter { background: #347d8b !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(2) .option-letter { background: #9a6b38 !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(3) .option-letter { background: #756093 !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(4) .option-letter { background: #92546d !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn.selected:not(.correct):not(.error) {
    z-index: 2;
    outline: 3px solid rgba(133,231,246,.92);
    outline-offset: 2px;
    filter: brightness(1.22) saturate(1.18) !important;
}
.question-card:not(.story-combined-card) .options-grid .option-btn.locked:not(.correct):not(.error) {
    opacity: .3;
    filter: brightness(.62) saturate(.38) !important;
}
.question-card:not(.story-combined-card) .options-grid .option-btn.correct {
    z-index: 3;
    opacity: 1;
    outline: 2px solid #5ab5ff;
    outline-offset: 1px;
    background: #176eb5 !important;
    filter: brightness(1.08) saturate(1.12) !important;
}
.question-card:not(.story-combined-card) .options-grid .option-btn.error {
    z-index: 3;
    opacity: 1;
    outline: 2px solid #ff7882;
    outline-offset: 1px;
    background: #a72d3c !important;
    filter: brightness(1.08) saturate(1.12) !important;
}
.question-card:not(.story-combined-card) .options-grid .option-btn.correct .option-letter { background: #2398ed !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn.error .option-letter { background: #d94b58 !important; }
.question-card:not(.story-combined-card) .options-grid .option-btn.correct::after,
.question-card:not(.story-combined-card) .options-grid .option-btn.error::after {
    content: '';
    position: absolute;
    z-index: 1;
    top: 0;
    bottom: 0;
    left: -22%;
    width: 12%;
    background: rgba(117,201,255,.42);
    animation: flatAnswerScan 1.55s ease-in-out infinite;
    pointer-events: none;
}
.question-card:not(.story-combined-card) .options-grid .option-btn.error::after { background: rgba(255,139,148,.4); }
.question-card:not(.story-combined-card) .options-grid .option-btn > * { position: relative; z-index: 2; }
.question-card:not(.story-combined-card) .check-result:empty { display: none; }
.question-card:not(.story-combined-card) .check-btn:not(:disabled) {
    background: #16879a;
    border: 1px solid rgba(110,235,240,.72);
    box-shadow: 0 0 15px rgba(56,219,224,.4);
    animation: checkReadyPulse 1.5s ease-in-out infinite;
}
#next-task.answer-ready {
    animation: standardNextReady 1.05s ease-in-out infinite;
}
@keyframes standardNextReady {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: .76; transform: translateY(-50%) scale(1.08); }
}

/* Certificate concept: a modern YAYA achievement card, not a formal diploma. */
.completion-view {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 28px;
    overflow: auto;
    background:
        radial-gradient(circle at 18% 15%, rgba(63,189,199,.12), transparent 30%),
        radial-gradient(circle at 82% 82%, rgba(123,84,190,.12), transparent 31%),
        #07131f;
}
.achievement-card {
    position: relative;
    width: min(1080px, 100%);
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(330px, .92fr) minmax(440px, 1.08fr);
    overflow: hidden;
    border: 1px solid rgba(140,199,216,.2);
    border-radius: 34px;
    background: #0b1b2a;
    color: #f5fbff;
}
.achievement-hero {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 42px 46px 38px;
    overflow: hidden;
    background: #123d52;
}
.achievement-hero::after {
    content: '';
    position: absolute;
    right: -92px;
    bottom: -104px;
    width: 310px;
    height: 310px;
    border: 58px solid rgba(89,220,215,.14);
    border-radius: 50%;
    pointer-events: none;
}
.achievement-brand {
    display: grid;
    grid-template-columns: 44px auto;
    grid-template-rows: 22px 18px;
    width: fit-content;
    align-items: center;
}
.achievement-brand > span {
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #ffd45e;
    color: #123043;
    font: 900 1.25rem/1 'Inter', sans-serif;
}
.achievement-brand strong { align-self: end; font-size: 1rem; letter-spacing: .08em; }
.achievement-brand small { align-self: start; color: #99c5d2; font-size: .58rem; letter-spacing: .17em; text-transform: uppercase; }
.achievement-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin-top: 56px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(102,225,201,.14);
    color: #9df0dc;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.achievement-status i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #5ed5b7; color: #123d52; font-size: .58rem; }
.achievement-overline { margin: 22px 0 7px; color: #8fbac8; font-size: .68rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.achievement-hero h1 { margin: 0; font: 850 clamp(2.7rem, 5vw, 4.6rem)/.94 'Inter', sans-serif; letter-spacing: -.055em; }
.achievement-hero h1 span { color: #ffd45e; }
.achievement-copy { max-width: 390px; margin: 22px 0 0; color: #bfd7df; font-size: .98rem; line-height: 1.62; }
.achievement-stars { margin-top: auto; padding-top: 28px; color: #ffd45e; font-size: 1.55rem; letter-spacing: 7px; filter: none; }

.achievement-summary {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 42px 44px 36px;
    background: #0b1b2a;
}
.achievement-summary-top { display: flex; align-items: center; justify-content: space-between; color: #7891a2; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.achievement-summary-top time { letter-spacing: .04em; text-transform: none; }
.achievement-score-area { display: grid; grid-template-columns: 190px 1fr; gap: 34px; align-items: center; margin-top: 54px; }
.achievement-score-ring {
    width: 184px;
    height: 184px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#5ed5b7 var(--score-angle), #1b3040 0);
}
.achievement-score-ring::before { content: ''; position: absolute; }
.achievement-score-ring > div {
    width: 146px;
    height: 146px;
    display: grid;
    place-content: center;
    text-align: center;
    border-radius: 50%;
    background: #0b1b2a;
}
.achievement-score-ring strong { font-size: 2.25rem; line-height: 1; }
.achievement-score-ring span { margin-top: 7px; color: #718b9d; font-size: .62rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.achievement-score-copy p { margin: 0 0 15px; color: #9df0dc; font-size: 1rem; font-weight: 750; }
.achievement-score-copy > strong { display: block; font-size: 2.8rem; line-height: 1; }
.achievement-score-copy > strong small { color: #647d8f; font-size: 1.1rem; font-weight: 650; }
.achievement-score-copy > span { display: block; margin-top: 8px; color: #718b9d; font-size: .65rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.achievement-skills { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 50px; }
.achievement-skills span { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 11px; background: #142a3a; color: #b8cbd6; font-size: .72rem; font-weight: 750; }
.achievement-skills i { color: #5ed5b7; }
.achievement-footer { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: end; margin-top: auto; padding-top: 30px; border-top: 1px solid rgba(143,190,207,.13); }
.achievement-footer div:first-child small, .achievement-footer div:first-child strong { display: block; }
.achievement-footer div:first-child small { color: #657f90; font-size: .58rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.achievement-footer div:first-child strong { margin-top: 4px; font-size: 1rem; }
.achievement-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #ffd45e; color: #142839; }
.achievement-again { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 15px; border: 0; border-radius: 12px; background: #1e7188; color: #f3fcff; font-size: .75rem; font-weight: 800; cursor: pointer; }
.achievement-again:hover { background: #2889a2; }

.achievement-confetti i { position: absolute; z-index: 4; width: 8px; height: 18px; border-radius: 3px; transform: rotate(28deg); pointer-events: none; }
.achievement-confetti i:nth-child(1) { top: 24px; left: 43%; background: #ffd45e; }
.achievement-confetti i:nth-child(2) { top: 57px; left: 47%; height: 9px; background: #5ed5b7; transform: rotate(72deg); }
.achievement-confetti i:nth-child(3) { top: 23px; right: 24px; background: #be8cff; transform: rotate(56deg); }
.achievement-confetti i:nth-child(4) { bottom: 29px; left: 32%; height: 10px; background: #ff789f; transform: rotate(76deg); }
.achievement-confetti i:nth-child(5) { bottom: 70px; right: 28px; background: #ffd45e; transform: rotate(-34deg); }
.achievement-confetti i:nth-child(6) { top: 42%; left: 18px; height: 9px; background: #63c7ef; transform: rotate(82deg); }

@media (max-width: 820px) {
    .completion-view { display: block; padding: 12px; }
    .achievement-card { grid-template-columns: 1fr; min-height: 0; border-radius: 24px; }
    .achievement-hero, .achievement-summary { padding: 28px 24px; }
    .achievement-status { margin-top: 34px; }
    .achievement-hero h1 { font-size: 3rem; }
    .achievement-stars { margin-top: 22px; }
    .achievement-score-area { grid-template-columns: 140px 1fr; gap: 22px; margin-top: 34px; }
    .achievement-score-ring { width: 136px; height: 136px; }
    .achievement-score-ring > div { width: 108px; height: 108px; }
    .achievement-score-ring strong { font-size: 1.65rem; }
    .achievement-skills { margin-top: 30px; }
    .achievement-footer { margin-top: 30px; }
}

/* Certificate v2: one stable composition with no overlapping layers. */
.completion-view,
.completion-view * { box-sizing: border-box; }
.completion-view {
    padding: clamp(12px, 3vw, 32px);
    background:
        radial-gradient(circle at 15% 12%, rgba(44, 187, 196, .12), transparent 31%),
        radial-gradient(circle at 88% 88%, rgba(115, 79, 183, .13), transparent 33%),
        #07131f;
}
.award-card {
    width: min(920px, 100%);
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: clamp(22px, 4vw, 42px);
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 3vw, 32px);
    border: 1px solid rgba(129, 190, 205, .22);
    border-radius: clamp(22px, 3vw, 32px);
    background: #0b1b2a;
    color: #f4fbff;
}
.award-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
    padding-bottom: 19px;
    border-bottom: 1px solid rgba(139, 191, 207, .14);
}
.award-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.award-brand-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: #ffd45e;
    color: #123043;
    font: 900 1.25rem/1 'Inter', sans-serif;
}
.award-brand > span:last-child { display: grid; gap: 2px; }
.award-brand strong { font-size: .92rem; letter-spacing: .045em; }
.award-brand small,
.award-header time { color: #7894a4; font-size: .65rem; font-weight: 750; letter-spacing: .08em; }
.award-header time { flex: 0 0 auto; }

.award-body {
    display: grid;
    grid-template-columns: minmax(0, 1.16fr) minmax(250px, .84fr);
    gap: clamp(18px, 3vw, 30px);
    align-items: stretch;
}
.award-message,
.award-result {
    min-width: 0;
    border-radius: 23px;
}
.award-message {
    padding: clamp(24px, 4vw, 40px);
    background: #123d52;
}
.award-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(95, 216, 190, .14);
    color: #9df0dc;
    font-size: .66rem;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
}
.award-status i {
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #5ed5b7;
    color: #123d52;
    font-size: .54rem;
}
.award-message > p { margin: 29px 0 0; color: #bbd4dc; font-size: clamp(1.05rem, 2vw, 1.35rem); font-weight: 700; }
.award-message h1 { margin: 2px 0 0; color: #ffd45e; font: 900 clamp(3rem, 7vw, 5rem)/.95 'Inter', sans-serif; letter-spacing: -.055em; overflow-wrap: anywhere; }
.award-stars { margin-top: 26px; color: #ffd45e; font-size: clamp(1.15rem, 2.5vw, 1.55rem); letter-spacing: 5px; }
.award-note { display: block; margin-top: 13px; color: #a9c7d1; font-size: .82rem; line-height: 1.5; }

.award-result {
    padding: clamp(24px, 4vw, 34px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #102839;
}
.award-result-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.award-result-title span { color: #8ea7b6; font-size: .67rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.award-result-title strong { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1; }
.award-progress { height: 10px; margin-top: 21px; overflow: hidden; border-radius: 999px; background: #20394a; }
.award-progress i { display: block; height: 100%; border-radius: inherit; background: #5ed5b7; }
.award-score-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; margin-top: 25px; }
.award-score-row strong { font-size: 2rem; line-height: 1; }
.award-score-row strong small { color: #668295; font-size: .9rem; }
.award-score-row > span { color: #7894a4; font-size: .67rem; font-weight: 750; line-height: 1.25; text-transform: uppercase; }
.award-result > p { margin: 18px 0 0; color: #9df0dc; font-size: .9rem; font-weight: 800; }

.award-skills { display: flex; flex-wrap: wrap; gap: 9px; }
.award-skills span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: #142b3b; color: #b8ccd7; font-size: .7rem; font-weight: 750; }
.award-skills i { color: #5ed5b7; }
.award-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(139, 191, 207, .14);
}
.award-teacher small,
.award-teacher strong { display: block; }
.award-teacher small { color: #668294; font-size: .58rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.award-teacher strong { margin-top: 3px; font-size: .92rem; }
.award-seal { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #ffd45e; color: #142839; }
.award-again { height: 40px; display: inline-flex; align-items: center; gap: 9px; padding: 0 15px; border: 0; border-radius: 12px; background: #1e7188; color: #f4fbff; font-size: .73rem; font-weight: 850; cursor: pointer; }
.award-again:hover { background: #2789a2; }

@media (max-width: 620px) {
    .completion-view { display: block; padding: 8px; }
    .award-card { max-height: none; min-height: calc(100dvh - 16px); padding: 20px; gap: 18px; border-radius: 22px; }
    .award-header { align-items: flex-start; }
    .award-header time { max-width: 105px; text-align: right; line-height: 1.35; }
    .award-body { grid-template-columns: 1fr; }
    .award-message { padding: 25px; }
    .award-result { padding: 24px; }
    .award-message > p { margin-top: 23px; }
    .award-message h1 { font-size: clamp(3rem, 16vw, 4.6rem); }
    .award-footer { grid-template-columns: 1fr auto; }
    .award-seal { display: none; }
}

@media (max-width: 390px) {
    .award-brand small { display: none; }
    .award-again span { display: none; }
    .award-again { width: 40px; justify-content: center; padding: 0; }
}

/* Final override: keep the story text genuinely scrollable. */
.story-combined-card .story-flow .reading-text-panel {
    height: clamp(210px, 39vh, 368px);
    max-height: clamp(210px, 39vh, 368px);
    overflow: hidden;
}
.story-combined-card .reading-text-panel .passage-content {
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: pan-y;
}

@media (max-width: 540px) {
    .story-combined-card .story-flow .reading-text-panel {
        height: min(38vh, 330px);
        max-height: min(38vh, 330px);
    }
}

/* Keep both story-question navigation arrows visually identical. */
.story-combined-card .story-question-actions .story-question-back,
.story-combined-card .story-question-actions .story-question-skip {
    position: absolute;
    top: 50%;
    width: 50px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(116, 205, 229, 0.42);
    border-radius: 14px;
    background: rgba(21, 105, 104, 0.38);
    color: #eafffc;
    box-shadow: none !important;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    font-size: 1.08rem;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color 0.16s ease, border-color 0.16s ease,
        transform 0.16s ease, opacity 0.16s ease;
}

.story-combined-card .story-question-actions .story-question-back {
    left: 0;
    right: auto;
}

.story-combined-card .story-question-actions .story-question-skip {
    right: 0;
    left: auto;
}

.story-combined-card .story-question-actions .story-question-back:hover:not(:disabled),
.story-combined-card .story-question-actions .story-question-skip:hover:not(:disabled) {
    background: rgba(27, 132, 130, 0.55);
    border-color: rgba(145, 224, 240, 0.65);
}

.story-combined-card .story-question-actions .story-question-back:active:not(:disabled),
.story-combined-card .story-question-actions .story-question-skip:active:not(:disabled) {
    transform: translateY(-50%) scale(0.9);
}

.story-combined-card .story-question-actions .story-question-back:disabled {
    visibility: hidden;
    pointer-events: none;
}

.story-combined-card .story-question-actions .story-question-skip.ready-next {
    background: rgba(21, 105, 104, 0.38);
    border-color: rgba(116, 205, 229, 0.42);
    box-shadow: none !important;
    animation: storyArrowReady 1.05s ease-in-out infinite;
}

@keyframes storyArrowReady {
    0%, 100% { transform: translateY(-50%) scale(1); opacity: 1; }
    50% { transform: translateY(-50%) scale(1.06); opacity: 0.82; }
}

@media (max-width: 540px) {
    .story-combined-card .story-question-actions .story-question-back,
    .story-combined-card .story-question-actions .story-question-skip {
        width: 42px;
        height: 38px;
        font-size: 0.95rem;
    }
}

/* Large student avatar beside regular task prompts. */
.question-card:not(.story-combined-card) .task-count {
    margin-left: auto;
}

.question-card:not(.story-combined-card) .mascot-voice-over {
    position: relative;
    align-items: flex-end;
    overflow: visible;
}

.question-card:not(.story-combined-card) {
    overflow: visible;
}

.question-card:not(.story-combined-card) .mascot-voice-over > img {
    position: relative;
    z-index: 2;
    width: 278px;
    max-width: none;
    margin-top: -181px;
    align-self: flex-end;
    transform-origin: bottom center;
    top: 28px;
}

@media (max-width: 540px) {
    .question-card:not(.story-combined-card) .mascot-voice-over > img {
        width: 206px;
        margin-top: -135px;
        top: 18px;
    }
}

/* One brighter A/B/C/D palette for story and standard questions. */
.story-combined-card .story-options .option-btn:nth-child(1):not(.correct):not(.error),
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(1):not(.correct):not(.error) {
    background: #1565c0 !important;
}
.story-combined-card .story-options .option-btn:nth-child(2):not(.correct):not(.error),
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(2):not(.correct):not(.error) {
    background: #d65a00 !important;
}
.story-combined-card .story-options .option-btn:nth-child(3):not(.correct):not(.error),
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(3):not(.correct):not(.error) {
    background: #b52a55 !important;
}
.story-combined-card .story-options .option-btn:nth-child(4):not(.correct):not(.error),
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(4):not(.correct):not(.error) {
    background: #12824f !important;
}
.story-combined-card .story-options .option-btn:nth-child(1):not(.correct):not(.error) .option-letter,
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(1):not(.correct):not(.error) .option-letter {
    background: #42a5f5 !important;
}
.story-combined-card .story-options .option-btn:nth-child(2):not(.correct):not(.error) .option-letter,
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(2):not(.correct):not(.error) .option-letter {
    background: #ff9800 !important;
}
.story-combined-card .story-options .option-btn:nth-child(3):not(.correct):not(.error) .option-letter,
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(3):not(.correct):not(.error) .option-letter {
    background: #e95782 !important;
}
.story-combined-card .story-options .option-btn:nth-child(4):not(.correct):not(.error) .option-letter,
.question-card:not(.story-combined-card) .options-grid .option-btn:nth-child(4):not(.correct):not(.error) .option-letter {
    background: #25b979 !important;
}

/* Telegram-like YAYA vector pattern: one small cached seamless asset. */
#star-field {
    opacity: 1;
    background-color: #071521;
    background-image: url("assets/yaya-homework-pattern.svg?v=7"), linear-gradient(150deg, #071521 0%, #0a1b2a 52%, #08131f 100%);
    background-repeat: repeat, no-repeat;
    background-size: 320px 296px, 100% 100%;
    background-position: 0 0, center;
    filter: none;
    transform: none;
}

.kinetic-grid,
.ribbon,
.halo {
    display: none !important;
}

@media (max-width: 540px) {
    #star-field {
        background-size: 276px 255px, 100% 100%;
    }
    .glass-header {
        height: 62px;
        padding: 0 16px;
    }
    .logo-small#portal-link { font-size: .96rem; }
    .student-header-logo { width: 40px; height: 40px; }
    .header-session-date { display: block !important; font-size: .72rem; }
}
