:root {
    color-scheme: light;
    --navy: #193656;
    --ink: #203044;
    --muted: #788493;
    --line: #e2e7eb;
    --paper: #fff;
    --canvas: #f7f5ef;
    --green: #22a979;
    --green-dark: #16835d;
    --green-pale: #e9f7f1;
    font-family: "DM Sans", sans-serif;
}

* { box-sizing: border-box; }

body {
    min-width: 320px;
    margin: 0;
    padding-bottom: 94px;
    background: var(--canvas);
    color: var(--ink);
}

button, input { font: inherit; }
button { color: inherit; }

.topbar {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(20px, 5vw, 72px);
    background: var(--navy);
    color: white;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-family: Manrope, sans-serif;
    font-size: 19px;
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 9px;
    background: var(--green);
    font-size: 17px;
}

.brand-light { font-weight: 500; }
.top-links { display: flex; align-items: center; gap: 20px; font-size: 13px; }
.top-links a { color: #e8eef5; text-underline-offset: 3px; }
.demo-label { padding: 6px 10px; border: 1px solid #536a82; border-radius: 20px; color: #d3e2ef; font-size: 11px; }

.training-shell { max-width: 1440px; margin: 0 auto; padding: 22px clamp(16px, 3vw, 42px) 36px; }
.breadcrumbs { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.breadcrumbs a { color: var(--navy); text-underline-offset: 3px; }
.training-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr) 220px; align-items: start; gap: 22px; }
.lesson-sidebar, .exercise-card, .stat-card, .live-card { border: 1px solid var(--line); border-radius: 9px; background: var(--paper); box-shadow: 0 3px 12px rgb(25 54 86 / 4%); }

.lesson-sidebar { overflow: hidden; }
.course-heading { padding: 21px 18px 17px; }
.eyebrow { margin: 0; color: var(--green-dark); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.course-heading h2 { margin: 8px 0 5px; font-family: Manrope, sans-serif; font-size: 17px; line-height: 1.3; }
.course-heading > p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.lesson-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.lesson-item { display: flex; width: 100%; min-height: 61px; align-items: center; gap: 10px; padding: 9px 13px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; }
.lesson-item.is-active { border-left: 3px solid var(--green); background: #f5fbf8; }
.lesson-number { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 50%; background: #f0f3f5; color: #697786; font-size: 10px; font-weight: 700; }
.is-active .lesson-number { background: var(--green); color: white; }
.lesson-name { min-width: 0; flex: 1; color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.35; }
.lesson-name small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 400; }
.lesson-state { color: var(--green); font-size: 11px; }
.is-upcoming .lesson-name { color: #647180; font-weight: 500; }
.lock-icon { color: #a4adb7; font-size: 16px; }
.sidebar-note { margin: 0; padding: 14px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.lesson-workspace { min-width: 0; }
.lesson-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 2px 0 16px; }
.lesson-header .eyebrow { display: flex; align-items: center; gap: 8px; }
.lesson-header h1 { margin: 7px 0 0; color: var(--navy); font-family: Manrope, sans-serif; font-size: clamp(22px, 2vw, 28px); letter-spacing: -.03em; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #d9f3e8; }
.lesson-progress { width: min(185px, 38%); padding-bottom: 3px; color: #647180; font-size: 11px; text-align: right; }
.progress-track { height: 7px; overflow: hidden; margin-top: 7px; border-radius: 10px; background: #e7ebee; }
.progress-track span { display: block; width: 50%; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s ease; }

.exercise-card { padding: clamp(18px, 2.4vw, 30px); }
.exercise-copy { margin-bottom: 20px; }
.step-label { color: var(--green-dark); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.exercise-copy h2 { margin: 8px 0 9px; color: var(--navy); font-family: Manrope, sans-serif; font-size: 19px; }
.exercise-copy > p:not(.task-feedback) { max-width: 680px; margin: 0; color: #465466; font-size: 14px; line-height: 1.7; }
.exercise-copy strong { color: var(--ink); }
.task-feedback { min-height: 20px; margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.task-feedback.is-correct { color: var(--green-dark); font-weight: 600; }
.task-feedback.is-incorrect { color: #b9473f; }

.spreadsheet { overflow: hidden; border: 1px solid #dfe4e8; border-radius: 5px; background: white; }
.sheet-toolbar { display: flex; min-height: 43px; align-items: center; gap: 10px; padding: 6px 9px; border-bottom: 1px solid #e5e9ec; }
.name-box { display: flex; min-width: 54px; justify-content: space-between; gap: 9px; padding: 5px 7px; border: 1px solid #e1e5e8; border-radius: 3px; color: #465466; font-size: 11px; }
.name-box span:last-child { color: #7f8a95; }
.fx-mark { color: #738090; font-family: Georgia, serif; font-size: 13px; font-style: italic; }
.formula-form { display: flex; min-width: 0; flex: 1; gap: 8px; }
.formula-form[hidden] { display: none; }
.formula-form input { width: 100%; min-width: 80px; height: 30px; padding: 4px 8px; border: 1px solid #dce2e6; border-radius: 4px; color: var(--ink); font-size: 11px; }
.formula-form input:focus { outline: 2px solid #9de0c4; border-color: var(--green); }
.formula-form button { flex: 0 0 auto; padding: 5px 10px; border: 0; border-radius: 4px; background: var(--green); color: white; font-size: 10px; font-weight: 700; cursor: pointer; }
.formula-hint { overflow: hidden; color: #89939d; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sheet-scroll { overflow-x: auto; }
.sheet-grid { display: grid; min-width: 420px; grid-template-columns: 34px minmax(145px, 1fr) minmax(130px, 1fr); }
.sheet-corner, .column-heading, .row-heading { display: grid; min-height: 29px; place-items: center; border-right: 1px solid #e0e5e9; border-bottom: 1px solid #e0e5e9; background: #f5f7f8; color: #697786; font-size: 10px; }
.sheet-cell { min-width: 0; min-height: 37px; padding: 7px 10px; border: 0; border-right: 1px solid #e0e5e9; border-bottom: 1px solid #e0e5e9; background: white; color: #465466; font-size: 11px; text-align: left; cursor: pointer; }
.sheet-cell:hover { background: #f3fbf7; }
.sheet-cell.is-heading { background: #f7faf8; color: #314356; font-weight: 700; }
.sheet-cell.is-selected { position: relative; z-index: 1; outline: 2px solid var(--green); outline-offset: -2px; background: #f7fffb; }
.sheet-cell.is-correct { background: #e4f6ed; color: var(--green-dark); font-weight: 700; }
.sheet-caption { margin: 0; padding: 9px 12px; border-top: 1px solid #eef0f2; color: #8a949d; font-size: 10px; }

.progress-sidebar { display: grid; gap: 13px; }
.stat-card { position: relative; padding: 18px 15px; border-left: 3px solid var(--green); }
.stat-icon { position: absolute; top: 14px; right: 14px; display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; background: var(--green-pale); color: var(--green-dark); font-size: 15px; }
.stat-card h2 { margin: 9px 0 6px; color: var(--green-dark); font-family: Manrope, sans-serif; font-size: 25px; }
.stat-card h2 small { color: #687584; font-family: "DM Sans", sans-serif; font-size: 11px; font-weight: 500; }
.stat-caption { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.streak-card .stat-icon { color: #d39236; background: #fff4e3; }
.live-card { padding: 16px; background: #f8fbfd; }
.live-card-label { display: inline-flex; align-items: center; gap: 8px; color: var(--green-dark); font-size: 10px; font-weight: 700; }
.live-card h2 { margin: 12px 0 6px; color: var(--navy); font-family: Manrope, sans-serif; font-size: 14px; }
.live-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

.action-bar { position: fixed; z-index: 3; right: 0; bottom: 0; left: 0; display: grid; min-height: 82px; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 12px clamp(20px, 5vw, 72px); background: var(--navy); color: white; }
.action-feedback { display: flex; align-items: center; gap: 9px; color: #d7e2ec; font-size: 13px; }
.feedback-check { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: var(--green); font-weight: 800; }
.feedback-check:not(:empty) { background: rgb(34 169 121 / 15%); }
.points-earned { color: #39ce94; font-weight: 700; }
.action-bar button { min-width: 154px; min-height: 44px; padding: 0 19px; border: 0; border-radius: 25px; background: var(--green); color: white; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .2s, transform .2s; }
.action-bar button:hover:not(:disabled) { transform: translateY(-1px); background: var(--green-dark); }
.action-bar button:disabled { background: #52677d; color: #c9d2dc; cursor: not-allowed; }
.keyboard-hint { color: #aebdcb; font-size: 10px; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

:focus-visible { outline: 3px solid #4dc99b; outline-offset: 3px; }

@media (max-width: 1050px) {
    .training-layout { grid-template-columns: 220px minmax(0, 1fr); }
    .progress-sidebar { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
    .lesson-sidebar { grid-row: span 2; }
}

@media (max-width: 700px) {
    body { padding-bottom: 108px; }
    .topbar { min-height: 58px; padding: 0 16px; }
    .brand { font-size: 16px; }
    .top-links { gap: 10px; font-size: 11px; }
    .demo-label { padding: 5px 7px; font-size: 9px; }
    .training-shell { padding: 16px 14px 24px; }
    .training-layout { grid-template-columns: 1fr; gap: 16px; }
    .lesson-sidebar { grid-row: auto; }
    .course-heading { padding: 15px 16px 12px; }
    .lesson-list { display: flex; overflow-x: auto; }
    .lesson-list li { min-width: 166px; flex: 1; }
    .lesson-item { min-height: 59px; padding: 8px; }
    .lesson-name { font-size: 10px; }
    .sidebar-note { padding: 9px 13px; }
    .lesson-header { align-items: start; }
    .lesson-progress { width: 115px; padding-top: 6px; font-size: 10px; }
    .exercise-card { padding: 17px 13px; }
    .exercise-copy > p:not(.task-feedback) { font-size: 13px; }
    .progress-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .live-card { grid-column: 1 / -1; }
    .stat-card { padding: 14px 12px; }
    .stat-card h2 { font-size: 21px; }
    .action-bar { min-height: 94px; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px; }
    .action-feedback { gap: 5px; font-size: 11px; }
    .action-bar button { min-width: 132px; min-height: 42px; padding: 0 12px; font-size: 11px; }
    .keyboard-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
