:root {
    --study-bg: #e8eef5;
    --study-surface: #ffffff;
    --study-primary: #2563a8;
    --study-primary-hover: #1d4f86;
    --study-text: #1e2a44;
    --study-text-muted: #526079;
    --study-text-subtle: #64748b;
    --study-border: #dbe4ef;
    --study-border-strong: #c9daf0;
    --study-success: #166534;
    --study-success-bg: #f0fdf4;
    --study-success-border: #bbf7d0;
    --study-error: #991b1b;
    --study-error-bg: #fff5f5;
    --study-error-border: #fecaca;
    --study-shadow: 0 1px 3px rgba(30, 42, 68, 0.06), 0 4px 14px rgba(30, 42, 68, 0.04);
    --study-radius: 14px;
    --study-radius-sm: 12px;
    --study-touch-min: 2.75rem;
    --code-editor-bg: #141c28;
    --code-editor-gutter: #0f1520;
}

html, body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--study-bg);
    color: var(--study-text);
    min-height: 100%;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--study-primary);
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.study-home {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
}

.study-home__status {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    background: #f4f7fb;
    border: 1px solid #d8e3f0;
    color: #334155;
}

.study-home__status--error {
    background: #fff5f5;
    border-color: #f0d4d4;
    color: #8b2e2e;
}

.study-home__header {
    margin-bottom: 2rem;
}

.study-home__eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2563a8;
}

.study-home__title {
    margin: 0 0 0.75rem;
    font-size: 1.85rem;
    line-height: 1.3;
    color: #1e2a44;
}

.study-home__description {
    margin: 0;
    color: #526079;
    line-height: 1.6;
}

.study-home__stage {
    margin-bottom: 1.75rem;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    background: #eef4fb;
    border: 1px solid #d8e3f0;
}

.study-home__stage-title {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    color: #1e2a44;
}

.study-home__stage-description {
    margin: 0;
    color: #526079;
    line-height: 1.55;
}

.stage-progress {
    margin-bottom: 1.75rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
}

.stage-progress__summary {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e2a44;
}

.stage-progress__percent {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563a8;
}

.stage-progress__next {
    margin-top: 1rem;
}

.stage-progress__next-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
}

.stage-progress__next-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #1e2a44;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.stage-progress__continue {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.65rem 1rem;
    border: 1px solid #2563a8;
    border-radius: 999px;
    background: #2563a8;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.stage-progress__continue:hover:not(:disabled) {
    background: #1d4f8c;
}

.stage-progress__continue:disabled {
    border-color: #94a3b8;
    background: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
}

.review-summary {
    margin-bottom: 1.75rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
}

.review-summary__title {
    margin: 0 0 0.65rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1e2a44;
}

.review-summary__highlight {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2563a8;
}

.review-summary__message {
    margin: 0;
    font-size: 0.92rem;
    color: #526079;
    line-height: 1.5;
}

.review-summary__next {
    margin: 0.35rem 0 0;
    font-size: 0.84rem;
    color: #64748b;
}

.review-summary__button {
    display: block;
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.6rem 1rem;
    border: 1px solid #2563a8;
    border-radius: 999px;
    background: #ffffff;
    color: #2563a8;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
}

.review-summary__button:hover {
    background: #f8fbff;
}

.review-queue {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
}

.review-queue__back {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: #2563a8;
    font-weight: 600;
    text-decoration: none;
}

.review-queue__back:hover {
    text-decoration: underline;
}

.review-queue__header {
    margin-bottom: 1.75rem;
}

.review-queue__title {
    margin: 0 0 0.45rem;
    font-size: 1.45rem;
    color: #1e2a44;
}

.review-queue__description {
    margin: 0;
    color: #526079;
    line-height: 1.55;
}

.review-queue__empty {
    margin: 0;
    font-size: 0.92rem;
    color: #526079;
    line-height: 1.5;
}

.review-queue__next {
    margin: 0.35rem 0 0;
    font-size: 0.84rem;
    color: #64748b;
}

.review-queue-section {
    margin-bottom: 1.75rem;
}

.review-queue-section__title {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1e2a44;
}

.review-queue-section__count {
    margin: 0 0 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563a8;
}

.review-queue-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .review-queue-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.review-queue-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.95rem 1rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
}

.review-queue-card__meta {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    overflow-wrap: anywhere;
}

.review-queue-card__meta--scheduled {
    color: #2563a8;
}

.review-queue-card__chapter {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
}

.review-queue-card__title {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #1e2a44;
    overflow-wrap: anywhere;
}

.review-queue-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.review-queue-card__status {
    align-self: flex-start;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.review-queue-card--link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.review-queue-card--link:hover {
    border-color: #2563a8;
    background: #f8fbff;
}

.review-queue-card--scheduled {
    background: #f8fafc;
}

.chapter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .chapter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.chapter-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.35rem;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
}

.chapter-card__label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2563a8;
}

.chapter-card__title {
    margin: 0;
    font-size: 1.15rem;
    color: #1e2a44;
}

.chapter-card__subtitle {
    margin: 0;
    color: #526079;
    line-height: 1.55;
}

.chapter-card__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.chapter-card__meta div {
    margin: 0;
}

.chapter-card__meta dt {
    margin: 0 0 0.2rem;
    font-size: 0.8rem;
    color: #64748b;
}

.chapter-card__meta dd {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e2a44;
}

.chapter-card__progress-summary {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563a8;
}

.chapter-card__progress-track {
    margin-top: 0.35rem;
}

.chapter-card__button {
    align-self: flex-start;
    margin-top: 0.25rem;
    padding: 0.55rem 1rem;
    border: 1px solid #2563a8;
    border-radius: 999px;
    background: #ffffff;
    color: #2563a8;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.chapter-card__button:hover {
    background: #eef4fb;
}

.chapter-lock-badge {
    align-self: flex-start;
    margin-top: 0.25rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
}

.chapter-lock-message {
    margin: 0.5rem 0 0;
    font-size: 0.84rem;
    color: #64748b;
    line-height: 1.5;
}

.chapter-detail {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
}

.chapter-detail__back {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: #2563a8;
    font-weight: 600;
    text-decoration: none;
}

.chapter-detail__back:hover {
    text-decoration: underline;
}

.chapter-detail__header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #dbe4ef;
}

.chapter-detail__label {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2563a8;
}

.chapter-detail__title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    line-height: 1.3;
    color: #1e2a44;
}

.chapter-detail__subtitle {
    margin: 0 0 0.75rem;
    color: #526079;
    line-height: 1.55;
}

.chapter-detail__description {
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.chapter-progress {
    margin-bottom: 2rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #eef4fb;
    border: 1px solid #d8e3f0;
}

.chapter-progress__summary {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e2a44;
}

.chapter-progress__percent {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563a8;
}

.chapter-progress__track {
    height: 0.55rem;
    border-radius: 999px;
    background: #dbe4ef;
    overflow: hidden;
}

.chapter-progress__fill {
    height: 100%;
    border-radius: 999px;
    background: #2563a8;
    min-width: 0;
}

.session-block {
    margin-bottom: 2rem;
}

.session-block__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #eef4fb;
    border: 1px solid #d8e3f0;
}

.session-block__header-main {
    flex: 1;
    min-width: 0;
}

.session-toggle {
    flex-shrink: 0;
    min-height: 2.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid #94a3b8;
    border-radius: 999px;
    background: #ffffff;
    color: #526079;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.session-toggle:hover {
    background: #f8fafc;
}

.session-lock-badge {
    flex-shrink: 0;
    min-height: 2.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 600;
}

.session-lock-message {
    margin: -0.35rem 0 0;
    padding: 0 0.15rem;
    font-size: 0.84rem;
    color: #64748b;
    line-height: 1.5;
}

.session-block__title {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2563a8;
}

.session-block__name {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    color: #1e2a44;
}

.session-block__progress {
    margin: 0 0 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563a8;
}

.session-block__description {
    margin: 0;
    color: #526079;
    line-height: 1.55;
}

.activity-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

@media (min-width: 768px) {
    .activity-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.activity-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
}

.activity-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.activity-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.activity-card__complete {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #166534;
    white-space: nowrap;
}

.activity-card__order {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
}

.activity-card__type {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef4fb;
    border: 1px solid #c9daf0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563a8;
    white-space: nowrap;
}

.activity-card__title {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.45;
    color: #1e2a44;
}

.activity-card__instruction {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #526079;
}

.activity-card__note {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: #2563a8;
    font-weight: 600;
}

.activity-card--link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.activity-card--link:hover {
    border-color: #2563a8;
    background: #f8fbff;
}

.review-block {
    margin-bottom: 2rem;
}

.review-block__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #eef4fb;
    border: 1px solid #d8e3f0;
}

.review-block__header-main {
    flex: 1;
    min-width: 0;
}

.review-block__title {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e2a44;
}

.review-block__progress {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2563a8;
}

.review-group {
    margin-bottom: 1.25rem;
}

.review-group:last-child {
    margin-bottom: 0;
}

.review-group__title {
    margin: 0 0 0.65rem;
    padding: 0 0.15rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
}

.review-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 768px) {
    .review-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.review-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #dbe4ef;
}

.review-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
}

.review-card__order {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
}

.review-card__title {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: #1e2a44;
}

.review-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.review-card--link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.review-card--link:hover {
    border-color: #2563a8;
    background: #f8fbff;
}

.review-card--locked {
    background: #f8fafc;
}

.review-card__due {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.activity-detail {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
}

.activity-detail__back {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: #2563a8;
    font-weight: 600;
    text-decoration: none;
}

.activity-detail__back:hover {
    text-decoration: underline;
}

.activity-detail__header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #dbe4ef;
}

.activity-detail__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.activity-detail__context {
    font-size: 0.82rem;
    color: #64748b;
}

.activity-detail__title {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.35;
    color: #1e2a44;
}

.activity-detail__section {
    margin-bottom: 1.5rem;
}

.activity-detail__section-title {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2563a8;
}

.activity-detail__instruction,
.activity-detail__scenario {
    margin: 0;
    color: #334155;
    line-height: 1.65;
}

.code-block {
    margin: 0;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #dbe4ef;
    overflow-x: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #1e293b;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-block code {
    color: inherit;
    font-family: inherit;
}

.choice-list,
.requirement-list {
    margin: 0;
    padding-left: 1.35rem;
    color: #334155;
    line-height: 1.65;
}

.choice-list__item,
.requirement-list__item {
    margin-bottom: 0.45rem;
}

.choice-list__item:last-child,
.requirement-list__item:last-child {
    margin-bottom: 0;
}

.choice-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.choice-option {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #ffffff;
    color: #1e2a44;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}

.choice-option:hover {
    border-color: #93b4db;
    background: #f8fbff;
}

.choice-option--selected {
    border-color: #2563a8;
    background: #eef4fb;
    box-shadow: 0 0 0 1px #2563a8 inset;
}

.choice-option--correct {
    border-color: #16a34a;
    background: #f0fdf4;
    box-shadow: 0 0 0 1px #16a34a inset;
}

.choice-option--incorrect {
    border-color: #dc2626;
    background: #fef2f2;
    box-shadow: 0 0 0 1px #dc2626 inset;
}

.quiz-check-button {
    margin-top: 1rem;
    min-height: 3rem;
    padding: 0.7rem 1.35rem;
    border: none;
    border-radius: 999px;
    background: #2563a8;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.quiz-check-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.quiz-check-button:not(:disabled):hover {
    background: #1d4f86;
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1px solid transparent;
}

.quiz-feedback--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.quiz-feedback--error {
    background: #fff5f5;
    border-color: #fecaca;
    color: #991b1b;
}

.quiz-feedback__message {
    margin: 0;
    font-weight: 700;
    line-height: 1.5;
}

.quiz-feedback__detail {
    margin: 0.45rem 0 0;
    line-height: 1.55;
}

.code-input-field {
    display: block;
    width: 100%;
    min-height: 12rem;
    padding: 1rem 1.1rem;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #ffffff;
    color: #1e293b;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
    font-size: 0.88rem;
    line-height: 1.55;
    white-space: pre;
    overflow-x: auto;
    resize: vertical;
    box-sizing: border-box;
}

.code-input-field:focus {
    outline: none;
    border-color: #2563a8;
    box-shadow: 0 0 0 2px rgba(37, 99, 168, 0.15);
}

.hint-section {
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #fafbfd;
    border: 1px solid #e2e8f0;
}

.hint-list {
    margin: 0 0 0.85rem;
    padding-left: 1.35rem;
    color: #475569;
    line-height: 1.6;
}

.hint-list__item {
    margin-bottom: 0.5rem;
}

.hint-list__item:last-child {
    margin-bottom: 0;
}

.hint-button {
    min-height: 2.75rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid #94a3b8;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.hint-button:hover {
    border-color: #64748b;
    background: #f8fafc;
}

.hint-section__complete {
    margin: 0;
    font-size: 0.88rem;
    color: #64748b;
}

.answer-reveal-section {
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: #fffdf8;
    border: 1px solid #e8dfd0;
}

.answer-reveal-button,
.answer-reveal-cancel-button {
    min-height: 2.75rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.answer-reveal-button {
    border: 1px solid #b45309;
    background: #ffffff;
    color: #b45309;
}

.answer-reveal-button:hover {
    background: #fffbeb;
}

.answer-reveal-confirm {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.answer-reveal-confirm__message {
    margin: 0;
    color: #57534e;
    line-height: 1.6;
}

.answer-reveal-confirm__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.answer-reveal-cancel-button {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
}

.answer-reveal-cancel-button:hover {
    background: #f8fafc;
}

.activity-completion {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.activity-completion__message {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #15803d;
}

.activity-completion__cancel {
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #94a3b8;
    border-radius: 999px;
    background: #ffffff;
    color: #526079;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.activity-completion__cancel:hover {
    background: #f8fafc;
}

.answer-reveal-content__label {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #92400e;
}

.answer-reveal-content__text {
    margin: 0;
    color: #1e293b;
    line-height: 1.55;
}

.answer-reveal-content__key {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
}

/* ── Code editor (CodeMirror) ── */

.code-editor-shell {
    margin: 0.35rem 0 0;
}

.code-editor-chrome {
    border-radius: var(--study-radius-sm);
    overflow: hidden;
    border: 1px solid #1e293b;
    box-shadow: var(--study-shadow);
    background: var(--code-editor-bg);
}

.code-editor-tabbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    background: #0f1520;
    border-bottom: 1px solid #243044;
}

.code-editor-tabbar__file {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.code-editor-tabbar__dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
}

.code-editor-tabbar__filename {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e8edf4;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}

.code-editor-tabbar__hint {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
}

.code-editor-host {
    min-height: 14rem;
}

.code-editor-host .cm-editor {
    outline: none;
}

.code-editor-symbolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #111827;
    border-top: 1px solid #243044;
}

.code-editor-symbolbar__btn {
    flex-shrink: 0;
    min-width: 2.35rem;
    min-height: 2.15rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #1e293b;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.code-editor-symbolbar__btn:hover {
    background: #334155;
    border-color: #475569;
}

.code-editor-symbolbar__btn:active {
    background: #475569;
}

.code-editor-statusbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    padding: 0.4rem 0.85rem;
    background: #0f1520;
    border-top: 1px solid #243044;
    font-size: 0.72rem;
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
}

.code-editor-shell--fallback .code-editor-fallback {
    min-height: 14rem;
}

.activity-detail__section--editor {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.activity-detail__section--editor .activity-detail__section-title {
    padding: 0 0.15rem;
}

.activity-detail__section--editor .activity-detail__instruction {
    padding: 0 0.15rem;
    margin-bottom: 0.65rem;
}

.activity-detail__section:not(.activity-detail__section--editor) {
    padding: 1rem 1.15rem;
    border-radius: var(--study-radius);
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    box-shadow: var(--study-shadow);
}

.activity-detail__header {
    padding: 1rem 1.15rem;
    border-radius: var(--study-radius);
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    box-shadow: var(--study-shadow);
    border-bottom: 1px solid var(--study-border);
}

.session-block--expanded .session-block__header {
    border-color: var(--study-primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 168, 0.12);
    background: #ffffff;
}

.session-block--locked .session-block__header {
    opacity: 0.92;
}

.stage-progress,
.review-summary,
.chapter-card,
.chapter-progress,
.review-queue-card,
.activity-card,
.review-card {
    box-shadow: var(--study-shadow);
}

.review-queue-section--today .review-queue-section__title {
    color: var(--study-primary);
}

.review-queue-section--scheduled {
    opacity: 0.92;
}

.review-queue-section--scheduled .review-queue-section__count {
    color: var(--study-text-subtle);
}

@media (max-width: 480px) {
    .study-home,
    .chapter-detail,
    .activity-detail,
    .review-queue {
        padding-left: 0;
        padding-right: 0;
    }

    .code-editor-symbolbar__btn {
        min-width: 2.5rem;
        min-height: 2.35rem;
    }

    .quiz-check-button,
    .hint-button,
    .choice-option {
        min-height: var(--study-touch-min);
    }
}

/* ── Annotation canvas (Apple Pencil) ── */

.activity-detail--with-toolbar {
    padding-top: 0.25rem;
}

.annotation-floating-toolbar {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 0.35rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    width: min(100% - 1.5rem, 720px);
    pointer-events: none;
}

.annotation-floating-toolbar__pill,
.annotation-floating-toolbar__hint,
.annotation-floating-toolbar__confirm {
    pointer-events: auto;
}

.annotation-floating-toolbar__pill {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
    min-height: 2.75rem;
    padding: 0.3rem 0.45rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: 0 4px 18px rgba(30, 42, 68, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.annotation-floating-toolbar--collapsed .annotation-floating-toolbar__pill {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.annotation-toolbar__group {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.annotation-toolbar__group--tools {
    padding-right: 0.1rem;
}

.annotation-toolbar__group--style {
    padding: 0 0.1rem;
}

.annotation-toolbar__group--actions {
    padding-left: 0.1rem;
}

.annotation-toolbar__divider {
    flex-shrink: 0;
    width: 1px;
    height: 1.5rem;
    margin: 0 0.15rem;
    background: rgba(203, 213, 225, 0.95);
}

.annotation-toolbar__icon-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #475569;
    cursor: pointer;
}

.annotation-toolbar__icon-btn:hover:not(:disabled) {
    background: rgba(241, 245, 249, 0.95);
    color: #1e2a44;
}

.annotation-toolbar__icon-btn--active {
    background: rgba(219, 234, 254, 0.95);
    color: #1d4f86;
}

.annotation-toolbar__icon-btn--danger {
    color: #b91c1c;
}

.annotation-toolbar__icon-btn--danger:hover:not(:disabled) {
    background: rgba(254, 242, 242, 0.95);
    color: #991b1b;
}

.annotation-toolbar__icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.annotation-toolbar__icon-btn--collapse {
    margin-left: 0.1rem;
}

.annotation-toolbar__icon {
    width: 1.15rem;
    height: 1.15rem;
    display: block;
}

.annotation-toolbar__icon--width {
    width: 1.25rem;
    height: 1.25rem;
}

.annotation-toolbar__color-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.annotation-toolbar__color-btn:hover {
    background: rgba(241, 245, 249, 0.95);
}

.annotation-toolbar__color-btn-swatch {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: var(--annotation-color, #1e2a44);
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.55);
}

.annotation-toolbar__text-btn {
    min-height: 2.35rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--study-border);
    border-radius: 999px;
    background: var(--study-surface);
    color: var(--study-text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.annotation-toolbar__text-btn--danger {
    color: #991b1b;
    border-color: #fecaca;
}

.annotation-floating-toolbar__hint {
    margin: 0.35rem auto 0;
    max-width: fit-content;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--study-text-subtle);
    line-height: 1.35;
    background: rgba(255, 255, 255, 0.72);
}

.annotation-floating-toolbar__confirm {
    margin-top: 0.45rem;
}

.annotation-floating-toolbar__spacer {
    height: calc(env(safe-area-inset-top, 0px) + 4.1rem);
}

.annotation-floating-toolbar__spacer--collapsed {
    height: calc(env(safe-area-inset-top, 0px) + 3.35rem);
}

.annotation-region {
    position: relative;
    margin-bottom: 1.5rem;
}

.annotation-region__body {
    position: relative;
}

.annotation-region__content {
    position: relative;
    z-index: 1;
}

.annotation-region__canvas {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: transparent;
    touch-action: pan-y pinch-zoom;
}

.annotation-region__canvas--view {
    pointer-events: none;
}

.annotation-region__canvas--active {
    pointer-events: auto;
}

.annotation-region__error {
    margin: 0.65rem 0 0;
    font-size: 0.82rem;
    color: #991b1b;
}

.annotation-clear-confirm {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--study-radius-sm);
    background: #fff5f5;
    border: 1px solid #fecaca;
}

.annotation-clear-confirm__message {
    margin: 0 0 0.65rem;
    color: #991b1b;
    font-size: 0.88rem;
    line-height: 1.5;
}

.annotation-clear-confirm__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.annotation-region .activity-detail__header,
.annotation-region .activity-detail__section {
    margin-bottom: 1rem;
}

.annotation-region .activity-detail__section:last-child {
    margin-bottom: 0;
}

