:root {
    --page-bg: #f7f9fc;
    --surface: #fffefa;
    --surface-2: #f0f5fb;
    --surface-3: #e7eff8;
    --text: #172033;
    --muted: #66758c;
    --border: #d7e2ee;
    --blue: #1976f3;
    --blue-dark: #0f62d4;
    --green: #15a779;
    --amber: #c88319;
    --red: #d14343;
    --violet: #7c66d9;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 32px rgba(16, 24, 40, 0.06);
    --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 22px rgba(16, 24, 40, 0.05);
}

html[data-theme="dark"] {
    --page-bg: #0d1117;
    --surface: #151a21;
    --surface-2: #1d242c;
    --surface-3: #252e38;
    --text: #f0f6fc;
    --muted: #b7c3d1;
    --border: #27313b;
    /* Use the same blue tokens as light mode for consistent accents */
    --blue: #1976f3;
    --blue-dark: #0f62d4;
    --green: #63e6be;
    --amber: #ffd166;
    --red: #ff7b72;
    --violet: #b8a8ff;
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
    --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light dark;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.ui-shell {
    min-height: 100vh;
}

.classroom-logo {
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1.34rem;
    font-weight: 520;
    letter-spacing: 0.015em;
    text-decoration: none;
}

.btn-primary,
.btn-secondary,
.text-button,
.icon-button {
    min-height: 2.35rem;
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 750;
    line-height: 1;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.btn-primary {
    border: 1px solid var(--blue-dark);
    background: var(--blue);
    color: #ffffff;
    box-shadow: 0 1px 1px rgba(16, 24, 40, 0.08), 0 8px 18px color-mix(in srgb, var(--blue) 18%, transparent);
}

.btn-primary:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
}

.btn-secondary,
.icon-button {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 1px rgba(16, 24, 40, 0.04);
}

.btn-secondary:hover,
.icon-button:hover {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--blue) 22%, var(--border));
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--blue);
    padding-inline: 0;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.input-field:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--blue) 22%, transparent);
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

.input-field {
    width: 100%;
    min-height: 2.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    padding: 0.65rem 0.75rem;
    outline: none;
}

.input-field:focus {
    border-color: color-mix(in srgb, var(--blue) 55%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}

.loader-panel {
    display: grid;
    place-items: center;
    gap: 0.9rem;
    width: min(22rem, calc(100vw - 2rem));
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 1.25rem;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.loader-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.loader-progress {
    width: 100%;
    height: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
}

.loader-progress > div {
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}

.loader-dot {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}
