/* icon-cache-bust: 1785767300 */
/* ── Reset & Base ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/source-sans-3-latin-700-normal.woff2") format("woff2");
}

:root {
    --bg: #f6f9fa;
    --bg-surface: #ffffff;
    --bg-bubble-ai: #ffffff;
    --bg-bubble-user: #17394b;
    --bg-input: #ffffff;
    --text: #183747;
    --text-dim: #607985;
    --accent: #176c81;
    --accent-hover: #0c5265;
    --brand-ink: #17394b;
    --brand-gold: #f4c86e;
    --border: #d7e2e7;
    --surface: #ffffff;
    --correction-bg: #f2f8f5;
    --correction-border: #a2d0b4;
    --correction-original: #ad4a43;
    --correction-suggestion: #276a4a;
    --correction-note: #5d7067;
    --recording: #ef4444;
    --call-green: #22c55e;
    --call-red: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --font-sans: "Source Sans 3", system-ui, sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}
/* Sign-up and login are normal scrolling pages. The app shell above locks the
   page (html overflow hidden), and a body-level override alone cannot undo that:
   on phones the bottom of the sign-up steps (the Next button) was unreachable. */
html.page-scrolls { height: auto; overflow: auto; }

.hidden { display: none !important; }

/* ══════════ APP LAYOUT ══════════ */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* ── Header ── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}
header h1 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.3px;
}
.topic-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(112, 193, 220, 0.13);
    color: var(--accent);
    border-radius: var(--radius);
    font-weight: 500;
}
.btn-header {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.btn-header:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(112, 193, 220, 0.10);
}
.btn-icon { padding: 6px 8px; }
.btn-call-start {
    border-color: var(--call-green);
    color: var(--call-green);
}
.btn-call-start:hover {
    background: rgba(34, 197, 94, 0.12);
    color: var(--call-green);
    border-color: var(--call-green);
}

/* ── Topic Bar ── */
.topic-bar {
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
}
.topic-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 5px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}
.chip:hover {
    background: rgba(107, 138, 253, 0.12);
    color: var(--accent);
    border-color: var(--accent);
}

/* ── Chat Area ── */
main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
    min-height: 0;
}
#messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Fixed 1:1 corrections strip (mirrors debate side panel) ── */
.chat-corr-panel {
    flex-shrink: 0;
    max-height: min(120px, 18vh);
    overflow-y: auto;
    margin: 0 12px 6px;
    padding: 10px;
    background: var(--correction-bg);
    border: 1px solid var(--correction-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-corr-panel.is-empty {
    max-height: none;
}
.chat-corr-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--correction-suggestion);
    flex-shrink: 0;
}
.chat-corr-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-dim);
}
.chat-corr-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
}
.chat-corr-item {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px;
    font-size: 12px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.15);
    border-left: 3px solid var(--correction-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.45;
}
.chat-corr-empty { font-size: 12px; color: var(--text-dim); margin: 0; }

/* ── Messages ── */
.msg {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.msg-ai { align-self: flex-start; }
.msg-user { align-self: flex-end; }
.msg-system { align-self: center; max-width: 90%; }

.bubble {
    padding: 11px 15px;
    border-radius: var(--radius);
    line-height: 1.6;
    font-size: 15px;
    position: relative;
}
.msg-ai .bubble {
    background: var(--bg-bubble-ai);
    border-bottom-left-radius: 4px;
}
.msg-user .bubble {
    background: var(--bg-bubble-user);
    border-bottom-right-radius: 4px;
}
.msg-system .bubble {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    font-size: 13px;
    text-align: center;
}
.msg-label {
    display: block;
    font-size: 10px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bubble p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Replay Button ── */
.btn-replay {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-dim);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.bubble:hover .btn-replay { opacity: 1; }
.btn-replay:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

/* ── Corrections ── */
.corrections {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.corr-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--correction-suggestion);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.corr-title::before {
    content: '>';
    display: inline-block;
    transition: transform 0.2s;
    font-size: 10px;
}
.corrections.expanded .corr-title::before { transform: rotate(90deg); }
.corr-item {
    display: none;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
    margin-top: 6px;
    padding: 7px 9px;
    background: var(--correction-bg);
    border-left: 3px solid var(--correction-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
    line-height: 1.5;
}
.corrections.expanded .corr-item { display: flex; }
.corr-original { color: var(--correction-original); text-decoration: line-through; opacity: 0.8; }
.corr-arrow { color: var(--text-dim); font-size: 11px; }
.corr-suggestion { color: var(--correction-suggestion); font-weight: 500; }
.corr-note { display: block; width: 100%; color: var(--correction-note); font-size: 11px; margin-top: 2px; }

/* ── Media practice cards ── */
.media-practice-cards {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.media-practice-title {
    margin: 0 0 8px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
}
.media-practice-card {
    margin-top: 8px;
    padding: 9px;
    border-radius: var(--radius-sm);
    background: rgba(96, 165, 250, 0.1);
}
.media-practice-line {
    margin: 0;
    font-weight: 600;
}
.media-practice-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.media-practice-actions button {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}
.media-practice-actions button:hover { border-color: var(--accent); }
.media-practice-actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.media-practice-call-hint {
    margin: 7px 0 0;
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.4;
}

/* ── Typing Indicator ── */
.typing { display: flex; gap: 5px; padding: 12px 16px; }
.typing span {
    width: 7px; height: 7px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Footer / Input ── */
.app-footer,
footer.app-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    padding: 8px 14px 12px;
    background: var(--bg-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.footer-media-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.footer-compose {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.input-wrapper { flex: 1; min-width: 0; }
#input-message {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    color: var(--text);
    padding: 10px 14px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.5;
    max-height: 120px;
    transition: border-color 0.2s;
}
#input-message:focus { border-color: var(--accent); }
#input-message::placeholder { color: var(--text-dim); }

.btn-mic, .btn-send {
    width: 42px; height: 42px;
    border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
}
.btn-mic { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }
.btn-mic:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.btn-mic.recording {
    background: var(--recording); color: white;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}
.btn-send { background: var(--accent); color: white; }
.btn-send:hover { background: var(--accent-hover); }

/* ── Toast ── */
.toast {
    position: fixed; bottom: 100px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-bubble-ai); color: var(--text);
    padding: 8px 18px; border-radius: var(--radius-sm);
    font-size: 13px; opacity: 0; transition: all 0.3s;
    z-index: 2500; border: 1px solid rgba(255, 255, 255, 0.1);
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Scrollbar ── */
main::-webkit-scrollbar { width: 5px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

/* ══════════════════════════════════════════════ */
/*  CALL MODE                                     */
/* ══════════════════════════════════════════════ */

.call-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
}
.call-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.call-bg-blur {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--bg) 0%, #152038 40%, #0d1a2d 100%);
}
.call-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 30px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

/* Active call: full-height column — compact header, transcript fills the rest */
#call-active.call-screen {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}
#call-active .call-content-active {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    height: auto;
    max-height: none;
}

/* Compact horizontal header: avatar | timer + name + status */
#call-active .call-active-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    margin-bottom: 14px;
    padding-top: 6px;
}
#call-active .call-avatar {
    margin: 0;
    flex-shrink: 0;
}
#call-active .avatar-circle {
    width: 56px;
    height: 56px;
    font-size: 18px;
}
#call-active .call-avatar.speaking::after {
    top: -4px; left: -4px; right: -4px; bottom: -4px;
}
#call-active .call-active-meta {
    flex: 1;
    min-width: 0;
    text-align: left;
}
#call-active .call-timer {
    margin: 0 0 2px;
    font-size: 11px;
    opacity: 0.65;
    line-height: 1.2;
}
#call-active .call-name {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 2px;
    line-height: 1.25;
}
#call-active .call-status {
    font-size: 12px;
    margin: 0;
    min-height: 0;
    line-height: 1.2;
}
#call-active .mic-meter {
    width: 100%;
    max-width: none;
    height: 3px;
    margin: 0 0 18px; /* match gap below transcript */
    flex-shrink: 0;
}

/* Transcript fills leftover; equal 18px air above (mic-meter) and below */
#call-active .call-transcript {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    max-height: none;
    margin: 0 0 18px;
    padding: 14px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#call-active .call-transcript p {
    font-size: 17px;
    line-height: 1.55;
}

/* Over is now a circular control beside Speaker — see .over-btn */
#call-active .call-controls {
    margin-top: 0;
    gap: 18px;
    flex-shrink: 0;
    justify-content: center;
}
/* Same circle size for Over / Speaker / Mic / End */
#call-active .call-ctrl-btn svg {
    width: 56px;
    height: 56px;
    padding: 14px;
    box-sizing: border-box;
}
#call-active .over-btn svg {
    background: rgba(46, 204, 113, 0.22);
    color: #6ee7b7;
}
#call-active .over-btn:not(:disabled) svg {
    background: var(--call-green);
    color: #06281a;
}
#call-active .over-btn:disabled {
    opacity: 0.55;
    cursor: default;
}
#call-active .over-btn:disabled:hover { color: var(--text-dim); }
#call-active .over-btn:disabled:hover svg {
    background: rgba(46, 204, 113, 0.22);
    color: #6ee7b7;
}
#call-active .call-corr-panel {
    flex-shrink: 0;
    max-height: min(140px, 18vh);
    overflow-y: auto;
    margin: 0 0 10px;
    padding: 10px;
    background: var(--correction-bg);
    border: 1px solid var(--correction-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}
#call-active .call-corr-panel.is-empty {
    max-height: none;
}

/* ── Avatar ── */
.call-avatar {
    position: relative;
    margin-bottom: 20px;
}
.avatar-circle {
    width: 100px; height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    position: relative;
    z-index: 2;
}

/* Ringing animation */
.call-avatar.ringing .ring-wave {
    position: absolute;
    top: 50%; left: 50%;
    width: 100px; height: 100px;
    margin: -50px 0 0 -50px;
    border: 2px solid var(--call-green);
    border-radius: 50%;
    animation: ringPulse 2s ease-out infinite;
}
.call-avatar.ringing .ring-wave.delay {
    animation-delay: 0.5s;
}
@keyframes ringPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* Speaking animation */
.call-avatar.speaking .avatar-circle {
    animation: speakGlow 1.2s ease-in-out infinite;
}
.call-avatar.speaking::after {
    content: '';
    position: absolute;
    top: -8px; left: -8px; right: -8px; bottom: -8px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: speakRing 1.2s ease-in-out infinite;
}
@keyframes speakGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(107, 138, 253, 0.3); }
    50% { box-shadow: 0 0 40px rgba(107, 138, 253, 0.6); }
}
@keyframes speakRing {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

.call-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 6px;
}
.call-subtitle {
    color: var(--text-dim);
    font-size: 15px;
    margin-bottom: 50px;
}
.call-status {
    color: var(--call-green);
    font-size: 14px;
    margin-bottom: 16px;
    min-height: 20px;
}
/* Live mic input level — tick marks the speech detection threshold */
.mic-meter {
    position: relative;
    width: 180px;
    height: 6px;
    margin: 0 auto 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.mic-meter-fill {
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 3px;
    transition: width 0.1s linear;
}
.mic-meter-fill.speech { background: var(--call-green); }
.mic-meter-tick {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    border-radius: 1px;
    background: #fbbf24;
}

/* "Over to Tutor" — hand the turn to the AI immediately */
.btn-over-to-tutor {
    width: 100%;
    max-width: 320px;
    margin: 4px auto 14px;
    padding: 13px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: var(--call-green);
    color: #06281a;
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.08s;
    box-shadow: 0 4px 14px rgba(46, 204, 113, 0.3);
}
.btn-over-to-tutor:active { transform: scale(0.97); }
.btn-over-to-tutor:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
}
.btn-over-to-tutor .over-sub {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.8;
}
.call-timer {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 24px;
    font-variant-numeric: tabular-nums;
}

/* ── Incoming Call Actions ── */
.call-actions-incoming {
    display: flex;
    gap: 50px;
}
.call-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
    transition: transform 0.2s;
}
.call-btn:hover { transform: scale(1.08); }
.call-btn svg {
    width: 56px; height: 56px;
    padding: 14px;
    border-radius: 50%;
}
.call-btn.decline svg { background: var(--call-red); }
.call-btn.answer svg {
    background: var(--call-green);
    animation: answerPulse 2s infinite;
}
@keyframes answerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
}

/* ── Call Transcript ── */
.call-transcript {
    width: 100%;
    min-height: 160px;
    max-height: 375px;
    overflow-y: auto;
    margin: 10px 0 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.call-transcript p {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}
.call-transcript p.interim {
    color: var(--text-dim);
    font-style: italic;
}

/* ── Call Corrections (persistent strip under transcript) ── */
.call-corr-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--correction-suggestion);
    flex-shrink: 0;
}
.call-corr-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-dim);
}
.call-corr-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    min-height: 0;
}
.call-corr-item {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.15);
    border-left: 3px solid var(--correction-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 12px;
    line-height: 1.45;
}
.call-corr-empty { font-size: 12px; color: var(--text-dim); margin: 0; }

/* ── Call Controls ── */
.call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-top: 30px;
}
.call-ctrl-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 11px;
    transition: all 0.2s;
}
.call-ctrl-btn:hover { color: var(--text); }
.call-ctrl-btn svg {
    padding: 12px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s;
}
.call-ctrl-btn:hover svg { background: rgba(255, 255, 255, 0.14); }

.call-ctrl-btn.over-btn:disabled {
    opacity: 0.55;
    /* keep layout size; avoid opacity so low it disappears on dark bg */
}
.call-ctrl-btn.over-btn:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

/* Mic button in call */
.mic-btn svg { width: 60px; height: 60px; padding: 16px; }
.mic-btn.active svg {
    background: var(--call-green);
    color: white;
    animation: pulse 1.5s infinite;
}

/* End call button */
.end-btn svg {
    background: var(--call-red);
    color: white;
}
.end-btn:hover svg { background: #dc2626; }

/* Muted speaker */
.call-ctrl-btn.muted svg {
    background: rgba(239, 68, 68, 0.2);
    color: var(--call-red);
}

@media (max-height: 720px) {
    #call-active .call-content-active {
        padding: 14px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    }
    #call-active .call-active-top { margin-bottom: 10px; gap: 12px; }
    #call-active .avatar-circle { width: 48px; height: 48px; font-size: 16px; }
    #call-active .call-name { font-size: 16px; }
    #call-active .mic-meter { margin-bottom: 14px; }
    #call-active .call-transcript { margin-bottom: 14px; }
    #call-active .call-controls { gap: 14px; }
    .call-subtitle { margin-bottom: 24px; } /* incoming only */
}
@media (max-height: 640px) {
    #call-active .call-transcript p { font-size: 16px; }
    #call-active .call-controls { gap: 12px; }
}

/* ══════════════════════════════════════════════ */
/*  VOICE & SPEED CONTROLS                        */
/* ══════════════════════════════════════════════ */
.voice-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.voice-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    outline: none;
    max-width: 90px;
}
.voice-select:hover { border-color: var(--accent); }
.voice-select option { background: var(--bg-surface); color: var(--text); }
#speed-slider {
    width: 60px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
#speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
#speed-label {
    font-size: 10px;
    color: var(--text-dim);
    min-width: 28px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════ */
/*  MODAL (Session Report)                        */
/* ══════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--bg-surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-header h2 {
    font-size: 17px;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ══════════════════════════════════════════════ */
/*  CELEBRATION OVERLAY (post-session cards)      */
/*  Keep this above other dialogs while it is open. */
/*  It is hidden before the report modal opens.    */
/* ══════════════════════════════════════════════ */
.celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: linear-gradient(160deg, #1a2744 0%, #243556 45%, #1e3a5f 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    animation: fadeIn 0.2s ease;
}
.celebration-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.celebration-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }

.celebration-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
}
.celebration-progress[hidden] { display: none; }
.celebration-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease, transform 0.2s ease;
}
.celebration-dot.active { background: var(--accent); transform: scale(1.3); }

.celebration-body {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 180px;
    justify-content: center;
}

.celebration-preparing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text);
    letter-spacing: 0.02em;
}
.celebration-preparing-text {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
}
.celebration-preparing-hint {
    font-size: 13px;
    color: #cbd5e1;
}
.celebration-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--accent-hover);
    animation: celebrationSpin 0.85s linear infinite;
}
@keyframes celebrationSpin {
    to { transform: rotate(360deg); }
}

.celebration-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.celebration-card.celebration-card-enter { animation: celebrationCardIn 0.35s ease; }
@keyframes celebrationCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.celebration-emoji { font-size: 36px; margin-bottom: 10px; line-height: 1; }
.celebration-headline {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.25;
}
.celebration-sub {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 16px;
    line-height: 1.45;
}
.celebration-score {
    font-size: 52px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 12px;
}
.celebration-score-unit { font-size: 18px; font-weight: 600; margin-left: 4px; color: var(--text-dim); }
.celebration-score-small {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.celebration-streak-chip {
    display: block;
    width: fit-content;
    margin-inline: auto;
    margin-top: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fb923c;
    background: rgba(251, 146, 60, 0.12);
    border: 1px solid rgba(251, 146, 60, 0.22);
    border-radius: 999px;
}
.celebration-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--accent-hover);
    margin-bottom: 8px;
}
.celebration-expr {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.celebration-expr-meaning {
    font-size: 18px;
    color: #e2e8f0;
    margin-bottom: 12px;
    line-height: 1.45;
}
.celebration-expr-example {
    font-size: 16px;
    color: #cbd5e1;
    font-style: italic;
    line-height: 1.5;
}
.celebration-strength,
.celebration-next {
    font-size: 16px;
    color: var(--text);
    line-height: 1.6;
}
.celebration-error {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
}
.celebration-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-top: 24px;
}
.celebration-overlay.is-preparing .celebration-actions .btn-primary {
    visibility: hidden;
    pointer-events: none;
}
.celebration-actions .btn-secondary,
.celebration-actions .btn-primary {
    flex: 1;
}
@media (max-width: 480px) {
    .celebration-headline { font-size: 20px; }
    .celebration-score { font-size: 44px; }
}

/* ── Shadowing review (from the session report) ── */
.report-shadow-cta {
    margin: 0 0 18px;
    padding: 14px;
    border-radius: var(--radius);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    text-align: center;
}
.btn-shadow-start {
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}
.btn-shadow-start:hover { filter: brightness(1.08); }
.btn-shadow-start:active { transform: scale(0.985); }
.report-shadow-hint {
    margin: 8px 2px 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-dim);
}

/* Sit above the report modal it launches from. */
#shadow-overlay { z-index: 2600; }
.shadow-modal { max-width: 540px; }
.shadow-body { display: flex; flex-direction: column; gap: 14px; }
.shadow-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.shadow-kind {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.shadow-progress {
    font-size: 12px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.shadow-was {
    font-size: 13px;
    color: #f87171;
    text-decoration: line-through;
    opacity: 0.8;
}
.shadow-target {
    font-size: 22px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.2px;
}
.shadow-target .sw {
    transition: color 0.15s ease, background 0.15s ease;
    border-radius: 4px;
    padding: 0 1px;
}
.shadow-target .sw.hit { color: #6ee7b7; }
.shadow-target .sw.miss { color: #f87171; background: rgba(248, 113, 113, 0.12); }
.shadow-hint {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-dim);
}
.shadow-controls {
    display: flex;
    gap: 10px;
}
.shadow-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--bg-elevated, rgba(255, 255, 255, 0.05));
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.shadow-btn:hover { border-color: rgba(255, 255, 255, 0.28); }
.shadow-btn:active { transform: scale(0.98); }
.shadow-listen.playing {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}
.shadow-record.recording {
    background: rgba(248, 113, 113, 0.18);
    border-color: #f87171;
    animation: shadowPulse 1.1s ease-in-out infinite;
}
@keyframes shadowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0); }
}
.shadow-result {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.shadow-attempt-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.shadow-attempt {
    font-size: 15px;
    color: var(--text);
    min-height: 20px;
}
.shadow-score {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 10px;
}
.shadow-score-num { font-size: 22px; font-weight: 800; }
.shadow-score-sub { font-size: 13px; color: var(--text-dim); }
.shadow-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}
.shadow-nav-btn {
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.shadow-nav-btn:disabled { opacity: 0.35; cursor: default; }
.shadow-nav-btn.shadow-next {
    background: var(--accent);
    color: #fff;
    border: none;
}

/* ── Review chooser (shadow past learning) ── */
.review-modal { max-width: 520px; }
.review-body { display: flex; flex-direction: column; gap: 16px; }
.review-cta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.16);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: filter 0.15s ease, transform 0.1s ease;
}
.review-cta:hover { filter: brightness(1.08); }
.review-cta:active { transform: scale(0.99); }
.review-cta-title { font-size: 16px; font-weight: 700; }
.review-cta-sub { font-size: 12px; color: var(--text-dim); }
.review-list-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}
.review-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 42vh;
    overflow-y: auto;
}
.review-empty {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-dim);
    padding: 8px 2px;
}
.review-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.review-item:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); }
.review-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.review-item-date { font-size: 13px; font-weight: 600; }
.review-item-topic {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.review-item-count {
    font-size: 12px;
    font-weight: 600;
    color: #6ee7b7;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Wordbook ── */
.wordbook-modal { max-width: 520px; }
.wordbook-intro { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.5; }
.wordbook-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.wordbook-empty { font-size: 13px; color: var(--text-dim); }
.wordbook-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 12px; border-radius: var(--radius);
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
}
.wordbook-item.is-important {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.08);
}
.wordbook-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wordbook-expr { font-size: 15px; font-weight: 700; color: var(--text); }
.wordbook-meaning { font-size: 13px; color: var(--text-dim); }
.wordbook-example { font-size: 13px; color: #6ee7b7; font-style: italic; display: block; line-height: 1.45; }
.wordbook-item-actions { display: flex; flex-direction: column; gap: 4px; }
.wordbook-star, .wordbook-del {
    background: none; border: none; color: var(--text-dim);
    font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.wordbook-star { color: #a8a29e; }
.wordbook-star.is-on { color: #f59e0b; }
.wordbook-del:hover { color: #f87171; }

/* ── YouTube recommendations ── */
.youtube-modal { max-width: 540px; }
.youtube-disclaimer { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.youtube-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.yt-filter {
    padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.15);
    background: transparent; color: var(--text); font-size: 12px; cursor: pointer;
}
.yt-filter.active { background: rgba(96,165,250,0.25); border-color: #60a5fa; }
.youtube-section-title { font-size: 13px; font-weight: 700; margin: 12px 0 8px; }
.youtube-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.youtube-item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 14px; border-radius: var(--radius); text-decoration: none;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text); transition: background 0.15s ease;
}
.youtube-item:hover { background: rgba(255,255,255,0.08); }
.youtube-item-title { font-size: 14px; font-weight: 600; }
.youtube-item-meta { font-size: 11px; color: var(--text-dim); text-transform: capitalize; }
.youtube-item-note { font-size: 12px; color: #93c5fd; }
.youtube-empty { font-size: 13px; color: var(--text-dim); }

/* ── Ambient wordbook (idle overlay) ── */
.ambient-overlay {
    position: fixed; inset: 0; z-index: 2800;
    background: rgba(8, 14, 24, 0.88);
    display: flex; align-items: center; justify-content: center;
    padding: 24px; animation: fadeIn 0.4s ease;
}
.ambient-overlay.hidden { display: none; }
.ambient-card {
    max-width: 460px; width: 100%; text-align: center;
    padding: 32px 28px 28px; border-radius: var(--radius);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
.ambient-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 18px;
}
.ambient-label { font-size: 13px; color: #64748b; font-weight: 500; }
.ambient-progress { font-size: 12px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.ambient-expr {
    font-size: 20px; font-weight: 700; color: #0f172a;
    line-height: 1.5; margin-bottom: 12px;
}
.ambient-meaning {
    font-size: 17px; color: #334155; line-height: 1.55;
    margin-bottom: 16px;
}
.ambient-examples { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.ambient-examples.hidden { display: none; }
.ambient-example-line {
    font-size: 21px; color: #15803d; font-style: italic; line-height: 1.55;
    margin: 0; padding: 0 2px;
}
.ambient-important-badge {
    display: inline-block; margin-left: 6px;
    font-size: 12px; font-weight: 700; color: #b45309;
    background: #fef3c7; padding: 2px 8px; border-radius: 999px;
}
.ambient-important-badge.hidden { display: none; }
.ambient-actions {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.ambient-action-btn {
    appearance: none; border: 1px solid #fbbf24; background: #fffbeb;
    color: #92400e; font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: var(--radius); cursor: pointer; line-height: 1.2;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.ambient-action-btn.is-on {
    border-color: #f59e0b; background: #fef3c7; color: #b45309;
}
.ambient-action-danger {
    border-color: #fca5a5; background: #fef2f2; color: #b91c1c;
}
.ambient-action-btn:active { filter: brightness(0.96); }
.ambient-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.ambient-nav-btn, .ambient-shuffle-btn {
    appearance: none; border: 1px solid #cbd5e1; background: #f8fafc;
    color: #0f172a; font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
    line-height: 1.2;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.ambient-nav-btn:active, .ambient-shuffle-btn:active { background: #e2e8f0; }
.ambient-shuffle-btn {
    border-color: var(--accent); background: #eff6ff; color: var(--accent);
}
.ambient-read-btn {
    appearance: none; border: 1px solid var(--accent); background: #eff6ff;
    color: var(--accent); font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
    line-height: 1.2;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.ambient-read-btn.is-on {
    border-color: var(--accent); background: #dbeafe; color: var(--accent);
}
.ambient-read-btn:active { background: #bfdbfe; }
.ambient-btn-icon {
    width: 16px; height: 16px; flex: 0 0 16px;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}
.ambient-btn-icon.hidden { display: none; }
.ambient-hint { font-size: 12px; color: #94a3b8; }
.ambient-tap-prompt {
    appearance: none; display: block; width: 100%;
    margin: 0 0 16px; padding: 14px 16px;
    border: 1px solid var(--accent); border-radius: var(--radius);
    background: var(--accent); color: #ffffff;
    font-size: 16px; font-weight: 700; cursor: pointer;
    animation: ambientTapPulse 1.6s ease-in-out infinite;
}
.ambient-tap-prompt.hidden { display: none; }
@keyframes ambientTapPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }

/* ── Report Loading ── */
.report-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--text-dim);
}
.report-loading .typing { justify-content: center; margin-bottom: 12px; }
.report-loading p { font-size: 14px; }

.report-error {
    text-align: center;
    padding: 30px;
    color: #fca5a5;
    font-size: 14px;
}

/* ── Report Score ── */
.report-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}
.score-basis {
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.9;
}
.score-circle {
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 3px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.score-num {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}
.score-label {
    font-size: 11px;
    color: var(--text-dim);
}
.report-streak-chip {
    display: block;
    width: fit-content;
    margin-inline: auto;
    margin-top: -8px;
    margin-bottom: 16px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #fb923c;
    background: rgba(251, 146, 60, 0.12);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 999px;
}

/* ── Report Sections ── */
.report-section {
    margin-bottom: 20px;
}
.report-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.report-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
}
.report-section ul {
    list-style: none;
    padding: 0;
}
.report-section li {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    padding: 4px 0 4px 16px;
    position: relative;
}
.report-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ── Mistakes ── */
.report-mistakes-details summary {
    list-style: none;
    cursor: pointer;
}
.report-mistakes-details summary::-webkit-details-marker {
    display: none;
}
.report-mistakes-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.report-mistakes-details {
    padding: 2px 0;
}
.report-count-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.22);
}
.report-mistake-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(239, 68, 68, 0.06);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--correction-original);
}
.mistake-original {
    color: var(--correction-original);
    text-decoration: line-through;
    font-size: 14px;
    opacity: 0.85;
}
.mistake-arrow {
    color: var(--text-dim);
    font-size: 10px;
    margin: 2px 0;
}
.mistake-corrected {
    color: var(--correction-suggestion);
    font-weight: 500;
    font-size: 14px;
}
.mistake-explanation {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 4px;
}

/* ── Expressions ── */
.report-expr-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(107, 138, 253, 0.06);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}
.expr-eng {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
}
.expr-meaning {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}
.expr-example {
    font-size: 12px;
    color: var(--text);
    font-style: italic;
    margin-top: 4px;
    opacity: 0.8;
}

/* ── Homework ── */
.report-homework {
    background: rgba(107, 138, 253, 0.05);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(107, 138, 253, 0.2);
}

/* ── User badge / Logout ── */
.user-badge {
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: var(--radius);
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}
.admin-qa-badge {
    background: #64748b;
    color: #fff;
    padding: 2px 6px;
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
}
.btn-logout {
    color: #f87171 !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
}
.btn-logout:hover { background: rgba(248, 113, 113, 0.15) !important; }

/* ══════════════════════════════════════
   HELP & MENU BUTTONS
   ══════════════════════════════════════ */
.btn-help-trigger {
    color: var(--accent) !important;
    border-color: var(--accent) !important;
    font-weight: 700;
    width: 30px;
    height: 30px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    font-size: 15px;
}
.btn-help-trigger:hover {
    background: rgba(107, 138, 253, 0.15) !important;
}
.btn-menu-toggle {
    display: none;
    width: 30px;
    height: 30px;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center;
    justify-content: center;
}

/* ══════════════════════════════════════
   MOBILE DROPDOWN MENU
   ══════════════════════════════════════ */
.mobile-menu {
    position: absolute;
    top: 54px;
    right: 12px;
    width: 240px;
    max-height: min(calc(100dvh - 64px), calc(100vh - 64px));
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 500;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: menuSlide 0.15s ease;
}
@keyframes menuSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.mobile-menu-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 499;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    font-family: inherit;
}
.menu-item:hover,
.menu-item:active { background: rgba(255, 255, 255, 0.06); }
.menu-item-danger { color: #f87171 !important; }
.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0;
}
.menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.menu-icon svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Mobile speed slider in menu */
.menu-speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}
.menu-slider {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    max-width: 120px;
}
.menu-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* ══════════════════════════════════════
   HELP MODAL CONTENT
   ══════════════════════════════════════ */
.help-modal {
    max-width: 480px;
}
.help-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin: 20px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.help-content h3:first-child { margin-top: 0; }
.help-content p,
.help-content li {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text);
}
.help-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.help-content li {
    padding: 2px 0 2px 20px;
    position: relative;
}
.help-content li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: var(--accent);
}
.help-content .help-tip {
    background: rgba(107, 138, 253, 0.08);
    border: 1px solid rgba(107, 138, 253, 0.15);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 16px;
}
.help-content .help-tip h3 {
    margin-top: 0;
    margin-bottom: 6px;
}
.help-content .help-tip li {
    font-size: 13px;
    color: var(--text-dim);
}

/* ══════════════════════════════════════
   LOGIN PAGE (Dashboard)
   ══════════════════════════════════════ */
.login-body {
    background: #f0f2f7 !important;
    font-family: var(--font-sans);
    overflow: auto !important;
    height: auto !important;
}
.dash-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 24px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.dash-header { text-align: center; margin-bottom: 28px; }
.dash-logo {
    width: 72px;
    height: 72px;
    display: block;
    object-fit: cover;
    border-radius: 18px;
    margin: 0 auto 10px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22);
    border: 1px solid #e2e8f0;
    background: #ffffff;
}
.dash-header h1 { font-size: 22px; font-weight: 700; color: #1e293b; }
.dash-subtitle { color: #64748b; font-size: 14px; margin-top: 4px; }

.dash-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 10px;
    padding-left: 4px;
    font-weight: 600;
    width: 100%;
}

/* Family grid */
.dash-family-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}
.dash-member-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-member-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}
.dash-member-card.selected {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);
    background: #eff6ff;
}
.dash-member-card.waiting { opacity: 0.55; cursor: default; }
.dash-member-card.waiting:hover {
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transform: none;
}

.dash-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: white;
    flex-shrink: 0;
}
.dash-avatar.empty {
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    color: #94a3b8;
}
.dash-member-info { flex: 1; min-width: 0; }
.dash-member-name { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 3px; }
.dash-member-stats { display: flex; gap: 10px; font-size: 12px; color: #64748b; }
.dash-stat { display: flex; align-items: center; gap: 3px; }
.dash-waiting-badge {
    font-size: 11px; color: #94a3b8;
    background: #f1f5f9; padding: 2px 8px; border-radius: var(--radius);
}

/* Activity */
.dash-activity {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 5px; flex-shrink: 0;
}
.dash-streak { font-size: 13px; font-weight: 600; }
.dash-streak.hot { color: #ea580c; }
.dash-streak.cold { color: #94a3b8; }
.dash-week-dots { display: flex; gap: 3px; }
.dash-week-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #e2e8f0;
}
.dash-week-dot.active { background: #34d399; }
.dash-week-dot.today { background: var(--accent); box-shadow: 0 0 6px rgba(59, 130, 246, 0.4); }

/* Level chart */
.dash-level-section { width: 100%; margin-top: 4px; margin-bottom: 20px; }
.dash-level-chart {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 18px 16px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-chart-title { font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 16px; }
.dash-level-track { position: relative; height: 56px; margin-bottom: 8px; }
.dash-track-bar {
    position: absolute; bottom: 12px; left: 0; right: 0;
    height: 8px;
    background: linear-gradient(90deg, #fca5a5, #fcd34d, #86efac, #93c5fd, #3b82f6);
    border-radius: 4px;
}
.dash-level-labels {
    display: flex; justify-content: space-between; padding: 0 2px;
}
.dash-level-labels span {
    font-size: 10px; font-weight: 600; color: #94a3b8;
    text-align: center; width: 30px;
}
.dash-track-marker {
    position: absolute; bottom: 22px;
    display: flex; flex-direction: column; align-items: center;
    transform: translateX(-50%); transition: all 0.3s;
}
.dash-marker-name {
    font-size: 10px; font-weight: 700; padding: 2px 6px;
    border-radius: var(--radius-sm); color: white;
    margin-bottom: 4px; white-space: nowrap;
}
.dash-marker-pin {
    width: 12px; height: 12px; border-radius: 50%;
    border: 2.5px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* PIN section */
.dash-pin-section {
    width: 100%; text-align: center; margin-bottom: 20px;
    background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: var(--radius); padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    animation: fadeIn 0.3s ease;
}
.dash-pin-label { color: #64748b; font-size: 14px; margin-bottom: 12px; }
.dash-pin-label strong { color: #1e293b; }
.dash-pin-input {
    background: #f8fafc; border: 2px solid #e2e8f0; border-radius: var(--radius);
    color: #1e293b; font-size: 28px; font-weight: 700;
    text-align: center; letter-spacing: 12px;
    padding: 12px 16px; width: 180px; outline: none;
}
.dash-pin-input:focus { border-color: var(--accent); }
.dash-pin-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.dash-pin-error { color: #ef4444; font-size: 13px; margin-top: 8px; }
.dash-btn-primary {
    background: var(--accent); color: #fff; border: none; border-radius: var(--radius);
    padding: 10px 24px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: opacity 0.2s;
}
.dash-btn-primary:hover { opacity: 0.9; }
.dash-btn-secondary {
    background: transparent; color: #64748b;
    border: 1px solid #e2e8f0; border-radius: var(--radius);
    padding: 10px 24px; font-size: 14px; cursor: pointer;
}
.dash-btn-secondary:hover { background: #f8fafc; }
.dash-btn-new {
    display: block; width: 100%; padding: 13px;
    background: #ffffff; border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius); color: var(--accent);
    font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.dash-btn-new:hover { border-color: var(--accent); background: #eff6ff; }
.dash-qa-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed #e2e8f0;
}
.dash-qa-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.dash-qa-buttons .dash-btn-secondary {
    flex: 1 1 auto;
    min-width: 88px;
}

/* A single, familiar sign-in form, shared visually with the setup flow. */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: #f1f5fb !important;
}
.auth-card {
    width: min(100%, 420px);
    padding: 36px 32px;
    border: 1px solid #dfe7f1;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 44px rgba(28, 75, 133, 0.08);
    color: #182a43;
}
.auth-brand {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
}
.auth-mark {
    display: block;
    margin: 0 auto 18px;
    border-radius: 15px;
    background: #1c4b85;
}
.auth-eyebrow {
    margin-bottom: 8px;
    color: #1c4b85;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .18em;
}
.auth-brand h1 { font-size: 23px; line-height: 1.25; letter-spacing: -.025em; }
.auth-brand h1 span { display: block; margin-top: 4px; font-size: 16px; font-weight: 600; }
.auth-intro { margin: 14px 0 26px; color: #52657d; font-size: 13px; line-height: 1.6; }
.auth-form label { display: block; margin: 16px 0 7px; font-size: 13px; font-weight: 700; }
.auth-form label span { color: #607189; font-weight: 500; }
.auth-form input {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid #cbd8e7;
    border-radius: 10px;
    background: #f8faff;
    color: #182a43;
    font: inherit;
    font-size: 16px;
}
.auth-form input:focus-visible, .auth-card button:focus-visible {
    outline: 3px solid rgba(28, 75, 133, .25);
    outline-offset: 2px;
}
.auth-form input:focus { border-color: #1c4b85; background: #fff; }
.auth-error { margin-top: 12px; color: #ad352d; font-size: 13px; line-height: 1.5; }
.auth-submit, .auth-create {
    width: 100%;
    min-height: 48px;
    border-radius: 11px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.auth-submit { margin-top: 22px; border: 0; background: #1c4b85; color: #fff; }
.auth-submit:hover { background: #163e70; }
.auth-submit:disabled, .auth-qa button:disabled { opacity: .55; cursor: wait; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 27px 0 17px; color: #74849a; font-size: 10px; font-weight: 700; letter-spacing: .05em; white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: #e1e8f1; }
.auth-create { border: 1px solid #b9cde4; background: #fff; color: #1c4b85; }
.auth-create:hover { background: #f3f7fc; }
.auth-qa { margin-top: 24px; padding-top: 18px; border-top: 1px solid #e1e8f1; text-align: center; }
.auth-qa > p:first-child { color: #65758c; font-size: 12px; margin-bottom: 10px; }
.auth-qa-actions { display: flex; gap: 8px; }
.auth-qa-actions button { flex: 1; min-height: 40px; border: 1px solid #d2deeb; border-radius: 8px; background: #f8faff; color: #1c4b85; cursor: pointer; }
@media (max-width: 440px) { .auth-card { padding: 30px 22px; } }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none; border-radius: var(--radius);
    padding: 10px 24px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 24px;
    font-size: 14px;
    cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.05); }
.btn-full { width: 100%; }
.btn-small {
    background: var(--accent);
    color: #fff;
    border: none; border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
}

.btn-new-user {
    background: transparent;
    color: var(--accent);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 14px 28px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    width: 100%; max-width: 300px;
}
.btn-new-user:hover { border-color: var(--accent); background: rgba(107, 138, 253, 0.06); }

/* ══════════════════════════════════════
   ONBOARDING PAGE
   ══════════════════════════════════════ */
.onboard-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    min-height: 100vh;
}
.onboard-progress {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 32px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.onboard-step h2 { font-size: 20px; margin-bottom: 4px; }
.step-desc { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px; font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.form-input:focus { border-color: var(--accent); }
.form-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: block; }
.form-error { color: #f87171; font-size: 13px; margin-bottom: 12px; }

.step-nav { display: flex; gap: 12px; margin-top: 24px; }
.step-nav .btn-primary { flex: 1; }
.step-nav .btn-secondary { flex: 0 0 auto; }

/* Interest grid */
.interest-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 16px;
}
.interest-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer; transition: all 0.2s;
}
.interest-chip:hover { border-color: var(--accent); }
.interest-chip.selected {
    background: rgba(107, 138, 253, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}
.interest-chip.custom { font-style: italic; }
.custom-interest { display: flex; gap: 8px; margin-bottom: 24px; }
.custom-interest .form-input { flex: 1; }

/* Assessment chat */
.assessment-chat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 320px;
    overflow-y: auto;
    padding: 16px;
    margin-bottom: 12px;
}
.assessment-messages { display: flex; flex-direction: column; gap: 10px; }
.assess-msg {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    max-width: 85%;
    line-height: 1.5;
}
.assess-ai {
    background: rgba(107, 138, 253, 0.12);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.assess-user {
    background: rgba(255, 255, 255, 0.08);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.assess-system { color: #f87171; font-size: 12px; align-self: center; }
.assess-ai:hover .btn-replay { opacity: 1; }

.assessment-input-area { display: flex; flex-direction: row; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.assessment-input-area .btn-mic { width: 38px; height: 38px; flex-shrink: 0; }
.assessment-input-area textarea { flex: 1; min-width: 0; }
.assessment-buttons { display: flex; gap: 8px; }
.assessment-buttons .btn-primary { flex: 1; }
.btn-accent {
    background: #22c55e;
    color: #fff;
    border: none; border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
}
.btn-accent:hover { opacity: 0.9; }
.btn-accent:disabled { opacity: 0.5; }

/* Results */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    margin: 24px 0;
}
.result-level { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.result-score { margin-bottom: 16px; }
.score-big { font-size: 48px; font-weight: 700; }
.score-label { font-size: 18px; color: var(--text-dim); }
.result-summary { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.result-details { text-align: left; }
.result-section { margin-bottom: 16px; }
.result-section h4 { font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.result-section ul { list-style: none; padding: 0; }
.result-section li {
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-dim);
    padding-left: 16px;
    position: relative;
}
.result-section li::before {
    content: '•';
    position: absolute; left: 0;
    color: var(--accent);
}

/* Setup uses the same quiet card language as sign-in. */
.onboarding-body {
    min-height: 100vh;
    height: auto !important;
    overflow: auto !important;
    background: #f1f5fb;
    color: #182a43;
}
.onboarding-body .onboard-container {
    max-width: 560px;
    min-height: auto;
    margin: 28px auto;
    padding: 32px;
    border: 1px solid #dfe7f1;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 44px rgba(28, 75, 133, .08);
}
.onboard-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 26px; }
.onboard-brand { color: #1c4b85; font-weight: 800; letter-spacing: -.02em; }
.onboard-topline a { color: #1c4b85; font-size: 13px; font-weight: 700; text-decoration: none; }
.onboard-topline a:hover { text-decoration: underline; }
.onboard-step-label { margin-bottom: 10px; color: #52657d; font-size: 12px; font-weight: 700; }
.onboarding-body .onboard-progress { background: #e1e8f1; margin-bottom: 30px; }
.onboarding-body .progress-fill { background: #1c4b85; }
.onboarding-body .onboard-step h2 { color: #182a43; font-size: 23px; line-height: 1.25; }
.onboarding-body .step-desc { color: #52657d; line-height: 1.5; }
.onboard-language-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.onboard-language-choice {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
    min-height: 122px; padding: 17px;
    border: 1px solid #cbd8e7; border-radius: 13px;
    background: #f8faff; color: #182a43;
    text-align: left; cursor: pointer;
}
.onboard-language-choice:hover { border-color: #1c4b85; background: #edf4fc; }
.onboard-language-choice strong { font-size: 23px; line-height: 1.2; }
.onboard-language-choice span { margin-top: 9px; color: #52657d; font-size: 12px; }
.onboarding-body .form-group label { color: #354c68; }
.onboarding-body .form-input {
    min-height: 44px; border-color: #cbd8e7; background: #f8faff;
    color: #182a43; font-size: 16px;
}
.onboarding-body .form-input:focus { border-color: #1c4b85; background: #fff; }
.onboarding-body .form-hint { color: #65758c; }
.onboarding-body .form-error, .onboarding-body .assess-system { color: #ad352d; }
.onboarding-body .btn-primary { background: #1c4b85; }
.onboarding-body .btn-secondary { border-color: #cbd8e7; color: #354c68; }
.onboarding-body .btn-secondary:hover { background: #f3f7fc; }
.onboarding-body .interest-chip { border-color: #cbd8e7; background: #f8faff; color: #354c68; }
.onboarding-body .interest-chip.selected { border-color: #1c4b85; background: #edf4fc; color: #1c4b85; }
.onboarding-body .assessment-chat, .onboarding-body .result-card {
    border-color: #dfe7f1; background: #f8faff;
}
.onboarding-body .assess-user { background: #deebfa; }
.onboarding-body .result-summary, .onboarding-body .result-section li { color: #52657d; }
.onboard-saved-note {
    margin: -10px 0 18px; padding: 10px 12px;
    border-left: 3px solid #1c4b85; border-radius: 0 8px 8px 0;
    background: #edf4fc; color: #354c68;
    font-size: 12px; line-height: 1.5;
}
.onboarding-body :is(button, a, input, textarea):focus-visible {
    outline: 3px solid rgba(28, 75, 133, .26); outline-offset: 2px;
}
@media (max-width: 600px) {
    .onboarding-body .onboard-container { margin: 0; min-height: 100vh; padding: 24px 20px 40px; border: 0; border-radius: 0; }
    .onboard-language-choices { grid-template-columns: 1fr; }
    .onboard-language-choice { min-height: 90px; }
}

/* ── Mobile ── */
@media (max-width: 600px) {
    header { padding: 10px 12px; }
    header h1 { font-size: 14px; }
    .header-right { gap: 4px; }

    .btn-header { font-size: 11px; padding: 5px 8px; }

    main { padding: 12px; }
    .app-footer,
    footer.app-footer { padding: 8px 10px 10px; gap: 6px; }
    .footer-compose { gap: 6px; }
    .msg { max-width: 92%; }
    .bubble { font-size: 14px; padding: 10px 13px; }

    .call-controls { gap: 20px; }
    .call-actions-incoming { gap: 36px; }

    .modal { max-height: 92vh; margin: 8px; }
    .modal-body { padding: 16px; }

    .dash-container { padding: 16px 16px; }
    .onboard-container { padding: 16px 16px 30px; }
    .user-badge { display: none; }

    .topic-badge {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-menu {
        top: 48px;
        right: 8px;
        max-height: min(calc(100dvh - 56px), calc(100vh - 56px));
    }
}

/* ══════════ TOPIC PICKER MODAL ══════════ */
.topic-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(4px);
}

.topic-modal-box {
    background: var(--bg-surface);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 720px;
    max-height: 82vh;
    overflow-y: auto;
    padding: 20px 20px 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.topic-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.topic-modal-header span {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.topic-modal-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-dim);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.topic-modal-close:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }

.topic-step-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 14px;
}

/* Category grid */
.topic-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.topic-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.18s;
    color: var(--text);
}
.topic-cat-card:hover, .topic-cat-card:active {
    background: rgba(107, 138, 253, 0.12);
    border-color: var(--accent);
}

.topic-cat-icon {
    width: 22px; height: 22px; line-height: 1; color: var(--accent);
}
.topic-cat-icon svg {
    display: block; width: 100%; height: 100%;
    fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
}
.topic-cat-name { font-size: 12px; color: var(--text-dim); font-weight: 500; text-align: center; }

/* Step 2 */
.topic-step2-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.topic-back-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-dim);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.topic-back-btn:hover { border-color: var(--accent); color: var(--accent); }

.topic-step2-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.topic-subtopic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.topic-subtopic-chip {
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.topic-subtopic-chip:hover {
    background: rgba(107, 138, 253, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.topic-custom-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.topic-custom-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s;
}
.topic-custom-field:focus { border-color: var(--accent); }
.topic-custom-field::placeholder { color: var(--text-dim); }

.topic-custom-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.topic-custom-btn:hover { background: var(--accent-hover); }

@media (max-width: 480px) {
    .topic-cat-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .topic-cat-icon { width: 20px; height: 20px; }
    .topic-cat-name { font-size: 11px; }
    .topic-cat-card { padding: 11px 6px; }
}

/* ══════════════════════════════════════════════ */
/*  REPORT DELIVERY (email / Slack)               */
/* ══════════════════════════════════════════════ */

.report-send {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.report-send-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.report-send-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin: 0 0 10px;
    line-height: 1.5;
}
.report-send-hint b { color: var(--text); font-weight: 600; }
.report-send-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.report-send-controls input {
    flex: 1;
    min-width: 160px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
}
.report-send-controls input:focus { border-color: var(--accent); }
.report-send-controls button { white-space: nowrap; }
.report-send-controls button:disabled { opacity: 0.5; cursor: default; }
.report-send-status {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
    min-height: 16px;
}

/* Report rating row (thumbs + one-line comment) */
.report-feedback {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.report-feedback-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.report-feedback-rate {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.report-feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    cursor: pointer;
}
.report-feedback-btn[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.report-feedback-controls {
    display: flex;
    gap: 8px;
}
.report-feedback-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 8px 10px;
    font-size: 16px;
    outline: none;
}
.report-feedback-input:focus { border-color: var(--accent); }
.report-feedback-send {
    min-height: 44px;
    white-space: nowrap;
}
.report-feedback-send:disabled { opacity: 0.5; cursor: default; }
.report-feedback-status {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
    min-height: 16px;
}
.report-feedback-controls[hidden] { display: none; }
/* Same row inside the last celebration card: compact, centered */
.celebration-card .report-feedback {
    width: 100%;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.celebration-card .report-feedback-rate { justify-content: center; }
.celebration-card .report-feedback-title { margin-bottom: 8px; }
.celebration-card .report-feedback-status { margin-top: 6px; min-height: 0; }

/* ══════════════════════════════════════════════ */
/*  3자 화상 토론 모드 (Video debate mode)         */
/* ══════════════════════════════════════════════ */

/* Header entry button */
.btn-debate-start-entry {
    border-color: var(--accent);
    color: #93c5fd;
}
.btn-debate-start-entry:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    border-color: var(--accent);
}
.btn-media-start-entry {
    border-color: #14b8a6;
    color: #5eead4;
}
.btn-media-start-entry:hover {
    background: rgba(20, 184, 166, 0.12);
    color: #5eead4;
    border-color: #14b8a6;
}
.btn-call-start,
.btn-debate-start-entry,
.btn-media-start-entry {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ── Config modal ── */
.tutor-settings-modal { max-width: 440px; }
.tutor-settings-body .debate-field-label { margin-top: 4px; }
.tutor-voice-hint {
    font-size: 12px; color: var(--text-dim); line-height: 1.45;
    margin: 8px 0 18px;
}
.tutor-speed-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 16px;
    font-size: 12px;
    color: var(--text-dim);
}
.tutor-speed-row .menu-slider { flex: 1; }
.tutor-speed-row strong { min-width: 40px; text-align: right; color: var(--text); }
.tutor-settings-body .btn-debate-go { width: 100%; margin-top: 4px; }

.topic-speed-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    color: var(--text-dim);
}
.topic-speed-title { flex-shrink: 0; font-weight: 600; }
.topic-speed-slider { flex: 1; min-width: 0; }
.topic-speed-value { min-width: 40px; text-align: right; color: var(--text); font-weight: 600; }
.debate-config-intro {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 16px;
    line-height: 1.5;
}
.debate-field-label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 600;
    margin: 12px 0 6px;
}
.debate-text-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 11px;
    /* 16px+: prevents iOS Safari from auto-zooming on focus */
    font-size: 16px;
    outline: none;
    font-family: inherit;
    resize: vertical;
}
.debate-text-input:focus { border-color: var(--accent); }
select.debate-text-input option { background: var(--bg-surface); color: var(--text); }

.persona-config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 8px;
}
.persona-config {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 12px 14px 16px;
}
.persona-config-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.persona-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.persona-config-head.persona1 .persona-dot { background: #6b8afd; }
.persona-config-head.persona2 .persona-dot { background: #f59e0b; }

.persona-style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.persona-style-chip {
    padding: 4px 10px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}
.persona-style-chip:hover { border-color: var(--accent); color: var(--accent); }

.btn-debate-go {
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #1d4ed8);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-debate-go:hover { opacity: 0.92; }
.btn-debate-go:disabled { opacity: 0.5; cursor: default; }
.debate-config-status {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 10px;
    min-height: 16px;
    text-align: center;
}

/* ── Media learning ── */
.media-config-modal, .media-paste-modal { max-width: 460px; }
.media-config-body { display: flex; flex-direction: column; }
.media-option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 4px 0 2px;
    padding: 0;
    border: 0;
}
.media-option-group .debate-field-label {
    width: 100%;
    margin-bottom: 0;
}
.media-option-group label {
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}
.media-option-group input { accent-color: var(--accent); }
.media-optional { color: var(--text-dim); font-weight: 400; }
.media-recents .debate-field-label { margin-bottom: 6px; }
.media-recents-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.media-recent-chip {
    padding: 5px 9px;
    border: 1px solid rgba(20, 184, 166, 0.55);
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.08);
    color: #5eead4;
    font: inherit;
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
}
.media-recent-chip:hover {
    border-color: #14b8a6;
    background: rgba(20, 184, 166, 0.16);
}
.media-paste-tip {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(148, 163, 184, 0.08);
}
.media-paste-tip p,
.media-paste-tip-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-dim);
}
.media-paste-tip-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.btn-media-find-source {
    margin-top: 0;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.btn-media-find-source:hover {
    background: rgba(59, 130, 246, 0.2);
}
.btn-media-find-youtube {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;
}
.btn-media-find-youtube:hover {
    background: rgba(220, 38, 38, 0.22);
}
.media-paste-length-hint {
    margin: -4px 0 12px;
    font-size: 12px;
    color: #fbbf24;
    line-height: 1.4;
}
.media-badge {
    background: rgba(168, 85, 247, 0.16);
    color: #d8b4fe;
}
.btn-media-paste {
    padding: 8px 10px;
    border: 1px solid rgba(168, 85, 247, 0.45);
    border-radius: var(--radius-sm);
    background: rgba(168, 85, 247, 0.12);
    color: #d8b4fe;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-media-paste:hover {
    background: rgba(168, 85, 247, 0.22);
    border-color: #d8b4fe;
}
.btn-media-youtube {
    padding: 8px 10px;
    border: 1px solid rgba(248, 113, 113, 0.5);
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-media-youtube:hover {
    background: rgba(220, 38, 38, 0.22);
    border-color: #fca5a5;
}
.btn-media-to-call {
    padding: 8px 10px;
    border: 1px solid rgba(34, 197, 94, 0.5);
    border-radius: var(--radius-sm);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-media-to-call:hover {
    background: rgba(34, 197, 94, 0.22);
    border-color: #86efac;
}
.btn-media-end {
    margin-left: auto;
    padding: 8px 12px;
    border: 1px solid rgba(239, 68, 68, 0.55);
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-media-end:hover {
    background: rgba(239, 68, 68, 0.28);
    border-color: #f87171;
    color: #fecaca;
}
.btn-call-to-text {
    align-self: stretch;
    width: 100%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: var(--radius);
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-call-to-text:hover {
    background: rgba(59, 130, 246, 0.24);
    border-color: #93c5fd;
    color: #dbeafe;
}
.media-char-count {
    margin: 4px 0 12px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: right;
}
.media-char-count.is-near-limit { color: #fbbf24; }
.media-char-count.is-at-limit { color: #f87171; font-weight: 600; }
.report-youtube-cta {
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.08);
}
.btn-youtube-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: none;
    background: #dc2626;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-youtube-open:hover { opacity: 0.92; }
.report-youtube-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}
.celebration-yt-btn { margin-top: 14px; }

/* ── Overlay ── */
.debate-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: linear-gradient(135deg, var(--bg) 0%, #152038 45%, #0d1a2d 100%);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}
.debate-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.debate-topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}
.debate-topbar .btn-header {
    flex-shrink: 0;
}
#debate-speed-control {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 4px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}
#debate-speed-control input[type="range"] {
    width: 72px;
    max-width: 18vw;
}
.debate-mode-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius);
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    white-space: nowrap;
}
.debate-topic-label {
    font-size: 14px;
    color: var(--text);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.debate-status {
    font-size: 12px;
    color: var(--call-green);
    white-space: nowrap;
}
.btn-debate-leave {
    border-color: var(--call-red);
    color: #fca5a5;
    margin-left: auto;
}
.btn-debate-leave:hover { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: var(--call-red); }

/* ── Tile grid (compact so chat keeps most of the viewport) ── */
.debate-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 6px 10px;
    flex: 0 0 auto;
    max-height: min(112px, 16vh);
}
.debate-tile {
    position: relative;
    height: min(100px, 14vh);
    min-height: 72px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #11141f;
    border: 2px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.debate-tile.persona1 { border-color: rgba(107, 138, 253, 0.35); }
.debate-tile.persona2 { border-color: rgba(245, 158, 11, 0.35); }
.debate-tile.active {
    box-shadow: 0 0 0 2px var(--accent), 0 0 26px rgba(107, 138, 253, 0.5);
    border-color: var(--accent);
}
.debate-tile.persona2.active {
    box-shadow: 0 0 0 2px #f59e0b, 0 0 26px rgba(245, 158, 11, 0.5);
    border-color: #f59e0b;
}

.debate-webcam {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);  /* mirror like a typical self-view */
    background: #000;
}
.debate-avatar-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.debate-cam-hint {
    font-size: 11px;
    color: #9aa0aa;
    text-align: center;
    max-width: 90%;
}
.tile-persona .avatar-circle { width: 48px; height: 48px; font-size: 18px; }
.tile-persona.persona2 .avatar-circle { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.tile-footer {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    font-size: 12px;
}
.tile-name { font-weight: 600; color: #fff; }
.tile-mic-ind { font-size: 12px; opacity: 0.85; }
.tile-cam-toggle {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e4e4e7;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: var(--radius);
    cursor: pointer;
}
.tile-cam-toggle:hover { background: rgba(0, 0, 0, 0.7); }

/* ── User tile: photo / illustration layers ── */
.user-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.user-avatar-illust {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-avatar-illust span { font-size: 48px; line-height: 1; }

/* ── Persona tile: chosen portrait fills the tile (fallback = initials circle) ── */
.persona-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #11141f;
}

/* Gear button to open the "내 화면 설정" chooser (top-right of the user tile) */
.tile-avatar-gear {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tile-avatar-gear:hover { background: rgba(0, 0, 0, 0.75); }

/* ── Avatar chooser modal ── */
.avatar-chooser-modal { max-width: 440px; }
.avatar-chooser-intro { color: var(--text-dim, #9aa0aa); font-size: 13px; margin-bottom: 14px; }
.avatar-mode-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.avatar-mode-tab {
    flex: 1;
    padding: 8px 6px;
    font-size: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #e4e4e7;
    cursor: pointer;
}
.avatar-mode-tab.active {
    border-color: var(--accent, #6b8afd);
    background: rgba(107, 138, 253, 0.18);
    color: #fff;
}
.avatar-pane { display: flex; flex-direction: column; gap: 10px; }
.avatar-pane-desc { color: var(--text-dim, #9aa0aa); font-size: 13px; }
.avatar-upload-label {
    display: inline-block;
    align-self: flex-start;
    padding: 8px 16px;
    border-radius: var(--radius);
    background: var(--accent, #6b8afd);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.avatar-photo-preview-wrap { margin-top: 4px; }
.avatar-photo-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.avatar-pane-status, .avatar-chooser-result {
    font-size: 12px;
    color: var(--text-dim, #9aa0aa);
    margin-top: 6px;
    min-height: 16px;
}
.illust-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.illust-cell {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.illust-cell span { font-size: 30px; line-height: 1; }
.illust-cell.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent, #6b8afd);
}

/* ── Persona avatar picker (debate config modal) ── */
.persona-avatar-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}
.persona-avatar-group-label {
    font-size: 11px;
    color: #9aa0aa;
    margin-top: 2px;
}
.persona-avatar-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.persona-avatar-cell {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    background: #11141f;
    cursor: pointer;
    overflow: hidden;
    flex: 0 0 auto;
}
.persona-avatar-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.persona-avatar-cell.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent, #6b8afd);
}

/* ── Lower area: chat + private corrections (primary focus of the screen) ── */
.debate-lower {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 10px;
    padding: 0 12px 6px;
    min-height: 0;
}
.debate-chat {
    overflow-y: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.debate-msg { display: flex; }
.debate-msg-user { justify-content: flex-end; }
.debate-msg-persona1, .debate-msg-persona2, .debate-msg-system { justify-content: flex-start; }
.debate-bubble {
    position: relative;
    max-width: 96%;
    width: fit-content;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 16px;
    line-height: 1.5;
}
.debate-msg-user .debate-bubble { background: var(--bg-bubble-user); color: #fff; border-bottom-right-radius: 4px; }
.debate-msg-persona1 .debate-bubble { background: rgba(107, 138, 253, 0.16); border: 1px solid rgba(107, 138, 253, 0.3); border-bottom-left-radius: 4px; }
.debate-msg-persona2 .debate-bubble { background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(245, 158, 11, 0.3); border-bottom-left-radius: 4px; }
.debate-msg-system .debate-bubble { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.debate-msg-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.9;
}
.debate-msg-persona1 .debate-msg-label { color: #8ba4ff; }
.debate-msg-persona2 .debate-msg-label { color: #fbbf24; }

.debate-side {
    background: var(--correction-bg);
    border: 1px solid var(--correction-border);
    border-radius: var(--radius);
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.debate-corr-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--correction-suggestion);
    margin-bottom: 8px;
}
.debate-corr-sub { font-size: 10px; font-weight: 400; color: var(--text-dim); }
.debate-corr-items { display: flex; flex-direction: column; gap: 8px; }
.debate-corr-items .corr-item {
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}
.debate-corr-empty { font-size: 12px; color: var(--text-dim); }

/* ── Input row ── */
.debate-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.debate-input-row .input-wrapper { flex: 1; min-width: 0; }
.btn-debate-end-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--call-red);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s;
}
.btn-debate-end-bar:hover { background: #dc2626; }
.btn-debate-end-bar:active { transform: scale(0.96); }
.btn-debate-end-bar svg { display: block; }
.debate-input-row textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    color: var(--text);
    padding: 11px 14px;
    /* 16px+: prevents iOS Safari from auto-zooming on focus */
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.4;
}
.debate-input-row textarea:focus { border-color: var(--accent); }
.debate-input-row textarea:disabled { opacity: 0.5; }
.btn-debate-mic.recording { background: var(--recording); color: #fff; }
/* Hands-free voice mode active (mic toggle on, between listening segments) */
.btn-debate-mic.voice-on { background: var(--call-green); color: #06281a; }
.btn-debate-mic.voice-on.recording { background: var(--recording); color: #fff; }

/* "넘기기 / Over to AI" — compact mirror of the call-mode "Over to Tutor" button */
.btn-debate-over {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    flex-shrink: 0;
    padding: 6px 16px;
    height: 44px;
    background: var(--call-green);
    color: #06281a;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.08s;
    box-shadow: 0 3px 12px rgba(34, 197, 94, 0.3);
}
.btn-debate-over:active { transform: scale(0.96); }
.btn-debate-over:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-debate-over .over-sub { font-size: 9px; font-weight: 500; opacity: 0.8; }

/* User tile listening indicator (mic active while hands-free listens) */
.tile-mic-ind.listening { color: var(--call-green); animation: micPulse 1.1s ease-in-out infinite; }
.debate-tile.tile-user.listening {
    box-shadow: 0 0 0 2px var(--call-green), 0 0 22px rgba(34, 197, 94, 0.45);
    border-color: var(--call-green);
}
@keyframes micPulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.18); }
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .persona-config-grid { grid-template-columns: 1fr; }
    .debate-status { display: none; }
    .debate-topic-label { max-width: 36vw; }
    #debate-speed-control input[type="range"] { width: 56px; }
    .debate-grid {
        grid-template-columns: repeat(3, 1fr);
        padding: 4px 8px;
        gap: 5px;
        max-height: min(88px, 12vh);
    }
    /* Keep all three tiles on one compact row so chat stays large */
    .debate-tile {
        height: min(80px, 11vh);
        min-height: 64px;
    }
    .debate-tile.tile-user { grid-column: auto; }
    .tile-persona .avatar-circle { width: 32px; height: 32px; font-size: 13px; }
    .user-avatar-illust span { font-size: 32px; }
    .tile-cam-toggle { display: none; }
    .tile-avatar-gear { width: 24px; height: 24px; font-size: 11px; top: 4px; right: 4px; }
    .debate-lower {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        padding: 0 8px 4px;
        gap: 6px;
    }
    .debate-chat { padding: 6px; }
    .debate-bubble {
        max-width: 98%;
        font-size: 16.5px;
        line-height: 1.55;
    }
    .debate-side { max-height: 14vh; padding: 8px; }
    .debate-corr-empty { display: none; }
    .debate-side:has(.debate-corr-empty) {
        max-height: none;
        padding: 6px 8px;
    }
    .debate-side:has(.debate-corr-empty) .debate-corr-title {
        margin-bottom: 0;
        font-size: 12px;
    }
    .btn-debate-over { padding: 6px 10px; height: 44px; font-size: 13px; }
    .btn-debate-over .over-sub { display: none; }
    .chat-corr-panel { margin: 0 8px 6px; max-height: min(120px, 18vh); }
}

/* ══════════════════════════════════════════════ */
/*  LEARNING DIGEST — Calm Studio                 */
/* ══════════════════════════════════════════════ */
.menu-item-label { flex: 1; }
.learning-unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.learning-focus-chip {
    margin: 8px 14px 0;
    padding: 8px 10px 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-surface));
    color: var(--text);
    font-size: 12px;
}
.learning-focus-chip-pulse {
    animation: learningFocusPulse 0.8s ease 3;
}
@keyframes learningFocusPulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
}
.learning-focus-kicker {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}
#learning-focus-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#btn-clear-learning-focus {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
}
#btn-clear-learning-focus:hover { color: var(--text); }

.session-expression-resume-chips {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: min(42vw, 520px);
    overflow: hidden;
}
.session-expression-resume-chip {
    padding: 3px 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-surface));
    color: var(--text-dim);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.expression-goals-modal { max-width: 560px; }
.expression-goals-help {
    margin: 0 0 14px;
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1.6;
}
.expression-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    min-height: 42px;
    margin: 10px 0 18px;
}
.expression-suggestion-chip {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    line-height: 1.45;
    cursor: pointer;
}
.expression-suggestion-chip.selected {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, var(--bg-surface));
    color: var(--accent);
}
.expression-custom-row,
.expression-goals-actions {
    display: flex;
    gap: 8px;
}
.expression-custom-row .debate-text-input { flex: 1; min-width: 0; }
.expression-goals-actions {
    margin-top: 18px;
    flex-wrap: wrap;
}
.expression-goals-actions .btn-primary { flex: 1 1 230px; }
.expression-goals-actions .btn-secondary { flex: 1 1 140px; }
.expression-goals-modal .modal-header h2 { font-size: 21px; }
.expression-goals-modal .learning-modal-kicker { font-size: 11px; }
.expression-goals-modal :is(.btn-primary, .btn-secondary, .debate-text-input) { font-size: 16px; }
.expression-goals-modal :is(.btn-primary, .btn-secondary) { min-height: 46px; }

.learning-settings-modal,
.learning-digests-modal,
.learning-digest-detail-modal { max-width: 560px; }
.learning-settings-body { display: flex; flex-direction: column; gap: 14px; }
.learning-consent-copy {
    padding: 14px 15px;
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.65;
}
.learning-toggle-row,
.learning-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.025);
}
.learning-toggle-row > span,
.learning-field-row > span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.learning-toggle-row strong,
.learning-field-row strong { font-size: 14px; color: var(--text); }
.learning-toggle-row small,
.learning-field-row small { color: var(--text-dim); font-size: 11px; line-height: 1.45; }
.learning-toggle-row input {
    width: 38px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
}
.learning-field-row input {
    width: 70px;
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font: inherit;
    text-align: center;
}
.learning-toggle-row input:disabled,
.learning-field-row input:disabled { opacity: 0.4; cursor: not-allowed; }
.learning-settings-actions { display: flex; gap: 8px; margin-top: 2px; }
.learning-settings-actions > button { flex: 1; }
.learning-danger-btn {
    padding: 10px 14px;
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: var(--radius);
    background: rgba(248, 113, 113, 0.08);
    color: #fca5a5;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.learning-danger-btn:hover { background: rgba(248, 113, 113, 0.14); }
.learning-status { min-height: 18px; color: var(--text-dim); font-size: 12px; }

.learning-modal-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.6px;
}
.learning-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}
.learning-list-toolbar p { color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.learning-list-toolbar .btn-secondary { padding: 7px 13px; flex-shrink: 0; }
.learning-digest-list { display: flex; flex-direction: column; gap: 9px; }
.learning-digest-card {
    position: relative;
    width: 100%;
    padding: 15px 42px 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.learning-digest-card:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface));
    transform: translateY(-1px);
}
.learning-digest-card.is-unread::before {
    content: '';
    position: absolute;
    top: 17px;
    left: 6px;
    width: 4px;
    height: 18px;
    border-radius: var(--radius);
    background: var(--accent);
}
.learning-digest-card strong { font-size: 14px; line-height: 1.45; }
.learning-digest-meta { color: var(--text-dim); font-size: 11px; }
.learning-digest-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    color: var(--accent);
    transform: translateY(-50%);
}
.learning-empty {
    padding: 22px 8px;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}
.learning-error { color: #fca5a5; }

.learning-digest-detail { display: flex; flex-direction: column; gap: 18px; }
.learning-digest-hero {
    padding: 20px;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface));
}
.learning-digest-hero span {
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
}
.learning-digest-hero h3 {
    margin: 9px 0 7px;
    color: var(--text);
    font-size: 19px;
    line-height: 1.45;
}
.learning-digest-hero p { color: var(--text-dim); font-size: 12px; }
.learning-digest-section h4 {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.learning-digest-section ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.learning-digest-section li {
    position: relative;
    padding: 8px 10px 8px 25px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}
.learning-digest-section li::before {
    content: '—';
    position: absolute;
    left: 9px;
    color: var(--accent);
}
.learning-digest-section .learning-empty { padding: 6px 0; text-align: left; }
.learning-apply-btn {
    width: 100%;
    padding: 12px 16px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.learning-apply-btn:hover { background: var(--accent-hover); }
.learning-apply-btn:disabled { opacity: 0.55; cursor: wait; }

@media (max-width: 480px) {
    .learning-focus-chip { margin: 7px 10px 0; }
    .learning-focus-kicker { display: none; }
    .learning-settings-actions { flex-direction: column; }
    .learning-toggle-row, .learning-field-row { gap: 10px; }
    .learning-digest-hero { padding: 16px; }
}

/* 2026 brand refinement: one visual language across practice and setup. */
body:not(.auth-page):not(.onboarding-body) {
    background: #081522;
}
#app {
    max-width: 860px;
    border-inline: 1px solid rgba(182, 212, 228, .10);
    box-shadow: 0 0 80px rgba(0, 0, 0, .16);
}
#app > header {
    min-height: 66px;
    padding: 12px 22px;
    border-bottom-color: rgba(189, 218, 232, .13);
}
.header-left { min-width: 0; gap: 12px; }
.header-left h1 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.025em;
    white-space: nowrap;
}
.brand-mark {
    display: block;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
}
.btn-header {
    min-height: 34px;
    font-family: inherit;
    font-weight: 600;
    border-color: rgba(180, 211, 227, .18);
    color: #c0cfda;
}
#app > header .voice-controls, #app > header #btn-new, #app > header #btn-logout { display: none; }
#app > header .btn-menu-toggle { display: flex; }
#app > header .btn-debate-start-entry, #app > header .btn-media-start-entry {
    border-color: rgba(180, 211, 227, .18);
    color: #c0cfda;
}
#app > header .btn-debate-start-entry:hover, #app > header .btn-media-start-entry:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(112,193,220,.1);
}
.btn-header:hover, .btn-header:focus-visible {
    border-color: var(--accent);
    color: var(--text);
}
.topic-bar { padding: 10px 22px; border-bottom-color: rgba(189, 218, 232, .1); }
.chip { border-color: rgba(180, 211, 227, .18); background: rgba(255,255,255,.035); }
#chat-area { padding: 26px 24px; }
#messages { gap: 18px; }
.bubble { padding: 13px 17px; line-height: 1.55; }
.msg-ai .bubble { border: 1px solid rgba(183, 214, 230, .10); }
.msg-user .bubble { border: 1px solid rgba(112, 193, 220, .18); }
.msg-label { font-size: 11px; letter-spacing: .08em; }
.app-footer, footer.app-footer {
    padding: 14px 22px 16px;
    border-top-color: rgba(189, 218, 232, .13);
}
#input-message { border-color: rgba(180, 211, 227, .2); }
#input-message:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(112,193,220,.13); }
.btn-send, .btn-primary, .learning-apply-btn { color: #102b3e; font-weight: 700; }
.btn-mic { border: 1px solid rgba(180, 211, 227, .2); }
.btn-mic.voice-on { border-color: var(--accent); color: var(--accent); background: rgba(112, 193, 220, .13); }
.btn-mic.voice-on.recording { border-color: var(--recording); background: var(--recording); color: #fff; }
.mobile-menu { top: 64px; width: min(320px, calc(100vw - 24px)); border-color: rgba(180,211,227,.2); box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.menu-item { min-height: 46px; }
.menu-icon { color: var(--accent); }
.topic-modal-box, .modal { border: 1px solid rgba(180,211,227,.17); box-shadow: 0 24px 70px rgba(0,0,0,.35); }

.auth-page, .onboarding-body {
    background: #edf3f6 !important;
}
.auth-page { height: auto; overflow: auto; }
.auth-card, .onboarding-body .onboard-container {
    border-color: #d8e3ea;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(22, 56, 85, .09);
}
.auth-card { width: min(100%, 450px); padding: 42px 38px; }
.auth-mark { width: 72px; height: 72px; border-radius: 16px; margin-bottom: 22px; }
.auth-eyebrow { color: var(--brand-ink); letter-spacing: .14em; }
.auth-brand h1 { color: #162f46; font-size: 26px; }
.auth-brand h1 span { color: #566f80; font-size: 16px; }
.auth-intro { color: #50697b; font-size: 14px; }
.auth-form input, .onboarding-body .form-input {
    border-color: #c6d6e0;
    border-radius: 10px;
    background: #f9fbfc;
}
.auth-form input:focus, .onboarding-body .form-input:focus {
    border-color: #276788;
    box-shadow: 0 0 0 3px rgba(39,103,136,.12);
}
.auth-submit, .onboarding-body .btn-primary { background: var(--brand-ink); color: #fff; }
.auth-submit:hover, .onboarding-body .btn-primary:hover { background: #245477; }
.auth-create { border-color: #a9c1d1; color: var(--brand-ink); }
.auth-create:hover { background: #edf5f8; }
.onboard-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--brand-ink); }
.onboard-brand img { width: 34px; height: 34px; border-radius: 9px; }
.onboarding-body .onboard-container { max-width: 600px; padding: 38px; }
.onboarding-body .onboard-step h2 { color: #162f46; font-size: 27px; letter-spacing: -.025em; }
.onboarding-body .progress-fill { background: var(--brand-ink); }
.onboard-language-choice { min-height: 132px; border-color: #c6d6e0; background: #f9fbfc; }
.onboard-language-choice:hover, .onboard-language-choice:focus-visible { border-color: #276788; background: #eef6f9; }
.onboarding-body .interest-chip.selected { border-color: #276788; background: #e8f3f7; color: var(--brand-ink); }

:is(button, a, input, textarea, select):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 600px) {
    #app > header { min-height: 56px; padding: 10px 12px; }
    .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
    .mobile-menu { top: 56px; }
    .header-left h1 { font-size: 16px; }
    #chat-area { padding: 16px 12px; }
    .bubble { font-size: 16px; line-height: 1.55; }
    .menu-item { font-size: 15px; }
    .chat-corr-title, .chat-corr-empty { font-size: 14px; }
    .chat-corr-sub { font-size: 12px; }
    .expression-goals-modal .modal-body { padding: 20px; }
    .app-footer, footer.app-footer { padding: 10px 12px 12px; }
    .onboarding-body .onboard-container { margin: 0; min-height: 100vh; padding: 28px 20px 40px; border: 0; border-radius: 0; }
    .onboarding-body .onboard-step h2 { font-size: 24px; }
}
@media (max-width: 420px) {
    .auth-card { padding: 32px 24px; }
}

/* Light studio: the speaking surface stays quiet and the next action stays clear. */
body:not(.auth-page):not(.onboarding-body) { background: var(--bg); }
#app {
    max-width: 920px;
    background: #fff;
    border-inline: 1px solid var(--border);
    box-shadow: 0 18px 72px rgba(23, 57, 75, .055);
}
#app > header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    min-height: 72px;
    padding: 12px 26px;
}
.header-left h1 { color: var(--text); font-size: 19px; letter-spacing: -.035em; }
.brand-mark { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 12px; }
.btn-header, #app > header .btn-debate-start-entry, #app > header .btn-media-start-entry {
    min-height: 42px;
    border-color: var(--border);
    background: #fff;
    color: var(--text);
    font-size: 14px;
}
.btn-header:hover, #app > header .btn-debate-start-entry:hover, #app > header .btn-media-start-entry:hover {
    background: #eef6f8;
    border-color: var(--accent);
    color: var(--accent);
}
.btn-call-start {
    background: var(--brand-ink);
    border-color: var(--brand-ink);
    color: #fff;
}
.btn-call-start:hover { background: #24556a; color: #fff; border-color: #24556a; }
.btn-help-trigger { border-color: var(--border) !important; color: var(--text) !important; }
.btn-menu-toggle { border-radius: 11px !important; }
.topic-bar { background: #fff; border-bottom: 1px solid var(--border); }
.chip, .topic-subtopic-chip {
    background: #f6f9fa;
    border-color: var(--border);
    color: var(--text);
    font-size: 14px;
}
.chip:hover, .topic-subtopic-chip:hover { background: #e8f3f6; color: var(--accent); }
#chat-area { background: #f7f9fa; padding: 30px 28px; }
#messages { gap: 20px; }
.msg { max-width: min(86%, 660px); }
.bubble { border-radius: 18px; font-size: 17px; line-height: 1.55; }
.msg-ai .bubble { border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(23,57,75,.035); }
.msg-user .bubble { color: #fff; border: 1px solid var(--brand-ink); }
.msg-user .msg-label { color: #d9e8ec; }
.msg-system .bubble { color: #9f3b35; }
.msg-label { color: var(--accent); font-size: 12px; letter-spacing: .07em; }
.btn-replay { opacity: 1; background: #f1f6f8; color: var(--accent); }
.btn-replay:hover { background: #e2eef1; }
.corrections, .media-practice-cards { border-top-color: var(--border); }
.chat-corr-panel, #call-active .call-corr-panel, .debate-side {
    background: #f2f8f5;
    border-color: #d7e9dc;
    border-radius: 14px;
}
.chat-corr-item { background: #fff; border-left-color: var(--correction-border); }
.chat-corr-title, .debate-corr-title, .call-corr-title { color: var(--correction-suggestion); font-size: 15px; }
.chat-corr-empty, .debate-corr-empty, .call-corr-empty { font-size: 14px; }
.chat-corr-sub, .debate-corr-sub, .call-corr-sub { font-size: 12px; }
.corr-item { background: #fff; }
.media-practice-card { background: #eef5f7; }
.media-practice-actions button { border-color: var(--border); }
.app-footer, footer.app-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 16px 26px calc(18px + env(safe-area-inset-bottom, 0px));
}
#input-message, .debate-input-row textarea {
    background: #f8fafb;
    border: 1px solid #cbdce2;
    color: var(--text);
}
#input-message:focus, .debate-input-row textarea:focus { box-shadow: 0 0 0 3px #dceef2; }
.btn-mic { background: #f4f8f9; border: 1px solid var(--border); color: var(--brand-ink); }
.btn-mic:hover { background: #e9f3f5; }
.btn-send, .btn-primary, .learning-apply-btn { background: var(--brand-ink); color: #fff; }
.btn-send:hover, .btn-primary:hover, .learning-apply-btn:hover { background: #24556a; }
.mobile-menu { background: #fff; border: 1px solid var(--border); box-shadow: 0 22px 48px rgba(23,57,75,.16); }
.menu-item:hover, .menu-item:active { background: #f1f7f8; }
.menu-divider { background: var(--border); }
.menu-slider { background: #d5e2e7; }
.menu-item-danger, .learning-danger-btn { color: #a4403c !important; }
.toast { border-color: var(--border); box-shadow: 0 8px 30px rgba(23,57,75,.13); }

/* Dialogs and learning tools use one paper/card system. */
.modal-overlay, .topic-modal-overlay { background: rgba(19, 46, 61, .43); }
.modal, .topic-modal-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(23,57,75,.18);
}
.topic-modal-box { border-radius: 20px 20px 0 0; }
.modal-header { border-bottom-color: var(--border); }
.modal-header h2, .topic-modal-header span { color: var(--text); font-size: 21px; }
.topic-modal-close, .modal-close { background: #f1f6f8; color: var(--text-dim); }
.topic-cat-card, .avatar-mode-tab, .media-recent-chip, .learning-toggle-row,
.learning-field-row, .learning-digest-card, .learning-digest-section li {
    background: #f8fafb;
    border-color: var(--border);
    color: var(--text);
}
.topic-cat-card:hover, .avatar-mode-tab.active { background: #e9f4f6; color: var(--accent); }
.topic-cat-name { color: var(--text); font-size: 14px; }
.topic-step-hint, .debate-config-intro, .debate-field-label { font-size: 14px; }
.topic-back-btn, .topic-custom-field, .debate-text-input, .learning-field-row input {
    background: #fff;
    border-color: #cbdce2;
    color: var(--text);
}
.topic-custom-btn, .btn-debate-go { background: var(--brand-ink); color: #fff; }
.topic-speed-row { border-top-color: var(--border); }
.expression-goals-modal .modal-header h2 { font-size: 23px; }
.expression-suggestion-chip { background: #fff; color: var(--text); }
.expression-suggestion-chip.selected { background: #e8f3f6; color: var(--accent); }
.learning-consent-copy { background: #f1f7f9; }
.learning-digest-card strong, .learning-toggle-row strong, .learning-field-row strong { font-size: 16px; }
.learning-toggle-row small, .learning-field-row small { font-size: 13px; }
.learning-modal-kicker { font-size: 11px; }
.learning-error { color: #a4403c; }
.learning-danger-btn { background: #fff3f2; }
.avatar-mode-tab.active { border-color: var(--accent); }
.avatar-chooser-intro, .avatar-pane-desc, .avatar-pane-status, .avatar-chooser-result { color: var(--text-dim); }
.avatar-upload-label { background: var(--brand-ink); }
.illust-cell.selected, .persona-avatar-cell.selected { border-color: var(--accent); box-shadow: 0 0 0 2px #d2e9ee; }

/* Voice call and three-person practice retain clear state colors on light surfaces. */
.call-bg-blur { background: #f6f9fa; }
.call-content { color: var(--text); }
.avatar-circle { background: var(--brand-ink); }
.call-status { color: #27764a; }
.mic-meter { background: #d7e2e7; }
.mic-meter-fill { background: #92b5bf; }
.call-transcript { background: #fff; border: 1px solid var(--border); color: var(--text); }
.call-ctrl-btn { color: var(--text); }
.call-ctrl-btn svg { background: #eaf2f4; }
.call-ctrl-btn:hover svg { background: #dcebee; }
.end-btn svg, .end-btn:hover svg { background: #d64646; color: #fff; }
.debate-overlay { background: var(--bg); color: var(--text); }
.debate-topbar { background: #fff; border-bottom: 1px solid var(--border); }
.debate-grid { background: var(--bg); }
.debate-tile { background: #e8eff2; border-color: #cddde3; }
.debate-chat { background: #f7f9fa; border: 1px solid var(--border); }
.debate-msg-persona1 .debate-bubble { background: #e9f2fa; border-color: #cbddec; }
.debate-msg-persona2 .debate-bubble { background: #fbf2e3; border-color: #ebd9b9; }
.debate-msg-persona1 .debate-msg-label { color: #315f94; }
.debate-msg-persona2 .debate-msg-label { color: #89601d; }
.debate-msg-system .debate-bubble { color: #9f3b35; }
.debate-input-row { background: #fff; border-top-color: var(--border); }

.auth-page, .onboarding-body { background: #f6f9fa !important; }
.auth-card, .onboarding-body .onboard-container {
    border-color: var(--border);
    box-shadow: 0 18px 54px rgba(23,57,75,.075);
}
.auth-mark { width: 84px; height: 84px; border: 1px solid var(--border); border-radius: 17px; }
.auth-brand h1, .onboarding-body .onboard-step h2 { color: var(--brand-ink); }
.auth-brand h1 { font-size: 30px; }
.auth-intro, .onboarding-body .step-desc { font-size: 16px; color: var(--text-dim); }
.auth-form label { font-size: 15px; }
.auth-form input, .onboarding-body .form-input { background: #fff; border-color: #cbdce2; font-size: 17px; }
.auth-submit, .onboarding-body .btn-primary { background: var(--brand-ink); }
.auth-create { color: var(--brand-ink); border-color: #b8cbd3; }
.auth-qa > p:first-child { font-size: 14px; }
.auth-qa-actions button { font-size: 15px; color: var(--brand-ink); }
.onboard-brand img { border: 1px solid var(--border); }

/* Secondary learning screens: review, wordbook, media and session summary. */
.celebration-overlay { background: #f6f9fa; }
.celebration-close { background: #eaf2f4; color: var(--text); }
.celebration-dot { background: #cbdce2; }
.celebration-card {
    background: #fff;
    border-color: var(--border);
    box-shadow: 0 16px 48px rgba(23,57,75,.09);
}
.celebration-preparing-text, .celebration-expr-meaning { color: var(--text); }
.celebration-preparing-hint, .celebration-expr-example { color: var(--text-dim); }
.celebration-spinner { border-color: #d7e2e7; border-top-color: var(--accent); }
.celebration-streak-chip, .report-streak-chip { color: #9a531c; }
.celebration-tag { color: var(--accent); }
.shadow-btn, .shadow-nav-btn, .review-item, .wordbook-item, .yt-filter, .youtube-item {
    background: #f8fafb;
    border-color: var(--border);
    color: var(--text);
}
.shadow-btn:hover, .review-item:hover, .youtube-item:hover { background: #edf5f7; border-color: #b5d2da; }
.shadow-result { background: #f5f9fa; border-color: var(--border); }
.shadow-target .sw.hit, .review-item-count, .wordbook-example { color: var(--correction-suggestion); }
.review-cta { background: #edf5f7; border-color: #bdd9e0; }
.yt-filter.active { background: #e7f3f6; border-color: var(--accent); color: var(--accent); }
.youtube-item-note { color: var(--accent); }
.report-error { color: #a4403c; }
.report-section h3 { font-size: 15px; }
.report-section p, .report-section li { font-size: 15px; }
.report-expr-item { background: #f1f7f9; }
.media-recent-chip { color: var(--accent); }
.btn-media-find-source, .btn-call-to-text { color: var(--accent); background: #eaf4f7; border-color: #b5d5df; }
.btn-media-find-youtube, .btn-media-youtube, .btn-media-end { color: #a13e39; background: #fff1f0; border-color: #e6c4c2; }
/* The dark-theme hover turned the label near-white on this pale red (invisible after a tap on iOS). */
.btn-media-end:hover { color: #8f302b; background: #ffe4e1; border-color: #d9a9a6; }
.btn-media-paste, .media-badge { color: #69439a; background: #f4effa; border-color: #d9c8e9; }
.btn-media-to-call { color: #23694b; background: #edf8f1; border-color: #bcdfc9; }
.media-paste-length-hint, .media-char-count.is-near-limit { color: #9a6512; }
.persona-config { background: #f8fafb; border-color: var(--border); }
.persona-style-chip { background: #fff; border-color: var(--border); color: var(--text); }
.btn-debate-go { background: var(--brand-ink); }
.debate-mode-badge { background: #eaf4f7; color: var(--accent); }
.btn-debate-leave { color: #a4403c; }
.learning-digest-section h4 { font-size: 14px; }
.learning-digest-section li { font-size: 15px; }
.learning-digest-meta, .learning-digest-hero p { font-size: 13px; }

@media (max-width: 600px) {
    #app > header { min-height: 62px; padding: 9px 14px; }
    .brand-mark { width: 38px; height: 38px; }
    .header-left h1 { font-size: 17px; }
    #chat-area { padding: 20px 14px; }
    .bubble { font-size: 17px; }
    .app-footer, footer.app-footer { padding: 12px 14px 15px; }
    .auth-card { padding: 34px 26px; }
    .onboarding-body .onboard-container { box-shadow: none; }
}

/* Session strip: topic on row 1, today's expressions on row 2 (swipe sideways when long). */
.session-strip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 26px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.session-strip.hidden, .session-strip .hidden { display: none; }
.session-strip-top {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: stretch;
    min-width: 0;
}
.session-strip-top .topic-badge { flex: 0 1 auto; min-width: 0; }
.session-strip-top .btn-chat-end { padding: 4px 12px; font-size: 13px; }
.session-strip .topic-badge {
    max-width: 100%;
    font-size: 13px;
    padding: 4px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.session-strip .session-expression-resume-chips {
    display: flex;
    flex-wrap: nowrap;
    align-self: stretch;
    max-width: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.session-strip .session-expression-resume-chips::-webkit-scrollbar { display: none; }
.session-strip .session-expression-resume-chip {
    flex: none;
    font-size: 13px;
    padding: 4px 10px;
}
@media (max-width: 600px) {
    .session-strip { padding: 8px 14px; }
}

/* Wordbook tabs: learned expressions vs imported words (Naver PDF / CSV). */
.wordbook-tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.wordbook-tab {
    padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; background: none;
    color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.wordbook-tab.is-active { color: var(--text); border-bottom-color: var(--brand-ink, #17394b); }
.wordbook-import-panel { display: flex; flex-direction: column; gap: 10px; }
.wordbook-import-panel.hidden { display: none; }
.wordbook-import-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wordbook-import-status { min-height: 18px; font-size: 13px; color: var(--text-dim); }
.wordbook-item.is-missing-meaning .wordbook-meaning { color: #a13e39; }

/* Tutor faces (static/avatars): photo over the initials circle; initials show if it fails. */
.avatar-circle { overflow: hidden; }
.avatar-circle .avatar-photo {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}
.avatar-circle .avatar-photo[hidden] { display: none; }
.msg-avatar {
    width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
    vertical-align: middle; margin-right: 6px;
}

/* 선생님 설정: name falls back to the voice's character name */
.tutor-name-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin: 4px 0 12px;
}

/* Wordbook review: the tutor reading the card + which words to review */
.ambient-tutor {
    display: flex; align-items: center; gap: 8px; min-width: 0;
}
.ambient-tutor-photo {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    flex: none; box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px rgba(15, 23, 42, 0.08);
    transition: box-shadow .2s;
}
.ambient-tutor.speaking .ambient-tutor-photo {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--accent);
}
.ambient-tutor-name { font-size: 13px; font-weight: 600; color: #334155; }
.ambient-source {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 6px;
    margin: -6px 0 16px;
}
.ambient-source.hidden { display: none; }
.ambient-source-chip {
    border: 1px solid #e2e8f0; background: #f8fafc; color: #475569;
    border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.ambient-source-chip.is-on { background: #0f172a; border-color: #0f172a; color: #ffffff; }
.ambient-source-count { opacity: .7; margin-left: 2px; font-variant-numeric: tabular-nums; }

/* 알림 설정 */
.notify-tutor { display: flex; align-items: center; gap: 12px; }
.notify-tutor .debate-config-intro { margin-bottom: 0; }
.notify-tutor-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; }
.notify-hint {
    font-size: 13px; line-height: 1.55; margin: 14px 0 0; padding: 10px 12px;
    border-radius: 10px; background: rgba(250, 204, 21, 0.12); color: var(--text);
}
.notify-hint.hidden, .notify-options.hidden { display: none; }
.notify-status { font-size: 13px; color: var(--text-dim); min-height: 18px; margin: 14px 0 8px; }
#btn-notify-toggle.is-off { background: transparent; color: var(--text); border: 1px solid var(--border, rgba(127,127,127,.3)); }
.notify-options { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.notify-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.notify-check input { width: 18px; height: 18px; }
.notify-time { max-width: 160px; margin-left: 26px; }
.notify-time:disabled { opacity: .45; }
.notify-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.notify-actions .btn-debate-go { width: auto; margin-top: 0; }

/* ══════════ Bottom tabs (2026-10-15 spec 2-1, 2-5) ══════════ */
.desktop-only-control { display: none !important; }

.tab-bar {
    display: flex;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-btn {
    flex: 1;
    min-height: 44px;
    padding: 6px 0 8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: 0; cursor: pointer;
    color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600;
}
.tab-btn.is-active { color: var(--brand-ink); }
.tab-icon, .line-icon {
    width: 24px; height: 24px; flex: 0 0 24px;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

.tab-panels {
    position: absolute;
    left: 0; right: 0;
    top: var(--header-h, 56px);
    bottom: var(--tabbar-h, 64px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
    z-index: 50;   /* above chat, below every overlay (300+) */
    padding: 16px 16px 24px;
}
.tab-panel-title { font-size: 22px; color: var(--brand-ink); margin: 4px 2px 14px; }

.review-card, .more-card {
    display: block; width: 100%; text-align: left;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
    font: inherit; color: var(--text);
}
.review-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.review-card-head h3 { font-size: 18px; color: var(--brand-ink); }
.review-step {
    width: 24px; height: 24px; border-radius: 50%; flex: 0 0 24px;
    background: var(--brand-gold); color: var(--brand-ink);
    font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.review-card-meta { font-size: 14px; color: var(--text-dim); margin: 2px 0 10px; }
/* Two equal columns, so buttons line up across cards whatever their label length. */
.review-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.review-action {
    min-height: 44px; padding: 0 8px; white-space: nowrap; border-radius: var(--radius-sm);
    border: 1px solid var(--accent); background: var(--bg-surface); color: var(--accent);
    font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.review-action.is-primary { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }

.more-card { display: flex; align-items: center; gap: 14px; min-height: 64px; cursor: pointer; position: relative; }
.more-card .line-icon { color: var(--accent); }
.more-card-text { display: flex; flex-direction: column; gap: 2px; }
.more-card-text strong { font-size: 18px; color: var(--brand-ink); }
.more-card-text span { font-size: 14px; color: var(--text-dim); }
.more-card .learning-unread-badge { margin-left: auto; }

.settings-group-title { font-size: 14px; color: var(--text-dim); margin: 18px 4px 6px; }
.settings-group {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.settings-group .menu-item {
    width: 100%; min-height: 48px; font-size: 16px;
    border-bottom: 1px solid var(--border); border-radius: 0;
}
.settings-group .menu-item:last-child { border-bottom: 0; }

.btn-new-topic {
    min-height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-surface);
    color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* 통화: an icon tile mirroring the logo tile (same size and corners); ::after keeps a 44px tap area. */
#app > header .btn-call-start {
    width: 42px; height: 42px; min-height: 42px; padding: 0; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center; position: relative;
}
#app > header .btn-call-start::after { content: ''; position: absolute; inset: -1px; }
#app > header .btn-call-start .header-btn-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
@media (max-width: 600px) {
    #app > header .btn-call-start { width: 38px; height: 38px; min-height: 38px; }
    #app > header .btn-call-start::after { inset: -3px; }
}

/* 「다른 표현 뽑기」 in the today's-expressions window */
.btn-expression-shuffle {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0 12px; margin: 2px 0 10px;
    border: 1px solid var(--accent); border-radius: var(--radius-sm);
    background: var(--bg-surface); color: var(--accent);
    font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-expression-shuffle .line-icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-expression-shuffle:disabled { opacity: .5; cursor: default; }

.shadow-complete { text-align: center; padding: 12px 4px 4px; }
.shadow-complete-icon { width: 48px; height: 48px; color: var(--correction-suggestion); margin-bottom: 8px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shadow-complete h3 { font-size: 18px; color: var(--brand-ink); margin-bottom: 6px; }
.shadow-complete p { font-size: 16px; color: var(--text-dim); margin-bottom: 16px; }
.shadow-complete .review-card-actions { justify-content: center; }

/* ══════════ First-run guide (spec 2-3) — above windows (2000-2600), below the wordbook (2800) ══════════ */
.guide-slides {
    position: fixed; inset: 0; z-index: 2700;
    background: var(--bg-surface);
    display: flex; flex-direction: column;
    padding: 24px 24px calc(20px + env(safe-area-inset-bottom, 0px));
}
.guide-slide { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.guide-slide-icon { width: 64px; height: 64px; color: var(--brand-ink); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guide-slide h2 { font-size: 24px; color: var(--brand-ink); line-height: 1.3; }
.guide-slide p { font-size: 17px; color: var(--text-dim); line-height: 1.5; max-width: 320px; }
.guide-dots { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.guide-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--border); }
.guide-dot.is-on { width: 20px; background: var(--brand-ink); }
.guide-foot { display: flex; justify-content: space-between; align-items: center; }
.guide-skip, .guide-next, .guide-tip-done {
    min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
    font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.guide-skip { background: none; border: 0; color: var(--text-dim); }
.guide-next, .guide-tip-done { background: var(--brand-ink); border: 0; color: #fff; }
.guide-ring {
    position: fixed; z-index: 2700; border-radius: 12px; pointer-events: auto;
    box-shadow: 0 0 0 3px var(--brand-gold);
}
.guide-ring:not(.is-dim) { pointer-events: none; }
.guide-ring.is-dim { box-shadow: 0 0 0 3px var(--brand-gold), 0 0 0 9999px rgba(10, 20, 30, 0.55); }
.guide-tip {
    position: fixed; z-index: 2701; max-width: 280px;
    background: var(--bg-surface); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.guide-tip strong { display: block; font-size: 17px; color: var(--brand-ink); margin-bottom: 4px; }
.guide-tip p { font-size: 15px; color: var(--text-dim); line-height: 1.45; margin-bottom: 10px; }
.guide-tip-done { float: right; }

/* Korean help (2026-10-15) */
.btn-ko-help {
    min-height: 44px; min-width: 44px; width: 44px; height: 44px; padding: 0; flex: 0 0 auto;
    border: 1px solid var(--border); border-radius: 50%;
    background: #f4f8f9; color: var(--brand-ink);
    display: inline-flex; align-items: center; justify-content: center;
    font: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
}
.btn-ko-help.active { background: var(--accent); color: #fff; }
.call-ctrl-btn.ko-btn.active { color: var(--brand-gold); }

.ko-help-card {
    margin-top: 10px; padding: 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-surface);
}
.ko-help-card.is-waiting { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29, 59, 79, .08); }
.ko-help-title { font-size: 14px; color: var(--text-dim); margin: 0 0 4px; }
.ko-help-line { font-size: 17px; font-weight: 600; color: var(--brand-ink); margin: 0 0 6px; }
.ko-help-note { font-size: 14px; color: var(--text-dim); margin: 0 0 10px; }
.ko-help-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ko-help-call-hint { font-size: 14px; color: var(--text-dim); margin: 8px 0 0; }
.ko-gloss { margin-top: 8px; font-size: 15px; }
.ko-gloss summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); font-size: 14px; }
.ko-gloss p { margin: 4px 0 0; color: var(--text); }
.call-ko-gloss { padding: 0 16px; }
.call-ko-help {
    width: 100%; margin: 0 0 12px; padding: 10px 14px; text-align: left;
    border: 1px solid var(--accent); border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
}
.call-ko-help-title { font-size: 14px; color: var(--text-dim); margin: 0 0 4px; }
.call-ko-help-line { font-size: 18px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.call-ko-help-note { font-size: 14px; color: var(--text-dim); margin: 0 0 8px; }
.call-ko-help-replay {
    min-height: 44px; padding: 0 16px; border-radius: 22px;
    border: 1px solid var(--accent); background: transparent; color: var(--text);
    font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
body.ko-gloss-off .ko-gloss,
body.ko-gloss-off .call-ko-gloss { display: none; }

/* Compose row (2026-10-16): mic, 한, input and send share one 44px line, centred. */
.footer-compose { align-items: center; }
.footer-compose .btn-mic, .footer-compose .btn-send { width: 44px; height: 44px; }
#input-message { min-height: 44px; padding: 9px 16px; border-radius: 22px; display: block; }

/* Session strip on one line: topic, 「오늘 표현 N」, spacer, 새 주제, 끝내기. */
.session-strip-top .topic-badge { flex: 0 1 auto; min-width: 0; }
.session-strip-spacer { flex: 1 1 auto; min-width: 0; }
.session-strip-top { gap: 6px; }
.session-strip .session-strip-top .topic-badge { flex: 0 1 auto; min-width: 64px; }
.btn-session-expr {
    flex: 0 0 auto; min-height: 32px; padding: 0 10px; border-radius: 16px;
    border: 1px solid var(--border); background: var(--bg-surface); color: var(--brand-ink);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-session-expr::after { content: ' ▾'; font-size: 11px; }
.btn-session-expr.open { border-color: var(--accent); color: var(--accent); }
.btn-session-expr.open::after { content: ' ▴'; }
.session-strip-top .btn-new-topic {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
    border: none; background: none; padding: 0 4px; min-height: 32px; white-space: nowrap;
}

/* Sign-up vs log-in (beta, 2026-10-16) */
.auth-new-hint { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: #fff8e6;
    color: var(--brand-ink); font-size: 14px; line-height: 1.5; }
.auth-new-hint.hidden { display: none; }
.auth-create-attention { box-shadow: 0 0 0 3px #e8b23a; }
.onboard-login-link { display: inline-flex; flex-direction: column; align-items: flex-end;
    font-size: 13px; line-height: 1.3; text-align: right; }
.onboard-login-link span { font-size: 12px; color: var(--text-dim); }

/* 내 계정 card (Settings) */
.account-card { padding: 4px 0; }
.account-section { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.account-section + .account-section { border-top: 1px solid var(--border); }
.account-label { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.account-login-name { font-size: 16px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.account-hint { margin: 0; font-size: 13px; color: var(--text-dim); }
.account-row { display: flex; gap: 8px; }
.account-input {
    flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px;
    font-size: 16px; font-family: inherit; color: var(--text);
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 10px;
}
.account-btn {
    min-height: 44px; min-width: 64px; padding: 8px 16px; font-size: 16px; font-family: inherit;
    font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer;
}
.account-status { margin: 0; min-height: 1.2em; font-size: 14px; color: var(--accent); }
.account-status.error { color: #a4403c; }

/* ══════════ Home tab (2026-10-24 fun elements spec, step 1) ══════════
   Gold is the "reward colour": streak, level and finished days only.
   Gold text uses --gold-ink (4.5:1 on white). */
:root { --gold-ink: #8a6410; --gold-soft: #fdf3dc; }

.header-streak {
    display: inline-flex; align-items: center; gap: 3px;
    min-height: 32px; padding: 0 10px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--bg-surface);
    color: var(--text-dim); font-size: 15px; font-weight: 700;
}
.header-streak .streak-flame { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.header-streak.is-on { color: var(--gold-ink); background: var(--gold-soft); border-color: var(--brand-gold); }
.header-streak.is-on .streak-flame { fill: var(--brand-gold); }

.home-tutor { display: flex; align-items: flex-start; gap: 12px; margin: 4px 0 16px; }
.home-tutor-avatar {
    width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%;
    object-fit: cover; background: var(--border);
}
.home-bubble {
    position: relative; flex: 1; min-width: 0;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 4px var(--radius) var(--radius) var(--radius); padding: 12px 14px;
}
.home-bubble-text { font-size: 17px; line-height: 1.5; color: var(--text); margin-bottom: 8px; word-break: keep-all; overflow-wrap: anywhere; }
.home-bubble-listen {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
    border: 1px solid var(--accent); border-radius: var(--radius-sm);
    background: var(--bg-surface); color: var(--accent);
    font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.home-bubble-listen .line-icon { width: 20px; height: 20px; flex-basis: 20px; }

.home-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.home-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.home-card-head h3 { font-size: 18px; color: var(--brand-ink); }
.home-card-meta { font-size: 14px; color: var(--text-dim); margin-top: 8px; }
.home-week-goal { font-size: 14px; font-weight: 600; color: var(--gold-ink); }

.home-week { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.home-day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.home-day-dot {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--border); background: var(--bg-surface);
}
.home-day-dot svg { width: 18px; height: 18px; fill: none; stroke: var(--brand-ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.home-day.is-done .home-day-dot { background: var(--brand-gold); border-color: var(--brand-gold); }
.home-day.is-today .home-day-dot { border-style: dashed; border-color: var(--accent); }
.home-day.is-missed .home-day-dot { background: var(--bg); }
.home-day-label { font-size: 13px; color: var(--text-dim); }
.home-day.is-today .home-day-label { color: var(--accent); font-weight: 700; }

.home-level-card .home-card-head { margin-bottom: 10px; }
.home-level-chip {
    display: inline-flex; gap: 4px; padding: 4px 10px; border-radius: 999px;
    background: var(--gold-soft); color: var(--gold-ink); font-size: 15px; font-weight: 700;
}
.home-soon { font-size: 13px; color: var(--text-dim); }
.home-progress { height: 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.home-progress span { display: block; height: 100%; background: var(--brand-gold); }

.home-start {
    display: block; width: 100%; min-height: 52px; margin-top: 4px;
    border: 0; border-radius: var(--radius); background: var(--brand-ink); color: #fff;
    font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
}

/* ── Fun elements steps 2–6: shields, missions, badges, quiz, level-up, cards ── */
.home-shields { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; color: var(--text-dim); }
.shield-icon, .home-day-dot svg.shield { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.home-day.is-shield .home-day-dot { border-color: var(--accent); background: #e8f3f6; }
.home-day.is-shield .home-day-dot svg { stroke: var(--accent); stroke-width: 1.8; }

.home-missions { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.home-mission { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.home-mission-check {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
    border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
}
.home-mission-check svg { width: 16px; height: 16px; fill: none; stroke: var(--brand-ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.home-mission.is-done .home-mission-check { background: var(--brand-gold); border-color: var(--brand-gold); }
.home-mission-text { flex: 1; font-size: 16px; color: var(--text); }
.home-mission.is-done .home-mission-text { color: var(--text-dim); }
.home-mission-xp { font-size: 14px; font-weight: 700; color: var(--gold-ink); }
.home-mission-go {
    min-height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
    border: 0; background: var(--brand-ink); color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.home-mission-go.is-more { background: transparent; color: var(--brand-ink); border: 1.5px solid var(--border); }

.home-badges-head { display: flex; justify-content: space-between; margin: 14px 0 8px; font-size: 14px; font-weight: 600; color: var(--text-dim); }
.home-badges { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.home-badge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.home-badge-icon {
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px dashed var(--border); color: var(--text-dim); background: var(--bg);
}
.home-badge-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.home-badge.is-earned .home-badge-icon { border: 2px solid var(--brand-gold); background: var(--gold-soft); color: var(--gold-ink); }
.home-badge-name { font-size: 12px; color: var(--text-dim); line-height: 1.2; }
.home-badge.is-earned .home-badge-name { color: var(--gold-ink); font-weight: 600; }

/* Quiz: a bottom sheet over everything except the guide (2700) */
.quiz-overlay {
    position: fixed; inset: 0; z-index: 2650; background: rgba(23, 57, 75, 0.45);
    display: flex; align-items: flex-end; justify-content: center;
}
.quiz-box {
    width: 100%; max-width: 720px; max-height: 100dvh; overflow-y: auto;
    background: var(--bg); border-radius: 18px 18px 0 0;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
}
.quiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.quiz-top .modal-close { position: static; }
.quiz-progress { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.quiz-progress span { display: block; height: 100%; width: 0; background: var(--brand-gold); transition: width .3s; }
.quiz-combo { padding: 4px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-ink); font-size: 14px; font-weight: 700; }
.quiz-kicker { font-size: 15px; color: var(--text-dim); margin-bottom: 6px; }
.quiz-meaning { font-size: 24px; font-weight: 700; color: var(--brand-ink); line-height: 1.35; margin-bottom: 18px; word-break: keep-all; }
.quiz-choices { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.quiz-choice {
    min-height: 54px; padding: 10px 16px; text-align: left; border-radius: var(--radius);
    border: 2px solid var(--border); background: var(--bg-surface); color: var(--text);
    font: inherit; font-size: 18px; font-weight: 600; cursor: pointer;
}
.quiz-choice:disabled { cursor: default; }
.quiz-choice.is-right { border-color: var(--brand-gold); background: var(--gold-soft); color: var(--brand-ink); }
.quiz-choice.is-answer { border-color: var(--correction-suggestion); color: var(--correction-suggestion); background: var(--correction-bg); }
.quiz-choice.is-wrong { color: var(--text-dim); background: var(--bg); }
.quiz-feedback { position: relative; margin-top: 14px; padding: 16px; border-radius: var(--radius); background: var(--bg-surface); border: 1px solid var(--border); }
.quiz-feedback.is-right { border-color: var(--brand-gold); }
.quiz-feedback-tutor { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.quiz-tutor-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--border); }
.quiz-feedback-line { font-size: 17px; font-weight: 600; color: var(--brand-ink); }
.quiz-feedback-example { font-size: 16px; color: var(--text); margin-bottom: 10px; font-style: italic; }
.quiz-xp { margin: 14px 0 12px; font-size: 14px; color: var(--gold-ink); font-weight: 600; }
.quiz-xp .home-progress { margin-top: 6px; }
.quiz-xp .home-progress span { transition: width .4s; }
/* Three small stars: one second, then gone (no confetti — Calm Studio). */
.quiz-stars { position: absolute; top: 8px; right: 12px; display: flex; gap: 4px; pointer-events: none; }
.quiz-stars span { width: 10px; height: 10px; background: var(--brand-gold); opacity: 0;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.quiz-feedback.is-right .quiz-stars span { animation: quiz-star 1s ease-out forwards; }
.quiz-feedback.is-right .quiz-stars span:nth-child(2) { animation-delay: .12s; }
.quiz-feedback.is-right .quiz-stars span:nth-child(3) { animation-delay: .24s; }
@keyframes quiz-star { 0% { opacity: 0; transform: scale(.4); } 40% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .quiz-feedback.is-right .quiz-stars span { animation: none; } }
.quiz-done { text-align: center; padding: 20px 4px 4px; }
.quiz-done-icon { width: 56px; height: 56px; fill: none; stroke: var(--gold-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.quiz-done h3 { font-size: 20px; color: var(--brand-ink); margin-bottom: 6px; }
.quiz-done p { font-size: 16px; color: var(--text-dim); margin-bottom: 18px; }

/* Level-up: a dark full screen with one gold medal */
.levelup-overlay {
    position: fixed; inset: 0; z-index: 2950; background: var(--brand-ink);
    display: flex; align-items: center; justify-content: center;
    padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
}
.levelup-box { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.levelup-medal {
    width: 132px; height: 132px; border-radius: 50%; border: 4px solid var(--brand-gold);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--brand-gold); margin-bottom: 8px;
}
.levelup-medal-kicker { font-size: 14px; font-weight: 700; letter-spacing: .2em; }
.levelup-number { font-size: 52px; font-weight: 700; line-height: 1; }
.levelup-medal-icon svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.levelup-title { font-size: 26px; color: #fff; }
.levelup-line { font-size: 17px; line-height: 1.5; color: #d7e2e7; word-break: keep-all; }
.levelup-badges { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.levelup-badge { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--brand-gold); font-weight: 600; }
.levelup-badge .home-badge-icon { width: 34px; height: 34px; border: 2px solid var(--brand-gold); background: transparent; color: var(--brand-gold); }
.levelup-share, .levelup-home {
    width: 100%; min-height: 52px; border-radius: var(--radius); font: inherit; font-size: 17px; font-weight: 700; cursor: pointer;
}
.levelup-share { background: var(--brand-gold); color: var(--brand-ink); border: 0; margin-top: 12px; }
.levelup-home { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }

/* Card collection (wordbook 「수집첩」 tab) */
.cards-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cards-filter {
    min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-surface); color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.cards-filter.is-active { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 360px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
.expr-card {
    display: flex; flex-direction: column; gap: 4px; min-height: 112px; padding: 10px;
    border-radius: var(--radius-sm); border: 1px solid #c9dfe8; background: #eef6f9; overflow: hidden;
}
.expr-card-tier { font-size: 11px; font-weight: 700; color: var(--accent); }
.expr-card-expr { font-size: 15px; line-height: 1.25; color: var(--brand-ink); overflow-wrap: anywhere; }
.expr-card-meaning { font-size: 12px; color: var(--text-dim); line-height: 1.3; word-break: keep-all; overflow-wrap: anywhere; }
.card-dots { display: flex; gap: 4px; margin-top: auto; }
.card-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--accent); }
.card-dot.is-on { background: var(--accent); }
.card-used { margin-top: auto; font-size: 11px; font-weight: 700; color: var(--gold-ink); }
.expr-card.is-mine { background: var(--bg-surface); border: 2px solid var(--brand-gold); }
.expr-card.is-mine .expr-card-tier { color: var(--gold-ink); }
.expr-card.is-gold { background: #0f4f5f; border: 2px solid var(--brand-gold); }
.expr-card.is-gold .expr-card-tier, .expr-card.is-gold .expr-card-expr, .expr-card.is-gold .card-used { color: var(--brand-gold); }
.expr-card.is-gold .expr-card-meaning { color: #cfe3e9; }
.cards-nudge { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--gold-soft); border: 1px solid var(--brand-gold); }
.cards-nudge p { font-size: 15px; color: var(--brand-ink); margin-bottom: 10px; line-height: 1.45; }
.wordbook-cards-panel { padding-top: 4px; }

/* ── 2026-10-25 JW feedback: calmer week dots, clearer badges ──
   No dashed lines. Missed = soft grey fill, today = solid teal ring,
   locked badge = grey silhouette, earned badge = gold coin with its own icon. */
.home-bubble-text { margin-bottom: 0; }
.home-day-dot { width: 34px; height: 34px; border: 2px solid #e3eaee; background: var(--bg-surface); }
.home-day.is-missed .home-day-dot { border-color: transparent; background: #edf1f3; }
.home-day.is-today .home-day-dot {
    border-style: solid; border-color: var(--accent); background: #e8f3f6;
    box-shadow: 0 0 0 3px rgba(23, 108, 129, .12);
}
.home-day.is-done .home-day-dot { box-shadow: 0 1px 3px rgba(178, 128, 30, .25); }
.home-day.is-missed .home-day-label, .home-day.is-future .home-day-label { color: #9aabb3; }

.home-badges { gap: 14px 6px; }
.home-badge-icon {
    width: 54px; height: 54px; border: 0; border-radius: 50%;
    background: #eef2f4; color: #a8b7bf;
}
.home-badge-icon svg { width: 26px; height: 26px; stroke-width: 1.8; }
.home-badge.is-earned .home-badge-icon {
    border: 0; color: #6b4a0c;
    background: radial-gradient(circle at 32% 28%, #fff1c9 0%, #f7d27c 45%, #e5ac3f 100%);
    box-shadow: 0 2px 6px rgba(178, 128, 30, .30), inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.home-badge-name { font-size: 12.5px; color: #8fa1aa; margin-top: 2px; }
.home-badge.is-earned .home-badge-name { color: var(--gold-ink); font-weight: 700; }

.levelup-badge .home-badge-icon {
    width: 36px; height: 36px; border: 0; color: #6b4a0c;
    background: radial-gradient(circle at 32% 28%, #fff1c9 0%, #f7d27c 45%, #e5ac3f 100%);
}
.levelup-badge .home-badge-icon svg { width: 20px; height: 20px; }
.home-shields { align-items: flex-start; line-height: 1.45; word-break: keep-all; }
.home-shields .shield-icon { flex: 0 0 18px; margin-top: 1px; }

/* ── Weekly league (2026-10-25) — calm list, gold only for the top three ── */
.home-league-text { font-size: 15px; color: var(--text); line-height: 1.5; word-break: keep-all; }
.home-league-actions { display: flex; gap: 8px; margin-top: 12px; }
.home-league-actions .review-action { flex: 1; }
.league-admin-note { font-size: 13px; color: var(--accent); font-weight: 600; margin: -4px 0 8px; }
.league-box { padding-top: 18px; }
.league-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.league-head .modal-close { position: static; }
.league-title { font-size: 21px; color: var(--brand-ink); }
.league-sub { font-size: 14px; color: var(--text-dim); margin-top: 4px; word-break: keep-all; }
.league-admin-banner {
    display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 10px 12px;
    border-radius: var(--radius-sm); background: #e8f3f6; color: var(--accent); font-size: 13px;
}
.league-demo-btn {
    align-self: flex-start; margin-top: 4px; min-height: 32px; padding: 0 10px; border-radius: 999px;
    border: 1px solid var(--accent); background: var(--bg-surface); color: var(--accent);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.league-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.league-row {
    display: grid; grid-template-columns: 28px 36px 1fr auto; align-items: center; gap: 10px;
    min-height: 52px; padding: 6px 12px; border-radius: var(--radius-sm);
    background: var(--bg-surface); border: 1px solid var(--border);
}
.league-rank { font-size: 16px; font-weight: 700; color: var(--text-dim); text-align: center; }
.league-avatar {
    width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: #eef2f4; color: var(--brand-ink); font-weight: 700; font-size: 15px;
}
.league-name { font-size: 16px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-tag { font-style: normal; font-size: 12px; font-weight: 700; color: var(--accent); margin-left: 4px; }
.league-tag.is-out { color: #9aabb3; }
.league-xp { font-size: 15px; font-weight: 700; color: var(--brand-ink); }
.league-row.is-top1 .league-rank, .league-row.is-top2 .league-rank, .league-row.is-top3 .league-rank {
    width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.league-row.is-top1 .league-rank { background: radial-gradient(circle at 32% 28%, #fff1c9, #f7d27c 45%, #e5ac3f); color: #6b4a0c; }
.league-row.is-top2 .league-rank { background: radial-gradient(circle at 32% 28%, #ffffff, #dfe6ea 50%, #b9c6cd); color: #3d5560; }
.league-row.is-top3 .league-rank { background: radial-gradient(circle at 32% 28%, #fbe3cf, #e3b28b 50%, #c2865b); color: #5c3417; }
.league-row.is-me { border: 2px solid var(--accent); background: #f2f9fb; }
.league-row.is-out { opacity: .55; }
.league-empty { padding: 20px; text-align: center; color: var(--text-dim); }
.league-foot { display: flex; justify-content: center; }
.league-foot .review-action { min-width: 60%; }
.league-admin-banner, .league-admin-note, .home-league-text { word-break: keep-all; }

/* League: pick the name shown on the board */
.league-name-pick { margin: 4px 0 14px; padding: 12px; border-radius: var(--radius); background: var(--bg-surface); border: 1px solid var(--border); }
.league-pick-title { font-size: 14px; font-weight: 700; color: var(--brand-ink); margin-bottom: 8px; }
.league-name-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.league-name-option {
    display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; padding: 6px 4px;
    border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg);
    font: inherit; cursor: pointer; color: var(--text);
}
.league-name-option.is-on { border: 2px solid var(--accent); background: #f2f9fb; }
.league-name-option:disabled { opacity: .45; cursor: default; }
.league-name-kind { font-size: 12px; color: var(--text-dim); }
.league-name-value { font-size: 15px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.league-pick-hint { font-size: 12.5px; color: var(--text-dim); margin-top: 8px; word-break: keep-all; }

/* Quiz difficulty (2026-10-25): blank sentences, typing, level chip */
.quiz-level {
    margin-left: auto; min-height: 32px; padding: 0 12px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-dim);
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.quiz-meaning.is-sentence { font-size: 20px; font-weight: 600; line-height: 1.5; word-break: normal; overflow-wrap: anywhere; }
.quiz-type { display: flex; flex-direction: column; gap: 10px; }
.quiz-hint { font-size: 15px; color: var(--gold-ink); font-weight: 600; }
.quiz-input {
    min-height: 52px; padding: 0 14px; border-radius: var(--radius); border: 2px solid var(--border);
    background: var(--bg-surface); color: var(--text); font: inherit; font-size: 18px;
}
.quiz-input:focus { outline: none; border-color: var(--accent); }
.quiz-feedback-meaning { font-size: 15px; color: var(--text-dim); margin: -4px 0 10px; }

/* ── My SoriBaum (2026-10-25) — the tree grows with the level ── */
.home-tree-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.home-tree {
    width: 96px; height: 96px; flex: 0 0 96px; border-radius: 22px;
    background: linear-gradient(180deg, #f2f8f6 0%, #fbf7ec 100%);
    display: flex; align-items: center; justify-content: center;
}
.sori-tree { width: 88px; height: 88px; display: block; }
.home-tree-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.home-tree-title { font-size: 14px; color: var(--text-dim); }
.home-tree-title strong { color: var(--brand-ink); }
.home-tree-next { font-size: 13px; color: var(--text-dim); word-break: keep-all; line-height: 1.4; }
.home-level-progress-head { justify-content: flex-end; margin-bottom: 6px; }
.levelup-tree {
    width: 132px; height: 132px; border-radius: 32px; margin-top: -4px;
    background: rgba(255, 255, 255, .92); display: flex; align-items: center; justify-content: center;
    animation: tree-grow .7s ease-out both;
}
.levelup-tree .sori-tree { width: 116px; height: 116px; }
@keyframes tree-grow { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .levelup-tree { animation: none; } }

/* 2026-10-25 JW: the bottom tabs floated too high on iPhone. Keep clear of the home
   indicator, but use less of the safe area (34pt → about 20pt) and less inner padding. */
.tab-bar { padding-bottom: max(6px, calc(env(safe-area-inset-bottom, 0px) - 12px)); }
.tab-btn { padding: 6px 0 4px; }


/* Header logo (2026-10-26): the tree mark in a navy box the size of the call button on
   the right, then the word "SoriBaum" with "Baum" in bright amber. */
.brand-box { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-box img { display: block; width: 40px; height: 40px; }
.header-left { gap: 10px; }
#app > header h1.brand-word {
    color: var(--brand-ink);
    font-family: "Arial Black", "Segoe UI", sans-serif;
    font-weight: 900;
    font-size: 20px;
    letter-spacing: -.02em;
    white-space: nowrap;
}
.brand-baum { color: #E5A52B; }
@media (max-width: 600px) {
    .brand-box { width: 38px; height: 38px; }
    .brand-box img { width: 36px; height: 36px; }
    #app > header h1.brand-word { font-size: 18px; }
    /* iPhone blurs what shows under the status bar; keep it the header's white. */
    html, body:not(.auth-page):not(.onboarding-body) { background: #fff; }
}

/* 내 계정 → 계정 삭제 */
.account-delete { border-top: 1px solid var(--border); padding-top: 14px; }
.account-hint { margin: 2px 0 8px; font-size: 13px; color: #6b7c86; }
.account-btn.account-btn-danger { background: #fff; color: #a4403c; border: 1px solid #e3b9b6; }

/* Sign-up: 「만 14세 이상입니다」 (2026-10-26) */
.ob-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.ob-check input { width: 18px; height: 18px; margin: 0; }
.ob-age .form-hint a { color: inherit; text-decoration: underline; }

/* 내 계정 → 자녀 계정 (2026-10-26) */
.account-children { border-top: 1px solid var(--border); padding-top: 14px; }
.child-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.child-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #f6f9fa; border-radius: 10px; font-weight: 600; }
.child-list .child-del { min-height: 32px; padding: 0 12px; }
.child-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--text); margin: 4px 0 6px; }
.child-consent input { margin-top: 3px; flex: none; }
.child-consent a { color: inherit; text-decoration: underline; }

/* Settings: policy · terms · contact links look like the other rows */
a.menu-item { text-decoration: none; box-sizing: border-box; }

/* 「신고」 beside the replay button on a tutor bubble (store AI-content policies) */
.btn-report-ai {
    position: absolute; top: 8px; right: 38px;
    width: 26px; height: 26px; border-radius: 50%; border: none;
    display: flex; align-items: center; justify-content: center;
    background: transparent; color: #9aabb5; cursor: pointer;
}
.btn-report-ai:hover { background: #f1f6f8; color: #a4403c; }
.btn-report-ai.is-done { color: #a4403c; cursor: default; }

/* One-time AI-transfer consent (Apple 5.1.2(i)) — above every other window */
.ai-consent-overlay { z-index: 4000; }
.ai-consent-modal { max-width: 440px; padding: 22px; }
.ai-consent-modal h2 { margin: 0 0 10px; font-size: 19px; }
.ai-consent-modal p { line-height: 1.6; margin: 0 0 10px; }
.ai-consent-small { font-size: 13px; color: #6b7c86; }
.ai-consent-small a { color: inherit; text-decoration: underline; }
.ai-consent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

.child-consent-box { margin: 6px 0; padding: 8px 10px; background: #f6f9fa; border-radius: 10px; font-size: 12.5px; line-height: 1.55; color: var(--text); }
.child-consent-box summary { font-weight: 700; cursor: pointer; }
.child-consent-box p { margin: 6px 0 0; }
.child-consent-box a { color: inherit; text-decoration: underline; }
