:root {
    --header-offset: 5rem;
    --sidebar: 17.5rem;
    --sidebar-width: var(--sidebar);
    --topbar-height: 4.5rem;
    --overlay: rgba(15, 23, 42, 0.35);
    --solution-panel-width: min(34vw, 24rem);
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --muted: #64748b;
    --text: #1e293b;
    --heading: #0f172a;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --panel-soft: #f1f5f9;
    --accent: #0f766e;
    --accent-hover: #115e59;
    --accent-ink: #f0fdfa;
    --accent-rgb: 15, 118, 110;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    --danger: #b91c1c;
}

html {
    scroll-snap-type: y mandatory;
}

html.scroll-nav-lock {
    scroll-snap-type: none !important;
}

html.scroll-nav-lock .q-card {
    content-visibility: visible !important;
}

#exam-main section[id],
.section-banner {
    scroll-margin-top: calc(var(--topbar-height, 4.5rem) + 0.75rem);
}

.section-banner {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

#scoreSummaryModal.modal-backdrop {
    z-index: 95;
    background: rgba(15, 23, 42, 0.62) !important;
}

#scoreSummaryModal .score-summary-modal,
.modal.score-summary-modal {
    position: relative;
    width: min(100%, 34rem);
    max-width: 34rem;
    text-align: center;
    background: #ffffff;
    color: var(--text);
    border: 1px solid #99f6e4;
    border-radius: 1.25rem;
    padding: 2rem 1.75rem 1.5rem;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.35);
}

.score-summary-modal .hint {
    margin: 0.45rem auto 1.25rem;
    max-width: 28rem;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.45;
}

.modal.score-summary-modal h2,
#scoreSummaryModal .score-summary-modal h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.75rem;
}

.score-summary-eyebrow {
    margin: 0 0 0.45rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
}

.score-summary-score {
    display: grid;
    gap: 0.35rem;
    margin: 0 auto 1.35rem;
    padding: 1.35rem 1.25rem;
    border-radius: 1rem;
    background: linear-gradient(160deg, #0f766e 0%, #0d9488 55%, #115e59 100%);
    border: 1px solid #0f766e;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.score-summary-score strong {
    font-size: 3.25rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #fff;
}

.score-summary-score span {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a7f3d0;
}

.score-summary-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}

.score-summary-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.score-summary-modal .modal-actions {
    justify-content: center;
}

.score-summary-modal .modal-actions .primary {
    min-width: 8.5rem;
    min-height: 2.6rem;
    font-size: 0.95rem;
    background: #0f766e;
    color: #f0fdfa;
    border-color: #0f766e;
}

.score-summary-modal .modal-actions .primary:hover {
    background: #115e59;
    border-color: #115e59;
    color: #f0fdfa;
}

.grade-results-banner {
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 1rem;
    padding: 1.15rem 1.25rem 1.2rem;
    margin: 0 0 1.1rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    scroll-margin-top: calc(var(--topbar-height, 4.5rem) + 0.75rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.grade-results-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.grade-results-label {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
}

.grade-results-score-line {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.grade-results-correct {
    position: relative;
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1;
    color: #5b21b6;
    z-index: 0;
}

.grade-results-correct::after {
    content: '';
    position: absolute;
    left: -0.08em;
    right: -0.08em;
    bottom: 0.08em;
    height: 0.42em;
    background: #facc15;
    z-index: -1;
    border-radius: 0.12em;
}

.grade-results-total {
    font-size: 1.55rem;
    font-weight: 800;
    color: #ca8a04;
}

.grade-results-percent {
    margin-left: 0.35rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
}

.grade-results-feedback {
    margin: 0.55rem 0 0;
    max-width: 28rem;
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.4;
}

.grade-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.35rem, 1fr));
    gap: 0.4rem;
}

.grade-result-tile {
    display: grid;
    gap: 0.15rem;
    justify-items: center;
    min-height: 2.85rem;
    padding: 0.3rem 0.2rem;
    border: 2px solid transparent;
    border-radius: 0.55rem;
    font: inherit;
    cursor: pointer;
}

.grade-result-tile.is-correct {
    background: #dcfce7;
    color: #166534;
}

.grade-result-tile.is-wrong {
    background: #fee2e2;
    color: #b91c1c;
}

.grade-result-tile.theme-emerald {
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.grade-result-tile.theme-indigo {
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.grade-result-tile.theme-purple {
    border-color: #9333ea;
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.35);
}

.grade-back-to-top {
    position: fixed;
    z-index: 80;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.4rem;
    padding: 0 0.9rem;
    border: 1px solid #c4b5fd;
    border-radius: 999px;
    background: #5b21b6;
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(91, 33, 182, 0.28);
    cursor: pointer;
    transform: translateX(-100%);
    margin-left: -0.65rem;
}

.grade-back-to-top:hover {
    background: #4c1d95;
}

.grade-back-to-top[hidden] {
    display: none;
}

@media (max-width: 980px) {
    .grade-back-to-top {
        transform: none;
        margin-left: 0;
        left: 0.75rem !important;
    }
}

.grade-result-num {
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

.grade-result-mark {
    font-size: 0.85rem;
    font-weight: 900;
    line-height: 1;
}

@media (max-width: 640px) {
    .grade-results-correct {
        font-size: 2.2rem;
    }
}

/* ===== App chrome: fixed sidebar + content column ===== */
.app-body-bg {
    background: #e8eef5;
}

#app-shell.shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-sidebar.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    z-index: 40;
}

.sidebar-brand-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
}

.app-brand {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}

.app-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.8rem;
    background: #059669;
    color: #fff;
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.25);
    flex-shrink: 0;
}

.app-brand-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.app-brand-subtitle {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.25;
    margin-top: 0.1rem;
}

.app-content.workspace {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    background: #e8eef5;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 0.7rem 1rem;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.97) 0%, rgba(13, 95, 89, 0.96) 100%);
    color: #f0fdfa;
    border-bottom: 1px solid rgba(204, 251, 241, 0.18);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.solution-open .app-topbar,
body.formula-open .app-topbar,
body.learn-open .app-topbar {
    z-index: 90;
}

.app-topbar .app-field-label {
    color: #99f6e4;
}

.app-topbar .app-progress-text {
    color: #f0fdfa;
}

.app-topbar .app-progress-track {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.22);
}

.app-topbar .app-progress-bar {
    background: #ecfdf5;
}

.nav-toggle.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.12);
    color: #ecfdf5;
    flex-shrink: 0;
    cursor: pointer;
}

.nav-toggle.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nav-toggle svg {
    display: block;
    fill: currentColor;
}

.nav-toggle .icon-menu {
    width: 1.35rem;
    height: auto;
    display: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-toggle .icon-fold {
    width: 1.35rem;
    height: 1.35rem;
}

.nav-toggle .fold-arrow {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform-origin: 20px 12px;
    transition: transform 0.2s ease;
}

#app-shell.shell.sidebar-collapsed .nav-toggle .fold-arrow {
    transform: scaleX(-1);
}

.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;
}

.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    width: 100%;
    margin: 0;
    padding: 0;
}

.app-topbar-left,
.header-lead {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1 1 0;
    min-width: 0;
}

.header-lead {
    min-width: max-content;
    flex-wrap: nowrap;
}

.app-topbar-tools,
.app-topbar .app-topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.65rem;
    min-width: max-content;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 0;
    min-width: 0;
}

.header-actions-cluster {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.28rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(204, 251, 241, 0.16);
}

.topbar-buy-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0 0.95rem;
    border: 1px solid #ff9900;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffb84d 0%, #ff9900 55%, #f08804 100%);
    color: #111827;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(240, 136, 4, 0.35);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.topbar-buy-btn:hover {
    background: linear-gradient(180deg, #ff9900 0%, #e47911 60%, #d9700b 100%);
    border-color: #e47911;
    color: #111827;
    box-shadow: 0 8px 18px rgba(228, 121, 17, 0.4);
    transform: translateY(-1px);
}

.topbar-buy-btn[hidden] {
    display: none;
}

.topbar-buy-short {
    display: none;
}

.app-topbar-title-wrap {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    justify-self: center;
    min-width: 7.25rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.6rem;
    background: #f0fdfa;
    box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.28), 0 0 10px rgba(15, 118, 110, 0.22);
}

.app-topbar-title-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.app-topbar-title-shine::before {
    content: "";
    position: absolute;
    inset: -80%;
    border-radius: 50%;
    background: conic-gradient(#2563eb, #14b8a6, #f59e0b, #ec4899, #2563eb);
}

.app-topbar-title-wrap::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: calc(0.75rem - 2px);
    background: #f0fdfa;
    pointer-events: none;
    z-index: 1;
}

.app-topbar-year {
    position: relative;
    z-index: 2;
    max-width: 11rem;
    margin: 0;
    padding: 0 1.15rem;
    border: 0;
    border-radius: 0.35rem;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b127db' d='M1.1 1.2 6 6.1l4.9-4.9 1.1 1.1L6 8.3.0 2.3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.05rem center;
    background-size: 0.65rem 0.4rem;
    font: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: #b127db;
    text-align: center;
    text-align-last: center;
    white-space: nowrap;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.app-topbar-year:hover,
.app-topbar-year:focus-visible {
    outline: none;
    background-color: rgba(177, 39, 219, 0.08);
}

.app-topbar-year:disabled {
    cursor: default;
    opacity: 0.85;
    background-image: none;
}

.app-topbar-year[hidden] {
    display: none;
}

.account {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    min-width: 8.5rem;
    min-height: 40px;
}

.account .account-btn,
.account .primary {
    max-width: 100%;
}

.account .account-btn > span:not(.avatar) {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 5.5rem;
}

.user-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--accent);
}

.user-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.user-icon .ring {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
}

.profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.profile-link:hover { color: var(--accent-hover); }
.profile-link:hover .user-icon { color: inherit; }
.profile-link:hover .ring { fill: rgba(var(--accent-rgb), 0.12); }

.app-topbar .profile-link,
.app-topbar .profile-link:hover { color: #f0fdfa; }

.app-topbar .user-icon,
.app-topbar .profile-link:hover .user-icon { color: #ddd6fe; }

.app-topbar .profile-link:hover .ring { fill: rgba(221, 214, 254, 0.28); }

.primary,
.account-btn,
.menu button,
.login-modal button {
    font-family: inherit;
    cursor: pointer;
}

.primary {
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--accent);
    border-radius: 30px;
    min-height: 40px;
    padding: 0 12px;
    font-weight: 700;
    font-size: 14px;
}

.app-topbar .primary {
    background: #f0fdfa;
    color: #0f766e;
    border-color: #f0fdfa;
}

.primary:hover:not(:disabled) {
    background: var(--panel);
    color: var(--heading);
    border-color: var(--accent);
}

.app-topbar .primary:hover:not(:disabled) {
    background: #fff;
    color: #115e59;
    border-color: #fff;
}

.account-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding-right: 14px;
    background: #f0fdfa;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 30px;
    min-height: 40px;
    padding-left: 6px;
    font-weight: 700;
    font-size: 14px;
    color: #0f766e;
}

.account-btn:hover { background: #fff; }

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 12px;
    font-weight: 800;
}

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 240px;
    padding: 8px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: var(--shadow);
    z-index: 40;
}

.menu-id {
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.menu-id strong { display: block; color: var(--heading); }
.menu-id span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    word-break: break-word;
}

.menu button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text);
    border-radius: 30px;
    min-height: 40px;
    padding: 0 12px;
    font-weight: 700;
    font-size: 14px;
}

.menu button:hover { background: var(--panel-soft); }

.login-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.login-modal[hidden] { display: none; }

.login-modal-scrim {
    position: absolute;
    inset: 0;
    background: var(--overlay);
}

/* Forced sign-in — blur practice UI and block dismiss */
body.login-required #app-shell {
    filter: blur(7px);
    pointer-events: none;
    user-select: none;
}

/* Keep header geometry stable while Firebase restores a session. */
body.auth-pending #signInBtn {
    visibility: hidden;
}

body.auth-pending .account .account-btn[aria-busy="true"] {
    pointer-events: none;
}

.login-modal.is-required {
    z-index: 100;
}

.login-modal.is-required .login-modal-scrim {
    background: rgba(15, 23, 42, 0.45);
    cursor: default;
}

.login-modal.is-required .login-modal-close {
    display: none;
}

.login-home-link {
    display: none;
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 1;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid #0f766e;
    background: #0f766e;
    color: #ecfdf5;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    line-height: 1.2;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.35);
}

.login-home-link i {
    font-size: 0.78rem;
}

.login-home-link:hover {
    background: #115e59;
    border-color: #115e59;
    color: #fff;
    box-shadow: 0 6px 16px rgba(15, 118, 110, 0.45);
}

.login-modal.is-required .login-home-link {
    display: inline-flex;
}

.login-modal.is-required .login-modal-card h2 {
    padding-right: 7.5rem;
}

.login-modal-card {
    position: relative;
    width: min(100%, 24rem);
    background: #fff;
    border-radius: 1rem;
    padding: 1.35rem 1.25rem 1.15rem;
    box-shadow: var(--shadow);
}

.login-modal-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--heading);
}

.login-modal-note {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    white-space: pre-line;
}

.login-modal-card form {
    display: grid;
    gap: 0.75rem;
}

.login-modal-card label {
    display: grid;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.login-modal-card input {
    border: 1px solid var(--line-strong);
    border-radius: 0.75rem;
    min-height: 42px;
    padding: 0 0.8rem;
    font: inherit;
    color: var(--text);
}

.login-modal-card input:focus {
    outline: 2px solid rgba(var(--accent-rgb), 0.35);
    border-color: var(--accent);
}

.login-modal:not(.is-create) .login-name,
.login-modal:not(.is-create) .login-confirm { display: none; }

.login-modal-card .primary { width: 100%; }

#verifyEmailCheck {
    margin-top: 0.35rem;
}

.login-modal-card .primary:disabled {
    opacity: 0.65;
    cursor: progress;
}

.login-switch {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    background: transparent;
    border: 0;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.login-modal-close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: var(--panel-soft);
    color: #334155;
}

.app-field-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
}

.app-progress {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.app-progress-copy {
    text-align: right;
}

.app-progress-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
}

.app-progress-track {
    width: 5.5rem;
    height: 0.55rem;
    border-radius: 999px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.app-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: #10b981;
    transition: width 0.3s ease;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.top-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    border-radius: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    transition: background 0.15s ease, color 0.15s ease;
}

.top-action-dark {
    background: #1e293b;
    color: #fff;
}

.top-action-dark:hover {
    background: #0f172a;
}

#pdf-panel-btn[hidden],
#error-log-btn[hidden] {
    display: none !important;
}

.top-action-amber {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.top-action-amber:hover {
    background: #fde68a;
}

.top-action-green {
    background: #059669;
    color: #fff;
}

.top-action-green:hover {
    background: #047857;
}

#grade-btn {
    background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 55%, #6ee7b7 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -2px 0 rgba(5, 150, 105, 0.18),
        0 3px 0 #059669,
        0 6px 12px -4px rgba(5, 150, 105, 0.35);
    transform: translateY(0);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease, color 0.15s ease;
}

#grade-btn:hover {
    background: linear-gradient(180deg, #ecfdf5 0%, #a7f3d0 50%, #5eead4 100%);
    color: #047857;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        inset 0 -2px 0 rgba(5, 150, 105, 0.16),
        0 4px 0 #047857,
        0 8px 14px -4px rgba(5, 150, 105, 0.4);
}

#grade-btn:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 2px 4px rgba(5, 150, 105, 0.25),
        0 1px 0 #059669,
        0 2px 6px -2px rgba(5, 150, 105, 0.3);
}

@media (prefers-reduced-motion: reduce) {
    #grade-btn {
        transition: none;
    }
}

.top-action-orange {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.top-action-orange:hover {
    background: #ffedd5;
    border-color: #fb923c;
    color: #7c2d12;
}

#grade-reset-btn[hidden] {
    display: none !important;
}

.top-action-muted {
    background: #e2e8f0;
    color: #334155;
}

.top-action-muted:hover {
    background: #cbd5e1;
}

#question-timer-toggle {
    background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 55%, #6ee7b7 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -2px 0 rgba(5, 150, 105, 0.18),
        0 3px 0 #059669,
        0 6px 12px -4px rgba(5, 150, 105, 0.35);
    transform: translateY(0);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease, color 0.15s ease;
}

#question-timer-toggle:hover {
    background: linear-gradient(180deg, #ecfdf5 0%, #a7f3d0 50%, #5eead4 100%);
    color: #047857;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        inset 0 -2px 0 rgba(5, 150, 105, 0.16),
        0 4px 0 #047857,
        0 8px 14px -4px rgba(5, 150, 105, 0.4);
}

#question-timer-toggle:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 2px 4px rgba(5, 150, 105, 0.25),
        0 1px 0 #059669,
        0 2px 6px -2px rgba(5, 150, 105, 0.3);
}

#question-timer-toggle[aria-pressed="true"] {
    background: linear-gradient(180deg, #0d9488 0%, #0f766e 55%, #115e59 100%);
    color: #ecfdf5;
    border: 1px solid #99f6e4;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -2px 0 rgba(0, 0, 0, 0.18),
        0 3px 0 #0f3f3c,
        0 0 0 2px rgba(20, 184, 166, 0.28),
        0 8px 18px -6px rgba(13, 148, 136, 0.85);
    animation: q-timer-glow 1.35s ease-in-out infinite alternate;
}

#question-timer-toggle[aria-pressed="true"]:hover {
    background: linear-gradient(180deg, #14b8a6 0%, #0f766e 60%, #115e59 100%);
}

#question-timer-toggle[aria-pressed="true"]:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, 0.28),
        0 1px 0 #0f3f3c,
        0 0 0 2px rgba(20, 184, 166, 0.22);
}

#question-timer-toggle[aria-pressed="true"] i {
    animation: q-timer-tick 1s steps(2, end) infinite;
}

@keyframes q-timer-glow {
    from {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.25),
            inset 0 -2px 0 rgba(0, 0, 0, 0.18),
            0 3px 0 #0f3f3c,
            0 0 0 2px rgba(20, 184, 166, 0.22),
            0 8px 16px -6px rgba(13, 148, 136, 0.75);
    }
    to {
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            inset 0 -2px 0 rgba(0, 0, 0, 0.18),
            0 3px 0 #0f3f3c,
            0 0 0 3px rgba(45, 212, 191, 0.36),
            0 10px 20px -6px rgba(15, 118, 110, 0.9);
    }
}

@keyframes q-timer-tick {
    from { transform: rotate(0deg); }
    to { transform: rotate(20deg); }
}

@media (prefers-reduced-motion: reduce) {
    #question-timer-toggle,
    #question-timer-toggle[aria-pressed="true"],
    #question-timer-toggle[aria-pressed="true"] i {
        animation: none;
        transition: none;
    }
}

.q-time-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #78716c;
    background: rgba(255, 255, 255, 0.72);
    color: #44403c;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    flex-shrink: 0;
}

.q-time-chip i {
    font-size: 0.7rem;
    opacity: 0.85;
}

.q-time-chip .q-time-allotted {
    opacity: 0.75;
    font-weight: 600;
}

.q-time-chip.is-over {
    border-color: #ea580c;
    background: #fff7ed;
    color: #c2410c;
}

.q-time-chip.is-critical {
    border-color: #dc2626;
    background: #fef2f2;
    color: #b91c1c;
}

.q-time-chip.is-active {
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.35);
}

.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    color: #64748b;
    flex-shrink: 0;
}

.sidebar-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.9rem 1rem 1.25rem;
}

.sidebar-foot {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.sidebar-foot .count {
    font-weight: 800;
    font-size: 14px;
    color: #0f172a;
}

.sidebar-foot .review-progress {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.sidebar-foot .keys {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.sidebar-foot kbd {
    font-family: inherit;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    padding: 0 4px;
}

.sidebar-filters {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 0.85rem 0.85rem 0.75rem;
    margin-bottom: 1rem;
}

.exam-sidebar-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    margin: 0 0 0.8rem;
    padding: 0.7rem 0.65rem 0.75rem;
    border-radius: 0.75rem;
    background: #0f766e;
    color: #f0fdfa;
    text-align: center;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}

.exam-sidebar-timer[hidden] {
    display: none;
}

.exam-sidebar-timer-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.82;
}

.exam-sidebar-timer-value {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.exam-sidebar-timer.is-pending {
    background: #115e59;
}

.exam-sidebar-timer.is-low {
    background: #c2410c;
    box-shadow: 0 8px 18px rgba(194, 65, 12, 0.28);
}

.exam-sidebar-timer.is-ended {
    background: #b91c1c;
    box-shadow: 0 8px 18px rgba(185, 28, 28, 0.28);
}

.exam-sidebar-start {
    margin-top: 0.5rem;
    width: 100%;
    min-height: 2.15rem;
    border: 0;
    border-radius: 999px;
    background: #f0fdfa;
    color: #0f766e;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.exam-sidebar-start:hover {
    background: #fff;
}

.exam-sidebar-start[hidden] {
    display: none;
}

.sidebar-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.sidebar-filters .sidebar-field:last-of-type {
    margin-bottom: 0.55rem;
}

.sidebar-field label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
}

.sidebar-field select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    background: #fff;
}

.sidebar-field select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

.sidebar-actions {
    display: flex;
    align-items: center;
    margin-top: 0.35rem;
}

.sidebar-clear-btn {
    width: 100%;
    min-height: 2.15rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #fdba74;
    border-radius: 0.7rem;
    background: #fffcf8;
    color: #9a3412;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.sidebar-clear-btn:hover {
    background: #ffedd5;
    border-color: #fb923c;
    color: #7c2d12;
}

.side-exam-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 1rem;
}

.bookmark-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
    color: var(--heading);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.bookmark-filter-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-filter-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}

.bookmark-filter-btn:hover:not(:disabled) {
    background: var(--panel);
    border-color: var(--accent);
    color: var(--heading);
}

.bookmark-filter-btn.is-active {
    background: var(--panel);
    border-color: var(--line-strong);
}

.bookmark-filter-btn.is-active svg {
    fill: var(--accent);
    stroke: var(--accent);
}

.bookmark-filter-btn[hidden] { display: none; }

.side-exam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.65rem;
    padding: 0 0.95rem;
    border-radius: 0.75rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease, color 0.15s ease;
}

.side-exam-btn i {
    font-size: 0.92rem;
    line-height: 1;
}

.side-exam-btn-label {
    min-width: 0;
}

.side-exam-btn[hidden] {
    display: none;
}

#testModeBtn,
.test-mode-btn {
    border: 1px solid #f0c06a;
    color: #92400e;
    background: linear-gradient(180deg, #fff7e6 0%, #ffe2a8 100%);
    box-shadow: 0 3px 8px rgba(146, 64, 14, 0.12);
}

#testModeBtn:hover:not(:disabled),
.test-mode-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffefc2 0%, #ffd78a 100%);
    border-color: #e5ad4d;
    color: #78350f;
    box-shadow: 0 4px 10px rgba(146, 64, 14, 0.16);
    transform: translateY(-1px);
}

#testModeBtn.is-live,
.test-mode-btn.is-live {
    border-color: #f0a3b0;
    color: #9f1239;
    background: linear-gradient(180deg, #fff1f2 0%, #fecdd3 100%);
    box-shadow: 0 3px 8px rgba(159, 18, 57, 0.12);
}

#testModeBtn.is-live:hover:not(:disabled),
.test-mode-btn.is-live:hover:not(:disabled) {
    background: linear-gradient(180deg, #ffe4e6 0%, #fda4af 100%);
    border-color: #e88998;
    color: #881337;
    box-shadow: 0 4px 10px rgba(159, 18, 57, 0.16);
    transform: translateY(-1px);
}

#saveExamBtn,
.save-exam-btn {
    border: 1px solid #5fb8ad;
    color: #0f766e;
    background: linear-gradient(180deg, #e6fffa 0%, #99e6d8 100%);
    box-shadow: 0 3px 8px rgba(15, 118, 110, 0.12);
}

#saveExamBtn:hover:not(:disabled),
.save-exam-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ccfbf1 0%, #7dd3c7 100%);
    border-color: #3da89b;
    color: #0d5f59;
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.16);
    transform: translateY(-1px);
}

.side-btn {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--heading);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.side-btn:hover:not(:disabled) { border-color: var(--accent); }
.side-btn[hidden] { display: none; }

#enterCodeBtn,
.enter-code-btn {
    border: 1px solid #a3d16a;
    color: #3f6212;
    background: linear-gradient(180deg, #f3fce0 0%, #c6ea8a 100%);
    box-shadow: 0 3px 8px rgba(63, 98, 18, 0.12);
}

#enterCodeBtn:hover:not(:disabled),
.enter-code-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ecfccb 0%, #b4e06e 100%);
    border-color: #86b84f;
    color: #365314;
    box-shadow: 0 4px 10px rgba(63, 98, 18, 0.16);
    transform: translateY(-1px);
}

#copyExamCodeBtn {
    background: #ecfeff;
    border-color: #67e8f9;
    color: #155e75;
}

#copyExamCodeBtn:hover:not(:disabled) {
    background: #cffafe;
    border-color: #22d3ee;
    color: #0e7490;
}

.sidebar.test-active #enterCodeBtn,
.sidebar.test-ended #enterCodeBtn,
.sidebar.test-active #bookmarkFilterBtn,
.sidebar.test-active .sidebar-filters .sidebar-field,
.sidebar.test-ended .sidebar-filters .sidebar-field,
.sidebar.test-active .sidebar-filters .sidebar-actions,
.sidebar.test-ended .sidebar-filters .sidebar-actions {
    display: none;
}

.sidebar.test-active .sidebar-filters,
.sidebar.test-ended .sidebar-filters {
    background: transparent;
    border: 0;
    padding: 0;
}

.sidebar.test-active .exam-sidebar-timer,
.sidebar.test-ended .exam-sidebar-timer {
    margin-bottom: 0;
}

.sidebar-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 1rem 0 0.85rem;
}

.sidebar-section {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 0.85rem 0.85rem 0.75rem;
    margin-bottom: 1rem;
}

.sidebar-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.45rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-nav-link,
.sidebar-nav-muted {
    display: block;
    padding: 0.5rem 0.7rem;
    border-radius: 0.65rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.sidebar-nav-link:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.sidebar-nav-link.theme-emerald {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.sidebar-nav-link.theme-emerald:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #064e3b;
}

.sidebar-nav-link.theme-indigo {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.sidebar-nav-link.theme-indigo:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #312e81;
}

.sidebar-nav-link.theme-purple {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #6b21a8;
}

.sidebar-nav-link.theme-purple:hover {
    background: #f3e8ff;
    border-color: #d8b4fe;
    color: #581c87;
}

.sidebar-nav-muted {
    color: #94a3b8;
    font-weight: 600;
}

.app-main {
    flex: 1;
    min-width: 0;
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
    transition: margin-right 0.2s ease;
}

@media (min-width: 640px) {
    .app-progress {
        display: flex;
    }

    .app-brand-title {
        font-size: 1.05rem;
    }
}

@media (min-width: 981px) {
    .app-sidebar.sidebar {
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        height: 100dvh;
        transition: margin-left 0.2s ease, visibility 0.2s;
    }

    #app-shell.shell.sidebar-collapsed .app-sidebar.sidebar {
        margin-left: calc(-1 * var(--sidebar));
        visibility: hidden;
    }

    .top-action-label {
        display: inline;
    }

    .app-topbar {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

.scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: var(--overlay);
}

.scrim[hidden] {
    display: none;
}

@media (max-width: 980px) {
    #app-shell.shell {
        display: block;
    }

    .top-action-label {
        display: none;
    }

    .app-topbar .profile-link { display: none; }

    .app-topbar {
        padding: 0.55rem 0.65rem;
    }

    .header-actions {
        flex: 1 1 0;
        justify-content: flex-end;
    }

    .header-actions-cluster {
        gap: 0.25rem;
        padding: 0.2rem;
        background: transparent;
        border: 0;
    }

    .topbar-buy-btn {
        min-height: 2rem;
        padding: 0 0.7rem;
        font-size: 0.75rem;
        box-shadow: 0 4px 10px rgba(240, 136, 4, 0.3);
    }

    .topbar-buy-full {
        display: none;
    }

    .topbar-buy-short {
        display: inline;
    }

    .app-topbar-inner {
        gap: 0.45rem 0.6rem;
        flex-wrap: nowrap;
    }

    .header-lead {
        min-width: 0;
        gap: 0.4rem;
    }

    .app-topbar-tools,
    .app-topbar .app-topbar-actions {
        min-width: 0;
        gap: 0.3rem;
    }

    .nav-toggle.sidebar-toggle-btn {
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 0.55rem;
    }

    .app-topbar .top-action {
        padding: 0.3rem 0.42rem;
        font-size: 0.7rem;
        gap: 0.2rem;
        border-radius: 0.5rem;
    }

    /* Icon-only action buttons on mobile */
    .app-topbar .top-action > span:not(.error-log-count) {
        display: none;
    }

    .app-topbar .primary {
        min-height: 2rem;
        padding: 0 0.65rem;
        font-size: 0.75rem;
    }

    /* Avatar-only account chip — name adds overflow width */
    .app-topbar .account {
        min-width: 2.1rem;
        min-height: 0;
    }

    .app-topbar .account-btn {
        gap: 0;
        min-height: 0;
        padding: 2px;
        border-radius: 999px;
    }

    .app-topbar .account-btn > span:not(.avatar) {
        display: none;
    }

    .app-topbar .avatar {
        width: 1.65rem;
        height: 1.65rem;
        font-size: 0.65rem;
    }

    .app-topbar-title-wrap:has(.app-topbar-year[hidden]) {
        display: none;
    }

    .app-topbar-title-wrap {
        flex: 0 0 auto;
        margin-inline: auto;
        padding: 0.2rem 0.65rem;
    }

    .app-topbar-year { font-size: 1.05rem; }

    .app-progress-copy { display: none; }

    .nav-toggle .icon-menu {
        display: block;
    }

    .nav-toggle .icon-fold {
        display: none;
    }

    .app-sidebar.sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        height: 100vh;
        height: 100dvh;
        flex: none;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        box-shadow: 8px 0 30px rgba(15, 23, 42, 0.12);
    }

    .app-sidebar.sidebar.is-open {
        transform: none;
    }

    .sidebar-close-btn {
        display: inline-flex;
    }
}

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f5f9; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.q-card {
    transition: box-shadow 0.25s ease-in-out;
    scroll-margin-top: calc(var(--topbar-height, 4.5rem) + 0.75rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    content-visibility: auto;
    contain-intrinsic-size: auto 320px;
}

.practice-more {
    text-align: center;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0 0.5rem;
}
.q-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

.q-card .sol-drawer {
    display: none;
}

.q-card.is-editing-text .sol-drawer {
    display: block;
}

.q-card.sol-active {
    outline: 2px solid #34d399;
    outline-offset: 2px;
}

.q-card.formula-active {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

.q-answer-line {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.q-done {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.q-done input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #059669;
    cursor: pointer;
}

.q-card.is-correct .q-done span {
    color: #047857;
}

.solution-panel {
    position: fixed;
    top: var(--topbar-height, 4.5rem);
    right: 0;
    bottom: 0;
    z-index: 65;
    width: var(--solution-panel-width);
    display: flex;
    flex-direction: column;
    background: #f0fdf4;
    border-left: 1px solid #a7f3d0;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(105%);
    transition: transform 0.2s ease;
    pointer-events: none;
}

body.solution-open .solution-panel {
    transform: none;
    pointer-events: auto;
}

.solution-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #a7f3d0;
    background: #ecfdf5;
}

.solution-panel-title {
    font-size: 1rem;
    font-weight: 800;
    color: #065f46;
    line-height: 1.2;
}

.solution-panel-subtitle {
    font-size: 0.72rem;
    font-weight: 600;
    color: #059669;
}

.solution-panel-subtitle:empty {
    display: none;
}

.solution-panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem 1.1rem 1.5rem;
    color: #064e3b;
    font-size: 0.92rem;
    line-height: 1.5;
}

.solution-panel-empty {
    color: #64748b;
}

.solution-scrim {
    position: fixed;
    inset: 0;
    top: var(--topbar-height, 4.5rem);
    z-index: 60;
    background: var(--overlay);
}

.solution-scrim[hidden] {
    display: none;
}

@media (min-width: 981px) {
    body.solution-open .app-main {
        margin-right: var(--solution-panel-width);
    }

    .solution-scrim {
        display: none;
    }
}

@media (max-width: 980px) {
    .solution-panel {
        width: min(92vw, 24rem);
        z-index: 80;
    }

    .solution-scrim {
        z-index: 75;
    }
}

.formula-panel {
    position: fixed;
    top: var(--topbar-height, 4.5rem);
    right: 0;
    bottom: 0;
    z-index: 65;
    width: var(--solution-panel-width);
    display: flex;
    flex-direction: column;
    background: #fffbeb;
    border-left: 1px solid #fcd34d;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(105%);
    transition: transform 0.2s ease;
    pointer-events: none;
}

body.formula-open .formula-panel {
    transform: none;
    pointer-events: auto;
}

.formula-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #fcd34d;
    background: #fef3c7;
}

.formula-panel-title {
    font-size: 1rem;
    font-weight: 800;
    color: #92400e;
    line-height: 1.2;
}

.formula-panel-subtitle {
    font-size: 0.72rem;
    font-weight: 600;
    color: #b45309;
}

.formula-panel-subtitle:empty {
    display: none;
}

.formula-panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.9rem 1rem 1.5rem;
    color: #292524;
    font-size: 0.9rem;
    line-height: 1.45;
}

.formula-panel-empty {
    color: #64748b;
}

.formula-scrim {
    position: fixed;
    inset: 0;
    top: var(--topbar-height, 4.5rem);
    z-index: 60;
    background: var(--overlay);
}

.formula-scrim[hidden] {
    display: none;
}

.formula-card {
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 0.85rem;
    padding: 0.75rem 0.8rem 0.85rem;
    margin-bottom: 0.75rem;
}

.formula-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
}

.formula-card-head h3 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1c1917;
    line-height: 1.2;
}

.formula-card-group {
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #b45309;
}

.formula-page {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 800;
    color: #92400e;
    background: #fef3c7;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
}

.formula-note,
.formula-block-title {
    margin: 0.35rem 0 0.2rem;
}

.formula-block-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #92400e;
}

.formula-note {
    font-size: 0.78rem;
    color: #44403c;
}

.formula-block + .formula-block {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid #fde68a;
}

.formula-lines .formula-line:first-child {
    border-top: 0;
}

.formula-line {
    display: grid;
    grid-template-columns: 6.6rem minmax(0, 1fr);
    gap: 0.25rem 0.55rem;
    align-items: baseline;
    padding: 0.28rem 0;
    border-top: 1px solid #fef3c7;
}

.formula-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #92400e;
}

.formula-eq {
    font-weight: 700;
    color: #1c1917;
}

.formula-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.formula-table th {
    text-align: left;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #92400e;
    padding: 0.15rem 0.35rem 0.3rem;
}

.formula-table td {
    padding: 0.18rem 0.35rem;
    border-top: 1px solid #fef3c7;
    vertical-align: top;
}

.formula-table tr.is-hit td,
.fraction-row.is-hit {
    background: #fde68a;
}

.formula-equiv {
    margin-top: 0.1rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #78716c;
}

.fraction-wall {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px;
    border: 1px solid #e7e5e4;
    border-radius: 0.45rem;
    background: #fafaf9;
}

.fraction-row {
    display: grid;
    grid-template-columns: repeat(var(--parts), minmax(0, 1fr));
    gap: 2px;
    border-radius: 0.2rem;
}

.fraction-cell {
    min-width: 0;
    padding: 0.12rem 0;
    border: 1px solid #e7e5e4;
    background: #fff;
    text-align: center;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.2;
    color: #1c1917;
}

.fraction-row .fraction-cell:first-child {
    background: var(--wall-color, #f5f5f4);
}

.fraction-row[data-d="1"] { --wall-color: #ddd6fe; }
.fraction-row[data-d="2"] { --wall-color: #bfdbfe; }
.fraction-row[data-d="3"] { --wall-color: #a7f3d0; }
.fraction-row[data-d="4"] { --wall-color: #bbf7d0; }
.fraction-row[data-d="5"] { --wall-color: #d9f99d; }
.fraction-row[data-d="6"] { --wall-color: #fef08a; }
.fraction-row[data-d="7"] { --wall-color: #fde047; }
.fraction-row[data-d="8"] { --wall-color: #fdba74; }
.fraction-row[data-d="9"] { --wall-color: #fb923c; }
.fraction-row[data-d="10"] { --wall-color: #f97316; }
.fraction-row[data-d="11"] { --wall-color: #f87171; }
.fraction-row[data-d="12"] { --wall-color: #ef4444; }

.fraction-row[data-d="10"] .fraction-cell:first-child,
.fraction-row[data-d="11"] .fraction-cell:first-child,
.fraction-row[data-d="12"] .fraction-cell:first-child {
    color: #fff;
}

.fraction-row.is-hit {
    outline: 2px solid #d97706;
    outline-offset: 1px;
}

@media (min-width: 981px) {
    body.formula-open .app-main,
    body.learn-open .app-main {
        margin-right: var(--solution-panel-width);
    }

    .formula-scrim,
    .learn-scrim {
        display: none;
    }
}

@media (max-width: 980px) {
    .formula-panel {
        width: min(92vw, 24rem);
        z-index: 80;
    }

    .formula-scrim {
        z-index: 75;
    }
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 140px;
    width: 100%;
    max-width: 28rem;
    margin: 0.75rem auto;
    padding: 1.25rem;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
}

.image-placeholder.is-uploading {
    opacity: 0.7;
    border-color: #34d399;
    background: #ecfdf5;
}

.image-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.image-upload-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.65rem;
    background: #059669;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.image-upload-link:hover {
    background: #047857;
}

.image-upload-link-inline {
    background: #f1f5f9;
    color: #334155;
    margin-top: 0.5rem;
}

.image-upload-link-inline:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.image-replace-bar {
    display: flex;
    justify-content: center;
    margin-top: 0.35rem;
}

.exam-image-frame {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.exam-image-frame.hidden {
    display: none;
}

.image-slot.has-image .exam-image {
    display: block;
    filter: brightness(1.04) contrast(0.95);
}

/* Soft wash so heavy black scan ink reads a bit lighter */
.exam-image-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    background: rgba(255, 252, 248, 0.22);
    pointer-events: none;
}

/* Inline question text editing */
.q-edit-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.q-edit-link,
.q-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    background: transparent;
    padding: 0.2rem 0.35rem;
    border-radius: 0.4rem;
}

.q-edit-link:hover,
.q-cancel-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.q-edit-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.q-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: #059669;
    padding: 0.35rem 0.7rem;
    border-radius: 0.55rem;
}

.q-save-btn:hover {
    background: #047857;
}

.q-save-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.q-edit-status {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
}

.q-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.q-edit-field span {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
}

.q-edit-field textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #0f172a;
    background: #fff;
    resize: vertical;
    min-height: 4.5rem;
}

.q-edit-field textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.q-card.is-editing-text {
    border-color: #6ee7b7;
    box-shadow: 0 0 0 1px #a7f3d0;
}

.q-text-below {
    margin-top: 0.15rem;
}

.q-prompt-below-view:empty,
.q-prompt-below-view.hidden {
    display: none;
}

/* The sentence that actually asks the student to answer */
.q-task {
    display: inline-block;
    max-width: 100%;
    margin-top: 0.35rem;
    vertical-align: top;
    padding: 0.2rem 0.55rem;
    font-size: 0.9rem;
    font-style: italic;
    background: #f4fcef;
    box-shadow: inset 3px 0 0 #ebc445;
    border-radius: 0.4rem;
    border-bottom: 1px solid #cacaca;
    line-height: 1.3;
}

.q-prompt-view > .q-task:first-child,
.q-prompt-below-view > .q-task:first-child {
    margin-top: 0;
}

.q-parts {
    list-style: none;
    margin: 0.55rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.q-part {
    display: grid;
    grid-template-columns: 1.7rem minmax(0, 1fr);
    column-gap: 0.2rem;
    align-items: start;
}

.q-part-label {
    font-weight: 800;
    color: var(--heading);
    line-height: 1.45;
}

.q-part-body {
    min-width: 0;
    line-height: 1.45;
}

.q-part-body .q-task {
    display: block;
    margin-top: 0.35rem;
    margin-left: 0.85rem;
}

.q-part-body > .q-task:first-child {
    margin-top: 0;
    margin-left: 0;
}

.q-split-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f766e;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 0.35rem 0.65rem;
    border-radius: 0.55rem;
}

.q-split-btn:hover {
    background: #d1fae5;
    color: #065f46;
}

.theme-emerald {
    --sec-from: #065f46;
    --sec-to: #059669;
    --sec-badge: rgba(6, 78, 59, 0.5);
    --sec-badge-text: #a7f3d0;
    --sec-border: rgba(52, 211, 153, 0.3);
    --sec-muted: #d1fae5;
}

.theme-indigo {
    --sec-from: #3730a3;
    --sec-to: #4f46e5;
    --sec-badge: rgba(49, 46, 129, 0.5);
    --sec-badge-text: #c7d2fe;
    --sec-border: rgba(129, 140, 248, 0.3);
    --sec-muted: #e0e7ff;
}

.theme-purple {
    --sec-from: #6b21a8;
    --sec-to: #9333ea;
    --sec-badge: rgba(88, 28, 135, 0.5);
    --sec-badge-text: #e9d5ff;
    --sec-border: rgba(192, 132, 252, 0.3);
    --sec-muted: #f3e8ff;
}

/* Native MathML fractions in prompts / solutions */
math {
    font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "Times New Roman", serif;
    font-size: 1.05em;
    vertical-align: -0.2em;
}

math[display="block"] {
    display: block;
    margin: 0.5rem 0;
    text-align: center;
}

.q-card math mfrac,
.solution-panel-body math mfrac,
.sol-work math mfrac {
    padding: 0 0.15em;
}

/* Question header: year / number / skill chips / marks */
.q-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    column-gap: 0.85rem;
    row-gap: 0.45rem;
    margin: -1.5rem -1.5rem 0;
    padding: 0.85rem 1.5rem 0.75rem;
    border-bottom: 1px solid #a67c52;
    border-radius: 5px 5px 0 0;
    background-color: #eee7dc;
    background-image:
        linear-gradient(rgba(118, 89, 61, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(118, 89, 61, 0.18) 1px, transparent 1px);
    background-size: 12px 12px;
}

.q-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-bottom: 0.05rem;
}

.q-head-end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-end;
}

.q-head-end .viewer-actions button,
.q-head-end .q-formula-toggle,
.q-head-end .q-learn-toggle,
.q-head-end .q-sol-toggle {
    border-color: #64748b;
}

.q-marks-badge {
    white-space: nowrap;
    border: 1px solid #64748b;
    background: #c4ecd9;
    color: #202020;
}

.q-bookmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
}

.q-bookmark.is-on {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #b45309;
}

.viewer-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
}

.viewer-actions button {
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--panel-2);
    min-height: 26px;
    padding: 0 8px;
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
}

.viewer-actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.viewer-actions .bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bookmark-btn svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}

.bookmark-btn[aria-pressed="true"] svg {
    fill: var(--accent);
    stroke: var(--accent);
}

.bookmark-btn[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--accent);
    background: #ecfdf5;
}

body.test-active .q-head-end .viewer-actions,
body.test-active .q-head-end .q-formula-toggle,
body.test-active .q-head-end .q-learn-toggle,
body.test-active .q-head-end .q-sol-toggle,
body.test-running .q-edit-toolbar,
body.test-running .error-report {
    display: none;
}

/* After grading in exam mode, allow reviewing solutions while results stay pinned. */
body.test-active.grade-results-open .q-head-end .q-sol-toggle,
body.test-active.grade-results-open .q-head-end .q-learn-toggle,
body.test-active.grade-results-open .q-head-end .q-formula-toggle {
    display: inline-flex;
}

/* Admin-only: PDF compare, error flags, and question editing */
body:not(.is-admin) #pdf-panel-btn,
body:not(.is-admin) #pdf-panel,
body:not(.is-admin) #error-log-btn,
body:not(.is-admin) #error-log-panel,
body:not(.is-admin) .error-report,
body:not(.is-admin) .q-edit-toolbar,
body:not(.is-admin) .q-edit-field,
body:not(.is-admin) .image-replace-bar,
body:not(.is-admin) .image-upload-link,
body:not(.is-admin) .image-placeholder,
body:not(.is-admin) .image-slot:not(.has-image) {
    display: none !important;
}

.test-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: #0f766e;
    color: #ecfdf5;
    border-radius: 1rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
}

.test-banner strong { font-size: 1.35rem; letter-spacing: 0.04em; }

.test-banner .primary {
    background: #f0fdfa;
    color: #0f766e;
    border-color: #f0fdfa;
}

.drawer-backdrop,
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: var(--overlay);
}

.drawer-backdrop[hidden],
.modal-backdrop[hidden] { display: none; }

.drawer {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(100%, 22rem);
    background: #fff;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    padding: 1rem 1rem 1.25rem;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.drawer-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.drawer-head button,
.modal-actions button:not(.primary) {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 30px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    font-weight: 700;
    cursor: pointer;
}

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0 0 0.85rem;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
    display: grid;
    gap: 8px;
}

.history-list li {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}

.history-list button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 0.8rem 0.9rem;
    cursor: pointer;
}

.history-list strong { display: block; color: var(--heading); }
.history-list span { color: var(--muted); font-size: 12px; }

.saved-exam-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.saved-exam-open {
    flex: 1 1 auto;
    min-width: 0;
}

.saved-exam-code-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding-right: 0.5rem;
}

.saved-exam-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--heading);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    background: rgba(var(--accent-rgb), 0.08);
}

.history-list .saved-exam-copy {
    width: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    background: var(--panel);
    color: var(--heading);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.history-list .saved-exam-copy:hover {
    border-color: var(--line-strong);
}

.history-empty {
    padding: 0.9rem;
    color: var(--muted);
    font-size: 0.9rem;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
}

.modal fieldset {
    border: 0;
    padding: 0;
    margin: 0.75rem 0;
}

.modal legend {
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}

.modal-backdrop {
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.modal {
    width: min(100%, 28rem);
    max-height: min(92vh, 40rem);
    overflow: auto;
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

#testSetupForm.modal {
    width: min(100%, 38rem);
}

.modal h2 { margin: 0 0 0.35rem; font-size: 1.2rem; }

.save-exam-code-modal {
    text-align: center;
}

.save-exam-code-modal .hint {
    margin: 0 0 1rem;
}

.save-exam-code-display {
    display: grid;
    gap: 0.35rem;
    margin: 0 0 1.1rem;
    padding: 1rem 1.1rem;
    border-radius: 0.9rem;
    border: 1px solid #a7f3d0;
    background: #ecfdf5;
}

.save-exam-code-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
}

.save-exam-code-value {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    color: #115e59;
    font-variant-numeric: tabular-nums;
}

.save-exam-code-modal .modal-actions {
    justify-content: center;
}

.reset-filters-modal .hint {
    margin: 0 0 1rem;
}

.reset-filters-confirm,
#resetFiltersConfirm.primary {
    background: #ea580c;
    border-color: #ea580c;
    color: #fff7ed;
}

.reset-filters-confirm:hover,
#resetFiltersConfirm.primary:hover {
    background: #c2410c;
    border-color: #c2410c;
    color: #fff7ed;
}

.field {
    display: grid;
    gap: 0.3rem;
    margin: 0.75rem 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.exam-setup-row {
    display: grid;
    grid-template-columns: 1fr 7.5rem;
    gap: 0.75rem;
    align-items: end;
}

.exam-setup-row .field {
    margin: 0.75rem 0 0;
}

@media (max-width: 420px) {
    .exam-setup-row {
        grid-template-columns: 1fr;
    }
}

.field select,
.field input {
    border: 1px solid var(--line-strong);
    border-radius: 0.75rem;
    min-height: 42px;
    padding: 0 0.8rem;
    font: inherit;
    color: var(--text);
}

.field input[type="number"] {
    width: 100%;
}

.year-range-field {
    margin-top: 0.35rem;
}

.year-range-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.topic-pills {
    display: grid;
    gap: 0.75rem;
    max-height: 18rem;
    overflow: auto;
    padding: 0.15rem 0.1rem 0.25rem;
}

.topic-pill-group {
    display: grid;
    gap: 0.4rem;
}

.topic-strand-label {
    margin: 0;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.topic-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.topic-pill {
    appearance: none;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.topic-pill:hover {
    border-color: #14b8a6;
    color: #0f766e;
    background: #f0fdfa;
}

.topic-pill[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.topic-pill:focus-visible {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
}

.exam-include {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0.5rem 0 0.75rem;
}

.exam-include[hidden] { display: none; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#testGenerate:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

#testGenerate:not(:disabled),
#testGenerate.is-ready {
    background: var(--accent);
    color: var(--accent-ink);
    border: 2px solid var(--accent);
    cursor: pointer;
}

#testGenerate:not(:disabled):hover,
#testGenerate.is-ready:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-ink);
}

.error-note {
    min-height: 1.1rem;
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 700;
    margin: 0;
}

.q-sol-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
}

.q-sol-toggle:hover,
.q-sol-toggle.is-open {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #047857;
}

.q-formula-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
}

.q-formula-toggle:hover,
.q-formula-toggle.is-open {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #b45309;
}

.q-learn-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
}

.q-learn-toggle:hover,
.q-learn-toggle.is-open {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.q-card.learn-active {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.learn-panel {
    position: fixed;
    top: var(--topbar-height, 4.5rem);
    right: 0;
    bottom: 0;
    z-index: 65;
    width: var(--solution-panel-width);
    display: flex;
    flex-direction: column;
    background: #eff6ff;
    border-left: 1px solid #bfdbfe;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(105%);
    transition: transform 0.2s ease;
    pointer-events: none;
}

body.learn-open .learn-panel {
    transform: none;
    pointer-events: auto;
}

.learn-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #bfdbfe;
    background: #dbeafe;
}

.learn-panel-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e3a8a;
    line-height: 1.2;
}

.learn-panel-subtitle {
    font-size: 0.72rem;
    font-weight: 600;
    color: #1d4ed8;
}

.learn-panel-subtitle:empty {
    display: none;
}

.learn-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.learn-enlarge-btn {
    border: 1px solid #93c5fd;
    background: #fff;
    color: #1d4ed8;
    border-radius: 0.5rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.learn-enlarge-btn:hover {
    background: #dbeafe;
}

.learn-enlarge-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

#learn-enlarge-btn:not(:disabled) {
    position: relative;
    z-index: 0;
    overflow: hidden;
    border-color: transparent;
    color: #1e3a8a;
    background: #eff6ff;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.28), 0 0 10px rgba(59, 130, 246, 0.28);
}

#learn-enlarge-btn:not(:disabled)::before {
    content: "";
    position: absolute;
    inset: -70%;
    border-radius: 50%;
    background: conic-gradient(#2563eb, #14b8a6, #f59e0b, #ec4899, #2563eb);
    animation: enlarge-border-spin 2.2s linear infinite;
    z-index: -2;
}

#learn-enlarge-btn:not(:disabled)::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: calc(0.5rem - 2px);
    background: #eff6ff;
    z-index: -1;
}

#learn-enlarge-btn:not(:disabled):hover {
    color: #1e40af;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45), 0 0 14px rgba(37, 99, 235, 0.4);
}

#learn-enlarge-btn:not(:disabled):hover::after {
    background: #dbeafe;
}

@keyframes enlarge-border-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    #learn-enlarge-btn:not(:disabled)::before {
        animation: none;
    }
}

.learn-enlarge {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.55);
}

.learn-enlarge[hidden] {
    display: none;
}

.learn-enlarge-card {
    width: min(68rem, 94vw);
    height: min(52rem, 90vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.learn-enlarge-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #dbeafe;
    border-bottom: 1px solid #bfdbfe;
}

.learn-enlarge-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #1e3a8a;
}

.learn-enlarge-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background: #fff;
}

.learn-list {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #dbeafe;
    background: #fff;
}

.learn-list:empty {
    display: none;
}

.learn-file {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 8.5rem;
    max-width: 12rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.55rem;
    border: 1px solid #dbeafe;
    background: #f8fafc;
    color: #1e3a8a;
    text-align: left;
    cursor: pointer;
}

.learn-file.is-active {
    background: #dbeafe;
    border-color: #60a5fa;
}

.learn-file-name {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
}

.learn-file-folder {
    font-size: 0.62rem;
    font-weight: 600;
    color: #64748b;
}

.learn-viewer {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #f8fafc;
}

.learn-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.learn-panel-empty {
    margin: 0;
    padding: 1.25rem;
    color: #64748b;
}

.learn-scrim {
    position: fixed;
    inset: 0;
    top: var(--topbar-height, 4.5rem);
    z-index: 60;
    background: var(--overlay);
}

.learn-scrim[hidden] {
    display: none;
}

@media (max-width: 980px) {
    .learn-panel {
        width: min(92vw, 24rem);
        z-index: 80;
    }

    .learn-scrim {
        z-index: 75;
    }
}

.sol-concept {
    background: #fff;
    border-left: 3px solid #059669;
    border-radius: 0.45rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 1rem;
}

.sol-concept-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: #065f46;
    line-height: 1.3;
}

.sol-concept-fact {
    margin: 0.15rem 0 0;
    color: #047857;
    line-height: 1.4;
}

.sol-work {
    background: #fff;
    border: 1px solid #d1fae5;
    border-radius: 0.65rem;
    padding: 0.85rem 0.95rem 0.7rem;
}

.sol-steps {
    margin: 0.15rem 0 0.35rem 1.15rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: #064e3b;
    line-height: 1.45;
}

.sol-step-text,
.sol-step-lead {
    margin: 0;
}

.sol-step-lead {
    margin-bottom: 0.12rem;
}

.sol-eq {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    column-gap: 0.45rem;
    row-gap: 0.08rem;
    width: 100%;
    margin-top: 0.12rem;
    padding-left: 0.35rem;
}

.sol-eq-op {
    font-weight: 700;
    text-align: right;
    min-width: 0.7rem;
}

.sol-eq-expr {
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.sol-answer {
    margin-top: 0.9rem;
    margin-bottom: 0.35rem;
    font-weight: 800;
    color: #064e3b;
}

.sol-answer span {
    margin-right: 0.35rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #059669;
}

/* Skill filter meta chips on questions */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.4rem 0.75rem;
    min-width: 0;
    padding-left: 0.75rem;
    border-left: 1px solid #e2e8f0;
}

.meta-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.12rem;
}

.meta-label {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
    line-height: 1;
}

.meta-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1.2;
}

.meta-strand {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.meta-sub {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.meta-process {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

/* Per-question error flagging */
.error-report {
    border-top: 1px dashed #e2e8f0;
    padding-top: 0.85rem;
    margin-top: 0.25rem;
}

.error-report-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.error-report-main input {
    accent-color: #d97706;
    width: 1rem;
    height: 1rem;
}

.q-card.has-error-flag {
    border-color: #fcd34d;
    box-shadow: 0 0 0 1px #fde68a;
}

.error-report-types {
    display: none;
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.75rem;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
}

.error-report.is-open .error-report-types {
    display: flex;
}

.error-type-option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
    user-select: none;
}

.error-type-option input {
    accent-color: #d97706;
}

.error-log-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #b45309;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
}

.error-log-count.hidden {
    display: none;
}

.error-log-panel {
    position: fixed;
    inset: 0;
    z-index: 80;
}

.error-log-panel.hidden {
    display: none;
}

.error-log-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

.error-log-drawer {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(24rem, 100%);
    background: #fff;
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
}

.error-log-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.error-log-close {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: #64748b;
    background: #f1f5f9;
}

.error-log-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.error-log-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}

.error-log-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 2.5rem 1rem;
}

.error-log-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.65rem;
    background: #f8fafc;
}

.error-log-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.error-log-item-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
}

.error-log-item-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.error-log-type-chip {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: capitalize;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.error-log-remove {
    font-size: 0.7rem;
    font-weight: 700;
    color: #b91c1c;
    background: transparent;
    padding: 0.15rem 0.35rem;
    border-radius: 0.35rem;
}

.error-log-remove:hover {
    background: #fee2e2;
}

.error-log-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem 1rem 1.1rem;
    border-top: 1px solid #e2e8f0;
}

.error-log-btn-secondary,
.error-log-btn-danger {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
}

.error-log-btn-secondary {
    background: #f1f5f9;
    color: #334155;
}

.error-log-btn-secondary:hover {
    background: #e2e8f0;
}

.error-log-btn-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.error-log-btn-danger:hover {
    background: #fee2e2;
}

/* PDF compare slide-in panel — shifts main content left */
:root {
    --pdf-panel-width: min(46vw, 640px);
}

#app-shell {
    transition: margin-right 0.28s ease;
    min-width: 0;
}

body.pdf-compare-open {
    overflow-x: hidden;
}

body.pdf-compare-open #app-shell {
    margin-right: var(--pdf-panel-width);
}

.pdf-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--pdf-panel-width);
    z-index: 70;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    pointer-events: none;
}

body.pdf-compare-open .pdf-panel {
    transform: translateX(0);
    pointer-events: auto;
}

.pdf-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.pdf-panel-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: #64748b;
    background: #e2e8f0;
    text-decoration: none;
}

.pdf-panel-icon-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.pdf-panel-controls {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.55rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.pdf-panel-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.pdf-panel-field span {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
}

.pdf-panel-field select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0f172a;
    background: #fff;
}

.pdf-panel-field select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.pdf-panel-viewer {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #f1f5f9;
}

.pdf-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.pdf-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
}

body.pdf-compare-open #pdf-panel-btn {
    box-shadow: inset 0 0 0 2px #34d399;
}

@media (max-width: 900px) {
    :root {
        --pdf-panel-width: min(92vw, 420px);
    }

    body.pdf-compare-open #app-shell {
        margin-right: 0;
    }
}

.login-modal:not(.is-create) .login-role { display: none; }

.login-role {
    margin: 0;
    padding: 0;
    border: 0;
}

.login-role legend {
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}

.login-role-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.login-role-pills label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.login-role-pills input {
    min-height: 0;
    accent-color: var(--accent);
}

.payment-banner {
    position: fixed;
    top: 0.75rem;
    left: 50%;
    z-index: 90;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: min(36rem, calc(100% - 1.5rem));
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    box-shadow: var(--shadow);
}

.payment-banner[hidden] { display: none; }

.payment-banner.is-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #99f6e4;
}

.payment-banner.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.payment-banner-text {
    margin: 0;
    flex: 1;
    font-weight: 700;
    font-size: 0.9rem;
}

.payment-banner-close {
    border: 0;
    background: transparent;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

.upgrade-modal .upgrade-warning {
    color: #b45309;
    font-weight: 700;
}

.pay-success {
    z-index: 110;
    background: rgba(255, 255, 255, 0.82);
    overflow: hidden;
}

.pay-success-card {
    position: relative;
    z-index: 1;
    width: min(100%, 27rem);
    box-sizing: border-box;
    padding: 2rem 2rem 1.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.9rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    font-family: Inter, sans-serif;
    color: #374151;
}

.pay-success-check {
    display: inline-grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    background: #4caf50;
    color: #fff;
    font-size: 1.15rem;
}

.pay-success-card h2 {
    margin: 1.4rem 0 0.75rem;
    font-size: clamp(1.75rem, 6vw, 2.2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #1f2937;
}

.pay-success-card p {
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    line-height: 1.55;
}

.pay-success-btn {
    border: 0;
    border-radius: 0.4rem;
    padding: 0.7rem 1rem;
    background: #2b2b2b;
    color: #fff;
    font: 500 0.9rem Inter, sans-serif;
    cursor: pointer;
}

.pay-success-btn:hover { background: #111; }

.pay-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pay-confetti-piece {
    position: absolute;
    top: -2rem;
    animation: pay-confetti-fall linear forwards;
}

@keyframes pay-confetti-fall {
    to {
        transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin));
    }
}

@media (prefers-reduced-motion: reduce) {
    .pay-confetti { display: none; }
}

.upgrade-currency {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.75rem 0 0.25rem;
}

.upgrade-modal .upgrade-currency-btn {
    min-height: 2.5rem;
    border-radius: 0.6rem;
    border: 2px solid #e5e7eb;
    background: #fff;
    color: #111827;
    font-weight: 800;
    cursor: pointer;
}

.upgrade-modal .upgrade-currency-btn[aria-checked="true"] {
    border-color: #ff9900;
    background: #fff7ed;
}

.paywall-empty-btn {
    margin-top: 1rem;
}

.year-range-pill.is-locked {
    opacity: 0.72;
    box-shadow: inset 0 0 0 1px #99f6e4;
}

html:has(.lp-body) {
    scroll-behavior: smooth;
}

.lp-body,
.lp-body * {
    box-sizing: border-box;
}

.lp-body {
    margin: 0;
    max-width: 100%;
    overflow-x: clip;
    background: #e8eef5;
    color: var(--text);
    font-family: Inter, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
    html:has(.lp-body) {
        scroll-behavior: auto;
    }
}

.lp-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.7rem 4vw;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.97) 0%, rgba(13, 95, 89, 0.96) 100%);
    color: #f0fdfa;
    border-bottom: 1px solid rgba(204, 251, 241, 0.18);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lp-nav-inner {
    width: min(72rem, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.lp-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.lp-brand-mark {
    width: 2.45rem;
    height: 2.45rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 0.85rem;
    background: linear-gradient(180deg, #ffffff 0%, #ccfbf1 100%);
    color: #0f766e;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.55),
        0 8px 18px rgba(15, 23, 42, 0.18);
}

.lp-brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    line-height: 1.05;
}

.lp-brand-name {
    font-family: Fredoka, Inter, sans-serif;
    font-weight: 700;
    font-size: 1.28rem;
    letter-spacing: 0.01em;
    color: #f0fdfa;
}

.lp-brand-tag {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #99f6e4;
}

.lp-nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.28rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(204, 251, 241, 0.16);
}

.lp-nav-link {
    color: #ccfbf1;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

.lp-nav-link:hover {
    color: #fff;
    background: rgba(240, 253, 250, 0.12);
}

.lp-nav-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0 0.95rem;
    border-radius: 999px;
    border: 1px solid #ff9900;
    color: #111827;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.88rem;
    background: linear-gradient(180deg, #ffb84d 0%, #ff9900 55%, #f08804 100%);
    box-shadow: 0 6px 14px rgba(240, 136, 4, 0.35);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.lp-nav-buy:hover {
    background: linear-gradient(180deg, #ff9900 0%, #e47911 60%, #d9700b 100%);
    border-color: #e47911;
    color: #111827;
    box-shadow: 0 8px 18px rgba(228, 121, 17, 0.4);
    transform: translateY(-1px);
}

.lp-nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0 1.05rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #ecfdf5 100%);
    color: #0f766e;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.88rem;
    border: 1px solid #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.lp-nav-cta:hover {
    background: #fff;
    color: #115e59;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
    transform: translateY(-1px);
}

.lp-hero,
.lp-section,
.lp-devices,
.lp-devices-wrap {
    width: min(72rem, calc(100% - 8vw));
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.lp-hero,
.lp-section {
    margin-top: 0;
    margin-bottom: 0;
    padding: 4.5rem 0;
}

.lp-section {
    scroll-margin-top: 5.5rem;
}

.lp-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 1.05fr);
    gap: 1.65rem 2rem;
    align-items: center;
    padding: 2rem 1.75rem 1.85rem;
    background: #bfdbfe;
    border-radius: 0 0 1.75rem 7.5rem;
    box-shadow: 0 22px 48px rgba(37, 99, 235, 0.14);
    overflow: hidden;
}

.lp-hero .lp-lead {
    margin: 0.75rem 0 1.1rem;
}

.lp-kicker {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
}

.lp-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.1;
    color: var(--heading);
}

.lp-lead {
    margin: 1rem 0 1.5rem;
    font-size: 1.1rem;
    line-height: 1.55;
    color: #334155;
    max-width: 38rem;
}

.lp-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.25rem;
}

.lp-hero-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.lp-hero-action-note {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    text-align: center;
}

.lp-hero-actions .primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    min-width: min(10.5rem, 100%);
    max-width: 100%;
    padding: 0 1rem;
    font-weight: 800;
}

.lp-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 40px;
    min-width: min(10.5rem, 100%);
    max-width: 100%;
    padding: 0 1rem;
    border-radius: 30px;
    border: 2px solid #ff9900;
    color: #111827;
    font-weight: 800;
    text-decoration: none;
    background: linear-gradient(180deg, #ffb84d 0%, #ff9900 55%, #f08804 100%);
    box-shadow: 0 6px 14px rgba(240, 136, 4, 0.35);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.lp-secondary:hover {
    background: linear-gradient(180deg, #ff9900 0%, #e47911 60%, #d9700b 100%);
    border-color: #e47911;
    color: #111827;
    box-shadow: 0 8px 18px rgba(228, 121, 17, 0.4);
    transform: translateY(-1px);
}

.lp-hero-visual {
    position: relative;
    display: grid;
    place-items: center;
    max-width: min(100%, 34rem);
    width: 100%;
    max-height: 23rem;
    justify-self: end;
}

.lp-hero-visual-img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 23rem;
    object-fit: contain;
    object-position: center;
}

.lp-devices {
    margin: 1.35rem auto 0;
    padding: 1.1rem 1.6rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    background: transparent;
    border: 1px solid #dbe4ee;
    border-radius: 0.85rem;
}

.lp-no-sub {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    font-style: italic;
    color: #334155;
    text-align: center;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
}

.lp-devices-heading {
    margin: 0;
    margin-top: 1.5rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f766e;
    text-align: center;
    letter-spacing: 0.02em;
}

.lp-devices-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.5rem;
    flex-wrap: wrap;
}

.lp-devices-list li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
}

.lp-devices-icon {
    display: grid;
    place-items: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 999px;
    background: #ecfdf5;
    color: #0f766e;
}

.lp-devices-icon svg {
    width: 1.4rem;
    height: 1.4rem;
}

.lp-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.lp-card,
.lp-price {
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 1.2rem;
    padding: 1.5rem 1.4rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.lp-card h3,
.lp-price h3 {
    margin: 0 0 0.45rem;
    font-size: 1.2rem;
}

.lp-card p,
.lp-copy {
    margin: 0;
    color: #475569;
    line-height: 1.5;
}

.lp-section h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    color: var(--heading);
}

.lp-feature-list {
    display: grid;
    gap: 3.5rem;
    padding-top: 3.5rem;
    padding-bottom: 2rem;
}

.lp-features-heading {
    margin: 0;
    grid-column: 1 / -1;
    text-align: center;
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
}

.lp-feature {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 2.5rem 3rem;
    align-items: center;
}

.lp-feature:nth-child(even) {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

.lp-feature:nth-child(even) .lp-feature-media {
    order: 2;
}

.lp-feature:nth-child(even) .lp-feature-copy {
    order: 1;
}

.lp-feature-media {
    display: grid;
    place-items: center;
    min-height: 14rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 1.5rem;
    border-bottom-left-radius: 4.5rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.lp-feature-media img {
    display: block;
    width: min(100%, 22rem);
    height: auto;
    max-height: 16rem;
    object-fit: contain;
}

.lp-feature-copy h2 {
    margin: 0;
    font-size: clamp(1.55rem, 2.8vw, 2.15rem);
    line-height: 1.2;
    color: var(--heading);
    max-width: 22rem;
}

.lp-pricing {
    text-align: center;
}

.lp-pricing .lp-kicker,
.lp-pricing h2 {
    text-align: center;
}

.lp-price-wrap {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 1rem 1.25rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 1.5rem;
}

.lp-price {
    width: 100%;
    max-width: 22rem;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
}

.lp-price-or {
    margin: 0;
    align-self: center;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.lp-price-badge {
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #ccfbf1;
    color: #115e59;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lp-price-amount {
    margin: 0;
    font-size: 3rem;
    font-weight: 800;
    color: var(--heading);
    line-height: 1;
}

.lp-price-amount span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted);
}

.lp-price-amount .lp-price-currency {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #0f766e;
    vertical-align: 0.35em;
}

.lp-price-fx {
    margin: 0.45rem 0 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f766e;
}

.lp-price-copy {
    margin-top: 0.75rem;
    line-height: 1.55;
}

.lp-price ul {
    margin: 1rem 0 1.25rem;
    padding-left: 1.1rem;
    color: #334155;
    line-height: 1.55;
}

.lp-faq details {
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    margin-top: 0.7rem;
}

.lp-faq summary {
    font-weight: 800;
    cursor: pointer;
}

.lp-faq p {
    margin: 0.55rem 0 0;
    color: #475569;
    line-height: 1.5;
}

.lp-footer {
    padding: 2rem 6vw 2.5rem;
    background: #0f172a;
    color: #cbd5e1;
}

.lp-footer-inner {
    width: min(72rem, 100%);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.lp-footer a {
    color: #99f6e4;
    text-decoration: none;
    font-weight: 700;
}

.lp-warn {
    margin: 0.75rem 0 0;
    color: #b45309;
    font-weight: 700;
}

@media (max-width: 900px) {
    .lp-hero,
    .lp-section,
    .lp-devices,
    .lp-devices-wrap {
        width: calc(100% - 1.5rem);
        max-width: calc(100% - 1.5rem);
    }

    .lp-grid-2,
    .lp-feature,
    .lp-feature:nth-child(even) {
        grid-template-columns: minmax(0, 1fr);
    }

    .lp-price-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .lp-price {
        width: 100%;
        max-width: none;
    }

    .lp-price-or {
        padding: 0.15rem 0;
    }

    .lp-price-amount {
        font-size: clamp(2.1rem, 9vw, 3rem);
    }

    .lp-feature:nth-child(even) .lp-feature-media,
    .lp-feature:nth-child(even) .lp-feature-copy {
        order: initial;
    }

    .lp-feature-list {
        gap: 2.5rem;
        padding-left: 0;
        padding-right: 0;
    }

    .lp-feature,
    .lp-feature-media,
    .lp-feature-copy {
        min-width: 0;
        max-width: 100%;
    }

    .lp-feature-media {
        border-bottom-left-radius: 3.25rem;
        min-height: 12rem;
        width: 100%;
    }

    .lp-feature-media img {
        max-width: 100%;
    }

    .lp-feature-copy h2 {
        max-width: none;
    }

    .lp-devices {
        border-radius: 0.85rem;
        padding: 1rem 1rem;
    }

    .lp-hero {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        text-align: center;
        border-bottom-left-radius: 5.5rem;
        padding: 1.65rem 1rem 1.5rem;
    }

    .lp-hero > div:first-child {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .lp-hero .lp-lead {
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
    }

    .lp-hero-actions {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        flex-wrap: wrap;
        width: 100%;
        max-width: 100%;
        margin-inline: auto;
    }

    .lp-hero-action {
        max-width: 100%;
    }

    .lp-hero-visual {
        justify-self: center;
        width: 100%;
        max-width: min(100%, 28rem);
        max-height: 18.5rem;
    }

    .lp-hero-visual-img {
        max-width: 100%;
        max-height: 18.5rem;
    }

    .lp-nav {
        padding: 0.65rem 0.75rem;
        max-width: 100%;
    }

    .lp-nav-inner {
        width: 100%;
        max-width: 100%;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .lp-brand-tag {
        display: none;
    }

    .lp-nav-links {
        gap: 0.25rem;
        padding: 0.2rem;
        background: transparent;
        border: 0;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .lp-nav-link {
        display: none;
    }

    .lp-nav-buy,
    .lp-nav-cta {
        min-height: 2.15rem;
        padding: 0 0.7rem;
        font-size: 0.78rem;
        max-width: 100%;
    }

    .lp-footer-inner {
        width: 100%;
        max-width: 100%;
        padding-inline: 0;
    }
}
