* { box-sizing: border-box; }

:root {
    --bg: #fbf6ed;
    --surface: #fffdf8;
    --surface-soft: #faf5ec;
    --ink: #282a24;
    --muted: #727164;
    --line: #e9ddca;
    --line-soft: #f0e7d9;
    --coral: #ee8565;
    --coral-strong: #db7252;
    --coral-soft: #fff0e8;
    --status-coral: #E97755;
    --status-coral-soft: #FBE9E1;
    --status-coral-card: #FFF8F4;
    --status-coral-border: #F1C5B5;
    --status-sage: #7E8F73;
    --status-sage-ink: #5F6F58;
    --status-sage-soft: #E8EEE5;
    --status-sage-card: #F4F7F2;
    --status-sage-border: #C9D4C4;
    --status-viewed: #858078;
    --status-viewed-soft: #F2EFEA;
    --status-viewed-card: #FBFAF8;
    --status-viewed-border: #E6DED3;
    --accent: #9b705f;
    --accent-strong: #765443;
    --green: #7E8F73;
    --green-ink: #5F6F58;
    --green-soft: #e9ede2;
    --gold: #8a6426;
    --shadow: 0 18px 38px rgba(91, 70, 43, 0.055);
}

html { background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
    padding: 0;
}

[hidden] { display: none !important; }

a { color: var(--accent-strong); }
p { color: var(--muted); line-height: 1.65; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 760px);
    background: rgba(255, 253, 249, 0.96);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 42px;
    box-shadow: var(--shadow);
}

.app-shell {
    width: min(1260px, 100%);
    margin: 0 auto;
    padding: 26px 32px 30px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.brand-mark { min-width: 0; }

.student-header {
    min-height: 58px;
    padding: 0 2px;
    border-bottom: 1px solid rgba(231, 219, 200, 0.75);
}

.student-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand-dots {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 26px;
    flex: 0 0 34px;
}

.brand-dots span {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.brand-dots span:first-child {
    left: 0;
    top: 0;
    background: #7e8d74;
}

.brand-dots span:last-child {
    right: 0;
    bottom: 0;
    background: var(--coral);
}

.eyebrow, .product-name {
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0;
}

h1, h2, h3 { color: var(--ink); letter-spacing: 0; }

h1 {
    margin: 4px 0 4px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 3.2vw, 36px);
    line-height: 1.12;
}

.student-opening {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin: 24px 0 18px;
}

.student-opening h1 {
    margin: 0;
    font-size: clamp(28px, 2.5vw, 36px);
    line-height: 1.12;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.student-page-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin: 14px 0 10px;
    padding: 6px 0;
    background: linear-gradient(to bottom, var(--bg) 70%, rgba(251, 246, 237, 0));
}

.download-history-form {
    margin: 0;
}

.home-return {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 14px;
    gap: 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.week-nav {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.week-pill,
.current-week-indicator {
    min-height: 40px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(224, 215, 199, 0.9);
    background: rgba(255, 253, 248, 0.62);
    color: #777367;
    text-decoration: none;
    font-weight: 760;
    white-space: nowrap;
}

.current-week-indicator {
    justify-self: end;
    cursor: default;
    background: rgba(255, 253, 248, 0.72);
}

.week-range {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.82;
}

.week-pill.is-active {
    border-color: transparent;
    background: #f3a083;
    color: #fffdf8;
    box-shadow: 0 10px 22px rgba(238, 133, 101, 0.16);
}

h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.14;
}

h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.logout, .pill-link {
    color: #766e61;
    text-decoration: none;
    font-size: 14px;
}

.pinyin-global {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid #e6dac8;
    background: rgba(255, 253, 248, 0.78);
    color: var(--ink);
    font-size: 14px;
    font-weight: 760;
}

.pinyin-global[aria-pressed="true"] {
    border-color: rgba(238, 133, 101, 0.28);
    background: var(--coral-soft);
    color: #9b573f;
}

.links {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.auth-card button {
    width: 100%;
    margin-top: 14px;
}

.auth-card input {
    padding: 14px 15px;
}

.language-select {
    width: auto;
    min-width: 112px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #e6dac8;
    background: rgba(255, 253, 248, 0.78);
    color: var(--ink);
    font: inherit;
}

.language-form { margin: 0; }

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

.hero-panel, .composer, .history-panel, .queue-panel, .review-panel, .response-panel, .overview-tile, .privacy-note {
    background: rgba(255, 253, 249, 0.94);
    border: 1px solid rgba(231, 219, 200, 0.95);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 20px 22px;
    margin-bottom: 18px;
}

.hero-panel p {
    max-width: 720px;
    margin: 0;
}

.composer {
    padding: 28px;
    margin-bottom: 20px;
}

.student-desktop-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
    gap: 24px;
    align-items: start;
}

.student-desktop-grid .composer,
.student-desktop-grid .history-panel {
    margin: 0;
    min-width: 0;
}

.student-desktop-grid .section-head {
    margin-bottom: 16px;
}

.student-desktop-grid .composer .section-head {
    display: block;
}

.student-desktop-grid .composer .section-head p {
    margin-top: 4px;
}

.student-desktop-grid .section-head h2 {
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 20px;
    font-weight: 800;
}

.student-desktop-grid .section-head p {
    max-width: 260px;
    margin: 0;
    text-align: right;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.mode-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.student-desktop-grid .mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 16px;
}

.mode-tab, button, .button {
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    background: #f3ebdf;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-tab.is-active, button.primary, .button.primary {
    background: var(--ink);
    color: #fff;
}

.student-desktop-grid .mode-tab {
    min-height: 110px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.9);
    font-size: 21px;
    font-weight: 850;
    box-shadow: none;
    flex-direction: column;
    gap: 10px;
}

.student-desktop-grid .mode-write,
.student-desktop-grid .mode-speak,
.student-desktop-grid .mode-image {
    color: var(--green-ink);
}

.student-desktop-grid .mode-write.is-active,
.student-desktop-grid .mode-speak.is-active,
.student-desktop-grid .mode-image.is-active {
    background: var(--coral-soft);
    border-color: rgba(238, 133, 101, 0.58);
    box-shadow: inset 0 0 0 2px rgba(238, 133, 101, 0.22);
    color: var(--coral-strong);
}

.student-desktop-grid .mode-tab:hover {
    border-color: #d8cbb6;
    background: #fffdf8;
}

.student-desktop-grid .mode-write.is-active:hover,
.student-desktop-grid .mode-speak.is-active:hover,
.student-desktop-grid .mode-image.is-active:hover {
    background: var(--coral-soft);
}

.student-desktop-grid .mode-tab:focus-visible,
.week-pill:focus-visible,
.conversation-summary:focus-visible {
    outline: 3px solid rgba(238, 133, 101, 0.36);
    outline-offset: 3px;
}

.mode-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mode-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.student-desktop-grid button.primary {
    background: var(--coral);
    color: #fff;
    min-height: 54px;
    border-radius: 16px;
    font-size: 18px;
}

.student-desktop-grid button.primary:hover {
    background: var(--coral-strong);
}

button.secondary, .button.secondary {
    background: #f3ebdf;
    color: var(--ink);
}

button.ghost, .button.ghost {
    background: transparent;
    color: var(--accent-strong);
    border: 1px solid var(--line);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.field-group { margin-top: 16px; }

label {
    display: block;
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 750;
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.92);
    color: var(--ink);
    font: inherit;
}

textarea {
    min-height: 132px;
    padding: 18px 20px;
    resize: vertical;
}

input[type="file"] {
    padding: 12px;
}

.checkbox {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.checkbox input {
    width: auto;
}

.mode-panel {
    display: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
}

.mode-panel.is-active { display: block; }

.audio-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.audio-tool, .image-tool {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.76);
    border: 1px solid var(--line-soft);
}

.native-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    opacity: 0;
}

.file-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
}

.file-picker-status {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.record-actions, .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}

.recording-state {
    margin-top: 12px;
    color: var(--muted);
    font-size: 15px;
}

.audio-box.is-recording .recording-state {
    color: var(--accent-strong);
    font-weight: 800;
}

.audio-box.is-recording .audio-tool:first-child {
    border-color: rgba(169, 96, 72, 0.55);
    box-shadow: 0 0 0 3px rgba(169, 96, 72, 0.12);
}

.pending-audio, .pending-images {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.pending-clip, .pending-image {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
}

.pending-clip audio { width: 100%; margin-top: 8px; }

.pending-image img {
    width: 92px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.composer-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-top: 20px;
}

.student-desktop-grid .composer-footer {
    display: grid;
    grid-template-columns: 1fr;
}

.student-desktop-grid .composer-footer p {
    margin: 0;
    order: 2;
    text-align: center;
}

.notice {
    margin: 16px 0;
    padding: 13px 15px;
    border-radius: 14px;
    background: #edf4ef;
    color: #315c40;
}

.notice.error {
    background: #fff0ed;
    color: #8a3d34;
}

.meta {
    padding: 18px;
    margin: 24px 0;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.meta strong { color: var(--ink); }

.history-panel, .queue-panel, .review-panel, .response-panel, .timer-panel, .teacher-timer-bar {
    padding: 22px;
    margin-top: 22px;
}

.timer-panel, .teacher-timer-bar {
    border: 1px solid rgba(238, 133, 101, 0.24);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.9);
}

.teacher-timer-bar {
    padding: 14px 16px;
    margin-top: 14px;
}

.teacher-timer-bar.is-idle {
    border-color: var(--line-soft);
    background: rgba(255, 253, 248, 0.72);
    box-shadow: none;
}

.teacher-timer-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
}

.teacher-timer-bar.is-idle .teacher-timer-main {
    display: flex;
    align-items: center;
}

.teacher-timer-student {
    font-size: 17px;
    font-weight: 760;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.teacher-timer-clock {
    font-size: 22px;
    font-weight: 760;
    color: #8d563e;
    white-space: nowrap;
}

.timer-actions, .teacher-timer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.timer-switch-prompt {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(238, 133, 101, 0.26);
    border-radius: 14px;
    background: rgba(255, 246, 241, 0.86);
}

.timer-panel h2 {
    font-size: 34px;
    margin: 2px 0 4px;
}

.timer-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.timer-stats > div {
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(250, 247, 240, 0.7);
}

.history-panel.recent-panel {
    padding: 28px;
}

.history-list, .queue-list {
    display: grid;
    gap: 12px;
}

.conversation-card, .queue-card {
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.82);
    overflow: hidden;
}

.queue-card-clickable {
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.queue-card-clickable:hover,
.queue-card-clickable:focus-visible {
    border-color: rgba(238, 133, 101, 0.42);
    box-shadow: 0 12px 30px rgba(66, 45, 30, 0.08);
    outline: none;
    transform: translateY(-1px);
}

.conversation-card.student-waiting {
    border-color: var(--status-coral-border);
    background: var(--status-coral-card);
}

.conversation-card.student-replied {
    border-color: #E8DED1;
    background: #FFFCF8;
}

.conversation-card.student-viewed {
    border-color: var(--status-viewed-border);
    background: var(--status-viewed-card);
}

.conversation-card.is-selected-for-download {
    border-color: rgba(238, 133, 101, 0.65);
    background: rgba(255, 240, 232, 0.72);
}

.conversation-card:hover,
.conversation-card:focus-within {
    border-color: rgba(238, 133, 101, 0.36);
    box-shadow: 0 12px 30px rgba(66, 45, 30, 0.07);
}

.conversation-card.student-replied:hover,
.conversation-card.student-replied:focus-within {
    border-color: var(--status-sage-border);
}

.conversation-card.student-viewed:hover,
.conversation-card.student-viewed:focus-within {
    border-color: var(--status-viewed-border);
    box-shadow: 0 8px 20px rgba(66, 45, 30, 0.045);
}

.conversation-summary, .queue-summary {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 15px 16px;
    background: transparent;
    text-align: left;
    border-radius: 0;
    color: inherit;
    text-decoration: none;
}

.queue-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.student-inline-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(118, 84, 67, 0.26);
}

.student-inline-link:hover,
.student-inline-link:focus-visible {
    color: var(--accent-strong);
    border-bottom-color: currentColor;
    outline: none;
}

.recent-panel .conversation-summary {
    min-height: 92px;
}

.summary-title {
    font-weight: 760;
    overflow-wrap: anywhere;
}

.student-replied .summary-title {
    color: var(--ink);
}

.student-viewed .summary-title {
    color: var(--status-viewed);
}

.filter-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.72);
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 750;
    font-size: 14px;
}

.filter-tab.is-active {
    border-color: var(--accent-strong);
    color: var(--ink);
    background: #fffdf8;
}

.filter-tab.student-waiting.is-active {
    border-color: var(--status-coral-border);
    background: var(--status-coral-soft);
    color: var(--status-coral);
}

.filter-tab.student-replied.is-active {
    border-color: var(--status-sage-border);
    background: var(--status-sage-soft);
    color: var(--status-sage-ink);
}

.filter-tab.student-viewed.is-active {
    border-color: var(--status-viewed-border);
    background: var(--status-viewed-soft);
    color: var(--status-viewed);
}

.teacher-filter-tabs .filter-tab.is-active {
    border-color: var(--status-coral-border);
    background: var(--status-coral-soft);
    color: var(--status-coral);
}

.service-start-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: -4px 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: rgba(255, 253, 248, 0.62);
}

.service-start-form input[type="date"] {
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf8;
}

.service-start-form input[type="text"],
.service-start-form input[type="email"],
.service-start-form select,
.notification-preference-form select {
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fffdf8;
}

.student-account-strip {
    align-items: center;
    background: #fffcf8;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    justify-content: space-between;
    margin: 0 0 16px;
    padding: 10px 12px;
}

.form-readonly-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.invitation-result textarea {
    width: 100%;
    min-height: 180px;
    margin: 10px 0;
    resize: vertical;
}

.notification-preference-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.notification-status {
    background: #f7efe6;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    margin: 0 0 12px;
    padding: 5px 10px;
}

.compact-fieldset {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 10px 0;
    padding: 10px 12px;
}

.support-line {
    color: var(--muted);
    font-size: 14px;
}

.summary-meta, .muted, .small {
    color: var(--muted);
    font-size: 14px;
}

.queue-processing {
    margin-top: 8px;
    line-height: 1.45;
}

.limit-warning {
    display: inline-flex;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(238, 133, 101, 0.14);
    color: #a24836;
    font-size: 12px;
    font-weight: 750;
}

.student-replied .summary-meta,
.student-replied .media-indicator {
    color: var(--status-sage-ink);
}

.conversation-detail, .review-grid {
    border-top: 1px solid var(--line);
    padding: 18px;
    max-width: 100%;
    min-width: 0;
}

.review-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
    align-items: start;
}

.message-section {
    max-width: 100%;
    min-width: 0;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid rgba(234, 223, 206, 0.8);
    margin-top: 14px;
}

.amber-reply-section {
    padding: 22px;
    background: #fffdf8;
    border-color: rgba(238, 133, 101, 0.22);
    box-shadow: 0 12px 28px rgba(105, 74, 50, 0.045);
}

.student-submission-section {
    background: rgba(250, 245, 236, 0.82);
    border-color: var(--line-soft);
}

.student-submission-section summary {
    cursor: pointer;
    color: #746e62;
    font-weight: 760;
}

.student-submission-section summary:focus-visible {
    outline: 3px solid rgba(238, 133, 101, 0.32);
    outline-offset: 4px;
    border-radius: 8px;
}

.conversation-turn {
    width: min(100%, 820px);
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    scroll-margin-top: 82px;
    margin: 12px 0;
    padding: 14px;
    border: 1px solid rgba(234, 223, 206, 0.8);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.86);
}

.conversation-turn.is-current {
    border-color: rgba(238, 133, 101, 0.42);
}

.conversation-turn.amber-turn {
    margin-left: auto;
    background: rgba(255, 240, 232, 0.82);
    border-color: rgba(238, 133, 101, 0.26);
}

.conversation-turn .turn-sender {
    font-weight: 800;
    color: var(--ink);
}

.reply-disclosure > summary {
    width: fit-content;
    list-style: none;
}

.reply-disclosure > summary::-webkit-details-marker {
    display: none;
}

.reply-disclosure form {
    margin-top: 16px;
}

.reply-tool > summary {
    cursor: pointer;
    font-weight: 800;
}

.reply-tool > summary:focus-visible {
    outline: 3px solid rgba(238, 133, 101, 0.32);
    outline-offset: 4px;
    border-radius: 8px;
}

.conversation-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 16px;
}

.continue-context {
    margin: 0 0 14px;
    padding: 10px 12px;
    font-size: 14px;
}

.reply-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    min-width: 0;
}

.reply-heading h3 {
    margin: 0 0 2px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
    line-height: 1.2;
}

.amber-avatar {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 50%;
    background: var(--coral);
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 22px;
    font-weight: 800;
}

.textblock {
    max-width: 100%;
    min-width: 0;
    margin-top: 10px;
    padding: 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    overflow-wrap: anywhere;
    line-height: 1.7;
}

.reply-text {
    border-color: rgba(238, 133, 101, 0.16);
    background: rgba(255, 253, 248, 0.92);
    color: var(--ink);
}

.chinese-text {
    font-size: 18px;
    line-height: 1.75;
}

.pinyin-panel {
    margin: 10px 0 6px;
    padding: 13px 15px;
    border-radius: 14px;
    background: #fff7ed;
    color: #66584f;
    font-size: 18px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.interface-pinyin {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #6b5f56;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: inherit;
    overflow-wrap: anywhere;
}

button .interface-pinyin,
.button .interface-pinyin,
.mode-tab .interface-pinyin,
.week-pill .interface-pinyin,
.status .interface-pinyin,
.media-indicator .interface-pinyin,
.transcript-toggle .interface-pinyin {
    flex-basis: 100%;
    order: -1;
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.28;
    color: currentColor;
    opacity: 0.78;
}

button.has-interface-pinyin,
.button.has-interface-pinyin,
.week-pill.has-interface-pinyin,
.status.has-interface-pinyin,
.media-indicator.has-interface-pinyin,
.transcript-toggle.has-interface-pinyin {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    white-space: normal;
}

.home-return.has-interface-pinyin {
    flex-direction: row;
    align-items: center;
}

.home-return .interface-pinyin {
    flex-basis: 100%;
}

.reading-mode-selector {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-width: 0;
}

[data-turn-reading-selector],
.transcript-panel .reading-mode-selector {
    max-width: 100%;
    margin-bottom: 10px;
}

.reading-mode-buttons {
    display: inline-grid;
    grid-template-columns: repeat(3, auto);
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    padding: 4px;
    border: 1px solid rgba(233, 119, 85, 0.22);
    border-radius: 999px;
    background: #fff8f4;
}

.reading-mode-button {
    min-height: 34px;
    min-width: 52px;
    max-width: 104px;
    border: 0;
    border-radius: 999px;
    padding: 7px 11px;
    background: var(--coral);
    color: #fff;
    font-size: 13px;
    font-weight: 760;
    cursor: pointer;
    white-space: nowrap;
    overflow: visible;
}

.reading-mode-button:hover,
.reading-mode-button:focus-visible {
    background: var(--coral-strong);
    outline: 2px solid rgba(95, 111, 88, 0.34);
    outline-offset: 2px;
}

.reading-mode-button ruby {
    ruby-position: over;
}

.reading-mode-button rt {
    color: currentColor;
    font-size: 10px;
    line-height: 1;
}

.reading-mode-button.is-active {
    background: var(--status-sage-ink) !important;
    color: #fff !important;
}

.reading-mode-ruby-choice {
    display: inline-block;
}

.lookup-word {
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .lookup-word:hover {
        background: #eef2eb;
        box-shadow: 0 0 0 2px #eef2eb;
    }
}

.lookup-word.is-selected {
    background: #e8eee5;
    box-shadow: 0 0 0 2px #d8e0d3;
}

.lookup-word:focus-visible {
    outline: 2px solid rgba(95, 111, 88, 0.42);
    outline-offset: 2px;
    border-radius: 4px;
}

.word-lookup-popup {
    position: fixed;
    z-index: 1000;
    max-width: min(260px, calc(100vw - 28px));
    padding: 10px 12px;
    border: 1px solid #d8e0d3;
    border-radius: 10px;
    background: #fffcf8;
    box-shadow: 0 16px 36px rgba(57, 38, 18, 0.16);
    color: var(--ink);
}

.word-lookup-popup strong {
    display: block;
    margin-bottom: 2px;
}

.word-lookup-popup p {
    margin: 4px 0 0;
}

.word-lookup-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: max-content;
    margin: 8px 0 10px;
    padding: 7px 10px;
    border: 1px solid #d8e0d3;
    border-radius: 999px;
    background: #eef2eb;
    color: #5f6f58;
    font-size: 13px;
    font-weight: 650;
}

.word-lookup-hint svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.word-lookup-hint button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0 2px;
}

.word-lookup-hint button:focus-visible {
    outline: 2px solid rgba(95, 111, 88, 0.42);
    outline-offset: 2px;
    border-radius: 4px;
}

[data-reading-variant] {
    display: none;
}

.learning-text-variants [data-reading-variant="hanzi"],
[data-transcript-reading-scope][data-reading-mode="hanzi"] [data-reading-variant="hanzi"],
[data-transcript-reading-scope][data-reading-mode="ruby"] [data-reading-variant="ruby"],
[data-transcript-reading-scope][data-reading-mode="pinyin"] [data-reading-variant="pinyin"] {
    display: block;
}

[data-transcript-reading-scope][data-reading-mode="ruby"] [data-reading-variant="hanzi"],
[data-transcript-reading-scope][data-reading-mode="pinyin"] [data-reading-variant="hanzi"] {
    display: none;
}

.reading-ruby-text {
    line-height: 2.42;
    word-spacing: 0;
    max-width: 100%;
    min-width: 0;
}

.reading-ruby-text .ruby-word {
    display: inline;
    line-height: inherit;
    margin: 0;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
}

.reading-ruby-text ruby {
    ruby-position: over;
}

.reading-ruby-text .ruby-word rt {
    color: #4f6049;
    font-size: 0.72em;
    font-weight: 680;
    line-height: 1.16;
    text-align: center;
    white-space: nowrap;
}

.reading-pinyin-only {
    color: #5f6f58;
    line-height: 1.75;
    word-spacing: 0;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.reading-pinyin-only .lookup-word {
    display: inline-block;
    margin: 0 0.03em;
    white-space: nowrap;
}

.mode-tab .interface-pinyin {
    font-size: 13px;
}

.interface-pinyin + .summary-meta,
.interface-pinyin + .file-picker-status {
    margin-top: 3px;
    font-size: 13px;
}

textarea + .interface-pinyin {
    margin: 8px 0 0;
    color: #766a5e;
    font-size: 15px;
    line-height: 1.45;
}

.section-head .interface-pinyin,
.reply-heading .interface-pinyin,
.audio-row .interface-pinyin,
.textblock + .interface-pinyin,
.privacy-note + .interface-pinyin {
    max-width: 100%;
}

.interface-pinyin + .summary-title,
.interface-pinyin + .summary-meta {
    display: block;
}

.student-time-summary {
    display: grid;
    gap: 4px;
    justify-items: end;
}

.teacher-student-grid {
    display: grid;
    gap: 12px;
}

.teacher-student-card .queue-summary {
    align-items: start;
}

.pending-count {
    margin-top: 6px;
    color: var(--coral-strong);
    font-size: 18px;
    font-weight: 850;
}

.conversation-list-section {
    margin-top: 18px;
}

.conversation-list-section h3 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 16px;
}

.conversation-list-section.is-pending h3 {
    color: var(--coral-strong);
}

.conversation-list-section.is-pending .queue-card {
    border-color: rgba(238, 133, 101, 0.32);
    background: rgba(255, 246, 241, 0.78);
}

.section-count {
    display: inline-flex;
    min-width: 24px;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--coral-soft);
    color: var(--coral-strong);
    font-size: 13px;
}

.conversation-context-section {
    grid-column: 1 / -1;
}

.pinyin-enabled [data-pinyin-panel],
[data-pinyin-panel][data-pinyin-visible="true"] {
    display: block !important;
}

.summary-pinyin {
    display: block;
    margin-top: 8px;
    padding: 0;
    background: transparent;
    color: #6b5f56;
    font-size: 17px;
    line-height: 1.65;
}

.transcript-panel {
    max-width: 100%;
    min-width: 0;
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    line-height: 1.65;
}

.transcript-text,
.learning-text-variants {
    max-width: 100%;
    min-width: 0;
}

.transcript-toggle {
    margin-top: 10px;
}

.transcript-action {
    margin-top: 10px;
}

.status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f3ebdf;
    color: #60483d;
    font-size: 13px;
    font-weight: 800;
}

.status.student-waiting,
.status.student-replied {
    position: relative;
    padding-left: 22px;
}

.status.student-waiting {
    background: var(--status-coral-soft);
    color: var(--status-coral);
}

.status.student-waiting::before,
.status.student-replied::before {
    content: "";
    position: absolute;
    left: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-coral);
}

.status.student-replied {
    background: var(--status-sage-soft);
    color: var(--status-sage-ink);
}

.status.student-replied::before {
    background: var(--status-sage);
}

.status.student-viewed {
    background: var(--status-viewed-soft);
    color: var(--status-viewed);
    font-weight: 720;
}

.status.reply_ready {
    background: var(--green-soft);
    color: var(--green);
}

.status.reviewing {
    background: #fbefd5;
    color: var(--gold);
}

.media-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.media-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(232, 238, 229, 0.74);
    color: var(--status-sage-ink);
    font-size: 13px;
    font-weight: 700;
}

.media-indicator svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.audio-list, .image-list {
    list-style: none;
    display: grid;
    gap: 10px;
    margin: 10px 0 0;
    padding: 0;
    max-width: 100%;
    min-width: 0;
}

.audio-row {
    display: grid;
    grid-template-columns: 135px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    max-width: 100%;
    min-width: 0;
}

.audio-row-plain {
    grid-template-columns: minmax(0, 1fr);
}

.audio-row > div {
    max-width: 100%;
    min-width: 0;
}

.audio-row audio {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.audio-title-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
    min-width: 0;
}

.audio-title-cell strong {
    overflow-wrap: anywhere;
}

.audio-title-edit-trigger {
    padding: 0;
    min-height: 0;
    font-size: 13px;
}

.audio-title-edit-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto auto;
    gap: 6px;
    width: min(100%, 520px);
    align-items: center;
}

.audio-title-edit-form input {
    min-height: 38px;
    padding: 8px 10px;
}

.message-correction {
    margin: 8px 0;
}

.message-correction summary {
    color: var(--status-sage);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

.message-correction form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.message-correction textarea {
    min-height: 90px;
}

.audio-title-field {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.audio-title-field input {
    max-width: 360px;
    min-height: 38px;
    padding: 8px 10px;
}

.download-history-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.download-selection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.download-select-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 760;
}

.download-select-row input {
    width: auto;
    margin-top: 3px;
}

.inline-export-form {
    margin: 0;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.image-grid a {
    display: block;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
}

.image-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.privacy-note {
    margin: 28px 0 0;
    padding: 0 4px;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--muted);
    font-size: 14px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.overview-tile {
    padding: 16px;
    box-shadow: none;
}

.overview-number {
    font-size: 30px;
    font-weight: 850;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}

.filter-chip.is-active {
    background: var(--ink);
    color: #fff;
}

.empty-state {
    padding: 24px;
    border-radius: 18px;
    background: var(--surface-soft);
    color: var(--muted);
}

@media (max-width: 860px) {
    .app-shell { padding: 18px; }
    .student-opening {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 18px 0 14px;
    }
    .student-opening h1 {
        font-size: 28px;
    }
    .history-panel > .section-head h2 {
        font-size: 32px;
    }
    .student-desktop-grid {
        grid-template-columns: 1fr;
    }
    .app-header, .section-head, .composer-footer {
        align-items: stretch;
        flex-direction: column;
    }
    .header-actions { justify-content: flex-start; }
    .audio-tools, .review-grid, .overview-grid {
        grid-template-columns: 1fr;
    }
    .teacher-timer-main {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .teacher-timer-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .app-shell { padding: 12px; }
    h1 {
        font-size: 28px;
    }
    h2,
    .history-panel > .section-head h2 {
        font-size: 28px;
    }
    .student-opening {
        margin: 14px 0 12px;
    }
    .student-opening h1 {
        font-size: 24px;
        line-height: 1.18;
    }
    .student-page-nav {
        margin: 8px 0 8px;
        padding: 4px 0;
    }
    .conversation-detail {
        padding: 12px;
    }
    .conversation-turn {
        padding: 12px;
        scroll-margin-top: 72px;
    }
    .amber-reply-section {
        padding: 14px;
    }
    .transcript-panel {
        padding: 10px;
    }
    .reading-mode-buttons {
        width: fit-content;
        max-width: 100%;
    }
    .reading-mode-button {
        font-size: 12px;
        padding-left: 6px;
        padding-right: 6px;
    }
    .reading-mode-button rt {
        font-size: 9px;
    }
    .auth-card, .composer, .history-panel, .queue-panel, .review-panel, .response-panel, .hero-panel, .teacher-timer-bar {
        border-radius: 16px;
        padding: 18px;
    }
    .conversation-summary, .queue-summary, .pending-clip, .pending-image, .audio-row {
        grid-template-columns: 1fr;
    }
    .timer-stats {
        grid-template-columns: 1fr;
    }
    .timer-actions {
        justify-content: stretch;
    }
    .timer-actions button {
        width: 100%;
    }
    .teacher-timer-actions .button,
    .teacher-timer-actions button {
        width: 100%;
    }
    .record-actions button, .actions button, .actions .button, .composer-footer button {
        width: 100%;
    }
    audio { width: 100%; }
}
