:root {
    color-scheme: light;
    --ink: #20242a;
    --muted: #68707c;
    --line: #dfe4ea;
    --brand: #2f7d6f;
    --brand-strong: #1e665b;
    --paper: #ffffff;
    --soft: #f6f8fb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Arial, Helvetica, sans-serif;
}

.shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 96px;
}

.hero,
.topbar {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 24px;
    align-items: center;
    margin-bottom: 18px;
}

.hero-copy {
    padding: 28px 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(30px, 5vw, 54px);
    line-height: 1.02;
}

.hero p:not(.eyebrow) {
    color: var(--muted);
    font-size: 17px;
    line-height: 1.55;
}

.video-panel {
    aspect-ratio: 16 / 9;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(24, 32, 42, .16);
}

.video-panel iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.student-panel,
.exercise-card,
.notice,
.table-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.student-panel {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 14px;
    align-items: end;
    padding: 16px;
    margin-bottom: 18px;
}

label span,
.student-panel label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd3dc;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
    background: #fff;
}

select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cbd3dc;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus {
    outline: 3px solid rgba(47, 125, 111, .18);
    border-color: var(--brand);
}

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

.exercise-list {
    display: grid;
    gap: 16px;
}

.exercise-card {
    padding: 12px;
}

.worksheet-card {
    overflow-x: auto;
    overflow-y: hidden;
    display: none;
}

.worksheet-card.active {
    display: block;
}

.exercise-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    min-height: 38px;
    padding: 0 4px 10px;
}

.pdf-stage {
    position: relative;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.pdf-stage img {
    display: block;
    width: 100%;
    height: auto;
}

.worksheet-input {
    position: absolute;
    min-height: 0;
    padding: 0 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #111820;
    background: transparent;
    box-shadow: none;
    font-size: clamp(12px, 1.65vw, 20px);
    font-weight: 800;
    line-height: 1;
    text-align: center;
    overflow: hidden;
}

.field-input,
.digit-input,
.final-input {
    padding: 0 2px;
}

.worksheet-input:focus {
    outline: 2px solid rgba(50, 179, 137, .75);
    background: rgba(255, 255, 255, .5);
}

.digit-input {
    padding: 0;
}

.worksheet-choice {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
}

.worksheet-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 1px;
    opacity: 0;
}

.worksheet-choice span {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    color: transparent;
    background: transparent;
}

.worksheet-choice:hover,
.worksheet-choice:focus-within {
    border-color: rgba(47, 125, 111, .22);
    background: rgba(47, 125, 111, .04);
}

.worksheet-choice input:checked + span {
    border-color: #32b389;
    color: #fff;
    background: #32b389;
}

.worksheet-panel {
    position: absolute;
    width: min(42%, 440px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 2px solid rgba(47, 125, 111, .28);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 24px rgba(17, 24, 39, .14);
}

.worksheet-panel label span {
    margin-bottom: 3px;
    color: #39424e;
    font-size: 11px;
}

.worksheet-panel input {
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid #bfc8d1;
    font-weight: 800;
    text-align: center;
}

.feedback {
    min-height: 20px;
    margin: 0;
    font-weight: 700;
}

.exercise-card.correct {
    border-color: #76d2a5;
    background: #f0fff7;
}

.worksheet-card.locked .worksheet-input,
.worksheet-card.locked .worksheet-panel input {
    color: #0f5132;
    -webkit-text-fill-color: #0f5132;
    cursor: not-allowed;
}

.worksheet-card.locked .worksheet-choice {
    cursor: not-allowed;
}

.exercise-card.incorrect {
    border-color: #f1a0aa;
    background: #fff6f7;
}

.actionbar {
    position: fixed;
    left: 50%;
    bottom: 14px;
    width: min(1180px, calc(100% - 28px));
    transform: translateX(-50%);
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 30px rgba(24, 32, 42, .16);
    backdrop-filter: blur(10px);
}

.question-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin: 16px 0 86px;
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    color: #fff;
    background: var(--brand);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--brand-strong);
}

.button.secondary {
    border: 1px solid var(--line);
    color: var(--brand-strong);
    background: #fff;
}

.button:disabled {
    opacity: .65;
    cursor: not-allowed;
}

#saveMessage {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.notice {
    padding: 18px;
}

.notice.error {
    border-color: #f1a0aa;
    background: #fff6f7;
}

.notice.success {
    border-color: #76d2a5;
    background: #f0fff7;
}

.auth-shell {
    width: min(460px, calc(100% - 28px));
    min-height: 100vh;
    display: grid;
    align-items: center;
    margin: 0 auto;
    padding: 28px 0;
}

.auth-card,
.panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.auth-card h1,
.panel h2,
.table-wrap h2,
.month-column h2,
.month-column h3 {
    margin: 0;
}

.plain-link {
    color: var(--brand-strong);
    font-weight: 700;
    text-decoration: none;
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 16px;
    margin-bottom: 16px;
}

.section-head,
.inline-form,
.header-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: end;
}

.inline-form label {
    flex: 1;
}

.classroom-card {
    margin-bottom: 18px;
}

.app-banner,
.classroom-banner {
    padding: 28px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, #51327f, #df4f67);
}

.app-banner .eyebrow,
.app-banner p,
.classroom-banner a,
.classroom-banner span,
.classroom-banner strong {
    color: rgba(255, 255, 255, .88);
}

.classroom-banner {
    display: grid;
    gap: 18px;
    margin-bottom: 22px;
}

.classroom-banner nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.classroom-banner a,
.back-link {
    font-weight: 800;
    text-decoration: none;
}

.back-link {
    display: inline-flex;
    margin-bottom: 18px;
    color: var(--brand-strong);
}

.classroom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.ap-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(25, 34, 46, .08);
}

.classroom-tile {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.classroom-grade {
    min-height: 86px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: #5b3b8c;
    font-size: 32px;
    font-weight: 900;
}

.classroom-count {
    display: grid;
    justify-items: center;
    color: var(--muted);
}

.classroom-count strong {
    color: var(--ink);
    font-size: 34px;
}

.tile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.create-classroom,
.schedule-form,
.assign-card,
.student-create-form,
.report-filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}

.progress-banner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 220px));
    gap: 14px;
    margin-bottom: 18px;
}

.progress-banner div {
    padding: 18px;
    border-radius: 8px;
    color: #fff;
    background: #2f7d6f;
}

.progress-banner strong {
    display: block;
    font-size: 36px;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.option-card {
    min-height: 150px;
    display: grid;
    place-items: center;
    padding: 18px;
    border-radius: 8px;
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.option-blue {
    background: #3e7cb1;
}

.option-red {
    background: #d94f61;
}

.option-yellow {
    background: #d89a27;
}

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

.month-tabs a {
    flex: 0 1 auto;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--brand-strong);
    background: #fff;
    font-weight: 800;
    text-decoration: none;
}

.month-tabs a.active {
    color: #fff;
    background: var(--brand);
}

.program-card,
.resource-detail {
    display: grid;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.resource-detail {
    max-width: 900px;
}

.download-list {
    display: grid;
    gap: 8px;
}

.download-list a {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--brand-strong);
    font-weight: 800;
    text-decoration: none;
}

.schedule-row td {
    background: #f7fafc;
}

.schedule-form {
    grid-template-columns: 1.1fr .7fr 1fr 1fr .7fr auto;
    align-items: end;
}

.schedule-form label,
.assign-card label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.schedule-form input,
.schedule-form select,
.assign-card input,
.assign-card select {
    margin-top: 4px;
}

.assign-card {
    grid-template-columns: 2fr 1fr .7fr 1fr 1fr .7fr auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fafc;
}

.assign-card h2 {
    grid-column: 1 / -1;
}

.student-create-form {
    grid-template-columns: 1.4fr .6fr .8fr auto;
}

.report-filter-form {
    grid-template-columns: 1fr 1.4fr auto auto;
}

.credentials-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #76d2a5;
    border-radius: 8px;
    background: #f0fff7;
}

.credentials-card h2,
.credentials-card p {
    margin: 0;
}

.credentials-card p {
    margin-top: 6px;
    color: var(--muted);
}

.credentials-card dl {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.credentials-card dl div {
    min-width: 180px;
    padding: 10px 12px;
    border: 1px solid #bdebd2;
    border-radius: 8px;
    background: #fff;
}

.credentials-card dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.credentials-card dd {
    margin: 4px 0 0;
    color: var(--brand-strong);
    font-size: 20px;
    font-weight: 900;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.month-column {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fbfd;
}

.activity-pill,
.student-activity {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid #d7dee7;
    border-radius: 8px;
    background: #fff;
}

.activity-pill span,
.student-activity h3 {
    font-weight: 800;
}

.student-activity p {
    margin: 0;
    color: var(--muted);
}

.score-badge {
    width: max-content;
    padding: 5px 8px;
    border-radius: 999px;
    color: #0f5132;
    background: #dff7ec;
    font-size: 13px;
    font-weight: 800;
}

.score-badge.pending {
    color: #60470c;
    background: #fff2cc;
}

.status-badge {
    display: inline-flex;
    width: max-content;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.status-draft {
    color: #60470c;
    background: #fff2cc;
}

.status-enabled {
    color: #0f5132;
    background: #dff7ec;
}

.status-disabled {
    color: #3f4752;
    background: #e8edf3;
}

.status-retired {
    color: #842029;
    background: #f8d7da;
}

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

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

@media (max-width: 820px) {
    .hero,
    .topbar,
    .student-panel,
    .panel-grid {
        grid-template-columns: 1fr;
    }

    .hero-copy {
        padding: 10px 0;
    }

    .exercise-toolbar,
    .actionbar,
    .question-nav {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .worksheet-panel {
        width: 52%;
        gap: 6px;
        padding: 7px;
    }

    .worksheet-panel label span {
        font-size: 10px;
    }

    .worksheet-panel input {
        min-height: 30px;
        padding: 4px;
    }

    .pdf-stage {
        min-width: 760px;
    }

    .section-head,
    .inline-form,
    .header-actions,
    .credentials-card {
        align-items: stretch;
        flex-direction: column;
    }

    .student-create-form {
        grid-template-columns: 1fr;
    }

    .report-filter-form {
        grid-template-columns: 1fr;
    }
}
