:root {
    --accent: #F1913D;
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --ink: #2C2E33;
    --muted: #5C5E61;
    --line: #ECECEC;
    --paper: #ffffff;
    --canvas: #F7F7F7;
    --success: #25C55B;
    --danger: #F2695C;
    --radius-panel: 16px;
    --radius-button: 12px;
    --radius-image: 8px;
    --shadow-panel: 0 4px 10px #0000000A;
    --text-body: 16px;
    --text-small: 13px;
    --text-heading: 22px;
}
body[data-home-theme="sunny"] {
    --accent: #F1913D;
    --accent-soft: #FEF3E7;
    --canvas: #F9F6F2;
    --line: #EFE8DF;
}
body[data-home-theme="ocean"] {
    --accent: #0EA5E9;
    --accent-soft: #E0F2FE;
    --canvas: #F0F7FB;
    --line: #DCEBF5;
    --ink: #1E293B;
}
body[data-home-theme="space"] {
    --accent: #6366F1;
    --accent-soft: #EEF2FF;
    --canvas: #F3F4FA;
    --line: #E2E5F3;
    --ink: #1E1B4B;
}
body[data-home-theme="arcade"] {
    --accent: #10B981;
    --accent-soft: #D1FAE5;
    --canvas: #F0F9F5;
    --line: #D9EFE6;
    --ink: #143328;
}
body[data-home-theme="sticker"] {
    --accent: #EC4899;
    --accent-soft: #FCE7F3;
    --canvas: #FBF3F7;
    --line: #F2DFEA;
    --ink: #381A2C;
}
body[data-home-theme="brick"] {
    --accent: #EF4444;
    --accent-soft: #FEE2E2;
    --canvas: #FAF3F3;
    --line: #F0DFDF;
    --ink: #361B1B;
}
@font-face {
    font-family: Lexend;
    src: url('../fonts/proty_preview/Lexend-variable.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Lexend, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: var(--text-body); line-height: 1.4; letter-spacing: 0; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2 { margin: 0; font-weight: 600; }
.icon { display: inline-block; flex: none; width: 20px; height: 20px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.preview-shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 100vh; }
.sidebar { position: relative; z-index: 2; flex: 1 1 272px; min-width: 0; display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 2px 2px #1C24331A; }
.brand { height: 78px; box-sizing: border-box; padding: 0 24px 0 32px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.brand img { display: block; width: 42px; height: 42px; border-radius: 12px; }
.brand span { font-size: 24px; font-weight: 600; line-height: 30px; }
.sidebar-menu { padding: 24px 16px 0; display: flex; flex-direction: column; }
.sidebar-item { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-radius: var(--radius-panel); font-size: 16px; font-weight: 400; line-height: 20px; }
.sidebar-item .icon { color: #A3ABB0; }
.sidebar-item.is-active, .sidebar-item.is-active:hover { background: var(--accent); color: white; }
.sidebar-item.is-active .icon { color: white; }
.menu-divider { margin: 12px 24px; border-top: 1px solid var(--line); }
.menu-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--accent); color: white; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; }
.sidebar-footer { margin-top: auto; padding: 24px 16px; }
.sidebar-student { display: flex; align-items: center; gap: 12px; padding: 16px 0 0 24px; border-top: 1px solid var(--line); }
.avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 19px; font-weight: 600; line-height: 1; display: flex; align-items: center; justify-content: center; }
.student-details { min-width: 0; }
.student-name { font-size: 15px; font-weight: 600; line-height: 22px; }
.student-course { font-size: 12px; line-height: 18px; color: var(--muted); }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 78px; box-sizing: border-box; padding: 0 32px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; line-height: 30px; }
.account { display: flex; align-items: center; gap: 10px; }
.account .avatar { width: 44px; height: 44px; font-size: 17px; }
.account-name { font-size: 16px; line-height: 22px; }
.account .icon { width: 16px; height: 16px; stroke-width: 1.8; }
.page-content { flex-grow: 1; padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 24px; }
.course-content { gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 24px; }
.stat-card { background: var(--paper); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); padding: 12px 20px; display: flex; align-items: center; gap: 14px; }
.stat-icon { flex: none; width: 80px; height: 80px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.stat-icon .icon { width: 36px; height: 36px; stroke-width: 1.3; }
.stat-label { font-size: 16px; font-weight: 500; line-height: 24px; }
.stat-value { display: flex; align-items: baseline; gap: 8px; }
.stat-number { font-size: 36px; font-weight: 500; line-height: 44px; }
.stat-number.is-accent { color: var(--accent); }
.stat-unit { font-size: 14px; font-weight: 500; line-height: 20px; color: var(--muted); }
.home-columns { flex-grow: 1; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.home-primary { flex: 6 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.home-secondary { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--paper); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); }
.todo-panel { padding: 26px 28px 12px; }
.lessons-panel { flex: 1 0 auto; display: flex; flex-direction: column; padding: 26px 20px 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2 { font-size: var(--text-heading); line-height: 30px; }
.lessons-panel .panel-heading { padding: 0 8px; }
.more-link { display: flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 500; line-height: 20px; color: var(--accent); }
.more-link .icon { width: 16px; height: 16px; stroke-width: 1.8; }
.table-scroll { margin-top: 14px; overflow-x: auto; }
.lessons-panel .table-scroll { flex: none; padding: 0 8px; }
.lesson-table { width: 100%; min-width: 620px; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.lesson-table th { box-sizing: border-box; text-align: left; background: var(--ink); color: white; font-size: 14px; font-weight: 600; line-height: 19.6px; padding: 8.5px 19px; }
.lesson-table th:first-child { border-radius: 8px 0 0 8px; }
.lesson-table th:last-child { border-radius: 0 8px 8px 0; }
.lesson-table th:not(:first-child) { box-shadow: inset 1px 0 0 #FFFFFF1F; padding-left: 28px; }
.todo-table .deadline-column { width: 112px; }
.todo-table .status-column { width: 100px; }
.todo-table .action-column { width: 156px; }
.recent-table .date-column { width: 80px; }
.recent-table .materials-column { width: 130px; }
.recent-table .status-column { width: 84px; }
.recent-table .action-column { width: 76px; }
.recent-table th.date-column, .recent-table th.status-column, .recent-table th.action-column { padding: 8.5px 8px 8.5px 12px; }
.lesson-table td { padding: 12px 0; vertical-align: middle; }
.todo-table td { padding: 8px 0; }
.lesson-table td:first-child { padding-right: 16px; }
.lesson-table tbody tr + tr td { box-shadow: inset 0 1px 0 var(--line); }
.table-lesson { display: flex; align-items: center; gap: 20px; }
.table-lesson img { flex: none; display: block; width: 96px; height: 68px; border-radius: var(--radius-image); object-fit: cover; }
.table-title { display: block; font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.table-subtitle { margin-top: 6px; font-size: var(--text-small); line-height: 18px; color: var(--muted); }
.table-cell { min-height: 68px; box-sizing: border-box; padding: 0 12px 0 28px; border-left: 1px solid var(--line); display: flex; align-items: center; }
.date-cell { font-size: 15px; line-height: 22px; white-space: nowrap; }
.recent-table .date-cell, .recent-table .status-cell { padding: 0 8px 0 12px; }
.materials-cell { flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; }
.action-cell { padding-right: 0; }
.recent-table .action-cell { padding-left: 12px; }
.status-pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 16.25px; white-space: nowrap; }
.status-todo { background: var(--accent); color: white; }
.status-warning { background: var(--accent-soft); color: var(--accent); }
.status-success { background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--success); }
.button { display: inline-block; padding: 10px 28px; border-radius: var(--radius-button); border: 1px solid var(--accent); background: var(--accent); color: white; font-size: 16px; font-weight: 600; line-height: 22.4px; white-space: nowrap; text-align: center; }
.button:hover { color: white; }
.button-outline { background: var(--paper); color: var(--accent); font-weight: 400; }
.button-outline:hover { color: var(--accent); }
.recent-table .button { padding: 10px 7px; }
.material-button { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: var(--radius-button); border: 1px solid #BFBFBF; background: var(--paper); color: var(--ink); font-size: 13px; line-height: 18px; white-space: nowrap; }
.material-button .icon { width: 14px; height: 14px; }
.side-panel { padding: 18px 20px; }
.side-panel h2 { font-size: 18px; line-height: 26px; }
.my-course { margin-top: 10px; display: flex; align-items: center; gap: 14px; }
.my-course img { flex: none; display: block; width: 120px; height: 96px; border-radius: 10px; object-fit: cover; }
.course-summary { flex: 1 1 0; min-width: 0; }
.course-summary-title { font-size: 16px; font-weight: 600; line-height: 22px; }
.course-summary-count { margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--muted); }
.count-emphasis { font-weight: 600; color: var(--ink); }
.progress-bar { appearance: none; -webkit-appearance: none; display: block; margin-top: 5px; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.progress-bar::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.progress-bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.course-summary .button { margin-top: 8px; padding: 6px 18px; font-size: 14px; line-height: 20px; }
.achievement-list { margin-top: 10px; display: flex; flex-direction: column; gap: 9px; }
.achievement-labels { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.achievement-title { font-size: 15px; font-weight: 500; line-height: 20px; }
.achievement-count { font-size: 13px; line-height: 20px; color: var(--muted); white-space: nowrap; }
.achievement-button { margin-top: 14px; display: block; padding: 7px 20px; font-size: 15px; line-height: 22px; }
.news-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.news-item { display: flex; align-items: center; gap: 12px; }
.news-item img { flex: none; display: block; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.news-title { font-size: 14.5px; font-weight: 500; line-height: 21px; text-wrap: balance; }
.news-line { display: inline-block; }
.course-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.course-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.course-tab { display: inline-flex; align-items: center; height: 44px; box-sizing: border-box; padding: 0 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 16px; line-height: 1; white-space: nowrap; }
.course-tab.is-active { border-color: var(--accent); background: var(--accent); color: white; font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; box-sizing: border-box; padding: 0 12px 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; }
.filter-count { min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; line-height: 1; background: var(--canvas); color: var(--ink); }
.filter-pill.is-active { border-color: var(--ink); background: var(--ink); color: white; }
.filter-pill.is-active .filter-count { background: #FFFFFF2E; color: white; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 24px; }
.lesson-card { display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; box-shadow: var(--shadow-panel); }
.lesson-cover { position: relative; }
.lesson-cover img { display: block; width: 100%; height: 180px; object-fit: cover; }
.lesson-tags { position: absolute; top: 8px; left: 8px; display: flex; gap: 9px; flex-wrap: wrap; }
.lesson-tag { font-size: 14px; font-weight: 600; line-height: 19.6px; padding: 4px 13px 4px 12px; border-radius: 999px; background: var(--accent); color: white; white-space: nowrap; }
.lesson-date { background: #0B213280; }
.lesson-card-body { flex-grow: 1; display: flex; flex-direction: column; padding: 18px 20px; }
.lesson-card h2 { font-size: 17px; line-height: 24px; }
.lesson-meta { margin-top: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; line-height: 22px; color: var(--muted); white-space: nowrap; }
.lesson-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.lesson-meta .icon, .lesson-resource .icon { width: 18px; height: 18px; color: #A8ABAE; }
.lesson-meta-value { color: var(--ink); }
.resource-divider { margin: 12px 0 6px; border-top: 1px solid var(--line); }
.lesson-resource { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.resource-title { margin-right: auto; font-size: 15px; line-height: 22px; }
.download-button { flex: none; padding: 4px 15px; border-radius: 99px; border: 1px solid #BFBFBF; font-size: 13px; font-weight: 500; line-height: 18px; white-space: nowrap; }
.footer-divider { margin: 6px 0 14px; border-top: 1px solid var(--line); }
.lesson-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; }
.lesson-result { font-size: 20px; font-weight: 600; line-height: 25px; }
.result-todo { color: var(--danger); }
.result-warning { color: var(--accent); }
.result-success { color: var(--success); }
.lesson-note { margin-top: 2px; font-size: 13px; line-height: 18px; color: var(--muted); }
.upcoming .lesson-cover { height: 180px; background: #F1F1F1; }
.upcoming .lesson-tag { background: #A8ABAE; }
.upcoming h2 { color: #969799; }
.empty-state { padding: 24px 0; color: var(--muted); }
@media (max-width: 700px) {
    .sidebar { flex-basis: 100%; }
    .sidebar-menu { flex-direction: row; flex-wrap: wrap; padding: 12px; gap: 4px; }
    .sidebar-item { padding: 12px; }
    .menu-divider, .sidebar-footer { display: none; }
    .topbar { padding: 16px; }
    .page-content { padding: 20px 16px; }
    .home-primary, .home-secondary { flex-basis: 100%; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat-card { padding: 12px; gap: 8px; }
    .stat-icon { width: 40px; height: 40px; }
    .stat-icon .icon { width: 24px; height: 24px; }
    .stat-label { font-size: 13px; }
    .stat-number { font-size: 28px; }
    .todo-panel, .lessons-panel { padding: 20px 16px; }
    .panel-heading h2 { font-size: 20px; }
    .course-tab { padding: 0 18px; }
}
.status-locked { background: var(--line); color: var(--muted); }
.panel-heading { flex-wrap: wrap; }
.lesson-table .table-title, .lesson-table .date-cell { white-space: normal; overflow-wrap: anywhere; }
.lesson-table .student-details, .lesson-resource .resource-title { min-width: 0; overflow-wrap: anywhere; }
.material-button { max-width: 100%; box-sizing: border-box; white-space: normal; overflow-wrap: anywhere; }
.lesson-resource { padding: 6px 0; }
.side-panel .sidebar-student { padding-left: 0; margin-top: 10px; }
.home-primary > section > .lesson-grid { margin-top: 14px; }
.lesson-card-body > h2 { margin-top: 10px; }
.stat-value { flex-wrap: wrap; }
.online-material-frame { margin-top: 16px; min-width: 0; }
.online-material-frame img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.online-material-frame video, .online-material-frame audio { display: block; max-width: 100%; }
.online-material-frame iframe { display: block; width: 100%; height: 75vh; min-height: 480px; border: 0; }
.online-material-body { max-width: 880px; width: 100%; margin: 16px auto 0; line-height: 1.8; }
.online-material-body h2 { margin-top: 24px; font-size: var(--text-heading); }
.online-material-body p { margin: 12px 0; }
.course-toolbar > .student-details { flex: 1 1 320px; }
.course-toolbar .status-pill { white-space: normal; }
.topbar-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.proty-theme-picker { position: relative; }
.proty-theme-trigger { list-style: none; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; box-sizing: border-box; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--canvas); color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1; }
.proty-theme-trigger::-webkit-details-marker { display: none; }
.proty-theme-trigger:hover { border-color: var(--accent); color: var(--accent); }
.proty-theme-trigger .icon { width: 15px; height: 15px; stroke-width: 1.8; }
.theme-swatch { flex: none; width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px #0000001F; }
.theme-swatch[data-swatch="sunny"] { background: #F1913D; }
.theme-swatch[data-swatch="ocean"] { background: #0EA5E9; }
.theme-swatch[data-swatch="space"] { background: #6366F1; }
.theme-swatch[data-swatch="arcade"] { background: #10B981; }
.theme-swatch[data-swatch="sticker"] { background: #EC4899; }
.theme-swatch[data-swatch="brick"] { background: #EF4444; }
.proty-theme-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 184px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 10px 28px #1C243324; display: flex; flex-direction: column; gap: 4px; margin: 0; }
.proty-theme-menu-title { padding: 4px 10px 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.proty-theme-option { appearance: none; border: 0; background: transparent; width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-family: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; text-align: left; }
.proty-theme-option:hover { background: var(--accent-soft); color: var(--accent); }
.proty-theme-option.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.proty-pet-card { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; gap: 14px; }
.proty-pet-avatar { flex: none; width: 64px; height: 64px; border-radius: 12px; background-color: var(--paper); background-repeat: no-repeat; background-size: 200% 200%; background-position: 0 0; image-rendering: pixelated; }
.main > .pet-page { padding: 28px 32px 32px; box-sizing: border-box; width: 100%; }
@media (max-width: 700px) {
    .lesson-resource { flex-wrap: wrap; }
    .stat-value { gap: 4px; }
    .my-course { flex-wrap: wrap; }
    .my-course .course-summary { flex-basis: 140px; }
    .main > .pet-page { padding: 20px 16px; }
}

/* Keep C++ challenge history readable beside fixed-width action columns. */
.cpp-classroom-challenges td:first-child .student-details { min-width: 0; }
.cpp-classroom-challenges td:first-child .table-title,
.cpp-classroom-challenges td:first-child .table-subtitle,
.cpp-classroom-challenges td:first-child .table-subtitle a { white-space: normal; overflow-wrap: anywhere; }

@media (min-width: 701px) {
    .cpp-classroom-detail .home-primary { flex-basis: 900px; }
    .cpp-classroom-detail .home-secondary { flex-direction: row; flex-wrap: wrap; }
    .cpp-classroom-detail .home-secondary > .panel { flex: 1 1 260px; min-width: 0; }
}

.course-content .button:disabled { cursor: default; opacity: .45; }

/* Shared student list grid: keep dates intact and controls within their columns. */
.lesson-table.student-data-grid { min-width: var(--grid-min-width, 760px); }
.student-data-grid.cpp-home-table { --grid-materials-width: 170px; }
.student-data-grid.cpp-home-table.todo-table { --grid-min-width: 900px; }
.student-data-grid.cpp-home-table.recent-table { --grid-min-width: 800px; }
.student-data-grid.cpp-course-table { --grid-status-width: 180px; }
.student-data-grid.cpp-classroom-challenges { --grid-status-width: 160px; }
.student-data-grid .date-column, .student-data-grid .deadline-column { width: 124px; }
.student-data-grid .difficulty-column { width: 100px; }
.student-data-grid .materials-column { width: var(--grid-materials-width, 130px); }
.student-data-grid .status-column { width: var(--grid-status-width, 128px); }
.student-data-grid .action-column { width: 176px; }
.student-data-grid th:not(:first-child) { padding: 8.5px 12px; text-align: center; }
.student-data-grid .table-cell { justify-content: center; padding: 0 12px; text-align: center; }
.student-data-grid .materials-cell { align-items: center; }
.student-data-grid .table-cell .button { box-sizing: border-box; max-width: 100%; padding: 10px 12px; white-space: normal; overflow-wrap: anywhere; }
.student-data-grid .status-pill { box-sizing: border-box; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.student-data-grid .table-date { white-space: nowrap; overflow-wrap: normal; }
.student-data-grid .table-attendance { display: block; white-space: normal; overflow-wrap: anywhere; }
