*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --purple: #7c3aed;
    --purple-light: #f5f3ff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --white: #ffffff;
}

html, body.home-page {
    height: 100%;
    overflow: auto;
}

body.home-page.home-subpage,
body.home-page.home-subpage html {
    overflow: auto;
}

body.home-page {
    font-family: 'Nunito', sans-serif;
    color: var(--text);
    background: #f8fafc;
}

.home-shell {
    min-height: 100vh;
    height: auto;
    display: flex;
    flex-direction: column;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 18px;
}

.home-shell-scroll {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

/* Header */
.home-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0 8px;
    flex-shrink: 0;
    margin-bottom: 20px;
}

.home-header::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100vw;
    height: 1px;
    background: #dbe3ee;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    pointer-events: none;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.home-brand-logo {
    width: 118px;
    height: 118px;
    object-fit: contain;
    flex-shrink: 0;
}

.home-brand strong {
    font-size: 24px;
    font-weight: 900;
    color: var(--blue);
    line-height: 1.05;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.home-brand-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 32px;
}

.home-brand-meta {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.home-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.home-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.home-nav a img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.home-nav a:hover,
.home-nav a.is-active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

/* Main */
.home-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.home-section-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Live schedule on landing — 1 row on desktop */
.schedule-live {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px 20px;
    flex-wrap: nowrap;
    background: linear-gradient(135deg, #ebf4ff 0%, #ffffff 55%, #f0fff4 100%);
    border: 1px solid #bfdbfe;
    border-radius: 18px;
    padding: 14px 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.schedule-live--current {
    border-color: #86efac;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%, #eff6ff 100%);
}

.schedule-live--upcoming {
    border-color: #93c5fd;
}

.schedule-live--none {
    background: #fff;
    border-color: #e2e8f0;
}

.schedule-live-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    background: #1d4ed8;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

.schedule-live--current .schedule-live-badge {
    background: #047857;
}

.schedule-live-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
}

.schedule-live-main {
    min-width: 0;
}

.schedule-live-kicker {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.schedule-live-title {
    margin: 1px 0 0;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-live-detail {
    margin: 2px 0 0;
    font-size: 13px;
    color: #334155;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-live-timer {
    flex: 0 0 auto;
    text-align: right;
}

.schedule-live-countdown-label {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.schedule-live-countdown {
    margin-top: 1px;
    font-size: 24px;
    font-weight: 800;
    color: #1d4ed8;
    line-height: 1.15;
    white-space: nowrap;
}

.schedule-live--current .schedule-live-countdown {
    color: #047857;
}

.schedule-live-countdown-compact {
    display: none;
}

@media (max-width: 900px) {
    .schedule-live {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 14px 16px;
    }

    .schedule-live-body {
        flex: 1 1 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .schedule-live-timer {
        text-align: left;
        padding-top: 8px;
        border-top: 1px dashed #cbd5e1;
    }

    .schedule-live-title,
    .schedule-live-detail {
        white-space: normal;
    }

    .schedule-live-countdown {
        font-size: 22px;
    }
}

@media (max-width: 560px) {
    .schedule-live-title { font-size: 18px; }
    .schedule-live-countdown { font-size: 20px; }
}

/* Hero */
.home-hero {
    position: relative;
    flex-shrink: 0;
    min-height: auto;
    overflow: hidden;
    padding: 2px 0;
}

.home-hero-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background-image: var(--hero-bg);
    background-position: center right;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 0;
    pointer-events: none;
}

.home-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 72%;
}

.home-hero-intro {
    min-width: 0;
}

.home-hero-intro h1 {
    font-size: clamp(20px, 2.2vw, 32px);
    line-height: 1.1;
    font-weight: 900;
    margin-bottom: 8px;
    white-space: nowrap;
}

.home-hero-intro h1 .hl-blue { color: var(--blue); }
.home-hero-intro h1 .hl-purple { color: var(--purple); }

@media (min-width: 901px) {
    .home-hero-title-line2 {
        display: block;
    }
}

.home-hero-intro > p {
    font-size: clamp(12px, 1.15vw, 15px);
    line-height: 1.45;
    color: var(--text-muted);
    font-weight: 600;
    max-width: 900px;
}

.home-hero-features {
    display: flex;
    gap: 36px;
    align-items: flex-start;
}

.home-hero-carousel-viewport,
.home-hero-carousel-dots {
    display: none;
}

.home-hero-carousel-track {
    display: contents;
}

.home-hero-feature {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    text-align: left;
    min-width: 0;
}

.home-hero-feature img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex-shrink: 0;
}

.home-hero-feature-fallback {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
}

.home-hero-feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

.home-hero-feature-text .line1,
.home-hero-feature-text .line2 {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

/* Grade cards */
.home-grades {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
    margin: 32px 0;
}

.home-grade-card {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.32);
    background: var(--white);
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(15, 23, 42, 0.08);
}

.theme-blue { --card: var(--blue); --card-bg: var(--blue-light); }
.theme-green { --card: var(--green); --card-bg: var(--green-light); }
.theme-purple { --card: var(--purple); --card-bg: var(--purple-light); }

.home-grade-main {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: start;
    padding: 18px 18px 14px;
}

.home-grade-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.home-grade-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.home-grade-heading {
    display: flex;
    flex-direction: column;
}

.home-grade-number {
    font-size: 46px;
    font-weight: 900;
    line-height: 0.95;
    color: var(--card);
}

.home-grade-label {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: var(--card);
}

.home-grade-illustration {
    width: 120px;
    height: 80px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}

.home-grade-desc {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.home-grade-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    color: white;
    text-decoration: none;
    background: var(--card);
}

.theme-btn-blue { background: var(--blue); }
.theme-btn-green { background: var(--green); }
.theme-btn-purple { background: var(--purple); }

.home-grade-aside {
    background: #fafbfc;
    border-top: 1px solid var(--border);
    padding: 12px 16px 14px;
}

.home-grade-qr-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    min-width: 92px;
}

.home-grade-qr-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    font-size: 11px;
    font-weight: 800;
    color: var(--card);
    cursor: pointer;
    width: 100%;
}

.home-grade-qr-toggle.is-open {
    background: var(--card-bg);
    border-color: var(--card);
}

.home-grade-qr-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--text);
}

.home-grade-qr-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.home-grade-qr {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: white;
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.home-grade-qr-label,
.home-grade-cal-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0;
}

.home-grade-cal-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.home-grade-cal-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    font-size: 11px;
    font-weight: 800;
    color: var(--card);
    cursor: pointer;
    width: 100%;
}

.home-grade-cal-toggle.is-open {
    background: var(--card-bg);
    border-color: var(--card);
}

.home-grade-cal-panel {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    width: 100%;
}

.home-grade-cal-icon {
    font-size: 18px;
    line-height: 1;
}

.home-grade-cal-block p {
    font-size: 9px;
    line-height: 1.35;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.home-grade-calendar-btn {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    color: var(--card);
}

/* Quick links */
.home-quicklinks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.home-quicklink {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    min-height: 124px;
}

.home-quicklink img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.home-quicklink-fallback {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #e2e8f0;
    flex-shrink: 0;
}

.home-quicklink strong {
    display: block;
    font-size: 16px;
    line-height: 1.2;
}

.home-quicklink span:not(.home-quicklink-arrow) {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.35;
    font-weight: 600;
}

.home-quicklink-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}

/* Banner image slot — always below quick links */
.home-banner {
    display: block;
    flex-shrink: 0;
    width: 100%;
    margin-top: 8px;
    border-radius: 20px;
    overflow: hidden;
    line-height: 0;
    position: relative;
    z-index: 0;
}

.home-banner img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 175px;
    object-fit: cover;
    object-position: center;
}

/* Grade picker modal */
body.home-modal-open {
    overflow: hidden;
}

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

.home-grade-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.home-grade-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.home-grade-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    background: white;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.home-grade-modal-dialog h2 {
    font-size: 22px;
    font-weight: 900;
    color: var(--blue);
    margin-bottom: 8px;
}

.home-grade-modal-lead {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    font-weight: 600;
}

.home-grade-modal-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.home-grade-modal-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    color: white;
    cursor: pointer;
    text-align: center;
}

.home-grade-modal-close {
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
}

.home-grade-modal-close:hover {
    background: #f1f5f9;
}

/* Copyright */
.home-copyright {
    flex-shrink: 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 0 10px;
    font-weight: 600;
}

.home-copyright a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 800;
}

/* Subpages */
.home-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: color 0.2s, border-color 0.2s;
}

.home-back-link:hover {
    color: var(--blue);
    border-color: #bfdbfe;
}

.home-back-arrow {
    font-size: 18px;
    line-height: 1;
}

.home-subpage-main {
    flex: 1;
    padding: 16px 0 24px;
}

.home-subpage-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.home-subpage-card h1 {
    font-size: 28px;
    font-weight: 900;
    color: var(--blue);
    margin-bottom: 8px;
}

.home-subpage-lead {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    font-weight: 600;
}

.home-subpage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.home-subpage-panel {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
}

.home-subpage-panel h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text);
}

.home-subpage-panel ul,
.home-guide-list {
    margin-left: 18px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
}

.home-subpage-grade-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.home-contact-email {
    font-size: 16px;
    font-weight: 800;
    color: var(--blue);
    text-decoration: none;
}

.home-about-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 20px;
}

.home-about-highlight {
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
    border: 1px solid #dbeafe;
    border-radius: 16px;
    padding: 20px;
}

.home-about-highlight h2 {
    font-size: 20px;
    color: var(--blue);
    margin-bottom: 10px;
}

.home-about-highlight p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
    font-weight: 600;
}

.home-about-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.home-about-stat {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.home-about-stat strong {
    display: block;
    font-size: 22px;
    color: var(--purple);
    margin-bottom: 4px;
}

.home-about-stat span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.home-topic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.home-topic-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.home-topic-card .emoji {
    font-size: 28px;
    margin-bottom: 8px;
}

.home-topic-card h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text);
}

.home-topic-card p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    font-weight: 600;
}

.home-guide-steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.home-guide-step {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    position: relative;
}

.home-guide-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 10px;
}

.home-guide-step h3 {
    font-size: 15px;
    margin-bottom: 8px;
}

.home-guide-step p,
.home-guide-step li {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-muted);
    font-weight: 600;
}

.home-guide-step ul {
    margin-left: 18px;
    margin-top: 6px;
}

.home-faq-list {
    display: grid;
    gap: 10px;
}

.home-faq-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}

.home-faq-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text);
}

.home-faq-item p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}

.home-tip-box {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: #854d0e;
    font-weight: 700;
    margin-top: 12px;
}

.home-legal-content h3 {
    font-size: 16px;
    margin: 18px 0 8px;
    color: var(--text);
}

.home-legal-content p,
.home-legal-content li {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.home-legal-content ul {
    margin-left: 18px;
}

.home-legal-content a {
    color: var(--blue);
    font-weight: 700;
}

/* Calendar overview */
.home-cal-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.home-cal-overview-nav {
    display: flex;
    gap: 8px;
}

.home-cal-item-nav {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.home-cal-item-month {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    min-width: 110px;
    text-align: center;
}

.home-scroll-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1500;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: white;
    color: var(--blue);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
    cursor: pointer;
}

.home-scroll-top:hover {
    background: var(--blue-light);
}

.home-scroll-top[hidden] {
    display: none;
}

.mini-cal-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
}

.home-cal-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.home-cal-overview-item {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: #fafbfc;
}

.home-cal-overview-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.home-cal-overview-top h2 {
    font-size: 15px;
    color: var(--card);
}

.home-cal-overview-link {
    font-size: 11px;
    font-weight: 700;
    color: var(--card);
    text-decoration: none;
}

.home-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
    font-size: 10px;
    color: var(--text-muted);
}

.home-cal-legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.dot-yellow { background: #eab308; }
.dot-red { background: #ef4444; }
.dot-blue { background: #3b82f6; }

.mini-cal-title {
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
}

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.mini-cal-day-name,
.mini-cal-day {
    font-size: 9px;
    text-align: center;
    padding: 3px 0;
    border-radius: 4px;
}

.mini-cal-day-name {
    font-weight: 800;
    color: var(--text-muted);
}

.mini-cal-day.empty { visibility: hidden; }

.mini-cal-day.has-event.event-red { background: #fecaca; color: #991b1b; font-weight: 800; }
.mini-cal-day.has-event.event-yellow { background: #fef08a; color: #854d0e; font-weight: 800; }
.mini-cal-day.has-event.event-blue { background: #bfdbfe; color: #1e40af; font-weight: 800; }
.mini-cal-day.today { outline: 2px solid var(--card); }

.home-cal-events-title {
    font-size: 11px;
    font-weight: 800;
    color: var(--text);
    margin: 10px 0 6px;
}

.home-cal-events {
    margin-top: 10px;
}

.home-cal-events-empty {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 0;
}

.home-cal-events-list {
    list-style: none;
    max-height: 168px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.home-cal-events-list::-webkit-scrollbar {
    width: 5px;
}

.home-cal-events-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.home-cal-event-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
}

.home-cal-event-item.event-red { border-left: 3px solid #ef4444; }
.home-cal-event-item.event-yellow { border-left: 3px solid #eab308; }
.home-cal-event-item.event-blue { border-left: 3px solid #3b82f6; }

.home-cal-event-date {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 58px;
}

.home-cal-event-body {
    min-width: 0;
}

.home-cal-event-body strong {
    display: block;
    font-size: 10px;
    margin-bottom: 2px;
    color: var(--text);
}

.home-cal-event-body span {
    display: block;
    font-size: 10px;
    line-height: 1.35;
    color: var(--text-muted);
    font-weight: 600;
}

@media (max-height: 820px), (max-width: 1180px) {
    html, body.home-page:not(.home-subpage) {
        height: auto;
        overflow: auto;
    }

    .home-shell:not(.home-shell-scroll) {
        height: auto;
        min-height: 100vh;
    }

    .home-grades {
        grid-template-columns: repeat(2, 1fr);
    }

    .home-quicklinks {
        grid-template-columns: repeat(3, 1fr);
    }

    .home-hero-intro h1 {
        white-space: normal;
    }

    .home-brand-meta {
        white-space: normal;
    }

    .home-hero-content {
        max-width: 100%;
    }

    .home-hero-bg {
        width: 38%;
        opacity: 0.4;
    }

    .home-cal-overview-grid,
    .home-subpage-grid,
    .home-about-hero,
    .home-topic-grid,
    .home-guide-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .home-hero-bg {
        display: none;
    }

    .home-banner img {
        object-fit: contain;
        max-height: 120px;
        object-position: center;
    }
}

@media (max-width: 900px) {
    .home-shell {
        padding: 0 14px;
    }

    .home-header {
        margin-bottom: 16px;
    }

    .home-brand-logo {
        width: 88px;
        height: 88px;
    }

    .home-brand strong {
        font-size: 20px;
    }

    .home-brand-meta {
        font-size: 12px;
    }

    .home-brand-title-row {
        gap: 8px 20px;
    }

    .home-main,
    .home-section-stack {
        gap: 20px;
    }

    .home-grades {
        grid-template-columns: 1fr;
        gap: 14px;
        margin: 0;
    }

    .home-quicklinks {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .home-quicklink {
        padding: 16px 18px;
        min-height: 100px;
        gap: 14px;
    }

    .home-quicklink img {
        width: 52px;
        height: 52px;
    }

    .home-quicklink strong {
        font-size: 14px;
    }

    .home-quicklink span:not(.home-quicklink-arrow) {
        font-size: 12px;
    }

    .home-hero-content {
        display: contents;
    }

    .home-hero {
        display: flex;
        flex-direction: column;
    }

    .home-hero-intro {
        order: 1;
    }

    .home-hero-intro h1 {
        font-size: clamp(24px, 5.5vw, 34px);
        line-height: 1.15;
        white-space: normal;
    }

    .home-hero-intro > p {
        margin-bottom: 4px;
    }

    .home-hero-features {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .home-hero-features.is-carousel {
        display: block;
        margin-top: 16px;
    }

    .home-hero-features.is-carousel .home-hero-carousel-viewport {
        display: block;
        overflow: hidden;
        width: min(100%, 260px);
        margin: 0 auto;
    }

    .home-hero-features.is-carousel .home-hero-carousel-track {
        display: flex;
        transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
    }

    .home-hero-features.is-carousel .home-hero-feature {
        flex: 0 0 100%;
        justify-content: center;
        background: white;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 10px 12px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
        transform: scale(0.92);
        opacity: 0.65;
        transition: transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.35s ease;
    }

    .home-hero-features.is-carousel .home-hero-feature img,
    .home-hero-features.is-carousel .home-hero-feature-fallback {
        width: 52px;
        height: 52px;
    }

    .home-hero-features.is-carousel .home-hero-feature-text .line1,
    .home-hero-features.is-carousel .home-hero-feature-text .line2 {
        font-size: 12px;
    }

    .home-hero-features.is-carousel .home-hero-carousel-dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-top: 8px;
    }

    .home-hero-features.is-carousel .home-hero-feature.is-active {
        transform: scale(1);
        opacity: 1;
    }

    .home-hero-carousel-dot {
        width: 8px;
        height: 8px;
        border: none;
        border-radius: 50%;
        background: #cbd5e1;
        padding: 0;
        cursor: pointer;
    }

    .home-hero-carousel-dot.is-active {
        background: var(--blue);
        transform: scale(1.2);
    }

    .home-cal-overview-header .home-cal-overview-nav {
        display: none;
    }

    .home-cal-item-nav {
        display: flex;
    }

    .home-cal-item-nav .mini-cal-nav-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .home-grade-heading {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
    }

    .home-grade-card {
        display: flex;
        flex-direction: column;
    }

    .home-grade-main {
        display: contents;
    }

    .home-grade-body {
        order: 1;
        padding: 18px 18px 14px;
    }

    .home-grade-aside {
        order: 2;
        border-top: 1px solid #f1f5f9;
        border-bottom: none;
        padding: 10px 16px 4px;
    }

    .home-grade-qr-block {
        order: 3;
        padding: 4px 16px 12px;
        border-top: 1px solid #f1f5f9;
    }

    .home-grade-qr-toggle,
    .home-grade-cal-toggle {
        display: inline-flex;
    }

    .home-grade-qr-label,
    .home-grade-cal-label {
        display: none;
    }

    .home-grade-qr-panel,
    .home-grade-cal-panel {
        display: none;
    }

    .home-grade-qr-block.is-open .home-grade-qr-panel,
    .home-grade-cal-block.is-open .home-grade-cal-panel {
        display: flex;
    }

    .home-grade-cal-block.is-open .home-grade-cal-panel {
        flex-direction: row;
        align-items: flex-start;
    }

    .home-grade-qr-block,
    .home-grade-cal-block {
        align-items: stretch;
        min-width: 0;
        width: 100%;
    }

    .home-banner {
        margin-top: 18px;
        border-radius: 16px;
    }

    .home-banner img {
        max-height: 120px;
    }
}

@media (max-width: 760px) {
    .home-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 10px;
    }

    .home-nav {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 4px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .home-nav::-webkit-scrollbar {
        display: none;
    }

    .home-nav a {
        flex-shrink: 0;
        font-size: 12px;
        padding: 6px 10px 8px;
    }

    .home-nav a img {
        width: 16px;
        height: 16px;
    }

    .home-hero-intro h1 {
        font-size: clamp(26px, 7vw, 36px);
        line-height: 1.15;
    }

    .home-hero-intro > p {
        font-size: 13px;
    }

    .home-hero-features.is-carousel .home-hero-carousel-viewport {
        width: min(100%, 230px);
    }

    .home-grade-body {
        padding: 16px;
    }

    .home-grade-qr-block {
        padding: 4px 16px 12px;
    }

    .home-grade-number {
        font-size: 40px;
    }

    .home-grade-illustration {
        width: 100px;
        height: 68px;
    }

    .home-quicklinks {
        grid-template-columns: 1fr;
    }

    .home-quicklink-arrow {
        display: none;
    }

    .home-about-stats {
        grid-template-columns: 1fr;
    }

    .home-subpage-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .home-shell {
        padding: 0 12px;
    }

    .home-brand {
        gap: 10px;
    }

    .home-brand-logo {
        width: 72px;
        height: 72px;
    }

    .home-brand strong {
        font-size: 18px;
    }

    .home-brand-meta {
        font-size: 11px;
        line-height: 1.35;
    }

    .home-brand-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .home-grade-btn {
        width: 100%;
        justify-content: center;
    }

    .home-quicklink {
        min-height: auto;
        padding: 14px 16px;
    }

    .home-banner {
        margin-top: 14px;
        border-radius: 12px;
    }

    .home-banner img {
        max-height: 90px;
    }

    .home-copyright {
        font-size: 10px;
        padding: 10px 0 14px;
    }
}
