:root {
    --blue: #3157d5;
    --accent-rgb: 49, 87, 213;
    --header-middle: #1c3162;
    --header-end: #244484;
    --brand-tint: #6684ee;
    --nav-text: #d6def3;
    --nav-muted: #bdc9e8;
    --selection-bg: #cfdbff;
    --blue-dark: #243f9e;
    --blue-soft: #edf2ff;
    --navy: #17264b;
    --navy-light: #253a6b;
    --ink: #172033;
    --muted: #667085;
    --line: #dce3ee;
    --line-strong: #c7d1e0;
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-soft: #f8faff;
    --white: #ffffff;
    --green: #18794e;
    --green-soft: #e9f7ef;
    --amber: #946200;
    --amber-soft: #fff4d6;
    --red: #c9363e;
    --red-soft: #fff0f1;
    --violet: #6941c6;
    --radius: 16px;
    --radius-small: 10px;
    --shadow-sm: 0 1px 2px rgba(23, 38, 75, 0.05);
    --shadow: 0 10px 28px rgba(23, 38, 75, 0.08);
    --shadow-strong: 0 18px 48px rgba(23, 38, 75, 0.14);
}

/* 教師端集中覆寫色彩變數；學生端沿用上方靛藍色系。 */
body.teacher-site {
    --blue: #256b56;
    --blue-dark: #19513f;
    --blue-soft: #edf5ef;
    --accent-rgb: 37, 107, 86;
    --navy: #183d32;
    --navy-light: #285b4b;
    --header-middle: #234e40;
    --header-end: #326654;
    --brand-tint: #70a48e;
    --nav-text: #e1eee6;
    --nav-muted: #c3d9ca;
    --selection-bg: #cde8d5;
    --ink: #233a30;
    --muted: #64736a;
    --line: #dce4dd;
    --line-strong: #bbcbbf;
    --bg: #f5f5ef;
    --surface-soft: #f8f9f5;
    --shadow-sm: 0 2px 5px rgba(31, 58, 42, 0.05);
    --shadow: 0 10px 28px rgba(31, 58, 42, 0.08);
    --shadow-strong: 0 14px 32px rgba(31, 58, 42, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(
            circle at top right,
            rgba(var(--accent-rgb), 0.08),
            transparent 26rem
        ),
        var(--bg);
    color: var(--ink);
    font:
        16px/1.65
        "Noto Sans TC",
        "Microsoft JhengHei",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
textarea,
select {
    font-family:
        "Noto Sans TC",
        "Microsoft JhengHei",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    touch-action: manipulation;
}

img,
svg {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--selection-bg);
    color: var(--navy);
}

:focus-visible {
    outline: 3px solid rgba(var(--accent-rgb), 0.3);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
    padding: 9px 14px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--navy);
    font-weight: 800;
    box-shadow: var(--shadow);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* =========================================================
   共用頁面骨架與導覽
   ========================================================= */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    color: #ffffff;
    background:
        linear-gradient(
            112deg,
            var(--navy) 0%,
            var(--header-middle) 62%,
            var(--header-end) 100%
        );
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(15, 28, 59, 0.16);
}

.topbar-inner {
    width: min(1400px, calc(100% - 48px));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 30px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 11px;
    color: #ffffff;
    background:
        linear-gradient(
            145deg,
            var(--brand-tint),
            var(--blue)
        );
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(6, 17, 44, 0.24);
}

.brand-text {
    min-width: 0;
}

.brand strong {
    display: block;
    font-size: 16px;
    line-height: 1.35;
    letter-spacing: 0.02em;
}

.brand small,
.account-menu small {
    display: block;
    color: var(--nav-muted);
    font-size: 11px;
    line-height: 1.4;
}

.topnav {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.topnav a {
    position: relative;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--nav-text);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition:
        color 0.16s ease,
        background 0.16s ease;
}

.topnav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.topnav a.active {
    color: var(--navy);
    background: #ffffff;
    box-shadow: 0 5px 14px rgba(5, 15, 40, 0.18);
}

.account-menu {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    padding-left: 18px;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-weight: 800;
}

.account-text strong {
    display: block;
    max-width: 120px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu form {
    margin: 0;
}

.logout-link {
    padding: 6px 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--nav-text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.logout-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.page-shell {
    width: min(1280px, calc(100% - 48px));
    margin: 38px auto 64px;
    flex: 1;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: auto;
    padding: 22px max(24px, calc((100% - 1280px) / 2));
    background: var(--navy);
    color: #bbc7e6;
    font-size: 13px;
}

.messages {
    width: min(1280px, calc(100% - 48px));
    margin: 18px auto 0;
}

.message {
    padding: 12px 16px;
    border: 1px solid #cbd8ff;
    border-radius: var(--radius-small);
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.message + .message {
    margin-top: 8px;
}

.message.success {
    border-color: #bfe8cf;
    background: var(--green-soft);
    color: var(--green);
}

.message.error {
    border-color: #fac7cb;
    background: var(--red-soft);
    color: var(--red);
}

/* =========================================================
   文字層級與共用容器
   ========================================================= */

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1,
h2,
h3 {
    color: var(--ink);
    line-height: 1.35;
}

h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

h3 {
    font-size: 17px;
}

.page-heading,
.activity-header,
.panel-title,
.section-heading,
.button-row,
.activity-footer,
.mindmap-toolbar,
.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-heading,
.activity-header {
    position: relative;
    margin-bottom: 22px;
    padding: 24px 26px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}

.page-heading::before,
.activity-header::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--blue);
    content: "";
}

.page-heading > div:first-child,
.activity-header > div:first-child {
    min-width: 0;
    flex: 1;
}

.page-heading h1,
.activity-header h1 {
    margin: 0;
    font-family:
        "Noto Serif TC",
        "PMingLiU",
        Georgia,
        serif;
    font-size: clamp(27px, 3vw, 34px);
    letter-spacing: -0.02em;
}

.page-subtitle {
    max-width: 760px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.muted,
.activity-header > span {
    color: var(--muted);
}

.panel {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel + .panel {
    margin-top: 18px;
}

.panel-title {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
}

.panel-title h2,
.panel-title h3,
.panel-title p {
    margin-top: 0;
}

.panel-title h2,
.panel-title h3 {
    margin-bottom: 3px;
}

.panel-title p {
    margin-bottom: 0;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.stack h2 {
    margin-bottom: 0;
}

.section-heading {
    margin: 30px 0 12px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading a,
.table-wrap td a {
    color: var(--blue);
    font-weight: 800;
}

.section-heading a:hover,
.table-wrap td a:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

.empty-state {
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 30px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--muted);
    text-align: center;
}

.empty-state h2,
.empty-state h3,
.empty-state p {
    margin: 0;
}

.empty-state p {
    margin-top: 7px;
}

.empty-state .button {
    margin-top: 18px;
}

/* =========================================================
   按鈕與表單
   ========================================================= */

.button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    color: #344054;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition:
        border-color 0.16s ease,
        background 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.button:hover {
    border-color: #9aabd0;
    background: var(--blue-soft);
    color: var(--blue-dark);
    transform: translateY(-1px);
}

.button.primary {
    border-color: var(--blue);
    background: var(--blue);
    color: #ffffff;
    box-shadow: 0 7px 16px rgba(var(--accent-rgb), 0.22);
}

.button.primary:hover {
    border-color: var(--blue-dark);
    background: var(--blue-dark);
    color: #ffffff;
}

.button.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.button.wide {
    width: 100%;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.icon-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #344054;
    font-size: 14px;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: 0;
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

textarea {
    resize: vertical;
    line-height: 1.7;
}

input[type="file"] {
    padding: 8px;
    background: var(--surface-soft);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    min-height: 18px;
    height: 18px;
    accent-color: var(--blue);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

input::placeholder,
textarea::placeholder {
    color: #98a2b3;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-panel {
    max-width: 940px;
    margin: 0 auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 18px;
}

.form-group label {
    display: block;
}

.checkbox-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 11px;
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.checkbox-row > input {
    margin-top: 2px;
    flex: 0 0 auto;
}

.checkbox-row > span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.checkbox-row small {
    color: var(--muted);
    font-weight: 500;
}

.check {
    flex-direction: row;
    align-items: center;
    font-weight: 500;
}

.check input {
    width: auto;
}

.helptext,
.table-note {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}

.errorlist {
    margin: 0;
    padding: 0;
    color: var(--red);
    font-size: 13px;
    list-style: none;
}

.field-error {
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
}

.form-error,
.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid #fac7cb;
    border-radius: 9px;
    background: var(--red-soft);
    color: #a72d35;
    font-size: 14px;
    font-weight: 700;
}

.form-error p,
.alert p {
    margin-bottom: 0;
    font-weight: 500;
}

.alert-danger {
    border-color: #fac7cb;
    background: var(--red-soft);
    color: #a72d35;
}

/* =========================================================
   卡片、指標與表格
   ========================================================= */

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 23px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        transform 0.16s ease;
}

.card:hover {
    border-color: #bac8e2;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line);
}

.card-header h2 {
    margin: 0;
}

.card-content {
    flex: 1;
    padding: 17px 0;
}

.card-content p {
    margin: 0 0 8px;
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: auto;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.metric-grid article {
    position: relative;
    min-height: 116px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-grid article::after {
    position: absolute;
    inset: auto -18px -28px auto;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: var(--blue-soft);
    content: "";
}

.metric-grid strong {
    position: relative;
    z-index: 1;
    display: block;
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.25;
}

.metric-grid article > span:last-child {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 13px;
}

.metric-icon {
    position: absolute;
    top: 17px;
    right: 17px;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--green-soft);
    color: var(--green);
}

.metric-icon.blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.metric-icon.amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.metric-icon.violet {
    background: #f1edff;
    color: var(--violet);
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

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

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

th {
    background: #f4f7fc;
    color: #475467;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

tbody tr {
    transition: background 0.14s ease;
}

tbody tr:hover {
    background: #f8faff;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.status,
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.published,
.current {
    background: var(--green-soft);
    color: var(--green);
}

.draft {
    background: var(--amber-soft);
    color: var(--amber);
}

/* 不改動 selection / user-select，保留學生反白圈選功能。 */
.clipboard-notice {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    max-width: min(440px, calc(100vw - 40px));
    margin: 0;
    padding: 14px 18px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
    font: 600 14px/1.7 system-ui, sans-serif;
}

/* =========================================================
   儀表板與工作區
   ========================================================= */

.current-week {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
    gap: 30px;
    margin-bottom: 20px;
    padding: 30px;
    border: 1px solid #3455b5;
    border-radius: var(--radius);
    background:
        linear-gradient(
            125deg,
            var(--navy),
            #264887 72%,
            #3157d5
        );
    color: #ffffff;
    box-shadow: var(--shadow);
}

.current-week h2 {
    margin: 13px 0 4px;
    color: #ffffff;
    font-size: 26px;
}

.current-week p,
.progress-block span {
    color: #d8e2fa;
}

.current-week .status.current {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.progress-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 11px;
}

.progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(8, 21, 53, 0.45);
}

.progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #aec2ff;
}

.week-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.week-card {
    padding: 21px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.week-card h3 {
    margin: 7px 0;
}

.week-card p,
.week-card span {
    color: var(--muted);
}

.week-card.complete {
    border-left: 4px solid var(--green);
}

.week-card.locked {
    opacity: 0.58;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 18px;
}

.review-grid,
.work-layout,
.feedback-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 18px;
}

.article-text {
    font:
        18px/1.9
        "Noto Serif TC",
        "PMingLiU",
        Georgia,
        serif;
}

.article-text p {
    margin: 0 0 1.2em;
}

.legend {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.legend i {
    width: 18px;
    height: 7px;
    border-radius: 2px;
}

.teacher-mark,
.tag.teacher {
    background: #ffedb4;
}

.ai-mark,
.tag.ai {
    background: #d9e4ff;
}

.review-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.review-item p {
    margin: 0;
}

/* =========================================================
   閱讀、朗讀、問答與學習活動
   ========================================================= */

.reading-layout,
.selection-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
    gap: 18px;
}

.reading-layout {
    min-height: 620px;
    height: calc(100vh - 230px);
}

.selection-layout {
    align-items: start;
}

.article-pane,
.chat-pane,
.selection-pane {
    overflow: auto;
}

.article-pane {
    padding: 38px 7%;
    font:
        18px/1.95
        "Noto Serif TC",
        "PMingLiU",
        Georgia,
        serif;
}

.article-pane h2 {
    font-size: 29px;
}

.chat-pane {
    display: flex;
    flex-direction: column;
}

.chat-log {
    min-height: 180px;
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 4px 2px;
    scroll-behavior: smooth;
}

.chat-message {
    max-width: 90%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px 12px 12px 3px;
    background: var(--surface-soft);
    line-height: 1.65;
}

.chat-message.user {
    align-self: flex-end;
    border-color: #cad7ff;
    border-radius: 12px 12px 3px 12px;
    background: var(--blue-soft);
    color: var(--blue-dark);
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.chat-form textarea {
    min-height: 78px;
    resize: none;
}

.clear-chat {
    align-self: flex-start;
    margin-top: 2px;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: var(--blue);
    font-weight: 700;
    cursor: pointer;
}

.clear-chat:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

.activity-footer {
    margin-top: 15px;
}

.activity-footer span {
    color: var(--muted);
}

.selection-pane {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 124px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.selection-item {
    padding: 12px;
    border: 1px solid #d3defe;
    border-radius: 9px;
    background: var(--blue-soft);
}

.source-points {
    padding-left: 20px;
}

.source-points li {
    margin-bottom: 11px;
}

.speech-reader {
    margin: 0 0 24px;
    padding: 17px;
    border: 1px solid #cbd7fb;
    border-radius: 12px;
    background:
        linear-gradient(
            135deg,
            #f7f9ff,
            var(--blue-soft)
        );
}

.speech-reader-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.speech-reader-heading h3,
.speech-reader-heading p {
    margin: 0;
}

.speech-reader-heading p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.speech-language {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--navy);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.speech-reader-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 9px;
}

.speech-rate {
    min-width: 118px;
    margin-left: auto;
    font-size: 12px;
}

.speech-rate select {
    min-height: 40px;
}

.speech-status {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* =========================================================
   大綱、心智圖與回饋
   ========================================================= */

.outline-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.outline-row {
    display: grid;
    grid-template-columns: 45px 1fr auto;
    align-items: center;
    gap: 8px;
}

.outline-row.child {
    padding-left: 30px;
}

.mindmap-toolbar {
    margin-bottom: 11px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.mindmap-toolbar span {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
}

.mindmap-canvas {
    position: relative;
    height: 600px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background-color: var(--surface);
    background-image:
        radial-gradient(
            #ccd5e3 1px,
            transparent 1px
        );
    background-size: 20px 20px;
}

.mindmap-canvas svg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
}

.mindmap-canvas line {
    stroke: #98a6bc;
    stroke-width: 2;
}

.map-node {
    position: absolute;
    z-index: 1;
    min-width: 150px;
    padding: 13px 17px;
    border: 2px solid #9ab0ed;
    border-radius: 9px;
    background: var(--surface);
    font-weight: 800;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.map-node.root {
    border-color: var(--blue);
    background: var(--blue);
    color: #ffffff;
}

.filter-row {
    justify-content: flex-start;
    margin-bottom: 13px;
}

.filter {
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    cursor: pointer;
}

.filter:hover {
    color: var(--blue-dark);
    background: var(--blue-soft);
}

.filter.active {
    border-color: var(--blue);
    background: var(--blue);
    color: #ffffff;
}

.chart-card {
    margin-top: 18px;
}

.bar-chart {
    height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 28px 10% 0;
    border-bottom: 1px solid var(--line);
}

.bar-chart div {
    width: 58px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 7px;
}

.bar-chart i {
    display: block;
    width: 100%;
    border-radius: 6px 6px 0 0;
    background:
        linear-gradient(
            #7290f0,
            var(--blue)
        );
}

.bar-chart span {
    color: var(--muted);
    font-size: 12px;
}

.step-score {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border-radius: 9px;
    background: var(--green-soft);
    color: var(--green);
}

.step-score strong {
    font-size: 23px;
}

.step-score span {
    font-size: 12px;
}

.feedback-article mark {
    padding: 2px;
    border-radius: 2px;
}

.feedback-article mark.correct {
    background: #c9efd8;
}

.feedback-article mark.partial {
    background: #ffebb0;
}

.feedback-article mark.missed {
    background: #d3dfff;
}

.feedback-summary {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feedback-item {
    display: flex;
    gap: 11px;
    padding: 13px;
    border-radius: 9px;
}

.feedback-item > span {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    flex: 0 0 27px;
    border-radius: 50%;
    font-weight: 800;
}

.feedback-item p {
    margin: 3px 0 0;
    color: var(--muted);
}

.feedback-item.good {
    background: #f0fbf4;
}

.feedback-item.good > span {
    background: var(--green);
    color: #ffffff;
}

.feedback-item.improve {
    background: #fff9e8;
}

.feedback-item.improve > span {
    background: #c67a00;
    color: #ffffff;
}

.legend-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 7px 0 14px;
}

.legend-list span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.legend-list i {
    width: 18px;
    height: 8px;
    border-radius: 2px;
}

.legend-list i.correct {
    background: #c9efd8;
}

.legend-list i.partial {
    background: #ffebb0;
}

.legend-list i.missed {
    background: #d3dfff;
}

/* =========================================================
   登入頁
   ========================================================= */

.auth-page {
    min-height: 100vh;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background:
        linear-gradient(
            135deg,
            rgba(23, 38, 75, 0.97),
            rgba(36, 63, 158, 0.93)
        ),
        var(--navy);
}

.login-card {
    width: min(450px, 100%);
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-strong);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 34px;
    color: var(--navy);
    font-size: 14px;
    font-weight: 800;
}

.login-brand .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 15px;
}

.login-heading {
    margin-bottom: 25px;
}

.login-heading h1 {
    margin: 2px 0 6px;
    font-family:
        "Noto Serif TC",
        "PMingLiU",
        Georgia,
        serif;
    font-size: 30px;
}

.login-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-note {
    margin: 25px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* =========================================================
   研究歷程示意頁與寫作頁
   ========================================================= */

.trace-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.trace-grid article {
    position: relative;
    min-height: 210px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.trace-grid h2 {
    margin: 24px 0 8px;
    font-family:
        "Noto Serif TC",
        "PMingLiU",
        Georgia,
        serif;
    font-size: 20px;
}

.trace-grid p {
    min-height: 68px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.trace-grid strong {
    color: var(--blue-dark);
    font-size: 13px;
}

.trace-index {
    position: absolute;
    top: 18px;
    right: 20px;
    color: #d8e1ff;
    font-family: Georgia, serif;
    font-size: 34px;
    font-weight: 700;
}

.writing-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
    gap: 18px;
}

.writing-reference {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.reference-list {
    margin: 0;
    padding-left: 22px;
    color: #565f73;
}

.reference-list li {
    margin-bottom: 9px;
}

.concept-preview a {
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.mini-map {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    padding-top: 8px;
}

.mini-map span {
    grid-column: 1 / -1;
    justify-self: center;
    padding: 9px 16px;
    border-radius: 8px;
    background: var(--blue);
    color: #ffffff;
    font-weight: 800;
}

.mini-map i {
    padding: 8px 6px;
    border: 1px solid #9ab0ed;
    border-radius: 8px;
    background: var(--surface);
    color: #555f73;
    font-size: 12px;
    font-style: normal;
    text-align: center;
}

.writing-editor {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.writing-title {
    font-size: 20px;
    font-weight: 800;
}

.writing-editor textarea {
    min-height: 450px;
    font:
        17px/1.9
        "Noto Serif TC",
        "PMingLiU",
        Georgia,
        serif;
}

/* =========================================================
   響應式版面
   ========================================================= */

@media (max-width: 1120px) {
    .topbar-inner {
        min-height: 72px;
        flex-wrap: wrap;
        gap: 10px 20px;
        padding: 12px 0;
    }

    .topnav {
        order: 3;
        width: 100%;
        flex-basis: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .account-menu {
        margin-left: auto;
    }

    .metric-grid,
    .trace-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card-grid,
    .week-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-layout,
    .review-grid,
    .work-layout,
    .feedback-layout,
    .current-week,
    .reading-layout,
    .selection-layout,
    .writing-layout {
        grid-template-columns: 1fr;
    }

    .reading-layout {
        height: auto;
    }

    .reading-layout > * {
        min-height: 480px;
    }

    .selection-pane {
        position: static;
        max-height: none;
    }

    .current-week {
        gap: 18px;
    }

    .mindmap-canvas {
        height: 520px;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 15px;
    }

    .page-shell,
    .messages {
        width: calc(100% - 24px);
    }

    .page-shell {
        margin-top: 20px;
        margin-bottom: 42px;
    }

    .topbar-inner {
        width: calc(100% - 24px);
    }

    .brand small,
    .account-text {
        display: none;
    }

    .brand strong {
        font-size: 14px;
    }

    .account-menu {
        padding-left: 10px;
    }

    .topnav a {
        padding: 8px 10px;
        font-size: 13px;
    }

    .page-heading,
    .activity-header,
    .panel-title,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-heading,
    .activity-header {
        padding: 21px 20px;
    }

    .page-heading > .button,
    .activity-header > .button {
        width: 100%;
    }

    .panel {
        padding: 19px;
    }

    .form-grid,
    .metric-grid,
    .card-grid,
    .week-list,
    .trace-grid {
        grid-template-columns: 1fr;
    }

    .form-panel {
        max-width: none;
    }

    .chat-form {
        align-items: stretch;
        flex-direction: column;
    }

    .speech-rate {
        width: 100%;
        margin-left: 0;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px 18px;
    }

    .mindmap-toolbar {
        flex-wrap: wrap;
    }

    .mindmap-toolbar span {
        width: 100%;
        order: 3;
    }

    .login-card {
        padding: 28px 22px;
    }
}

@media (max-width: 480px) {
    .brand-text {
        display: none;
    }

    .topbar-inner {
        gap: 9px;
    }

    .account-menu {
        border-left: 0;
    }

    .speech-reader-controls .button {
        flex: 1;
    }

    .outline-row {
        grid-template-columns: 36px 1fr;
    }

    .outline-row .button,
    .outline-row button {
        grid-column: 1 / -1;
    }
}

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

/* =========================================================
   各功能頁既有專用樣式
   ========================================================= */

.rag-project-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rag-project-card {
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.rag-project-card h3 {
    margin: 0;
}

.rag-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 15px 0;
}

.rag-details div {
    min-width: 0;
}

.rag-details dt {
    color: var(--muted);
    font-size: 12px;
}

.rag-details dd {
    margin: 2px 0;
    overflow-wrap: anywhere;
}

.status.ready {
    background: var(--green-soft);
    color: var(--green);
}

.status.pending,
.status.indexing {
    background: var(--amber-soft);
    color: var(--amber);
}

.status.failed {
    background: #fee2e2;
    color: var(--red);
}

.form-note {
    margin-top: 18px;
}

.button-row form {
    display: inline-flex;
}

.reading-article,
.reading-assistant {
    overflow: auto;
}

.reading-assistant {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.article-content {
    font:
        17px/1.9
        "Noto Serif TC",
        "PMingLiU",
        serif;
}

.article-paragraph {
    position: relative;
    margin: 0 0 1.25em;
    padding-left: 36px;
    scroll-margin-top: 90px;
}

.article-paragraph:target {
    padding-top: 8px;
    padding-bottom: 8px;
    background: var(--blue-soft);
    border-radius: 8px;
}

.paragraph-number {
    position: absolute;
    top: 3px;
    left: 0;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    font:
        700 11px/1
        system-ui;
}

.rag-selector {
    margin-bottom: 2px;
}

.reading-assistant .chat-log {
    min-height: 260px;
}

.chat-message.assistant {
    align-self: flex-start;
    white-space: pre-wrap;
}

.chat-citations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.chat-citations a {
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
}

.reading-assistant .form-error {
    margin: 0;
}

.selectable-paragraph {
    position: relative;
    padding-left: 36px;
    margin-bottom: 20px;
}

.selectable-paragraph .paragraph-text {
    margin: 0;
}

.selection-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selection-item p {
    margin: 6px 0;
}

.previous-submission {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.previous-submission h3 {
    margin-bottom: 4px;
}

.previous-submission ul {
    padding-left: 20px;
}
.ai-generation-panel {
    display: grid;
    grid-template-columns: 1fr minmax(300px, 420px);
    align-items: end;
    gap: 18px;
    margin-bottom: 18px;
}

.ai-generation-panel h2 {
    margin-bottom: 4px;
}

.ai-generation-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.ai-generation-form label {
    flex: 1;
}

.form-warning {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--amber);
    font-size: 12px;
}

.generation-status-panel {
    margin-bottom: 18px;
}

.generation-status-panel > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reference-comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.reference-span-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reference-span {
    padding: 13px;
    border-radius: 9px;
}

.reference-span p {
    margin: 5px 0 0;
}

.teacher-reference {
    background: #fef3c7;
    border-left: 4px solid #d97706;
}

.ai-reference {
    background: #dbeafe;
    border-left: 4px solid var(--blue);
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.keyword-list span {
    padding: 3px 8px;
    border-radius: 999px;
    background: white;
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
}

.status.generating {
    background: var(--amber-soft);
    color: var(--amber);
}

.status.reviewed {
    background: var(--green-soft);
    color: var(--green);
}

@media (max-width: 900px) {
    .ai-generation-panel,
    .reference-comparison-grid {
        grid-template-columns: 1fr;
    }

    .ai-generation-form {
        align-items: stretch;
        flex-direction: column;
    }
}

.button.danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: #be123c;
}

.button.danger:hover {
    border-color: #fb7185;
    background: #ffe4e6;
}

.teacher-week-table table {
    min-width: 1050px;
}

.teacher-week-actions,
.graph-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.graph-button {
    border-color: #c4b5fd;
    color: #6d28d9;
}

.graph-metric-grid {
    margin-bottom: 1.25rem;
}

.graph-management-grid,
.graph-lower-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.graph-status-details {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin: 0 0 1rem;
}

.graph-status-details div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #e2e8f0;
}

.graph-status-details dt {
    color: #64748b;
}

.graph-status-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.graph-warning,
.graph-prerequisite {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #fde68a;
    border-radius: 0.7rem;
    background: #fffbeb;
    color: #92400e;
}

.graph-prerequisite p {
    margin: 0.35rem 0 0.8rem;
}

.graph-stage-note {
    margin: 1rem 0 0;
}

.status.building,
.status.running {
    background: #e0e7ff;
    color: #2949b8;
}

.status.succeeded {
    background: var(--green-soft);
    color: var(--green);
}

.status.skipped {
    background: #f1f5f9;
    color: #475569;
}

.kg-rag-status-panel {
    margin-bottom: 1.25rem;
    border-color: #c4b5fd;
    background: #f7f9ff;
}

.rag-index-history {
    margin-top: 1.25rem;
}

.chat-retrieval-mode {
    display: inline-flex;
    width: fit-content;
    margin-top: 0.55rem;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: #ede9fe;
    color: #6d28d9;
    font-size: 0.72rem;
    font-weight: 750;
}

.graph-preview-panel {
    margin-bottom: 1.25rem;
}

.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.graph-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #64748b;
    font-size: 0.78rem;
}

.graph-legend i {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
}

.graph-legend .week {
    background: #7c3aed;
}

.graph-legend .article {
    background: #2563eb;
}

.graph-legend .paragraph {
    background: #0f766e;
}

.graph-legend .concept {
    background: #d97706;
}

.knowledge-graph-canvas {
    width: 100%;
    max-height: 720px;
    overflow: auto;
    border: 1px solid #cbd7fb;
    border-radius: 0.8rem;
    background:
        radial-gradient(#cbd7fb 1px, transparent 1px),
        #fafaff;
    background-size: 22px 22px;
}

#knowledge-graph-svg {
    display: block;
    width: 100%;
    min-width: 950px;
    min-height: 560px;
}

.graph-edge {
    stroke: #94a3b8;
    stroke-width: 1.4;
    opacity: 0.62;
}

.graph-edge.mentions {
    stroke: #f59e0b;
}

.graph-edge.co_occurs {
    stroke: #a78bfa;
    stroke-dasharray: 6 4;
}

.graph-arrow {
    fill: #64748b;
}

.graph-node {
    cursor: pointer;
    outline: none;
}

.graph-node rect {
    stroke-width: 2;
    filter: drop-shadow(0 3px 4px rgb(15 23 42 / 12%));
}

.graph-node text {
    fill: #ffffff;
    font-size: 13px;
    font-weight: 750;
    text-anchor: middle;
    pointer-events: none;
}

.graph-node-week rect {
    fill: #7c3aed;
    stroke: #2949b8;
}

.graph-node-article rect {
    fill: #2563eb;
    stroke: #1d4ed8;
}

.graph-node-paragraph rect {
    fill: #0f766e;
    stroke: #115e59;
}

.graph-node-concept rect {
    fill: #d97706;
    stroke: #b45309;
}

.graph-node.selected rect,
.graph-node:focus rect {
    stroke: #111827;
    stroke-width: 4;
}

.graph-node-detail {
    max-height: 260px;
    margin: 0.8rem 0 0;
    overflow: auto;
    padding: 0.9rem;
    border-radius: 0.65rem;
    background: #111827;
    color: #e5e7eb;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.graph-run-error {
    color: #b91c1c;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .graph-management-grid,
    .graph-lower-grid {
        grid-template-columns: 1fr;
    }

    .graph-preview-panel .panel-title {
        align-items: flex-start;
        flex-direction: column;
    }
}
.review-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.review-selection {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-span-block {
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.review-span-block p {
    margin: 0 0 8px;
}
.submission-information {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.submission-information p {
    margin: 0.35rem 0 0;
}

.feedback-overview {
    margin-bottom: 1.25rem;
}

.feedback-keywords {
    margin-top: 1rem;
}

.feedback-message {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border-left: 4px solid #4f46e5;
    border-radius: 0.5rem;
    background: var(--blue-soft);
    color: #312e81;
    line-height: 1.7;
}

.highlight-feedback-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
}

.student-submitted-span {
    border-left: 4px solid #4f6fe5;
}

.feedback-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.feedback-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.feedback-legend i {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 999px;
}

.feedback-legend i.complete {
    background: #22c55e;
}

.feedback-legend i.partial {
    background: #f59e0b;
}

.feedback-legend i.missed {
    background: #ef4444;
}

.feedback-reference {
    border-left: 4px solid transparent;
}

.feedback-reference.complete {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

.feedback-reference.partial {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.feedback-reference.missed {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.feedback-reference-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.feedback-status {
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.feedback-status.complete {
    background: #dcfce7;
    color: #166534;
}

.feedback-status.partial {
    background: #fef3c7;
    color: #92400e;
}

.feedback-status.missed {
    background: #fee2e2;
    color: #991b1b;
}

.page-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

@media (max-width: 900px) {
    .highlight-feedback-grid {
        grid-template-columns: 1fr;
    }
}
.outline-keyword-panel {
    margin-bottom: 1.25rem;
}

.outline-editor-panel {
    min-height: 24rem;
}

.outline-node-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.outline-editor-node {
    margin-left: calc(
        (var(--outline-level) - 1) * 1.5rem
    );
    padding: 1rem;
    border: 1px solid #cbd7fb;
    border-left: 4px solid #4f6fe5;
    border-radius: 0.75rem;
    background: #ffffff;
}

.outline-node-heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.outline-level-label {
    display: inline-flex;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: #ede9fe;
    color: #2949b8;
    font-size: 0.8rem;
    font-weight: 700;
}

.outline-node-input {
    width: 100%;
    min-height: 4.5rem;
    resize: vertical;
}

.outline-node-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.outline-editor-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.submitted-outline {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.submitted-outline-node {
    margin-left: calc(
        (var(--outline-level) - 1) * 1.5rem
    );
    padding: 0.85rem 1rem;
    border-left: 4px solid #4f6fe5;
    border-radius: 0.5rem;
    background: #f8fafc;
}

.submitted-outline-node p {
    margin: 0.45rem 0 0;
    line-height: 1.7;
}

@media (max-width: 700px) {
    .outline-editor-node,
    .submitted-outline-node {
        margin-left: calc(
            (var(--outline-level) - 1) * 0.6rem
        );
    }

    .outline-editor-actions {
        flex-direction: column;
    }

    .outline-editor-actions .button {
        width: 100%;
    }
}
.concept-outline-reference {
    margin-bottom: 1.25rem;
}

.outline-reference-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.outline-reference-item {
    margin-left: calc(
        (var(--outline-level) - 1) * 1.25rem
    );
    padding: 0.65rem 0.8rem;
    border-left: 3px solid #6c83ec;
    background: #f8fafc;
}

.submitted-map-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.concept-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.concept-toolbar label {
    flex: 1;
}

.concept-canvas-panel {
    margin-bottom: 1.25rem;
}

.concept-canvas {
    position: relative;
    width: 100%;
    min-height: 600px;
    overflow: hidden;
    border: 1px solid #cbd7fb;
    border-radius: 0.75rem;
    background:
        linear-gradient(#eef2ff 1px, transparent 1px),
        linear-gradient(90deg, #eef2ff 1px, transparent 1px),
        #ffffff;
    background-size: 24px 24px;
    touch-action: none;
}

.concept-edge-layer,
.concept-node-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.concept-edge-layer {
    pointer-events: none;
}

.concept-edge-layer line {
    stroke: #4f6fe5;
    stroke-width: 2.5;
    vector-effect: non-scaling-stroke;
}

.concept-edge-layer text {
    fill: #2949b8;
    font-size: 15px;
    font-weight: 700;
    text-anchor: middle;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 5px;
}

.concept-node {
    position: absolute;
    z-index: 2;
    min-width: 110px;
    max-width: 190px;
    padding: 0.75rem 1rem;
    transform: translate(-50%, -50%);
    border: 2px solid #6c83ec;
    border-radius: 0.75rem;
    background: #ffffff;
    color: #312e81;
    font-weight: 700;
    box-shadow: 0 5px 14px rgb(79 70 229 / 15%);
    cursor: grab;
}

.concept-node:active {
    cursor: grabbing;
}

.concept-node.selected {
    border-color: #2949b8;
    background: #ede9fe;
    box-shadow: 0 0 0 4px rgb(99 102 241 / 18%);
}

.concept-empty-state {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #64748b;
    pointer-events: none;
}

.concept-control-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.edge-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.concept-edge-items {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.concept-edge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    background: #f8fafc;
}

@media (max-width: 850px) {
    .concept-control-grid,
    .edge-form {
        grid-template-columns: 1fr;
    }

    .concept-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .concept-canvas {
        min-height: 480px;
    }
}
.assignment-editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.assignment-question-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assignment-question-form {
    display: grid;
    grid-template-columns:
        100px
        minmax(0, 1fr)
        minmax(0, 1fr)
        auto;
    align-items: end;
    gap: 1rem;
}

.assignment-question-form textarea {
    width: 100%;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.table-actions form {
    margin: 0;
}

@media (max-width: 750px) {
    .assignment-question-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}
.assignment-question-list,
.submitted-answer-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.assignment-answer-item textarea {
    width: 100%;
    resize: vertical;
}

.assignment-question-text {
    margin-bottom: 1rem;
    color: #1e293b;
    font-size: 1.05rem;
    line-height: 1.8;
}

.submitted-answer-item {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
}

.submitted-answer-text {
    margin-top: 0.75rem;
    padding: 1rem;
    border-left: 4px solid #4f6fe5;
    background: #ffffff;
    line-height: 1.8;
}
.hint-request-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #cbd7fb;
    border-radius: 0.75rem;
    background: #f7f9ff;
}

.hint-request-panel .button {
    margin-top: 0.75rem;
}

.hint-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hint-record {
    padding: 0.9rem 1rem;
    border-left: 4px solid #4f6fe5;
    border-radius: 0.5rem;
    background: var(--blue-soft);
}

.hint-record strong {
    color: #2949b8;
}

.hint-record p {
    margin: 0.45rem 0 0;
    line-height: 1.75;
}

.submitted-hints {
    margin-top: 1rem;
}

.submitted-hints summary {
    color: #2949b8;
    font-weight: 700;
    cursor: pointer;
}

.metric-duration {
    font-size: clamp(1.15rem, 2vw, 1.65rem) !important;
}

.research-method-note {
    margin-bottom: 1.25rem;
}

.research-method-note h2 {
    margin-top: 0;
}

.research-method-note p {
    margin-bottom: 0;
    line-height: 1.8;
}

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

.research-table-wrap table {
    min-width: 1160px;
}

.table-note {
    display: block;
    margin-top: 0.3rem;
    color: #64748b;
}

.research-heading-actions {
    margin: 0;
}

.research-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.completion-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.completion-checklist li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #f8fafc;
}

.completion-checklist li strong {
    color: #b45309;
}

.completion-checklist li.complete {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.completion-checklist li.complete strong {
    color: #15803d;
}

.compact-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.compact-metrics article {
    padding: 0.9rem;
    border-radius: 0.65rem;
    background: var(--blue-soft);
}

.compact-metrics span,
.compact-metrics strong {
    display: block;
}

.compact-metrics span {
    color: #64748b;
    font-size: 0.8rem;
}

.compact-metrics strong {
    margin-top: 0.35rem;
    color: #2949b8;
    font-size: 1.25rem;
}

.metric-evidence {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 1rem;
    margin: 1rem 0 0;
}

.metric-evidence div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.4rem;
}

.metric-evidence dt {
    color: #64748b;
}

.metric-evidence dd {
    margin: 0;
    font-weight: 700;
}

.manual-score-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.checkbox-label input {
    width: auto;
}

.artifact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.artifact-grid article,
.assignment-research-list details {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
}

.artifact-grid h3,
.artifact-grid p {
    margin-top: 0;
}

.assignment-research-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.assignment-research-list summary {
    color: #2949b8;
    font-weight: 700;
    cursor: pointer;
}

.research-answer-item {
    margin-top: 0.8rem;
    padding: 0.85rem;
    border-left: 3px solid #6c83ec;
    background: #ffffff;
}

.research-answer-item p {
    line-height: 1.7;
}

.event-data {
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .research-detail-grid,
    .artifact-grid,
    .score-grid {
        grid-template-columns: 1fr;
    }

    .compact-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}