/* Codimente AI Tutor — adapted from the Codimente
   Private AI design language: dark navy, blue accent.
   Landing page uses modern Google fonts (Sora + Inter). */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

/* The HTML hidden attribute loses to any display rule
   (a class with display:flex still shows a "hidden"
   element). That exact bug made the voice-review dialog
   invisible yet full-screen and click-stealing after its
   first close, which looked like the page crashing.
   This rule makes hidden ALWAYS win. */

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-size: 15px;
    background:
        radial-gradient(circle at top right, #123b75, #06152c 55%);
    color: white;
    min-height: 100vh;
}

a {
    color: #4da3ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =====================================================
   Landing page
   ===================================================== */

.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 5vw;
    background: rgba(4, 16, 31, 0.75);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(77, 163, 255, 0.15);
    position: sticky;
    top: 0;
    z-index: 10;
}

.landing-nav .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.landing-nav .brand img {
    height: 34px;
    width: auto;
}

.landing-nav .brand span {
    font-family: 'Sora', Arial, sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: 0.4px;
}

.landing-nav .brand span em {
    color: #4da3ff;
    font-style: normal;
}

.landing-nav .nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hero {
    flex: 1;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
    gap: 4vw;
    padding: 48px 5vw 40px;
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
}

.hero-copy .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #7db8ff;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 2.6px;
    text-transform: uppercase;
    border: 1px solid rgba(77, 163, 255, 0.35);
    border-radius: 999px;
    padding: 6px 14px;
    margin-bottom: 22px;
    background: rgba(22, 140, 255, 0.08);
}

.hero-copy h1 {
    font-family: 'Sora', Arial, sans-serif;
    font-size: clamp(1.55rem, 2.6vw, 2.1rem);
    line-height: 1.18;
    letter-spacing: -0.4px;
    margin: 0 0 14px;
    font-weight: 700;
}

.hero-copy h1 .accent {
    color: #3ea0ff;
}

.hero-copy .sub {
    color: #b9c9dc;
    font-size: 0.92rem;
    line-height: 1.62;
    max-width: 440px;
    margin: 0 0 22px;
}

.hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.hero-points {
    display: flex;
    flex-direction: column;
    gap: 9px;
    color: #cdddf0;
    font-size: 0.9rem;
}

.hero-points .point {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.hero-points .tick {
    color: #3ea0ff;
    font-weight: 700;
}

.hero-visual {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(77, 163, 255, 0.28);
    box-shadow: 0 26px 70px rgba(2, 10, 24, 0.6);
    background: #04101f;
    min-height: 300px;
    display: flex;
    align-items: flex-end;
}

.hero-visual .flag-bg {
    position: absolute;
    inset: 0;
    background-image: url("../images/botswana-flag.6e32a297de13.png");
    background-size: cover;
    background-position: center;
    opacity: 0.94;
}

.hero-visual .flag-tint {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(4, 16, 31, 0.10) 0%,
        rgba(4, 16, 31, 0.55) 55%,
        rgba(4, 16, 31, 0.92) 100%
    );
}

.hero-visual .visual-card {
    position: relative;
    padding: 22px 24px;
    width: 100%;
}

.hero-visual .visual-card .levels {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.hero-visual .visual-card .levels span {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    background: rgba(4, 16, 31, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 5px 12px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}

.hero-visual .visual-card p {
    margin: 0;
    font-family: 'Sora', Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.45;
    color: #f2f7ff;
    text-shadow: 0 2px 10px rgba(2, 10, 24, 0.8);
}

.feature-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    padding: 10px 5vw 34px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.feature {
    background: rgba(10, 31, 61, 0.65);
    border: 1px solid rgba(77, 163, 255, 0.16);
    border-radius: 14px;
    padding: 16px 18px;
}

.feature .icon {
    font-size: 1.05rem;
    margin-bottom: 7px;
}

.feature h3 {
    font-family: 'Sora', Arial, sans-serif;
    font-size: 0.92rem;
    margin: 0 0 6px;
    font-weight: 600;
}

.feature p {
    margin: 0;
    color: #9db4cf;
    font-size: 0.82rem;
    line-height: 1.55;
}

.landing-footer {
    text-align: center;
    padding: 26px 5vw 34px;
    color: #7d94b3;
    font-size: 0.82rem;
    border-top: 1px solid rgba(77, 163, 255, 0.12);
}

.landing-footer a {
    color: #9cc4ff;
}

/* =====================================================
   Buttons
   ===================================================== */

.btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 9px;
    border: 1px solid #168cff;
    background: linear-gradient(135deg, #2196ff, #0f6fd1);
    color: white;
    font-weight: 600;
    font-size: 0.87rem;
    cursor: pointer;
    font-family: 'Inter', Arial, sans-serif;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(22, 140, 255, 0.35);
    text-decoration: none;
}

.btn.secondary {
    background: rgba(22, 140, 255, 0.08);
    border-color: rgba(77, 163, 255, 0.45);
}

.btn.secondary:hover {
    background: rgba(22, 140, 255, 0.16);
    box-shadow: none;
}

.btn.small {
    padding: 7px 14px;
    font-size: 0.82rem;
}

.btn.danger {
    border-color: #e05252;
    background: transparent;
    color: #ff9c9c;
}

.btn.danger:hover {
    background: rgba(224, 82, 82, 0.15);
    box-shadow: none;
}

/* =====================================================
   App layout
   ===================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #04101f;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-right: 1px solid #0e2c52;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 112px;
    align-self: center;
}

.sidebar .learner-chip {
    background: #0a1f3d;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
    color: #b9c9dc;
}

.sidebar .learner-chip strong {
    color: white;
    display: block;
    margin-bottom: 2px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar nav a {
    color: #cdddf0;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.92rem;
}

.sidebar nav a:hover {
    background: #0a1f3d;
    text-decoration: none;
}

.sidebar nav a.active {
    background: #168cff;
    color: white;
    font-weight: 600;
}

.sidebar .section-label {
    color: #5f7ea6;
    font-size: 0.68rem;
    letter-spacing: 2px;
    margin: 12px 0 4px;
}

/* ---------- AI assistant sidebar groups ---------- */

.assistant-group {
    margin-bottom: 4px;
}

.assistant-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e4eefb;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 9px 12px;
    border-radius: 8px;
}

.assistant-link:hover {
    background: #0a1f3d;
    text-decoration: none;
}

.assistant-link.active {
    background: #168cff;
    color: white;
}

.assistant-link .assistant-dot {
    color: #4da3ff;
    font-size: 0.8rem;
}

.assistant-link.active .assistant-dot {
    color: white;
}

.assistant-subjects {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 2px 0 8px 22px;
    padding-left: 10px;
    border-left: 1px solid #12345f;
}

.assistant-subject {
    color: #9db4cf;
    font-size: 0.84rem;
    padding: 5px 8px;
    border-radius: 6px;
}

.assistant-subject:hover {
    background: #0a1f3d;
    color: #e4eefb;
    text-decoration: none;
}

.assistant-subject.active {
    background: rgba(22, 140, 255, 0.18);
    color: #7db8ff;
}

.main {
    flex: 1;
    padding: 28px 34px;
    max-width: 1100px;
}

.main h2 {
    font-family: 'Sora', Arial, sans-serif;
    font-size: 1.22rem;
    margin-top: 0;
    letter-spacing: -0.3px;
}

.main h3 {
    font-family: 'Sora', Arial, sans-serif;
    font-size: 0.98rem;
}

/* ---------- Subject hub action cards ---------- */

.hub-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 18px 0 22px;
}

.hub-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: linear-gradient(
        160deg,
        rgba(16, 45, 84, 0.8),
        rgba(6, 21, 44, 0.95)
    );
    border: 1px solid #12345f;
    border-radius: 14px;
    padding: 18px;
    color: white;
    transition: border-color 0.15s ease, transform 0.12s ease;
}

.hub-card:hover {
    border-color: #168cff;
    transform: translateY(-2px);
    text-decoration: none;
}

.hub-card .hub-icon {
    font-size: 1.25rem;
}

.hub-card h3 {
    margin: 0 0 5px;
    font-size: 1rem;
}

.hub-card p {
    margin: 0;
    color: #9db4cf;
    font-size: 0.84rem;
    line-height: 1.5;
}

.hub-card.primary {
    border-color: rgba(22, 140, 255, 0.65);
    background: linear-gradient(
        160deg,
        rgba(22, 140, 255, 0.22),
        rgba(6, 21, 44, 0.95)
    );
}

.hub-card.primary h3 {
    color: #9cd0ff;
}

/* ---------- Cards & grids ---------- */

.card {
    background: #0a1f3d;
    border: 1px solid #12345f;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.card h3 {
    margin-top: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.grid .card {
    margin-bottom: 0;
}

.subject-card {
    display: block;
    color: white;
}

.subject-card:hover {
    border-color: #168cff;
    text-decoration: none;
}

.subject-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.mastery-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.72rem;
    white-space: nowrap;
    color: #b9c9dc;
    background: #12345f;
}

.mastery-badge.strong {
    color: #7ee2a8;
    background: rgba(52, 199, 123, 0.14);
}

.mastery-badge.developing {
    color: #ffd479;
    background: rgba(255, 196, 77, 0.14);
}

.mastery-badge.needs_help {
    color: #ff9d9d;
    background: rgba(255, 99, 99, 0.14);
}

.mastery-badge.not_started {
    color: #8aa4c4;
    background: #12345f;
}

.sources-panel {
    margin-top: 8px;
}

.sources-toggle {
    background: none;
    border: 1px solid #1d4a7a;
    border-radius: 999px;
    color: #8aa4c4;
    font-size: 0.72rem;
    padding: 2px 10px;
    cursor: pointer;
}

.sources-toggle:hover {
    color: #d6e4f5;
    border-color: #168cff;
}

.sources-list {
    margin: 6px 0 0;
    padding: 6px 6px 6px 22px;
    background: rgba(29, 74, 122, 0.25);
    border: 1px solid #1d4a7a;
    border-radius: 8px;
    font-size: 0.78rem;
    color: #b9c9dc;
}

.sources-list li {
    margin: 2px 0;
}

.muted {
    color: #8aa4c4;
    font-size: 0.9rem;
}

.pill {
    display: inline-block;
    background: #12345f;
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 0.75rem;
    color: #b9c9dc;
    margin-right: 6px;
}

.pill.ok {
    background: #14532d;
    color: #bbf7d0;
}

.pill.warn {
    background: #713f12;
    color: #fde68a;
}

.pill.bad {
    background: #7f1d1d;
    color: #fecaca;
}

.progress-track {
    background: #06152c;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: #168cff;
    border-radius: 999px;
}

/* ---------- Lesson reader ---------- */

.lesson-section {
    background: #0a1f3d;
    border: 1px solid #12345f;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.lesson-section.speaking {
    border-color: #168cff;
    box-shadow: 0 0 0 1px #168cff;
}

.lesson-section .section-tools {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.lesson-section .speak-section.playing {
    background: #7f1d1d;
    border-color: #e05252;
    color: #fecaca;
}

.audio-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 14px 0;
    flex-wrap: wrap;
}

.audio-controls .status {
    color: #8aa4c4;
    font-size: 0.85rem;
}

/* ---------- Tutor chat ---------- */

.chat-window {
    background: #0a1f3d;
    border: 1px solid #12345f;
    border-radius: 12px;
    padding: 18px;
    height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    font-size: 0.95rem;
}

.chat-message.user {
    align-self: flex-end;
    background: #168cff;
}

.chat-message.assistant {
    align-self: flex-start;
    background: #06152c;
    border: 1px solid #12345f;
}

.chat-message .sources {
    margin-top: 8px;
    font-size: 0.78rem;
    color: #8aa4c4;
}

/* ---------- Rendered markdown in tutor answers ---------- */

.chat-message.assistant {
    background: linear-gradient(
        160deg,
        rgba(16, 45, 84, 0.85),
        rgba(6, 21, 44, 0.95)
    );
    border: 1px solid rgba(77, 163, 255, 0.22);
    box-shadow: 0 6px 18px rgba(2, 10, 24, 0.35);
}

.md p {
    margin: 0 0 8px;
}

.md p:last-child {
    margin-bottom: 0;
}

.md strong {
    color: #9cd0ff;
    font-weight: 700;
}

.md em {
    color: #c4d9f2;
}

.md code {
    background: rgba(2, 10, 24, 0.65);
    border: 1px solid #12345f;
    border-radius: 5px;
    padding: 1px 6px;
    font-family: Consolas, monospace;
    font-size: 0.85em;
    color: #ffd479;
}

.md h3,
.md h4,
.md h5,
.md h6 {
    font-family: 'Sora', Arial, sans-serif;
    color: #7db8ff;
    margin: 12px 0 6px;
    font-size: 0.98rem;
}

.md ul,
.md ol {
    margin: 6px 0 10px;
    padding-left: 20px;
}

.md li {
    margin-bottom: 4px;
}

.md ul li::marker {
    color: #4da3ff;
}

.md ol li::marker {
    color: #4da3ff;
    font-weight: 600;
}

.message-tools {
    margin-top: 8px;
}

.listen-btn.playing {
    background: #7f1d1d;
    border-color: #e05252;
    color: #fecaca;
    animation: pulse 1.4s infinite;
}

.chat-input-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.chat-input-row textarea {
    flex: 1;
    border-radius: 10px;
    border: 1px solid #12345f;
    background: #06152c;
    color: white;
    padding: 12px;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 48px;
    font-family: inherit;
}

.chat-language-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
}

.chat-language-row label {
    margin: 0;
    color: #cdddf0;
}

.chat-language-row select {
    background: #06152c;
    color: white;
    border: 1px solid #12345f;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-family: inherit;
}

.mic-button {
    border-radius: 10px;
    border: 1px solid #12345f;
    background: #06152c;
    color: #cdddf0;
    font-size: 1.2rem;
    padding: 0 16px;
    cursor: pointer;
}

.mic-button.recording {
    background: #7f1d1d;
    border-color: #e05252;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    50% { opacity: 0.6; }
}

/* ---------- Practice / exam ---------- */

.question-card .choices label {
    display: block;
    background: #06152c;
    border: 1px solid #12345f;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    cursor: pointer;
}

.question-card .choices label:hover {
    border-color: #168cff;
}

.feedback {
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 10px;
    display: none;
    white-space: pre-wrap;
}

.feedback.correct {
    display: block;
    background: #14532d;
    color: #bbf7d0;
}

.feedback.wrong {
    display: block;
    background: #7f1d1d;
    color: #fecaca;
}

.exam-timer {
    position: sticky;
    top: 0;
    background: #04101f;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #12345f;
    margin-bottom: 16px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}

/* ---------- Break overlay ---------- */

.break-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 16, 31, 0.96);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.break-overlay.open {
    display: flex;
}

.break-card {
    background: #0a1f3d;
    border: 1px solid #168cff;
    border-radius: 16px;
    padding: 32px;
    max-width: 520px;
    text-align: center;
}

.break-card .category {
    color: #4da3ff;
    letter-spacing: 3px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.break-card .prompt {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 18px 0;
}

.break-card .hint {
    color: #8aa4c4;
    font-size: 0.9rem;
}

.breath-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #168cff;
    margin: 20px auto;
    animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(0.7); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* ---------- Tables ---------- */

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table.data th,
table.data td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid #12345f;
}

table.data th {
    color: #8aa4c4;
    font-weight: normal;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ---------- Forms ---------- */

form label {
    display: block;
    margin: 14px 0 6px;
    color: #cdddf0;
    font-size: 0.9rem;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="date"],
form select,
form textarea {
    width: 100%;
    max-width: 480px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #12345f;
    background: #06152c;
    color: white;
    font-size: 0.95rem;
}

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checks label {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #06152c;
    border: 1px solid #12345f;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 0;
    cursor: pointer;
    font-size: 0.88rem;
}

.checks label:has(input:checked) {
    border-color: #168cff;
}

.messages li {
    list-style: none;
    background: #0a1f3d;
    border: 1px solid #168cff;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.messages {
    padding: 0;
}

/* ---------- Auth pages ---------- */

.auth-card {
    max-width: 400px;
    margin: 9vh auto;
    background: #0a1f3d;
    border: 1px solid #12345f;
    border-radius: 14px;
    padding: 30px;
}

.auth-card h2 {
    font-family: 'Sora', Arial, sans-serif;
    font-size: 1.2rem;
    margin: 0 0 14px;
}

.auth-card .auth-logo {
    display: block;
    width: 116px;
    margin: 0 auto 18px;
}

.guest-hint {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(22, 140, 255, 0.08);
    border: 1px dashed rgba(77, 163, 255, 0.4);
    font-size: 0.86rem;
    color: #cdddf0;
}

.guest-hint strong {
    color: #7db8ff;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        padding-top: 40px;
    }
    .hero-visual {
        min-height: 260px;
    }
}

/* Tablets and phones: the sidebar becomes a compact top
   bar, content goes single-column and touch targets grow. */

@media (max-width: 860px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px;
        border-right: none;
        border-bottom: 1px solid #0e2c52;
    }

    .sidebar-logo {
        width: 120px;
        align-self: flex-start;
    }

    .sidebar .learner-chip {
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .sidebar nav a {
        padding: 10px 12px;
        font-size: 0.88rem;
    }

    .sidebar .section-label {
        width: 100%;
        margin: 6px 0 2px;
    }

    .sidebar form {
        margin-top: 6px;
    }

    /* Assistant groups: label + horizontal scroll strip of
       subjects so phone users swipe instead of digging
       through menus. */

    .assistant-group {
        width: 100%;
    }

    .assistant-subjects {
        flex-direction: row;
        overflow-x: auto;
        margin-left: 0;
        padding: 4px 2px;
        border-left: none;
        -webkit-overflow-scrolling: touch;
    }

    .assistant-subject {
        white-space: nowrap;
        border: 1px solid #12345f;
        background: #06152c;
        padding: 8px 12px;
    }

    .main {
        padding: 16px 14px;
        max-width: 100%;
    }

    .main h2 {
        font-size: 1.25rem;
    }
}

/* Phones: single column, bigger targets, no horizontal
   scrolling anywhere. */

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .landing-nav {
        padding: 12px 4vw;
    }

    .landing-nav .brand img {
        height: 34px;
    }

    .hero {
        padding: 28px 5vw 30px;
        gap: 0;
    }

    .hero-copy h1 {
        font-size: clamp(1.5rem, 7.5vw, 2rem);
    }

    .hero-copy .sub {
        font-size: 0.95rem;
    }

    .hero-cta .btn,
    .hero-cta a.btn {
        width: 100%;
        text-align: center;
    }

    .hero-visual {
        min-height: 200px;
    }

    .feature-strip {
        grid-template-columns: 1fr;
        padding-bottom: 24px;
    }

    .hub-actions,
    .grid {
        grid-template-columns: 1fr;
    }

    .hub-card,
    .card {
        padding: 14px;
    }

    .main {
        padding: 12px 10px;
    }

    /* Buttons and nav: comfortable thumb targets. */

    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .sidebar nav a,
    .assistant-link,
    .assistant-subject {
        min-height: 40px;
        align-items: center;
    }

    /* Question choices: full-width tap rows. */

    .question-card .choices label {
        padding: 13px 14px;
        font-size: 0.98rem;
    }

    /* Tutor chat: fill the viewport minus chrome. */

    .chat-window {
        height: 58vh;
        padding: 12px;
    }

    .chat-message {
        max-width: 94%;
    }

    .chat-input-row {
        flex-wrap: nowrap;
    }

    .chat-input-row textarea {
        min-height: 52px;
        font-size: 16px; /* stops iOS zoom-on-focus */
    }

    .mic-button {
        padding: 0 14px;
        min-height: 48px;
    }

    /* Forms: roomier inputs, no iOS zoom. */

    form input[type="text"],
    form input[type="email"],
    form input[type="password"],
    form input[type="number"],
    form input[type="date"],
    form select,
    form textarea {
        font-size: 16px;
        max-width: 100%;
    }

    /* Wide tables scroll inside their card instead of
       breaking the page. */

    table.data {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .exam-timer {
        font-size: 0.95rem;
        padding: 8px 10px;
    }

    .break-card {
        padding: 22px;
        margin: 0 12px;
    }

    .audio-controls {
        gap: 6px;
    }
}

/* Very small phones */

@media (max-width: 380px) {
    .hero-copy h1 {
        font-size: 1.4rem;
    }

    .sidebar nav a {
        padding: 9px 10px;
        font-size: 0.84rem;
    }
}

/* Respect reduced-motion preferences on breaks and
   animations. */

@media (prefers-reduced-motion: reduce) {
    .breath-circle,
    .listen-btn.playing,
    .mic-button.recording {
        animation: none;
    }
}


/* =====================================================
   New-learner welcome banner (dashboard)
   ===================================================== */

.welcome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background:
        linear-gradient(120deg, rgba(77, 163, 255, 0.16),
        rgba(11, 31, 58, 0.55));
    border: 1px solid rgba(77, 163, 255, 0.35);
}

.welcome-copy h2 {
    margin: 0 0 6px;
}

.welcome-copy p {
    margin: 0 0 12px;
    max-width: 560px;
}

.welcome-art {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-orb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    font-size: 40px;
    background: radial-gradient(circle at 30% 25%,
        #4da3ff, #0b1f3a 75%);
    box-shadow: 0 8px 24px rgba(77, 163, 255, 0.35);
}

@media (max-width: 640px) {
    .welcome-banner {
        flex-direction: column;
        text-align: center;
    }

    .welcome-copy p {
        margin-left: auto;
        margin-right: auto;
    }
}

.welcome-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#welcomeVoiceStatus {
    margin: 8px 0 0;
    font-size: 0.85rem;
}

/* ------------------------------------------------------------
 * Voice review dialog (speech transcript confirmation)
 * ------------------------------------------------------------
 */

.voice-review-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 8, 20, 0.72);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.18s ease;
    padding: 20px;
}

.voice-review-overlay.open {
    opacity: 1;
}

.voice-review-card {
    width: min(440px, 100%);
    background: linear-gradient(160deg, #0a2244 0%, #061527 100%);
    border: 1px solid #1d4b86;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    text-align: center;
    transform: translateY(10px) scale(0.98);
    transition: transform 0.18s ease;
}

.voice-review-overlay.open .voice-review-card {
    transform: translateY(0) scale(1);
}

.voice-review-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border-radius: 50%;
    background: rgba(77, 163, 255, 0.14);
    border: 1px solid rgba(77, 163, 255, 0.35);
}

.voice-review-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    color: #eaf3ff;
}

.voice-review-hint {
    margin: 0 0 14px;
    font-size: 0.85rem;
    color: #9db8d9;
}

.voice-review-text {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 76px;
    border-radius: 12px;
    border: 1px solid #12345f;
    background: #06152c;
    color: white;
    padding: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    text-align: left;
}

.voice-review-text:focus {
    outline: 2px solid #4da3ff;
    outline-offset: 1px;
}

.voice-review-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}
