/* ═══ RESET & BASE ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #dbeafe;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --orange: #ea580c;
    --orange-light: #fff7ed;
    --purple: #7c3aed;
    --purple-light: #ede9fe;
    --teal: #0d9488;
    --teal-light: #ccfbf1;
    --pink: #db2777;
    --pink-light: #fce7f3;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --navy: #0f172a;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
    --shadow-xl: 0 20px 50px rgba(0,0,0,.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════ */
/* ═══ LANDING PAGE ═══                   */
/* ═══════════════════════════════════════ */
.lp-body {
    background: #fff;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
.lp-container { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Nav ── */
.lp-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.lp-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.lp-logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -.02em;
    text-decoration: none;
}
.lp-logo:hover { text-decoration: none; }
.lp-nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.lp-nav-links a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    transition: color .15s;
}
.lp-nav-links a:hover { color: var(--gray-900); text-decoration: none; }
.lp-nav-login { font-weight: 600 !important; color: var(--gray-700) !important; }
.btn-lp-cta {
    background: var(--blue);
    color: #fff !important;
    padding: .5rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .9rem;
    transition: all .15s;
}
.btn-lp-cta:hover { background: var(--blue-dark); text-decoration: none; }

.lp-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.lp-menu-toggle span {
    width: 24px; height: 2px; background: var(--gray-700); border-radius: 2px;
    transition: .2s;
}

@media (max-width: 768px) {
    .lp-menu-toggle { display: flex; }
    .lp-nav-links {
        display: none;
        position: absolute;
        top: 64px; left: 0; right: 0;
        background: #fff;
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
        border-bottom: 1px solid var(--gray-200);
        box-shadow: var(--shadow-lg);
    }
    .lp-nav-links.open { display: flex; }
}

/* ── Hero ── */
.lp-hero {
    position: relative;
    overflow: hidden;
    padding: 8rem 0 5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1e40af 100%);
    color: #fff;
}
.lp-hero-bg { position: absolute; inset: 0; overflow: hidden; }
.lp-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .3;
}
.lp-orb-1 { width: 500px; height: 500px; background: #3b82f6; top: -150px; right: -100px; animation: orbFloat 8s ease-in-out infinite; }
.lp-orb-2 { width: 350px; height: 350px; background: #8b5cf6; bottom: -100px; left: -50px; animation: orbFloat 10s ease-in-out infinite reverse; }
.lp-orb-3 { width: 200px; height: 200px; background: #06b6d4; top: 40%; left: 50%; animation: orbFloat 6s ease-in-out infinite; }

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -20px); }
}

.lp-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
@media (max-width: 900px) {
    .lp-hero-inner { grid-template-columns: 1fr; text-align: center; }
    .lp-hero-actions { justify-content: center; }
}

.lp-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 100px;
    padding: .35rem 1rem;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .03em;
    margin-bottom: 1.5rem;
    color: rgba(255,255,255,.8);
}

.lp-hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.03em;
    margin-bottom: 1.25rem;
}
@media (max-width: 768px) { .lp-hero h1 { font-size: 2.2rem; } }

.lp-gradient-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lp-hero-sub {
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(255,255,255,.7);
    margin-bottom: 2rem;
    max-width: 480px;
}

.lp-hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-lp-primary {
    display: inline-flex;
    align-items: center;
    padding: .85rem 2rem;
    background: #fff;
    color: var(--blue-dark);
    font-weight: 700;
    font-size: 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.btn-lp-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,.2); text-decoration: none; }
.btn-lp-ghost {
    display: inline-flex;
    align-items: center;
    padding: .85rem 2rem;
    background: transparent;
    color: rgba(255,255,255,.9);
    font-weight: 600;
    font-size: 1rem;
    border: 1.5px solid rgba(255,255,255,.3);
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}
.btn-lp-ghost:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.btn-lg { padding: 1rem 2.5rem; font-size: 1.1rem; }

.lp-hero-note {
    margin-top: 1rem;
    font-size: .85rem;
    color: rgba(255,255,255,.45);
}

/* ── Hero Mockup ── */
.lp-mock {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto;
}
.lp-mock-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}
.lp-mock-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-300); }
.lp-mock-title { margin-left: auto; font-size: .7rem; color: var(--gray-500); font-weight: 600; }
.lp-mock-body { padding: 16px; color: var(--gray-900); }
.lp-mock-code {
    font-size: .8rem;
    color: var(--gray-500);
    margin-bottom: 10px;
}
.lp-mock-code strong { color: var(--blue); font-size: 1rem; letter-spacing: .1em; }
.lp-mock-q { font-weight: 700; font-size: .9rem; margin-bottom: 12px; }
.lp-mock-answers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.lp-mock-ans {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .82rem;
}
.lp-mock-correct { background: var(--green-light); }
.lp-mock-wrong { background: var(--red-light); }
.lp-mock-waiting { background: var(--gray-100); }
.lp-mock-student { font-weight: 600; min-width: 60px; }
.lp-mock-val { flex: 1; font-style: italic; color: var(--gray-700); }
.lp-mock-wait-text { color: var(--gray-400); }
.lp-mock-badge-g { color: var(--green); font-weight: 700; }
.lp-mock-badge-r { color: var(--red); font-weight: 700; }
.lp-mock-bar { height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.lp-mock-fill { width: 75%; height: 100%; background: var(--blue); border-radius: 3px; animation: mockFill 2s ease-out forwards; }
@keyframes mockFill { from { width: 0; } to { width: 75%; } }
.lp-mock-stat { font-size: .75rem; color: var(--gray-500); margin-top: 6px; text-align: right; }

/* ── Sections ── */
.lp-section { padding: 5rem 0; }
.lp-section-alt { background: var(--gray-50); }
.lp-section-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: -.02em;
    margin-bottom: .5rem;
}
.lp-section-sub {
    text-align: center;
    color: var(--gray-500);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

/* ── How It Works ── */
.lp-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}
.lp-step {
    text-align: center;
    max-width: 260px;
    padding: 1rem;
}
.lp-step-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}
.lp-step h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .5rem; }
.lp-step p { font-size: .9rem; color: var(--gray-500); line-height: 1.6; }
.lp-step-line {
    width: 60px; height: 2px;
    background: var(--gray-300);
    margin-top: 2.5rem;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .lp-step-line { display: none; }
    .lp-steps { flex-direction: column; align-items: center; }
}

/* ── Features ── */
.lp-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
@media (max-width: 900px) { .lp-feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .lp-feature-grid { grid-template-columns: 1fr; } }

.lp-fcard {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 1.75rem;
    transition: all .2s;
}
.lp-fcard:hover {
    border-color: var(--blue-light);
    box-shadow: 0 8px 30px rgba(37,99,235,.08);
    transform: translateY(-3px);
}
.lp-fcard-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.lp-fci-blue   { background: var(--blue-light);   color: var(--blue); }
.lp-fci-green  { background: var(--green-light);  color: var(--green); }
.lp-fci-purple { background: var(--purple-light); color: var(--purple); }
.lp-fci-orange { background: var(--orange-light); color: var(--orange); }
.lp-fci-teal   { background: var(--teal-light);   color: var(--teal); }
.lp-fci-pink   { background: var(--pink-light);   color: var(--pink); }

.lp-fcard h4 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; }
.lp-fcard p { font-size: .88rem; color: var(--gray-500); line-height: 1.6; }

/* ── Pricing ── */
.lp-pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 768px) { .lp-pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; } }

.lp-price-card {
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: 16px;
    padding: 2rem 1.75rem;
    text-align: center;
    position: relative;
    transition: all .2s;
}
.lp-price-card:hover { box-shadow: var(--shadow-lg); }
.lp-price-featured {
    border-color: var(--blue);
    box-shadow: 0 8px 30px rgba(37,99,235,.12);
    transform: scale(1.04);
}
.lp-price-popular {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--blue);
    color: #fff;
    padding: .25rem 1rem;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
}
.lp-price-name { font-size: 1.1rem; font-weight: 700; margin-bottom: .75rem; color: var(--gray-700); }
.lp-price-amount { margin-bottom: .25rem; }
.lp-price-dollar { font-size: 2.8rem; font-weight: 800; color: var(--gray-900); }
.lp-price-cents { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); vertical-align: top; }
.lp-price-mo { font-size: 1rem; color: var(--gray-500); font-weight: 500; }
.lp-price-period { font-size: .85rem; color: var(--gray-500); margin-bottom: 1.5rem; }
.lp-price-features {
    list-style: none;
    text-align: left;
    margin-bottom: 1.75rem;
}
.lp-price-features li {
    padding: .4rem 0;
    font-size: .9rem;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.lp-price-features li::before {
    content: '✓';
    color: var(--green);
    font-weight: 700;
    flex-shrink: 0;
}
.btn-lp-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 1.5rem;
    background: #fff;
    color: var(--blue);
    font-weight: 600;
    font-size: .95rem;
    border: 1.5px solid var(--blue);
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.btn-lp-secondary:hover { background: var(--blue-light); text-decoration: none; }

/* ── CTA ── */
.lp-cta {
    background: linear-gradient(135deg, var(--navy) 0%, #1e40af 100%);
    color: #fff;
    padding: 5rem 0;
    text-align: center;
}
.lp-cta h2 { font-size: 2rem; font-weight: 800; margin-bottom: .75rem; }
.lp-cta p { color: rgba(255,255,255,.65); font-size: 1.1rem; margin-bottom: 2rem; }

/* ── Footer ── */
.lp-footer {
    background: var(--navy);
    color: rgba(255,255,255,.5);
    padding: 3rem 0 2rem;
}
.lp-footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}
.lp-footer-logo {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}
.lp-footer-brand p { font-size: .85rem; margin-top: .25rem; }
.lp-footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.lp-footer-links a {
    color: rgba(255,255,255,.5);
    font-size: .85rem;
    text-decoration: none;
    transition: color .15s;
}
.lp-footer-links a:hover { color: #fff; text-decoration: none; }
.lp-footer-copy { font-size: .8rem; }

/* ═══════════════════════════════════════ */
/* ═══ AUTH PAGES (Login / Signup) ═══    */
/* ═══════════════════════════════════════ */
.auth-body {
    background: linear-gradient(135deg, #f0f4ff 0%, #dbeafe 50%, #ede9fe 100%);
    min-height: 100vh;
}
.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.auth-logo {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--blue);
    text-decoration: none;
    margin-bottom: 1.5rem;
}
.auth-logo:hover { text-decoration: none; }
.auth-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.auth-sub { color: var(--gray-500); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-card .form-group { text-align: left; }
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    width: 100%;
    padding: .7rem .9rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color .15s, box-shadow .15s;
}
.auth-card input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}
.auth-error {
    background: var(--red-light);
    color: var(--red);
    padding: .6rem 1rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: left;
}
.auth-success {
    background: var(--green-light);
    color: var(--green);
    padding: .6rem 1rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: left;
}

.session-prompt {
    text-align: center;
    padding: 1.2rem;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.session-prompt-icon {
    font-size: 2.2rem;
    margin-bottom: .4rem;
}
.session-prompt p {
    margin: 0 0 .3rem;
    font-weight: 600;
    font-size: .95rem;
    color: #92400e;
}
.session-prompt .session-prompt-sub {
    font-weight: 400;
    font-size: .88rem;
    color: #78350f;
    margin-bottom: 1rem;
}
.session-prompt-actions {
    display: flex;
    gap: .6rem;
    justify-content: center;
}
.session-prompt-actions .btn {
    min-width: 130px;
    font-size: .88rem;
    padding: .55rem 1rem;
}
.auth-footer {
    margin-top: 1.5rem;
    font-size: .9rem;
    color: var(--gray-500);
}
.auth-legal-links {
    margin-top: .75rem;
    font-size: .8rem;
    color: var(--gray-400);
    text-align: center;
}
.auth-legal-links a {
    color: var(--gray-500);
    text-decoration: none;
}
.auth-legal-links a:hover {
    color: var(--blue);
    text-decoration: underline;
}
.auth-icon {
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1rem;
}
.auth-icon-success { background: var(--green-light); color: var(--green); }
.auth-icon-error { background: var(--red-light); color: var(--red); }

/* ═══════════════════════════════════════ */
/* ═══ ACCOUNT PAGE ═══                   */
/* ═══════════════════════════════════════ */
.acc-wrap {
    display: flex;
    justify-content: center;
    padding: 2rem;
    min-height: 100vh;
    align-items: flex-start;
    padding-top: 4rem;
}
.acc-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 600px;
}
.acc-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}
.acc-header h2 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.acc-info { margin-bottom: 2rem; }
.acc-row {
    display: flex;
    justify-content: space-between;
    padding: .6rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: .95rem;
}
.acc-label { color: var(--gray-500); }
.acc-value { font-weight: 600; }
.acc-status {
    padding: .2rem .6rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 700;
}
.acc-status-trial { background: #fef3c7; color: #92400e; }
.acc-status-active { background: var(--green-light); color: var(--green); }
.acc-status-expired { background: var(--red-light); color: var(--red); }
.acc-status-cancelling { background: #fff3cd; color: #856404; }

.acc-cancel-notice {
    margin-top: .75rem;
    padding: .75rem 1rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    font-size: .85rem;
    color: #92400e;
    line-height: 1.5;
}

.acc-edit-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}
.acc-edit-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--gray-700);
}
.acc-edit-form .form-group {
    margin-bottom: 1rem;
}
.acc-edit-form .form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: .35rem;
}
.acc-edit-form input[type="text"],
.acc-edit-form input[type="email"],
.acc-edit-form input[type="password"] {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: .95rem;
}
.acc-edit-msg { font-size: .9rem; padding: .5rem 0; }
.acc-edit-msg.acc-edit-msg-ok { color: var(--green); }
.acc-edit-msg.acc-edit-msg-err { color: var(--red); }

.acc-plans h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.acc-plan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 500px) { .acc-plan-grid { grid-template-columns: 1fr; } }
.acc-plan-card {
    border: 1.5px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
}
.acc-plan-featured {
    border-color: var(--blue);
    box-shadow: 0 4px 15px rgba(37,99,235,.1);
}
.acc-plan-badge {
    position: absolute;
    top: -10px; left: 50%; transform: translateX(-50%);
    background: var(--blue);
    color: #fff;
    padding: .15rem .75rem;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 700;
}
.acc-plan-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.acc-plan-price { font-size: 1.8rem; font-weight: 800; }
.acc-plan-price span { font-size: .9rem; font-weight: 500; color: var(--gray-500); }
.acc-plan-billed { font-size: .8rem; color: var(--gray-500); margin-bottom: 1rem; }

/* ═══ SUBSCRIPTION BANNER ═══ */
.sub-banner {
    text-align: center;
    padding: .6rem 1rem;
    font-size: .88rem;
    font-weight: 600;
}
.sub-banner a { text-decoration: underline; font-weight: 700; }
.sub-banner-expired { background: var(--red-light); color: var(--red); }
.sub-banner-expired a { color: var(--red); }
.sub-banner-trial { background: #fef3c7; color: #92400e; }
.sub-banner-trial a { color: #92400e; }

/* ═══════════════════════════════════════ */
/* ═══ ADMIN DASHBOARD ═══               */
/* ═══════════════════════════════════════ */
.admin-body { background: var(--gray-50); }
.admin-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-header h1 { font-size: 1.6rem; font-weight: 800; margin: 0; }
.admin-sub { color: var(--gray-500); font-size: .9rem; }
.admin-header > div { display: flex; gap: .5rem; align-items: center; }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.admin-stat {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.25rem 1rem;
    text-align: center;
}
.admin-stat-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--blue);
}
.admin-stat-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .2rem;
}

.admin-section {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.admin-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.admin-table th {
    text-align: left;
    padding: .5rem .6rem;
    border-bottom: 2px solid var(--gray-200);
    font-size: .75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    white-space: nowrap;
}
.admin-table td {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.admin-table tr:hover td { background: var(--gray-50); }
.admin-name { font-weight: 600; white-space: nowrap; }
.admin-ua { font-size: .75rem; color: var(--gray-500); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .7rem 1.6rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-teacher { background: var(--blue); color: #fff; }
.btn-teacher:hover { background: var(--blue-dark); }
.btn-student { background: var(--green); color: #fff; }
.btn-student:hover { background: #15803d; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; }
.btn-xs { padding: .25rem .6rem; font-size: .78rem; }
.btn-correct { background: var(--green); color: #fff; }
.btn-wrong { background: var(--red); color: #fff; }
.btn-icon { background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 1.3rem; padding: .2rem .5rem; }
.btn-icon:hover { color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ═══ SCREENS ═══ */
.screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

/* ═══ CARDS ═══ */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}
.center-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.question-card {
    width: 100%;
    max-width: 600px;
}

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 1rem; text-align: left; }
.form-group label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.form-group small { color: var(--gray-500); font-weight: 400; }

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}
.input-sm { width: 100px; }
.input-code {
    text-align: center;
    font-size: 1.8rem;
    letter-spacing: .3rem;
    text-transform: uppercase;
    font-weight: 700;
}

.error-msg { color: var(--red); margin-top: .5rem; font-size: .9rem; }
.muted { color: var(--gray-500); font-size: .9rem; padding: 1rem; text-align: center; }
.hint { display: block; color: var(--gray-500); font-size: .8rem; margin-top: .25rem; }

/* ═══ TEACHER DASHBOARD ═══ */
.teacher-body { background: var(--gray-50); }
.teacher-body .screen { min-height: 100vh; }
.teacher-body #dashboard {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    min-height: 100vh;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: .5rem;
}
.header-left { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.header-left h2 { font-size: 1.2rem; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 1rem; font-size: .9rem; color: var(--gray-500); }
.join-code-display {
    font-size: .95rem;
    color: var(--gray-500);
}
.code-big {
    display: inline-block;
    background: var(--blue-light);
    color: var(--blue-dark);
    padding: .2rem .7rem;
    border-radius: 6px;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: .15rem;
    font-family: 'Courier New', monospace;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    align-items: start;
}
@media (max-width: 900px) {
    .dash-grid { grid-template-columns: 1fr; }
}

.panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}
.panel h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.panel h4 { margin: .75rem 0 .5rem; font-size: .95rem; }

/* ── Choices Builder ── */
#choicesSection { margin-bottom: 1rem; }
.choice-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .4rem;
}
.choice-label {
    width: 28px;
    height: 28px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}
.choice-text { flex: 1; padding: .4rem .6rem; font-size: .9rem; }
.choice-correct { display: flex; align-items: center; gap: .25rem; font-size: .8rem; white-space: nowrap; cursor: pointer; }

/* ── Tabs ── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1rem;
    gap: 0;
}
.tab {
    padding: .5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Responses ── */
.response-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}
.btn-add-time {
    background: var(--orange);
    color: #fff;
    border-color: var(--orange);
    font-weight: 700;
    font-size: .78rem;
    padding: .25rem .6rem;
    border-radius: 6px;
    white-space: nowrap;
}
.btn-add-time:hover {
    opacity: .85;
}
.response-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: .4rem;
    flex-wrap: wrap;
}
.response-name { font-weight: 600; min-width: 100px; }
.response-waiting { opacity: .55; }
.waiting-text { font-style: italic; color: var(--gray-400); }
.response-answer { flex: 1; color: var(--gray-700); font-style: italic; }
.response-grade { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-correct { background: var(--green-light); color: var(--green); }
.badge-wrong { background: var(--red-light); color: var(--red); }
.badge-pending { background: var(--orange-light); color: var(--orange); }

/* ── Data Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.data-table th { text-align: left; padding: .5rem; border-bottom: 2px solid var(--gray-200); font-size: .8rem; color: var(--gray-500); text-transform: uppercase; }
.data-table td { padding: .5rem; border-bottom: 1px solid var(--gray-100); }
.data-table tr:hover td { background: var(--gray-50); }

/* ── Student List ── */
.student-list { list-style: none; padding: 0; }
.student-list li {
    padding: .4rem .6rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: .9rem;
}

/* ── Randomizer ── */
.random-card {
    background: var(--blue-light);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.random-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: .5rem;
    cursor: pointer;
    transition: filter .25s ease, opacity .25s ease;
    user-select: none;
}
.random-name-hidden {
    filter: blur(8px);
    opacity: .6;
}
.random-answer { font-size: 1.4rem; font-style: italic; margin-bottom: .5rem; color: var(--gray-700); }
.random-badge { margin-bottom: 1rem; }
.random-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ── Image Preview ── */
.img-preview img { max-width: 200px; border-radius: 8px; margin-top: .5rem; }

/* ═══ STUDENT SCREENS ═══ */
.student-body { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); }

.waiting-anim {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
}
.waiting-anim.small { margin-top: 1rem; }
.pulse-ring {
    width: 80px;
    height: 80px;
    border: 4px solid var(--green);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}
.small .pulse-ring { width: 40px; height: 40px; border-width: 3px; }
.pulse-text { margin-top: 1rem; color: var(--gray-500); font-size: .95rem; }

@keyframes pulse {
    0% { transform: scale(.8); opacity: .5; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(.8); opacity: .5; }
}

.submitted-check {
    width: 70px;
    height: 70px;
    background: var(--green);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
    animation: popIn .3s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.submitted-feedback-wrap {
    margin: 1rem 0;
    width: 100%;
}
.submitted-feedback {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .95rem;
    text-align: center;
    line-height: 1.4;
}
.submitted-feedback-correct {
    background: var(--green-light);
    color: #166534;
    border: 1px solid #22c55e;
}
.submitted-feedback-wrong {
    background: var(--red-light);
    color: #991b1b;
    border: 1px solid #f87171;
}
.submitted-feedback-pending {
    background: var(--orange-light);
    color: #9a3412;
    border: 1px solid var(--orange);
}

/* ── Question Display ── */
.q-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1rem;
}
.q-timer-wrap {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
    padding: .25rem .55rem;
    background: var(--gray-100);
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800);
}
.q-timer-display {
    font-variant-numeric: tabular-nums;
    min-width: 2.6rem;
    text-align: right;
    font-weight: 800;
}
.q-timer-display.q-timer-urgent {
    color: #b91c1c;
    animation: q-timer-flash 0.45s ease-in-out infinite;
}
@keyframes q-timer-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.q-number { font-size: 1.2rem; font-weight: 700; }
.q-type-badge {
    background: var(--blue-light);
    color: var(--blue);
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}
.q-text { font-size: 1.1rem; margin-bottom: 1rem; line-height: 1.6; }
.q-image { margin-bottom: 1rem; text-align: center; }
.q-image img { max-width: 100%; max-height: 350px; border-radius: 8px; }

/* ── Choice Buttons ── */
.choices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
    margin-bottom: 1.25rem;
}
.choice-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem 1rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s;
    text-align: left;
    font-size: 1rem;
    font-family: inherit;
}
.choice-btn:hover { border-color: var(--blue); background: var(--blue-light); }
.choice-btn.selected {
    border-color: var(--blue);
    background: var(--blue-light);
    box-shadow: 0 0 0 2px var(--blue);
}
.choice-letter {
    width: 34px;
    height: 34px;
    background: var(--blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}
.choice-btn.selected .choice-letter { background: var(--blue-dark); }
.choice-body { flex: 1; }

/* ═══ UNGRADED TAB ═══ */
.ungraded-count {
    font-size: .9rem;
    font-weight: 600;
    color: var(--orange);
    margin-bottom: .75rem;
    padding: 0 .25rem;
}
.all-graded-msg { color: var(--green) !important; font-weight: 600; }

.grade-card {
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: .5rem;
    overflow: hidden;
    border-left: 3px solid var(--orange);
}
.grade-card-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    background: var(--orange-light);
    flex-wrap: wrap;
}
.grade-q-num {
    font-weight: 700;
    font-size: .85rem;
    color: var(--gray-700);
}
.grade-q-num small { font-weight: 400; color: var(--gray-500); }
.grade-student { font-weight: 600; font-size: .9rem; }
.correct-hint {
    margin-left: auto;
    font-size: .8rem;
    color: var(--green);
    background: var(--green-light);
    padding: .15rem .5rem;
    border-radius: 4px;
}
.correct-hint.no-answer {
    color: var(--gray-500);
    background: var(--gray-100);
}
.grade-card-body {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    flex-wrap: wrap;
}
.grade-answer {
    flex: 1;
    font-style: italic;
    color: var(--gray-700);
    font-size: .95rem;
    min-width: 120px;
}
.grade-actions { display: flex; gap: .35rem; }

/* ═══ ALL ANSWERS TAB ═══ */
.all-answers-question {
    margin-bottom: 1.25rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}
.all-answers-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    background: var(--blue-light);
    flex-wrap: wrap;
}
.all-answers-text {
    font-size: .9rem;
    color: var(--gray-700);
    flex: 1;
    min-width: 100px;
}
.answers-table { font-size: .85rem; }
.answers-table th { padding: .4rem .6rem; font-size: .75rem; }
.answers-table td { padding: .35rem .6rem; }
.answer-cell { font-style: italic; color: var(--gray-700); }
.grade-btns-cell { white-space: nowrap; }
.grade-btns-cell .btn { margin-left: .2rem; }

/* ═══ STUDENT SCORES SCREEN ═══ */
.scores-card {
    width: 100%;
    max-width: 500px;
    text-align: center;
}
.scores-card h2 { margin-bottom: 1.25rem; }

.score-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.score-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--gray-200) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.score-ring::before {
    content: '';
    width: 76px;
    height: 76px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
}
.score-pct {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
}
.score-stats {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    text-align: left;
    font-size: .95rem;
    font-weight: 600;
}
.stat-correct { color: var(--green); }
.stat-wrong { color: var(--red); }
.stat-pending { color: var(--orange); }

.score-rank-line {
    flex-basis: 100%;
    text-align: center;
    margin: 0;
    font-size: .95rem;
    line-height: 1.4;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    text-align: left;
}
.score-table th {
    padding: .5rem .6rem;
    border-bottom: 2px solid var(--gray-200);
    font-size: .8rem;
    color: var(--gray-500);
    text-transform: uppercase;
}
.score-table td {
    padding: .45rem .6rem;
    border-bottom: 1px solid var(--gray-100);
}
.score-table tr:hover td { background: var(--gray-50); }

/* ═══ TEACHER START SCREEN ═══ */
.start-screen {
    align-items: flex-start;
    padding: 2rem;
}
.start-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}
.start-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.start-top h1 { margin: 0; font-size: 1.6rem; }
.start-top-left { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.start-greeting { font-size: .95rem; color: var(--gray-500); }
.start-top-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.send-buttons { display: flex; gap: .5rem; margin-top: .5rem; }

.past-sessions-section h3 {
    font-size: 1rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .05rem;
    margin-bottom: .75rem;
}

.past-session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .85rem 1.1rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}
.ps-info { flex: 1; min-width: 200px; }
.ps-code {
    font-family: 'Courier New', monospace;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--blue-dark);
    letter-spacing: .1rem;
}
.ps-meta {
    font-size: .82rem;
    color: var(--gray-500);
    margin-top: .15rem;
}
.ps-actions {
    display: flex;
    gap: .4rem;
    align-items: center;
}

/* ═══ REVIEW SCREEN ═══ */
.review-container {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 1.5rem 0;
}
.review-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.review-header h2 { font-size: 1.3rem; margin: 0; }
.review-meta { font-size: .85rem; color: var(--gray-500); }
.review-tabs {
    display: flex;
    gap: .5rem;
    margin: 1rem 0 .75rem;
    border-bottom: 2px solid var(--gray-100, #f3f4f6);
    padding-bottom: 0;
}
.review-tabs .tab {
    padding: .45rem 1.1rem;
    font-size: .9rem;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--gray-500);
    font-weight: 500;
}
.review-tabs .tab.active {
    color: var(--teacher, #1a73e8);
    border-bottom-color: var(--teacher, #1a73e8);
}
.review-tab-content { display: none; }
.review-tab-content.active { display: block; }
.ps-archive-name {
    font-weight: 600;
    font-size: .95rem;
    color: var(--teacher, #1a73e8);
    margin-bottom: 2px;
}
#reviewScreen.screen {
    align-items: flex-start;
    padding: 2rem;
}

/* ═══ QUEUED QUESTIONS ═══ */
.queue-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    background: var(--blue-light);
    border-radius: 8px;
    padding: .6rem .85rem;
    margin-bottom: .4rem;
    flex-wrap: wrap;
}
.queue-info { flex: 1; min-width: 150px; }
.queue-info strong { font-size: .9rem; }
.queue-preview {
    font-size: .82rem;
    color: var(--gray-500);
    margin-top: .1rem;
    line-height: 1.4;
}

/* ═══ TABS OVERFLOW ═══ */
.tabs { flex-wrap: wrap; }

/* ═══ RESPONSE QUESTION DETAIL ═══ */
.response-question-detail {
    background: var(--blue-light);
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: .85rem 1rem;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.rq-text {
    font-weight: 600;
    margin-bottom: .4rem;
    line-height: 1.4;
}
.rq-image {
    margin-bottom: .5rem;
}
.rq-image img {
    max-width: 220px;
    border-radius: 6px;
}
.rq-choices {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-bottom: .4rem;
}
.rq-choice {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.rq-choice-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.rq-choice-text {
    color: var(--gray-700);
}
.rq-correct-mark {
    color: var(--green);
    font-weight: 700;
    margin-left: .15rem;
}
.rq-correct {
    font-size: .82rem;
    color: var(--gray-500);
    margin-top: .35rem;
}

/* ═══ TESTING MODE ═══ */
.btn-test {
    background: #f59e0b;
    color: #fff;
    border: none;
    font-weight: 600;
}
.btn-test:hover { background: #d97706; }

.test-indicator {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .65rem;
    border-radius: 6px;
    background: #fef3c7;
    color: #92400e;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    border: 1.5px solid #f59e0b;
    animation: testPulse 2s ease-in-out infinite;
}

@keyframes testPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

.history-actions {
    white-space: nowrap;
}
.history-actions .btn-danger {
    margin-left: .15rem;
}

/* Question # picker (teacher builder) */
.qnumber-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}
.qnumber-display {
    width: 3.25rem;
    text-align: center;
    background: var(--gray-50, #f9fafb);
    color: var(--gray-800);
    cursor: default;
}
.qquestion-picker {
    flex: 1;
    min-width: 12rem;
}

/* ═══ STUDENT GRID ═══ */
.student-grid-wrap {
    overflow-x: auto;
    margin-top: .5rem;
}
.student-grid {
    border-collapse: collapse;
    width: 100%;
    font-size: .85rem;
}
.student-grid th,
.student-grid td {
    padding: .3rem .25rem;
    text-align: center;
    white-space: nowrap;
}
.sg-name-header,
.sg-name-cell {
    text-align: left;
    font-weight: 600;
    padding-right: .75rem;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    min-width: 110px;
}
.sg-name-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    white-space: normal;
}
.sg-student-name {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    text-align: left;
}
.sg-remove-stu {
    flex-shrink: 0;
    font-size: .65rem !important;
    padding: .12rem .4rem !important;
    line-height: 1.2;
}
.sg-q-header {
    font-size: .75rem;
    font-weight: 700;
    color: var(--gray-500);
    padding-bottom: .15rem;
}
.sg-score-header {
    font-size: .72rem;
    font-weight: 800;
    color: var(--gray-700);
    padding-bottom: .15rem;
    min-width: 4.5rem;
}
.sg-score-cell {
    font-size: .8rem;
    font-weight: 800;
    text-align: center;
    vertical-align: middle;
}
.sg-class-pct-label {
    font-weight: 500;
    font-size: .72rem;
}
.sg-class-pct-label .muted {
    white-space: nowrap;
}
.sg-pct-row td {
    padding-top: 0;
    padding-bottom: .35rem;
}
.sg-pct-cell {
    font-size: .7rem;
    font-weight: 700;
    color: var(--gray-400);
}
.sg-pct-good { color: var(--green); }
.sg-pct-mid  { color: #d97706; }
.sg-pct-low  { color: var(--red); }

.sg-box {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    margin: 0 auto;
}
.sg-correct { background: var(--green); }
.sg-wrong   { background: var(--red); }
.sg-none    { background: var(--gray-200); }

/* ═══ UTILITY ═══ */
input[type="file"] {
    font-size: .9rem;
    padding: .4rem 0;
}

/* ═══ DISCOUNT PRICING ═══ */
.price-was {
    text-decoration: line-through;
    color: var(--red);
    font-size: .85em;
    font-weight: 500;
    margin-right: .25rem;
}
.price-was-sm {
    text-decoration: line-through;
    color: var(--red);
    font-size: .95em;
    font-weight: 500;
    margin-right: .15rem;
}
.lp-price-sale {
    position: absolute;
    top: -12px;
    right: 12px;
    background: var(--red);
    color: #fff;
    padding: .2rem .75rem;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    animation: salePulse 2s ease-in-out infinite;
}
@keyframes salePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
.acc-plan-sale {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--red);
    color: #fff;
    padding: .15rem .6rem;
    border-radius: 100px;
    font-size: .65rem;
    font-weight: 700;
}
.discount-ends {
    font-size: .78rem;
    color: var(--red);
    font-weight: 600;
    margin-top: .25rem;
    margin-bottom: .5rem;
}

/* ═══ ADMIN DISCOUNT FORM ═══ */
.admin-disc-row {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.admin-disc-form .form-group {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}
.admin-disc-form .form-group:last-child {
    flex: 0;
    min-width: auto;
}

/* ═══ ADMIN MANAGE MODAL ═══ */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.admin-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    animation: adminModalIn .15s ease;
}
@keyframes adminModalIn {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}
.admin-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}
.admin-modal-email {
    font-size: .85rem;
    color: var(--gray-500);
    margin-top: .15rem;
}
.admin-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 0 0 0 1rem;
}
.admin-modal-close:hover { color: var(--gray-700); }
.admin-modal-body { padding: 1.25rem 1.5rem; }
.admin-modal-section { margin-bottom: 1.25rem; }
.admin-modal-section:last-child { margin-bottom: 0; }
.admin-modal-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-500);
    display: block;
    margin-bottom: .5rem;
}
.admin-modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.admin-modal-status {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
    font-size: .9rem;
}
.admin-modal-sublabel {
    font-size: .85rem;
    color: var(--gray-600);
    margin-bottom: .25rem;
}
.admin-modal-btn-group {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.admin-modal-msg {
    padding: .75rem 1.5rem;
    font-size: .85rem;
    text-align: center;
}
.admin-modal-msg-ok  { background: var(--green-light); color: var(--green); }
.admin-modal-msg-err { background: var(--red-light); color: var(--red); }

/* ═══ ADMIN EMAIL COMPOSER ═══ */
.email-composer {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.25rem;
}
.email-composer-top {
    margin-bottom: 1rem;
}
.email-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}
.email-filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }
.email-filter-bar select { width: 100%; }
.email-recipient-badge {
    background: var(--blue-light);
    color: var(--blue);
    font-weight: 600;
    font-size: .85rem;
    padding: .45rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
}
.email-picker-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    margin-top: .75rem;
    overflow: hidden;
}
.email-picker-search {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.email-picker-search input {
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: .4rem .6rem;
    font-size: .85rem;
}
.email-picker-list {
    max-height: 220px;
    overflow-y: auto;
    padding: .25rem 0;
}
.email-picker-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .75rem;
    cursor: pointer;
    font-size: .85rem;
    transition: background .12s;
}
.email-picker-item:hover { background: var(--gray-50); }
.email-picker-item input { flex-shrink: 0; cursor: pointer; }
.email-picker-name { font-weight: 600; color: var(--text-dark); }
.email-picker-addr { color: var(--text-light); font-size: .8rem; }
.email-picker-actions {
    display: flex;
    gap: .5rem;
    padding: .5rem .75rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.email-format-bar {
    display: flex;
    gap: .25rem;
    padding: .35rem .5rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}
.email-fmt-btn {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 5px;
    padding: .2rem .55rem;
    cursor: pointer;
    font-size: .8rem;
    color: var(--text-dark);
    transition: background .12s, border-color .12s;
}
.email-fmt-btn:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}

.email-composer textarea {
    width: 100%;
    border: 1px solid var(--gray-200);
    border-radius: 0 0 8px 8px;
    padding: .75rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: .82rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 160px;
}
.email-composer textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.email-composer-actions {
    display: flex;
    gap: .6rem;
    margin-top: 1rem;
}
.email-status {
    margin-top: .75rem;
    padding: .6rem 1rem;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 500;
}
.email-status-ok {
    background: var(--green-light);
    color: var(--green);
}
.email-status-err {
    background: var(--red-light);
    color: var(--red);
}
.email-status-sending {
    background: var(--blue-light);
    color: var(--blue);
}

.email-preview-subject {
    padding: .75rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--text-dark);
    background: var(--gray-50);
}
.email-preview-frame {
    width: 100%;
    height: 420px;
    border: none;
    display: block;
}

/* ═══ SITE-WIDE OWNERSHIP FOOTER ═══ */
.site-owner-footer {
    text-align: center;
    padding: 1rem 1.5rem;
    font-size: .75rem;
    color: #9ca3af;
    background: #111827;
    letter-spacing: .02em;
}
.site-owner-footer span {
    color: #6b7280;
}

/* ═══════════════════════════════════════ */
/* ═══ SYMBOL TOOLBAR ═══                */
/* ═══════════════════════════════════════ */
/* ═══════════════════════════════════════ */
/* ═══ INSERT DROPDOWN (unified toolbar) ═ */
/* ═══════════════════════════════════════ */
.insert-dropdown {
    position: relative;
    display: inline-block;
    margin-top: .35rem;
}
.insert-toggle {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: .3rem .75rem;
    font-size: .82rem;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    transition: all .12s;
    font-weight: 500;
}
.insert-toggle:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}
.insert-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 70;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    padding: .3rem 0;
    margin-top: 4px;
    min-width: 160px;
}
.insert-menu.open { display: block; }
.insert-menu button {
    display: block;
    width: 100%;
    padding: .45rem .8rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: .85rem;
    font-family: inherit;
    color: var(--text);
    transition: background .1s;
}
.insert-menu button:hover {
    background: var(--blue-light);
    color: var(--blue);
}

.symbol-dropdown {
    position: relative;
    display: inline-block;
    margin-top: .35rem;
}
.symbol-toggle {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: .3rem .7rem;
    font-size: .82rem;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    transition: all .12s;
}
.symbol-toggle:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}
.symbol-panel {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 60;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    padding: .4rem;
    flex-wrap: wrap;
    gap: 2px;
    width: 280px;
    margin-top: 4px;
}
.symbol-panel.open { display: flex; }
.symbol-panel button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    font-family: inherit;
    padding: 0;
}
.symbol-panel button:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}

/* ═══════════════════════════════════════ */
/* ═══ FRACTION INPUT POPOVER ═══        */
/* ═══════════════════════════════════════ */
.fraction-dropdown {
    position: relative;
    display: inline-block;
    margin-top: .35rem;
    margin-left: .25rem;
}
.fraction-toggle {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: .3rem .7rem;
    font-size: .82rem;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    transition: all .12s;
}
.fraction-toggle:hover {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue);
}
.fraction-popover {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 65;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    padding: 12px 16px;
    margin-top: 4px;
    width: 140px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.fraction-popover.open { display: flex; }
.fraction-popover input[type="text"] {
    width: 80px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 5px 4px;
    outline: none;
    font-family: inherit;
    transition: border-color .15s;
}
.fraction-popover input[type="text"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.fraction-bar {
    width: 80px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}
.fraction-insert-btn {
    margin-top: 6px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 16px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    width: 100%;
}
.fraction-insert-btn:hover { background: var(--blue-dark, #1d4ed8); }
.fraction-label {
    font-size: .65rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Visual fraction rendering in displayed text */
.frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    text-align: center;
    font-size: .85em;
    line-height: 1.15;
    padding: 0 2px;
    margin: 0 1px;
}
.frac .frac-n {
    padding: 0 3px 1px;
    border-bottom: 1.5px solid currentColor;
}
.frac .frac-d {
    padding: 1px 3px 0;
}

/* ═══════════════════════════════════════ */
/* ═══ CHOICE IMAGE SUPPORT ═══          */
/* ═══════════════════════════════════════ */
.choice-content {
    flex: 1;
    min-width: 0;
}
.choice-img-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .3rem;
}
.btn-img-upload {
    font-size: .78rem;
    padding: .2rem .5rem;
    border: 1px dashed var(--gray-300);
    border-radius: 5px;
    cursor: pointer;
    color: var(--text-light);
    white-space: nowrap;
    transition: all .12s;
}
.btn-img-upload:hover {
    border-color: var(--blue);
    color: var(--blue);
}
.btn-img-upload input[type="file"] {
    display: none;
}
.choice-img-preview {
    position: relative;
    display: inline-block;
}
.choice-img-preview img {
    max-width: 80px;
    max-height: 50px;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
}
.choice-img-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: .7rem;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Student choice images */
.choice-btn-img {
    flex-direction: column;
    text-align: center;
}
.choice-btn-img .choice-letter {
    align-self: flex-start;
}
.choice-img {
    max-width: 120px;
    max-height: 80px;
    border-radius: 6px;
    margin: .3rem 0;
}
.rq-choice-img {
    max-width: 60px;
    max-height: 40px;
    border-radius: 4px;
    margin-left: .3rem;
    vertical-align: middle;
}

/* ═══════════════════════════════════════ */
/* ═══ IMAGE ANNOTATOR MODAL ═══         */
/* ═══════════════════════════════════════ */
.annotator-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.annotator-modal {
    background: #fff;
    border-radius: 14px;
    width: 95%;
    max-width: 860px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.annotator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.2rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 700;
    font-size: 1.05rem;
}
.annotator-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}
.annotator-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border-bottom: 1px solid var(--gray-100);
    align-items: center;
}
.ann-tool {
    padding: .3rem .65rem;
    font-size: .82rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all .12s;
}
.ann-tool:hover { border-color: var(--blue); color: var(--blue); }
.ann-tool.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.annotator-canvas-wrap {
    position: relative;
    margin: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    display: inline-block;
}
.annotator-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    cursor: crosshair;
}
.annotator-footer {
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
    padding: .75rem 1.2rem;
    border-top: 1px solid var(--gray-200);
}

/* ═══════════════════════════════════════ */
/* ═══ POLL BAR CHART ═══                */
/* ═══════════════════════════════════════ */
.poll-bar-chart {
    margin: .75rem 0;
}
.poll-bar-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
}
.poll-bar-label {
    min-width: 80px;
    font-size: .85rem;
    font-weight: 600;
    text-align: right;
    flex-shrink: 0;
}
.poll-bar-track {
    flex: 1;
    height: 24px;
    background: var(--gray-100);
    border-radius: 6px;
    overflow: hidden;
}
.poll-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--blue), #6366f1);
    border-radius: 6px;
    transition: width .4s ease;
    min-width: 2px;
}
.poll-bar-count {
    min-width: 65px;
    font-size: .8rem;
    color: var(--gray-500);
    flex-shrink: 0;
}
.poll-bar-chart-sm .poll-bar-label { min-width: 60px; font-size: .75rem; }
.poll-bar-chart-sm .poll-bar-track { height: 18px; }
.poll-bar-chart-sm .poll-bar-count { font-size: .7rem; min-width: 55px; }
.poll-bar-mine .poll-bar-fill {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}
.poll-bar-mine .poll-bar-label {
    color: #f59e0b;
}

/* ═══════════════════════════════════════ */
/* ═══ TABLE BUILDER + RENDERED TABLE ═══*/
/* ═══════════════════════════════════════ */
.table-dropdown {
    display: inline-block;
    position: relative;
    vertical-align: middle;
}
.table-toggle {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: .3rem .65rem;
    font-size: .82rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    transition: background .15s;
}
.table-toggle:hover {
    background: var(--gray-100);
}
.table-popover {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    z-index: 120;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.12);
    padding: .75rem;
    min-width: 260px;
}
.table-popover.open {
    display: block;
}
.tb-grid-wrap {
    display: flex;
    align-items: stretch;
    gap: .35rem;
}
.tb-grid {
    border-collapse: collapse;
    width: auto;
}
.tb-grid td {
    padding: 0;
}
.tb-grid .tb-cell {
    width: 72px;
    padding: .3rem .35rem;
    border: 1px solid var(--gray-300);
    font-size: .82rem;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: border-color .15s;
}
.tb-grid .tb-cell:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.tb-grid tr:first-child .tb-cell {
    background: var(--gray-50);
    font-weight: 600;
}
.tb-add-col {
    align-self: stretch;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    padding: 0 .5rem;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: background .15s, color .15s;
    min-height: 32px;
}
.tb-add-col:hover {
    background: var(--blue-light);
    color: var(--blue);
    border-color: var(--blue);
}
.tb-add-row {
    display: block;
    width: 100%;
    margin-top: .35rem;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    padding: .3rem 0;
    font-size: .82rem;
    cursor: pointer;
    color: var(--gray-500);
    font-family: inherit;
    transition: background .15s, color .15s;
}
.tb-add-row:hover {
    background: var(--blue-light);
    color: var(--blue);
    border-color: var(--blue);
}
.tb-actions {
    display: flex;
    gap: .5rem;
    margin-top: .6rem;
}
.tb-insert-btn {
    flex: 1;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .4rem .75rem;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.tb-insert-btn:hover {
    opacity: .9;
}
.tb-cancel-btn {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: .4rem .75rem;
    font-size: .82rem;
    cursor: pointer;
    font-family: inherit;
    color: var(--gray-500);
}
.tb-cancel-btn:hover {
    background: var(--gray-50);
}

/* Rendered question table */
.q-table {
    border-collapse: collapse;
    margin: .5rem 0;
    font-size: .88rem;
    width: auto;
    min-width: 120px;
    max-width: 100%;
}
.q-table th,
.q-table td {
    border: 1px solid var(--gray-300);
    padding: .35rem .6rem;
    text-align: center;
}
.q-table thead th {
    background: var(--gray-100);
    font-weight: 700;
    color: var(--text);
}
.q-table tbody td {
    background: #fff;
}
.q-table tbody tr:nth-child(even) td {
    background: var(--gray-50, #f8fafc);
}

/* ═══════════════════════════════════════ */
/* ═══ GRID / GRAPH EDITOR ═══           */
/* ═══════════════════════════════════════ */
.grid-config {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: .85rem 1rem;
    margin-bottom: .75rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.grid-config-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.grid-config-row > label {
    font-weight: 600;
    font-size: .82rem;
    min-width: 100px;
    color: var(--text);
}
.grid-config-row select,
.grid-config-row input[type="text"] {
    flex: 1;
    padding: .35rem .5rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: .85rem;
    font-family: inherit;
}
.grid-range-input {
    width: 72px !important;
    flex: none !important;
    padding: .35rem .4rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: .85rem;
    font-family: inherit;
    text-align: center;
}
.grid-range-row > span {
    font-size: .8rem;
    color: var(--gray-500);
}
.grid-axis-row {
    display: flex;
    gap: .75rem;
}
.grid-axis-row > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.grid-axis-row > div > label {
    font-weight: 600;
    font-size: .82rem;
    color: var(--text);
}
.grid-axis-row > div > input {
    padding: .35rem .5rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: .85rem;
    font-family: inherit;
}
.grid-config-row .checkbox-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 500;
    font-size: .85rem;
    cursor: pointer;
    min-width: 0;
}
.grid-color-picker {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .5rem;
}
.grid-color-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    margin-right: .15rem;
}
.grid-color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid var(--gray-200);
    background: var(--gc);
    cursor: pointer;
    padding: 0;
    transition: border-color .15s, box-shadow .15s;
}
.grid-color-btn:hover {
    border-color: var(--gray-400);
}
.grid-color-btn.active {
    border-color: var(--gc);
    box-shadow: 0 0 0 3px rgba(0,0,0,.12);
}
.grid-canvas-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    display: flex;
    justify-content: center;
}
.grid-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}
.grid-hint {
    margin-top: .4rem;
    font-size: .78rem;
}

/* Student grid viewer */
.grid-student-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    margin: .5rem 0;
    display: flex;
    justify-content: center;
}
.grid-student-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
}
.grid-student-wrap canvas.grid-interactive {
    cursor: crosshair;
}

/* ═══════════════════════════════════════ */
/* ═══ DRAG & DROP CANVAS EDITOR ═══     */
/* ═══════════════════════════════════════ */
.dd-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-bottom: .5rem;
    padding: .5rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}
.dd-tool, .dd-tool-action {
    padding: .35rem .65rem;
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: .82rem;
    font-family: inherit;
    transition: all .12s;
}
.dd-tool:hover, .dd-tool-action:hover {
    border-color: var(--blue);
    background: var(--blue-light);
}
.dd-tool.active {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.dd-sep {
    width: 1px;
    height: 24px;
    background: var(--gray-200);
    margin: 0 .25rem;
}
.dd-size-label, .dd-color-label {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .8rem;
    color: var(--gray-500);
}
.dd-pen-size { width: 70px; }
.dd-pen-color { width: 30px; height: 28px; padding: 0; border: 1px solid var(--gray-200); border-radius: 4px; cursor: pointer; }

/* ── DD Editor Modal ── */
.dd-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 1.5rem;
}
.dd-editor-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 780px;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.dd-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.2rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 700;
    font-size: 1.1rem;
}
.dd-editor-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}
.dd-editor-body {
    padding: 1rem 1.2rem;
}
.dd-editor-footer {
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
    padding: .75rem 1.2rem;
    border-top: 1px solid var(--gray-200);
}

/* ── DD Launch / Preview area ── */
.dd-launch-area {
    text-align: center;
}
.dd-preview-empty {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 2rem 1rem;
    color: var(--text-light);
    margin-bottom: .75rem;
    font-size: .9rem;
}
.dd-preview {
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: .75rem;
    position: relative;
}
.dd-preview img {
    display: block;
    width: 100%;
    height: auto;
}
.dd-preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .75rem;
    padding: .25rem .5rem;
    text-align: center;
}

.dd-canvas-wrap {
    position: relative;
    width: 700px;
    height: 400px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin-bottom: .75rem;
    display: inline-block;
}
.dd-canvas-layer {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
}
.dd-canvas-bg {
    z-index: 1;
}
.dd-canvas-draw {
    z-index: 2;
    cursor: crosshair;
}
.dd-paste-hint kbd {
    display: inline-block;
    padding: .1rem .35rem;
    font-size: .75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--gray-50);
}
.dd-pending-placement {
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    border: 2px dashed #10b981;
    border-radius: 6px;
    overflow: hidden;
    cursor: move;
    box-shadow: 0 0 0 1px rgba(255,255,255,.95);
}
.dd-pending-placement img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
.dd-pending-label {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    font-size: 10px;
    text-align: center;
    background: rgba(16, 185, 129, 0.92);
    color: #fff;
    padding: 3px 4px;
    pointer-events: none;
    line-height: 1.2;
}
.dd-pending-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    background: #10b981;
    cursor: nwse-resize;
    border-radius: 4px 0 6px 0;
    box-shadow: -1px -1px 4px rgba(0,0,0,.15);
}
.dd-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}
.dd-zone-box {
    position: absolute;
    border: 2px dashed var(--blue);
    background: rgba(59,130,246,.08);
    border-radius: 6px;
    cursor: move;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dd-zone-label {
    font-size: .75rem;
    font-weight: 700;
    color: var(--blue);
    pointer-events: none;
}
.dd-zone-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: .75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dd-zone-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--blue);
    cursor: se-resize;
    border-radius: 0 0 4px 0;
}

/* Text boxes on canvas overlay */
.dd-textbox {
    position: absolute;
    border: 1px dashed #9ca3af;
    background: rgba(255,255,255,.5);
    border-radius: 4px;
    cursor: move;
    pointer-events: auto;
    min-width: 60px;
    min-height: 20px;
}
.dd-textbox:hover, .dd-textbox:focus-within {
    border-color: var(--blue);
    background: rgba(255,255,255,.85);
}
.dd-textbox-content {
    padding: 3px 6px;
    outline: none;
    font-family: sans-serif;
    line-height: 1.3;
    cursor: text;
    word-wrap: break-word;
    white-space: pre-wrap;
    min-height: 1em;
}
.dd-textbox-content:empty::before {
    content: 'Type here...';
    color: #9ca3af;
    font-style: italic;
}
.dd-textbox-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: .7rem;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
}
.dd-textbox:hover .dd-textbox-remove { display: flex; }
.dd-textbox-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #9ca3af;
    cursor: se-resize;
    border-radius: 0 0 3px 0;
    display: none;
}
.dd-textbox:hover .dd-textbox-resize { display: block; }

/* Canvas table (DD editor) */
.dd-canvas-table {
    position: absolute;
    cursor: move;
    border: 2px dashed #999;
    border-radius: 4px;
    padding: 2px;
    background: rgba(255,255,255,.92);
    z-index: 10;
    min-width: 80px;
}
.dd-canvas-table .dd-textbox-remove {
    position: absolute;
    top: -10px;
    right: -10px;
}
.dd-tbl-grid {
    border-collapse: collapse;
    font-size: 12px;
}
.dd-tbl-grid td {
    padding: 0;
}
.dd-tbl-cell {
    width: 54px;
    padding: 2px 4px;
    border: 1px solid #bbb;
    font-size: 11px;
    text-align: center;
    background: transparent;
    outline: none;
}
.dd-tbl-cell:focus {
    border-color: var(--teacher, #1a73e8);
    box-shadow: 0 0 0 1px var(--teacher, #1a73e8);
}
.dd-tbl-btns {
    display: flex;
    gap: 4px;
    margin-top: 3px;
    justify-content: center;
}
.dd-tbl-add-btn {
    font-size: 10px;
    padding: 1px 6px;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: #f5f5f5;
    cursor: pointer;
    color: inherit;
}
.dd-tbl-add-btn:hover {
    background: #e8e8e8;
}

/* Student/display rendered canvas table */
.dd-student-table {
    position: absolute;
    pointer-events: none;
}
.dd-student-table table {
    border-collapse: collapse;
    font-size: 12px;
}
.dd-student-table th,
.dd-student-table td {
    border: 1px solid #bbb;
    padding: 2px 6px;
    text-align: center;
    font-size: 11px;
}
.dd-student-table th {
    background: rgba(0,0,0,.06);
    font-weight: 600;
}

.dd-modal-answers {
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
}
.dd-modal-answers-title {
    margin: 0 0 .35rem;
    font-size: 1rem;
    font-weight: 700;
}
.dd-modal-answers-hint {
    margin: 0 0 .6rem !important;
    font-size: .82rem;
}
.dd-answers-list-modal {
    margin-bottom: .5rem;
    max-height: 12rem;
    overflow-y: auto;
}
.dd-zone-controls, .dd-modal-answers, .dd-mapping-section {
    margin-bottom: .75rem;
}
.dd-zone-list {
    margin-top: .4rem;
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}
.dd-answer-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .3rem;
}
.dd-answer-num {
    width: 26px;
    height: 26px;
    background: var(--blue-light);
    color: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
}
.dd-answer-text {
    flex: 1;
    padding: .35rem .6rem;
    font-size: .88rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}
.dd-mapping-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .3rem;
    font-size: .88rem;
}
.dd-mapping-select {
    padding: .3rem .5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: .85rem;
}

/* ═══════════════════════════════════════ */
/* ═══ DRAG & DROP STUDENT VIEW ═══      */
/* ═══════════════════════════════════════ */
.question-card-wide {
    max-width: 760px !important;
}

.dd-student-canvas-wrap {
    position: relative;
    margin-bottom: .75rem;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.dd-student-bg {
    display: block;
    width: 100%;
    height: auto;
}
.dd-student-overlay {
    position: absolute;
    top: 0;
    left: 0;
}
.dd-student-zone {
    position: absolute;
    border: 2px dashed var(--blue);
    background: rgba(59,130,246,.06);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.dd-student-zone.dd-zone-hover {
    background: rgba(59,130,246,.2);
    border-color: #2563eb;
}
.dd-student-zone.dd-zone-has-answer {
    background: rgba(34,197,94,.1);
    border-color: #22c55e;
    border-style: solid;
}
.dd-zone-placeholder {
    font-size: .75rem;
    color: var(--blue);
    font-weight: 600;
    opacity: .6;
}
.dd-zone-filled {
    font-size: .82rem;
    font-weight: 600;
    color: #15803d;
    padding: .2rem .4rem;
}

.dd-student-zone-chip {
    cursor: grab;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dd-student-zone-chip.dd-dragging {
    opacity: .75;
}

.dd-student-bank-hint {
    color: var(--gray-600);
}

.dd-student-bank {
    width: 100%;
    flex-basis: 100%;
    min-height: 3rem;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: .5rem;
    background: #fff;
    transition: border-color .15s, background .15s;
}
.dd-student-bank.dd-bank-hover {
    border-color: var(--blue);
    background: rgba(59, 130, 246, 0.06);
}
.dd-student-bank-inner {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    min-height: 2rem;
}

.dd-student-answers {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
    padding: .5rem;
    background: var(--gray-50);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}
.dd-student-answer-item {
    padding: .5rem .85rem;
    background: var(--blue-light);
    color: var(--blue-dark);
    border: 2px solid var(--blue);
    border-radius: 8px;
    cursor: grab;
    font-weight: 600;
    font-size: .88rem;
    user-select: none;
    touch-action: none;
    transition: transform .1s, box-shadow .1s;
}
.dd-student-answer-item:active, .dd-student-answer-item.dd-dragging {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    cursor: grabbing;
    opacity: .8;
}
.dd-touch-clone {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,.2);
    opacity: .9;
}

/* Student text boxes (read-only) */
.dd-student-textbox {
    position: absolute;
    padding: 4px 6px;
    font-family: sans-serif;
    line-height: 1.3;
    word-wrap: break-word;
    pointer-events: none;
    white-space: pre-wrap;
}

/* ── DD Results Modal ── */
.dd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.dd-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    max-width: 780px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafb;
}
.dd-modal-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1a2332;
}
.dd-modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0 .2rem;
    transition: color .15s;
}
.dd-modal-close:hover { color: #ef4444; }
.dd-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.dd-modal-canvas-wrap {
    position: relative;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
}
.dd-modal-canvas-wrap img {
    display: block;
    width: 100%;
    height: auto;
}
.dd-modal-zone {
    position: absolute;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-align: center;
    padding: 2px;
    box-sizing: border-box;
    overflow: hidden;
}
.dd-modal-zone-correct {
    background: rgba(34,197,94,.18);
    border: 2.5px solid #22c55e;
    color: #166534;
}
.dd-modal-zone-wrong {
    background: rgba(239,68,68,.15);
    border: 2.5px solid #ef4444;
    color: #991b1b;
}
.dd-modal-zone-empty {
    background: rgba(107,114,128,.1);
    border: 2px dashed #9ca3af;
    color: #6b7280;
}
.dd-modal-legend {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid #e5e7eb;
}
.dd-modal-legend-items {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.dd-legend-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    padding: .35rem .6rem;
    border-radius: 6px;
}
.dd-legend-correct {
    background: #f0fdf4;
    color: #166534;
}
.dd-legend-wrong {
    background: #fef2f2;
    color: #991b1b;
}
.dd-legend-marker {
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
    width: 1.4rem;
    text-align: center;
}
.dd-legend-expected {
    font-size: .8rem;
    opacity: .7;
    font-style: italic;
}

.btn-dd-view {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    border: none;
    padding: .4rem .85rem;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s;
}
.btn-dd-view:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(99,102,241,.35);
}

/* ── Cancel Membership Modal ── */
.btn-cancel-link {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: .82rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    transition: color .15s;
}
.btn-cancel-link:hover { color: #ef4444; }

.cancel-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cancel-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    max-width: 460px;
    width: 100%;
    padding: 2rem 2rem 1.75rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.cancel-modal-close {
    position: absolute;
    top: .75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    transition: color .15s;
}
.cancel-modal-close:hover { color: #ef4444; }

.cancel-step { text-align: center; }
.cancel-step h3 {
    font-size: 1.2rem;
    margin: .5rem 0 .35rem;
    color: #1a2332;
}
.cancel-step > p {
    color: #6b7280;
    font-size: .9rem;
    margin-bottom: 1.25rem;
}
.cancel-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto .25rem;
}
.cancel-icon-warn { background: #fef3c7; color: #d97706; }
.cancel-icon-sad { background: #fee2e2; color: #dc2626; }
.cancel-icon-check { background: #dcfce7; color: #16a34a; }
.cancel-icon-success { background: #dbeafe; color: #2563eb; }

.cancel-offer-box {
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    border: 2px solid #93c5fd;
    border-radius: 12px;
    padding: 1.25rem 1rem;
    margin-bottom: 1.25rem;
    text-align: center;
}
.cancel-offer-badge {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .2rem .65rem;
    border-radius: 100px;
    margin-bottom: .6rem;
}
.cancel-offer-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e40af;
    margin-bottom: .3rem;
}
.cancel-offer-note {
    font-size: .85rem;
    color: #4b5563;
    margin: 0;
}

.cancel-reasons {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: .5rem;
}
.cancel-reason {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: .88rem;
    color: #374151;
    transition: background .1s, border-color .1s;
}
.cancel-reason:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}
.cancel-reason input[type="radio"] {
    accent-color: #ef4444;
    margin: 0;
    flex-shrink: 0;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: .7rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s;
}
.btn-danger:hover { background: #dc2626; }

.btn-muted { color: #9ca3af !important; font-size: .85rem !important; }

.cancel-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════ */
/* ═══ MOBILE RESPONSIVE ═══             */
/* ═══════════════════════════════════════ */
@media (max-width: 600px) {
    /* ── Landing page ── */
    .lp-price-featured { transform: none; }
    .lp-cta { padding: 3rem 0; }
    .lp-cta h2 { font-size: 1.5rem; }
    .lp-section-title { font-size: 1.5rem; }

    /* ── Auth pages ── */
    .auth-card { padding: 2rem 1.5rem; }
    .auth-wrap { padding: 1rem; }

    /* ── Account page ── */
    .acc-wrap { padding: 1rem; padding-top: 2rem; }
    .acc-card { padding: 1.5rem; }
    .acc-header h2 { font-size: 1.2rem; }
    .acc-row { flex-direction: column; gap: .15rem; padding: .5rem 0; }
    .acc-label { font-size: .82rem; }
    .acc-value { font-size: .9rem; }

    /* ── Teacher dashboard ── */
    .dash-header { padding: .75rem 1rem; }
    .header-left h2 { font-size: 1rem; }
    .header-right { font-size: .82rem; gap: .5rem; }
    .code-big { font-size: 1.1rem; padding: .15rem .5rem; letter-spacing: .1rem; }
    .dash-grid { padding: .75rem; gap: .75rem; }
    .panel { padding: 1rem; }
    .panel h3 { font-size: 1rem; }
    .send-buttons { flex-wrap: wrap; }
    .choice-row { flex-wrap: wrap; }

    /* ── Tabs ── */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .tab { padding: .45rem .65rem; font-size: .82rem; white-space: nowrap; flex-shrink: 0; }

    /* ── Responses ── */
    .response-card { padding: .5rem .6rem; gap: .4rem; }
    .response-name { min-width: 80px; font-size: .88rem; }
    .response-answer { font-size: .88rem; }
    .grade-card-header { padding: .4rem .6rem; }
    .grade-card-body { padding: .4rem .6rem; }
    .grade-answer { font-size: .88rem; min-width: 80px; }

    /* ── Start screen ── */
    .start-screen { padding: 1.5rem 1rem; }
    .start-container { max-width: 100%; }
    .start-top h1 { font-size: 1.3rem; }
    .past-session-card { padding: .7rem .85rem; }
    .ps-code { font-size: 1rem; }
    .ps-actions { gap: .3rem; }

    /* ── Review screen ── */
    #reviewScreen.screen { padding: 1.5rem 1rem; }
    .review-container { padding: 1rem 0; }

    /* ── Admin dashboard ── */
    .admin-wrap { padding: 1rem; }
    .admin-header h1 { font-size: 1.3rem; }
    .admin-stat { padding: 1rem .75rem; }
    .admin-stat-num { font-size: 1.4rem; }
    .admin-section { padding: 1rem; }
    .admin-disc-form .form-group { min-width: 100%; }

    /* ── Buttons ── */
    .btn { padding: .6rem 1.2rem; font-size: .92rem; }
    .btn-sm { padding: .35rem .7rem; font-size: .82rem; }
    .btn-xs { padding: .2rem .5rem; font-size: .75rem; }

    /* ── Student screens ── */
    .question-card { padding: 1.5rem; }
    .center-card { padding: 1.5rem; }
    .q-text { font-size: 1rem; }
    .choice-btn { padding: .7rem .85rem; font-size: .95rem; }

    /* ── Scores ── */
    .scores-card { padding: 1.5rem; }
    .score-ring { width: 80px; height: 80px; }
    .score-ring::before { width: 60px; height: 60px; }
    .score-pct { font-size: 1.2rem; }

    /* ── Forms ── */
    .form-group label { font-size: .85rem; }
    input[type="text"], input[type="number"], textarea, select { font-size: 16px; }

    /* ── Symbol toolbar ── */
    .symbol-panel button { width: 28px; height: 28px; font-size: .85rem; }
    .symbol-panel { width: 240px; }
    .fraction-popover { width: 120px; }
    .fraction-popover input[type="text"] { width: 64px; font-size: 1rem; }

    /* ── Choice images ── */
    .choice-img { max-width: 80px; max-height: 60px; }
    .choice-img-preview img { max-width: 60px; max-height: 40px; }
    .annotator-modal { max-width: 100%; border-radius: 10px; }
    .annotator-canvas-wrap { margin: .5rem; }

    /* ── Poll bar chart ── */
    .poll-bar-label { min-width: 50px; font-size: .75rem; }
    .poll-bar-count { min-width: 50px; font-size: .7rem; }

    /* ── DD Canvas ── */
    .dd-toolbar { gap: .25rem; padding: .35rem; }
    .dd-tool, .dd-tool-action { padding: .25rem .45rem; font-size: .75rem; }
    .dd-student-answer-item { padding: .4rem .6rem; font-size: .8rem; }
    .question-card-wide { max-width: 100% !important; }
    .dd-editor-overlay { padding: .5rem; }
    .dd-editor-body { overflow-x: auto; }
    .dd-editor-modal { max-width: 100%; }

    /* ── DD Modal ── */
    .dd-modal { border-radius: 10px; }
    .dd-modal-header { padding: .65rem 1rem; }
    .dd-modal-body { padding: .85rem; }
    .dd-legend-row { font-size: .82rem; padding: .25rem .4rem; }
    .btn-dd-view { padding: .35rem .65rem; font-size: .8rem; }

    /* ── Cancel modal ── */
    .cancel-modal { padding: 1.5rem 1.25rem 1.25rem; border-radius: 12px; }
    .cancel-step h3 { font-size: 1.05rem; }
    .cancel-offer-price { font-size: 1.1rem; }
    .cancel-reason { padding: .45rem .6rem; font-size: .82rem; }

    /* ── Sub banner ── */
    .sub-banner { font-size: .82rem; padding: .5rem .75rem; }
}

@media (max-width: 380px) {
    .dash-header { padding: .6rem .75rem; }
    .header-left h2 { font-size: .9rem; }
    .code-big { font-size: 1rem; }
    .panel { padding: .75rem; }
    .panel h3 { font-size: .95rem; }
    .btn-sm { padding: .3rem .6rem; font-size: .78rem; }
    .admin-header > div { flex-wrap: wrap; }
    .admin-modal { max-width: 100%; }
    .admin-modal-body { padding: 1rem; }
    .admin-modal-btn-group { flex-direction: column; }
    .acc-plan-price { font-size: 1.5rem; }
    .start-top { flex-direction: column; align-items: flex-start; }

    .demo-dock-grid { grid-template-columns: 1fr; }
    .demo-teacher-dock { left: .5rem; right: .5rem; max-width: none; }
}

/* ═══ Demo account: teacher dock (privacy / features) ═══ */
body.teacher-demo {
    padding-bottom: 12rem;
}
@media (min-width: 900px) {
    body.teacher-demo { padding-bottom: 10rem; }
}
.demo-teacher-dock {
    position: fixed;
    z-index: 950;
    left: 1rem;
    bottom: 0;
    max-width: min(1100px, calc(100vw - 2rem));
    margin: 0 auto;
    right: 1rem;
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #7dd3fc;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.12);
    font-size: .88rem;
    line-height: 1.45;
    color: #0c4a6e;
}
.demo-dock-toggle {
    width: 100%;
    text-align: left;
    padding: .65rem 1rem;
    border: none;
    background: rgba(255,255,255,.65);
    cursor: pointer;
    font: inherit;
    color: inherit;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.demo-dock-toggle:hover { background: rgba(255,255,255,.9); }
.demo-dock-toggle-icon { transition: transform .2s; display: inline-block; }
.demo-teacher-dock.demo-dock-collapsed .demo-dock-toggle-icon { transform: rotate(-90deg); }
.demo-teacher-dock.demo-dock-collapsed .demo-dock-body { display: none; }
.demo-dock-body { padding: 0 1rem 1rem; max-height: 42vh; overflow-y: auto; }
.demo-dock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.demo-dock-card h4 {
    margin: 0 0 .5rem;
    font-size: .95rem;
    color: #0369a1;
}
.demo-dock-card ul {
    margin: 0;
    padding-left: 1.1rem;
}
.demo-dock-card li { margin-bottom: .35rem; }
.demo-dock-card-privacy {
    background: rgba(255,255,255,.5);
    padding: .75rem;
    border-radius: 8px;
}

/* ═══ Demo session: student privacy strip ═══ */
body.student-demo-active {
    padding-bottom: 8rem;
}
.student-demo-strip {
    position: fixed;
    z-index: 900;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    border-top: 1px solid #6ee7b7;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    font-size: .82rem;
    line-height: 1.45;
    color: #064e3b;
    max-height: 45vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.student-demo-strip-toggle {
    flex-shrink: 0;
    width: 100%;
    text-align: left;
    padding: .55rem .85rem;
    border: none;
    background: rgba(255,255,255,.5);
    cursor: pointer;
    font-weight: 600;
    font-size: .85rem;
    color: #047857;
}
.student-demo-strip-body {
    padding: 0 .85rem .75rem;
    overflow-y: auto;
}
.student-demo-strip-body p { margin: 0; }
.student-demo-strip.student-demo-collapsed .student-demo-strip-body { display: none; }

/* Admin: handout demo credentials (private) */
.admin-demo-handout {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
}
.admin-demo-handout h2 { margin-top: 0; color: #14532d; }
.admin-demo-lead { color: #166534; margin: 0 0 1rem; max-width: 52rem; }
.admin-demo-credentials {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}
.admin-demo-credentials code {
    background: #fff;
    padding: .2rem .5rem;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}
.admin-demo-label {
    display: inline-block;
    min-width: 5rem;
    color: #15803d;
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.admin-demo-notes {
    margin: 0;
    padding-left: 1.2rem;
    color: #14532d;
    font-size: .92rem;
    line-height: 1.5;
}
.admin-demo-notes li { margin-bottom: .35rem; }
.admin-demo-notes code { font-size: .88em; }

/* ═══ Legal pages (privacy, student data) ═══ */
body.legal-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}
.legal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 2rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.legal-nav-logo {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e40af;
    text-decoration: none;
}
.legal-nav div { display: flex; gap: 1.25rem; }
.legal-nav a {
    font-size: .9rem;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
}
.legal-nav a:hover { color: #1e40af; }

.legal-wrap {
    max-width: 780px;
    margin: 2.5rem auto 4rem;
    padding: 2.5rem 2rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}
.legal-wrap h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 .35rem;
}
.legal-effective {
    color: #64748b;
    font-size: .92rem;
    margin: 0 0 1.5rem;
}
.legal-rule {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 2rem 0;
}
.legal-wrap h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 .75rem;
}
.legal-wrap h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #334155;
    margin: 1.25rem 0 .5rem;
}
.legal-wrap p {
    line-height: 1.7;
    margin: 0 0 .85rem;
    font-size: .95rem;
}
.legal-wrap ul {
    padding-left: 1.5rem;
    margin: 0 0 1rem;
}
.legal-wrap li {
    line-height: 1.65;
    margin-bottom: .4rem;
    font-size: .95rem;
}
.legal-wrap a { color: #2563eb; }
.legal-wrap a:hover { text-decoration: underline; }
.legal-wrap code {
    font-size: .88em;
    background: #f1f5f9;
    padding: .15rem .35rem;
    border-radius: 4px;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.25rem;
    font-size: .9rem;
}
.legal-table th {
    text-align: left;
    padding: .65rem .75rem;
    background: #1e293b;
    color: #f8fafc;
    font-weight: 600;
}
.legal-table th:first-child { border-radius: 8px 0 0 0; }
.legal-table th:last-child { border-radius: 0 8px 0 0; }
.legal-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid #e2e8f0;
}
.legal-table tr:nth-child(even) td { background: #f8fafc; }

.legal-callout {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
}
.legal-callout p {
    margin: 0 0 .65rem;
}
.legal-callout p:last-child { margin-bottom: 0; }

.legal-contact {
    list-style: none;
    padding-left: 0;
}
.legal-contact li { margin-bottom: .3rem; }

.legal-disclaimer {
    color: #94a3b8;
    font-size: .85rem;
    margin-top: 2rem;
}

.legal-footer {
    max-width: 780px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .82rem;
    color: #94a3b8;
}
.legal-footer-links {
    display: flex;
    gap: 1rem;
}
.legal-footer-links a {
    color: #64748b;
    text-decoration: none;
}
.legal-footer-links a:hover { color: #1e40af; }

@media (max-width: 640px) {
    .legal-wrap { margin: 1rem .75rem 3rem; padding: 1.5rem 1.25rem; border-radius: 10px; }
    .legal-wrap h1 { font-size: 1.5rem; }
    .legal-nav { padding: .75rem 1rem; }
    .legal-footer { padding: 0 1rem; flex-direction: column; text-align: center; }
}

@media print {
    .legal-nav, .legal-footer { display: none; }
    body.legal-body { background: #fff; }
    .legal-wrap { box-shadow: none; margin: 0; padding: 1rem; max-width: none; }
}

/* ═══════════════════════════════════════ */
/* ═══ INSERT DROPDOWN — sub-panel      ═ */
/* ═══════════════════════════════════════ */
.insert-dropdown .symbol-panel,
.insert-dropdown .fraction-popover,
.insert-dropdown .table-popover,
.insert-dropdown .lineplot-popover {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 65;
    margin-top: 4px;
}

/* ═══════════════════════════════════════ */
/* ═══ LINE PLOT                        ═ */
/* ═══════════════════════════════════════ */

/* Teacher editor */
.lp-config { margin-bottom: .5rem; }
.lp-config-row { display: flex; gap: .75rem; align-items: center; margin-bottom: .35rem; flex-wrap: wrap; }
.lp-config-row label { font-size: .85rem; display: flex; align-items: center; gap: .35rem; }
.lp-config-row input[type="text"] { flex: 1; padding: .25rem .5rem; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .85rem; }
.lp-range-row label { white-space: nowrap; }
.lp-canvas-wrap { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: .5rem; text-align: center; overflow-x: auto; }
.lp-canvas-wrap canvas { cursor: pointer; max-width: 100%; }
.lp-key-list { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .25rem; }
.lp-key-row { display: flex; gap: .35rem; align-items: center; }
.lp-key-row input { padding: .2rem .4rem; border: 1px solid var(--gray-200); border-radius: 4px; font-size: .82rem; }
.lp-key-row .lp-key-val { width: 60px; }
.lp-key-row .lp-key-lbl { flex: 1; min-width: 80px; }

/* Student line plot */
.lp-student-wrap { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: .5rem; text-align: center; overflow-x: auto; }
.lp-student-wrap canvas { cursor: pointer; max-width: 100%; }

/* Inline SVG */
.lp-inline-svg { display: block; margin: .5rem auto; max-width: 100%; }

/* Line plot popover (for insert dropdown) */
.lineplot-popover {
    display: none;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    padding: .75rem;
    width: 440px;
    max-width: 90vw;
}
.lineplot-popover.open { display: block; }
.lp-pop-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .35rem; flex-wrap: wrap; }
.lp-pop-row label { font-size: .82rem; display: flex; align-items: center; gap: .25rem; }
.lp-pop-row input { padding: .2rem .4rem; border: 1px solid var(--gray-200); border-radius: 4px; font-size: .82rem; }
.lp-pop-row input[type="number"] { width: 60px; }
.lp-pop-row input[type="text"] { flex: 1; min-width: 80px; }
.lp-pop-canvas { width: 100%; background: #fafbfc; border: 1px solid var(--gray-200); border-radius: 6px; cursor: pointer; }
