:root {
      color-scheme: light;
      --ink: #18222f;
      --muted: #657080;
      --line: #d7dde5;
      --bg: #f5f7fa;
      --panel: #ffffff;
      --nav: #23384f;
      --accent: #0f766e;
      --accent-2: #b45309;
      --danger: #b42318;
      --soft: #e8f3f1;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    * { box-sizing: border-box; }
    body { margin: 0; background: var(--bg); color: var(--ink); }
    header { background: var(--nav); color: white; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
    h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
    h2 { margin: 0 0 12px; font-size: 19px; }
    h3 { margin: 0 0 8px; font-size: 16px; }
    p { color: var(--muted); line-height: 1.45; }
    button, input, textarea, select { font: inherit; }
    button { border: 0; background: var(--accent); color: white; padding: 10px 14px; border-radius: 6px; cursor: pointer; font-weight: 700; }
    button.secondary { background: #42546a; }
    button.warning { background: var(--accent-2); }
    main { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 68px); }
    nav { border-right: 1px solid var(--line); background: white; padding: 18px; }
    nav button { display: block; width: 100%; margin-bottom: 8px; text-align: left; background: transparent; color: var(--ink); border: 1px solid var(--line); }
    nav button.active { background: var(--soft); border-color: var(--accent); color: #0b524d; }
    section { padding: 24px; }
    .toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
    .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
    .wide { grid-column: 1 / -1; }
    .metric { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .metric div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fbfcfd; }
    .metric strong { display: block; font-size: 22px; }
    table { width: 100%; border-collapse: collapse; font-size: 14px; }
    th, td { border-bottom: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; }
    th { color: #435064; font-size: 12px; text-transform: uppercase; }
    input[type=file], input[type=text], input[type=number], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px; background: white; color: var(--ink); }
    textarea { min-height: 84px; resize: vertical; }
    .stage-upload { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin-bottom: 16px; }
    .notice { border-left: 4px solid var(--accent-2); background: #fff8ed; padding: 12px; border-radius: 6px; color: #5f3b09; }
    .bad { border-left-color: var(--danger); background: #fff4f2; color: #7a271a; }
    .hidden { display: none; }
    [hidden] { display: none !important; }
    .auth-card { max-width: 560px; margin: 30px auto; }
    label { display: block; margin-bottom: 12px; }
    input[type=password], input:not([type]) { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px; }
    button:disabled { opacity: .55; cursor: wait; }
    .report-map { width: 100%; max-height: 500px; background: #fbfcfd; }
    .report h3 { margin-top: 28px; }
    #content > .card { margin-top: 16px; }
    #appMessage { margin-bottom: 16px; }
    .welcome-mode { background: #f3f6f3; }
    .welcome-mode > header { background: #f3f6f3; color: #173d38; border-bottom: 1px solid #d9e4de; padding: 24px 5%; }
    .welcome-mode #account { font-size: 14px; color: #52706a; }
    .welcome-mode main > section { max-width: 1440px; margin: auto; padding: 54px 5% 64px; }
    .welcome-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 64px; align-items: center; }
    .welcome-eyebrow { display: block; color: #39655b; font-size: 12px; font-weight: 800; letter-spacing: 1.8px; margin-bottom: 24px; }
    .welcome-story h2 { font-size: clamp(34px, 4.1vw, 60px); line-height: 1.12; letter-spacing: -2px; color: #173d38; margin-bottom: 26px; }
    .welcome-story h2 em { font-style: normal; color: #277a65; }
    .welcome-intro { font-size: 18px; line-height: 1.7; max-width: 590px; color: #4e665e; }
    .learning-path { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 48px; border-top: 1px solid #cfded5; padding-top: 25px; }
    .learning-path span { display: block; color: #66867b; font-size: 12px; margin-bottom: 14px; }
    .learning-path strong { color: #173d38; font-size: 17px; }
    .learning-path p { font-size: 14px; line-height: 1.55; color: #587166; }
    .role-card { border: 1px solid #d3e1d9; padding: 30px; border-radius: 18px; background: white; margin-bottom: 18px; }
    .student-role { background: #153f36; border-color: #153f36; color: white; box-shadow: 0 14px 32px #163e3512; }
    .role-label { font-size: 11px; color: #b8d9c8; letter-spacing: 1.4px; font-weight: 700; }
    .role-card h3 { font-size: 29px; margin: 14px 0; letter-spacing: -.6px; }
    .role-card p { line-height: 1.65; margin-bottom: 24px; }
    .student-role p { color: #d0e2d8; }
    .role-card button { width: 100%; display: flex; justify-content: space-between; padding: 14px 18px; border-radius: 8px; }
    .student-role button { background: #d9edaa; color: #173b2c; }
    .role-card small { display: block; font-size: 12px; color: #c2d6cc; margin-top: 16px; }
    .teacher-role h3 { font-size: 24px; margin-top: 0; color: #173d38; }
    .teacher-role button { color: #205849; background: #eef5ef; }
    .welcome-help { font-size: 13px; text-align: center; }
    .back-link { color: #27624f; background: transparent; padding: 0; margin-bottom: 25px; font-weight: 500; }
    .home-link { color: inherit; text-decoration: none; }
    .home-link:hover { text-decoration: underline; }
    .home-link:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
    #backNavigation { margin-bottom: 18px; }
    button:focus-visible, a:focus-visible { outline: 3px solid #b88731; outline-offset: 4px; }
    @media(max-width: 1000px) { .welcome-layout { gap: 30px; } .role-card { padding: 24px; } }
    @media(max-width: 760px) {
      .welcome-layout { grid-template-columns: 1fr; gap: 30px; }
      .welcome-mode main > section { padding-top: 32px; }
      .welcome-story h2 { letter-spacing: -1px; }
      .learning-path { margin-top: 28px; gap: 14px; }
      .welcome-mode > header { gap: 10px; flex-wrap: wrap; }
      .welcome-mode > header h1 { font-size: 20px; }
    }
    .map { width: 100%; min-height: 460px; border: 1px solid var(--line); background: #fbfcfd; border-radius: 8px; }
    .heatmap { display: grid; gap: 2px; overflow-x: auto; padding-bottom: 4px; }
    .heat-cell { min-width: 54px; min-height: 36px; padding: 6px; border-radius: 4px; text-align: center; font-size: 12px; color: #18222f; }
    .strategy-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 280px; overflow: auto; }
    .strategy-option { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fbfcfd; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }
    .chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .matrix-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 8px; }
    .matrix-table { min-width: 980px; }
    .matrix-table th, .matrix-table td { text-align: center; padding: 6px; }
    .matrix-table th:first-child, .matrix-table td:first-child { position: sticky; left: 0; background: #fbfcfd; text-align: left; z-index: 1; }
    .matrix-table input { width: 46px; text-align: center; padding: 6px; }
    .matrix-table input[readonly] { background: #e8eef5; color: #657080; }
    .pill { display: inline-block; padding: 4px 8px; border-radius: 999px; background: var(--soft); color: #0b524d; font-size: 12px; font-weight: 800; }
    @media (max-width: 900px) {
      main { grid-template-columns: 1fr; }
      nav { display: flex; gap: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
      nav button { min-width: 160px; margin-bottom: 0; }
      .grid, .stage-upload, .metric, .chart-grid, .strategy-list { grid-template-columns: 1fr; }
    }
