:root {
    --ink: #243538;
    --muted: #657477;
    --line: #d3dbd5;
    --line-dark: #aebbb5;
    --paper: #f6f7f2;
    --paper-deep: #e9eee8;
    --white: #fcfcf8;
    --accent: #537d78;
    --accent-dark: #315e5c;
    --accent-pale: #dfeae5;
    --navy: #294547;
    --warning: #9a614c;
    --warning-pale: #f2e5de;
    --success: #3f7561;
    --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.65;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
    min-height: 62px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navy);
    color: #f4f7f2;
    border-bottom: 1px solid #1e393a;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; font-weight: 650; letter-spacing: .03em; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #9bb8b2;
    color: #d9e8e1;
    font-size: 12px;
    letter-spacing: .08em;
}
.header-nav { display: flex; align-items: center; gap: 20px; }
.header-nav a, .header-nav .link-button { color: #d8e3df; font-size: 14px; }
.header-nav form { margin: 0; }
.user-name { color: #fff; font-weight: 600; }
.link-button { padding: 0; border: 0; background: transparent; cursor: pointer; }

.site-main { max-width: 1440px; margin: 0 auto; padding: 42px 42px 64px; }
.rating-main { max-width: 1680px; padding: 24px 30px 56px; }
.message-stack { max-width: 1440px; margin: 14px auto 0; padding: 0 42px; }
.message { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-pale); }
.message-error { border-color: var(--warning); background: var(--warning-pale); }
.message-success { border-color: var(--success); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 42px); line-height: 1.2; letter-spacing: -.02em; font-weight: 650; }
h2 { margin-bottom: 10px; font-size: 23px; line-height: 1.3; font-weight: 650; }
.eyebrow { margin-bottom: 9px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .16em; }
.quiet { color: var(--muted); }

.primary-button, .secondary-button, .warning-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 17px;
    border: 1px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    font-weight: 650;
    line-height: 1.2;
}
.primary-button { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }
.primary-button:hover { background: #264e4c; text-decoration: none; }
.primary-button:disabled { cursor: not-allowed; opacity: .48; }
.secondary-button { background: transparent; color: var(--ink); border-color: var(--line-dark); }
.secondary-button:hover { background: var(--paper-deep); text-decoration: none; }
.warning-button { background: var(--warning); color: #fff; }
.wide { width: 100%; }

/* Login: flat editorial split, not a floating card. */
.login-main { max-width: none; min-height: calc(100vh - 62px); padding: 0; }
.login-layout { min-height: calc(100vh - 62px); display: grid; grid-template-columns: 1.15fr .85fr; }
.login-intro {
    padding: clamp(58px, 9vw, 130px) clamp(40px, 9vw, 150px);
    background: #e7ede7;
    border-right: 1px solid var(--line);
}
.login-intro h1 { max-width: 700px; font-size: clamp(38px, 5vw, 66px); line-height: 1.15; }
.login-intro > p:not(.eyebrow) { max-width: 620px; font-size: 17px; color: #536365; }
.login-rule { width: 72px; margin: 36px 0 22px; border-top: 2px solid var(--accent); }
.login-form-area { display: grid; place-items: center; padding: 50px; background: var(--paper); }
.login-form { width: min(420px, 100%); }
.login-form h2 { margin-bottom: 30px; font-size: 27px; }
.login-form label, .stack-form label, .issue-report label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 650; }
.login-form input, .stack-form input, .task-toolbar input, .issue-report select, .issue-report textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line-dark);
    border-radius: 2px;
    background: var(--white);
    color: var(--ink);
    outline: none;
}
.login-form input:focus, .stack-form input:focus, .task-toolbar input:focus, .issue-report select:focus, .issue-report textarea:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 2px rgba(49,94,92,.12); }
.login-form .primary-button { margin-top: 25px; }
.form-error, .stack-form .errorlist { color: #8b4737; }

.narrow-page { max-width: 620px; margin: 50px auto; }
.stack-form { margin-top: 30px; padding-top: 8px; border-top: 1px solid var(--line); }
.stack-form .helptext { display: block; color: var(--muted); font-size: 13px; }
.stack-form .primary-button { margin-top: 20px; }

.training-banner {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 11px 15px;
    background: #e5ece3;
    border-top: 1px solid #bdcabf;
    border-bottom: 1px solid #bdcabf;
    color: #3d5548;
}
.training-banner em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--warning); }
.training-banner.compact { margin-bottom: 18px; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.metric { padding: 24px 18px; color: var(--ink); border-right: 1px solid var(--line); }
.metric:first-child { padding-left: 0; }
.metric:last-child { border-right: 0; }
.metric:hover { background: rgba(223,234,229,.55); text-decoration: none; }
.metric span { display: block; font-size: 31px; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); }
.metric.issue span { color: var(--warning); }

.task-section { margin-top: 30px; }
.task-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.task-toolbar input { max-width: 390px; background: transparent; }
.task-toolbar a { margin-left: 5px; font-size: 13px; }
.task-table-wrap { overflow-x: auto; border-top: 2px solid var(--navy); }
.task-table { width: 100%; border-collapse: collapse; background: rgba(252,252,248,.45); }
.task-table th { padding: 11px 13px; text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line-dark); white-space: nowrap; }
.task-table td { padding: 14px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.task-table tbody tr:hover { background: #edf1ec; }
.task-table td small { display: block; color: var(--muted); }
.task-number { color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.progress-fraction { font-size: 12px; color: var(--muted); }
.mini-progress { width: 92px; height: 3px; margin-top: 5px; background: #dce2dd; overflow: hidden; }
.mini-progress i { display: block; height: 100%; background: var(--accent); }
.status { display: inline-block; font-size: 12px; font-weight: 650; }
.status-completed { color: var(--success); }
.status-in_progress { color: #597272; }
.status-not_started { color: var(--muted); }
.status-video_issue { color: var(--warning); }
.lock-label { margin-left: 7px; padding-left: 7px; border-left: 1px solid var(--line-dark); color: var(--warning); font-size: 11px; }
.row-link { font-weight: 650; white-space: nowrap; }
.empty-row { padding: 45px !important; text-align: center; color: var(--muted); }

.task-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 2px 0 18px; border-bottom: 1px solid var(--line-dark); }
.task-identity { display: grid; grid-template-columns: auto auto; align-items: center; gap: 3px 16px; }
.task-identity h1 { grid-column: 1 / -1; margin: 3px 0 0; font-size: 32px; }
.task-identity p { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.back-link, .task-sequence { font-size: 12px; font-weight: 650; letter-spacing: .04em; }
.task-sequence { color: var(--muted); }
.leader-navigation { display: flex; gap: 9px; }

.trait-tabs { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line-dark); background: #edf1eb; }
.trait-tab { min-width: 0; padding: 12px 11px 10px; color: var(--ink); border-right: 1px solid var(--line); border-top: 3px solid transparent; }
.trait-tab:last-child { border-right: 0; }
.trait-tab:hover { background: var(--accent-pale); text-decoration: none; }
.trait-tab.active { background: var(--white); border-top-color: var(--accent-dark); }
.trait-tab.done strong { color: var(--success); }
.trait-tab span { display: block; color: #83918d; font-size: 10px; letter-spacing: .08em; }
.trait-tab strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.trait-tab small { color: var(--muted); font-size: 11px; }

.rating-workspace { display: grid; grid-template-columns: minmax(460px, .92fr) minmax(560px, 1.08fr); min-height: 680px; border-bottom: 1px solid var(--line-dark); }
.video-pane { align-self: start; position: sticky; top: 0; padding: 24px 26px 35px 0; border-right: 1px solid var(--line-dark); }
.video-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 12px; }
.video-heading h2 { margin: 0; font-size: 18px; }
.video-heading span { color: var(--muted); font-size: 12px; }
.video-frame { background: #172323; border: 1px solid #152020; }
.video-frame #leader-video { display: block; width: 100%; height: auto; min-height: 300px; max-height: 62vh; aspect-ratio: 16/9; background: #111; }
.video-frame video { display: block; width: 100%; height: 100%; background: #111; }
.video-loading { height: 100%; display: grid; place-items: center; color: #d8e3df; font-size: 14px; }
.video-loading.failed { color: #f0c7b8; }
.video-frame .prism-download, .video-frame [class*="download"] { display: none !important; }
.video-controls-extra { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.video-controls-extra > span { color: var(--muted); font-size: 12px; }
.speed-buttons { display: flex; }
.speed-buttons button { padding: 5px 8px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.speed-buttons button:first-child { border-left: 0; }
.speed-buttons button.active { color: var(--accent-dark); font-weight: 750; background: var(--accent-pale); }
.video-error { margin: 12px 0 0; padding: 8px 10px; color: #713d31; background: var(--warning-pale); border-left: 3px solid var(--warning); font-size: 13px; }
.issue-report { margin-top: 14px; border-bottom: 1px solid var(--line); }
.issue-report summary { padding: 8px 0 10px; color: var(--warning); cursor: pointer; font-size: 13px; font-weight: 650; }
.issue-report form { padding: 4px 0 18px; }
.issue-report .warning-button { margin-top: 13px; }

.scale-pane { min-width: 0; padding: 25px 0 0 28px; background: rgba(252,252,248,.54); }
.scale-heading { display: flex; justify-content: space-between; gap: 30px; padding: 0 12px 16px 0; border-bottom: 1px solid var(--line); }
.scale-heading > div:first-child { min-width: 0; }
.scale-heading h2 { margin-bottom: 5px; font-size: 27px; }
.scale-heading .scale-definition { margin: 8px 0 5px; color: #3f5052; font-size: 14px; line-height: 1.7; }
.scale-heading .scale-instructions { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.save-state { flex: none; align-self: flex-start; padding: 5px 8px; color: var(--success); border-bottom: 1px solid #a8c2b5; font-size: 12px; }
.save-state.saving { color: var(--muted); border-color: var(--line-dark); }
.save-state.error { color: var(--warning); border-color: var(--warning); }
.scale-legend { display: grid; grid-template-columns: repeat(var(--score-count), minmax(36px, 1fr)); width: calc(100% - 44px); margin-left: 32px; margin-right: 12px; padding: 12px 1px; color: #3f5052; font-size: 15px; font-weight: 650; border-bottom: 1px solid var(--line); }
.scale-legend span { min-width: 0; white-space: nowrap; }
.scale-legend span:first-child { grid-column: 1; justify-self: center; text-align: center; }
.scale-legend span:last-child { grid-column: -2; justify-self: center; text-align: center; }
.question-list { padding-right: 12px; }
.question-row { margin: 0; padding: 17px 0 18px; border: 0; border-bottom: 1px solid var(--line); }
.question-row legend { width: 100%; display: flex; gap: 11px; padding: 0 0 11px; color: #28383b; font-weight: 560; line-height: 1.55; }
.question-row legend > span { flex: none; color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .06em; }
.question-row legend small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
.question-row.missing { background: linear-gradient(90deg, rgba(242,229,222,.95), transparent 76%); }
.question-row.missing legend { color: #7a4034; }
.score-options { display: grid; grid-template-columns: repeat(var(--score-count), minmax(36px, 1fr)); width: calc(100% - 44px); margin-left: 32px; margin-right: 12px; border: 1px solid var(--line-dark); }
.score-choice { position: relative; min-width: 0; text-align: center; border-right: 1px solid var(--line); cursor: pointer; }
.score-choice:last-child { border-right: 0; }
.score-choice input { position: absolute; opacity: 0; pointer-events: none; }
.score-choice span { display: block; padding: 7px 4px; color: var(--muted); background: rgba(255,255,255,.28); }
.score-choice:hover span { background: var(--accent-pale); color: var(--accent-dark); }
.score-choice input:checked + span { background: var(--accent-dark); color: #fff; font-weight: 750; }
.score-choice input:focus-visible + span { outline: 2px solid #82a9a2; outline-offset: -2px; }
.score-choice input:disabled + span { cursor: default; }

.scale-footer { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-left: -28px; padding: 15px 12px 15px 28px; background: rgba(246,247,242,.96); border-top: 1px solid var(--line-dark); }
.scale-footer-right { display: flex; align-items: center; gap: 16px; }
.scale-footer-right > span { color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
    .site-main, .rating-main { padding-left: 22px; padding-right: 22px; }
    .rating-workspace { grid-template-columns: 1fr; }
    .video-pane { position: static; padding-right: 0; border-right: 0; border-bottom: 1px solid var(--line-dark); }
    .video-frame #leader-video { max-height: 520px; }
    .scale-pane { padding-left: 0; }
    .scale-footer { margin-left: 0; padding-left: 0; }
    .trait-tabs { grid-template-columns: repeat(4, 1fr); }
    .trait-tab { border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
    .site-header { padding: 0 16px; }
    .brand > span:last-child, .user-name { display: none; }
    .site-main, .rating-main { padding: 22px 15px 45px; }
    .message-stack { padding: 0 15px; }
    .login-layout { grid-template-columns: 1fr; }
    .login-intro { padding: 45px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
    .login-intro h1 { font-size: 38px; }
    .login-form-area { padding: 45px 24px 65px; }
    .page-heading, .task-header { align-items: flex-start; flex-direction: column; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .metric { border-bottom: 1px solid var(--line); }
    .metric:first-child { padding-left: 18px; }
    .task-toolbar { align-items: stretch; flex-wrap: wrap; }
    .task-toolbar input { max-width: none; flex: 1 1 100%; }
    .training-banner { grid-template-columns: 1fr; gap: 3px; }
    .leader-navigation { width: 100%; }
    .leader-navigation > * { flex: 1; }
    .trait-tabs { grid-template-columns: repeat(2, 1fr); }
    .video-heading { display: block; }
    .video-controls-extra { align-items: flex-start; flex-direction: column; }
    .scale-heading { flex-direction: column; gap: 8px; }
    .save-state { align-self: flex-end; }
    .scale-legend, .score-options { width: 100%; margin-left: 0; margin-right: 0; }
    .scale-footer { align-items: stretch; flex-direction: column; }
    .scale-footer-right { align-items: stretch; flex-direction: column; }
    .scale-footer .primary-button, .scale-footer .secondary-button { width: 100%; }
}
