:root {
  color-scheme: light;
  --navy: #15324b;
  --teal: #1f7a8c;
  --coral: #f25f5c;
  --gold: #e1a928;
  --ink: #1e2933;
  --muted: #607080;
  --grid: #d7e2e8;
  --bg: #f7fafc;
  --paper: #ffffff;
  --pale: #eef5f8;
  --line: #e3ebef;
  --shadow: 0 18px 44px rgba(21, 50, 75, 0.075);
  font-family: "Aptos", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(255,255,255,.72), rgba(247,250,252,.84)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(21,50,75,.018) 35px 36px),
    var(--bg);
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(31, 122, 140, .38);
  outline-offset: 2px;
}
.ambient { position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(1px); }
.ambient-one { width: 440px; height: 440px; top: -190px; right: -110px; background: radial-gradient(circle, rgba(225,169,40,.11), transparent 69%); }
.ambient-two { width: 520px; height: 520px; bottom: -310px; left: -230px; background: radial-gradient(circle, rgba(31,122,140,.10), transparent 70%); }

.masthead {
  max-width: 1600px;
  margin: 0 auto;
  padding: 22px 42px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(21, 50, 75, .10);
}
.brand { display: inline-flex; gap: 12px; align-items: center; color: var(--navy); text-decoration: none; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px 12px 12px 3px; background: var(--navy); color: white; box-shadow: 4px 4px 0 rgba(31,122,140,.22); }
.brand-mark span { font-family: Georgia, serif; font-size: 25px; font-weight: 700; line-height: 1; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 15px; letter-spacing: .045em; }
.brand-copy small, .section-kicker, .eyebrow, .stamp-label, .mini-heading span { font-family: Georgia, "Times New Roman", serif; letter-spacing: .14em; }
.brand-copy small { color: var(--muted); font-size: 9px; }
.masthead-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(31,122,140,.11); }
.masthead-divider { color: #b7c4cc; }

.page-shell { width: min(1520px, calc(100% - 64px)); margin: 0 auto; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; padding: 38px 5px 27px; }
.eyebrow { margin-bottom: 10px; color: var(--teal); font-size: 10px; font-weight: 700; }
h1 { margin: 0; color: var(--navy); font-size: clamp(30px, 3.1vw, 44px); line-height: 1.18; letter-spacing: -.055em; font-weight: 760; }
h1 span { margin-left: 9px; color: var(--teal); font-weight: 500; }
.intro-copy { margin: 11px 0 0; color: var(--muted); font-size: 15px; }
.intro-stamp { display: flex; gap: 10px; align-items: center; padding: 9px 15px 9px 10px; margin-bottom: 5px; border: 1px solid rgba(21,50,75,.13); border-radius: 8px; transform: rotate(-2deg); color: var(--navy); }
.stamp-number { color: var(--coral); font: 700 28px/1 Georgia, serif; }
.stamp-label { font-size: 8px; line-height: 1.45; }

.app-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 22px; align-items: start; }
.controls-panel, .learning-area { border: 1px solid rgba(21,50,75,.10); border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.controls-panel { position: sticky; top: 14px; padding: 22px 20px 18px; }
.controls-heading { padding-bottom: 17px; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.section-kicker { color: var(--coral); font-size: 9px; font-weight: 700; }
.controls-heading h2 { margin: 5px 0 3px; color: var(--navy); font-size: 20px; letter-spacing: -.035em; }
.controls-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.field { margin: 0 0 16px; }
.field > label, .field-label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 650; }
.select-field select, .seed-input-row input {
  width: 100%; min-height: 39px; padding: 8px 11px; border: 1px solid #d5e0e6; border-radius: 8px;
  color: var(--navy); background: #fff; font-size: 12px;
}
.select-field select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23607080' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.field-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.field-top label { color: var(--ink); font-size: 12px; font-weight: 650; }
.field-top output { min-width: 45px; padding: 3px 7px; border-radius: 5px; background: var(--pale); color: var(--teal); text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 750; }
.range-field input[type="range"] { display: block; width: 100%; height: 6px; margin: 11px 0 7px; appearance: none; border-radius: 10px; background: linear-gradient(90deg, var(--teal), #b7d2d7); cursor: pointer; }
.range-field input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; appearance: none; border: 3px solid white; border-radius: 50%; background: var(--teal); box-shadow: 0 1px 5px rgba(21,50,75,.28); }
.range-field input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 3px solid white; border-radius: 50%; background: var(--teal); box-shadow: 0 1px 5px rgba(21,50,75,.28); }
.range-bounds { display: flex; justify-content: space-between; color: #82919b; font-size: 10px; font-variant-numeric: tabular-nums; }
.confidence-field { margin-top: 5px; }
.segmented-control { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; padding: 4px; border-radius: 9px; background: #f0f4f6; }
.segmented-control button { border: 0; border-radius: 6px; padding: 7px 4px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.segmented-control button.selected { background: var(--navy); color: #fff; box-shadow: 0 2px 5px rgba(21,50,75,.16); }
.seed-field { margin-bottom: 15px; }
.seed-input-row { display: flex; gap: 7px; }
.seed-input-row input { min-width: 0; font-variant-numeric: tabular-nums; }
.seed-field small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.icon-button { width: 40px; flex: 0 0 40px; border: 1px solid #d5e0e6; border-radius: 8px; background: #fff; color: var(--teal); font-size: 21px; cursor: pointer; transition: transform .2s ease, background .2s ease; }
.icon-button:hover { background: var(--pale); transform: rotate(35deg); }
.database-controls { padding: 15px 0 1px; margin: 1px 0 15px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.database-controls[hidden], [hidden] { display: none !important; }
.mini-heading { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; color: var(--navy); }
.mini-heading span { color: var(--coral); font-size: 8px; font-weight: 700; }
.mini-heading b { font-size: 13px; }
.control-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border-left: 3px solid var(--gold); border-radius: 5px; background: #fff8e8; color: #665421; font-size: 10px; line-height: 1.55; }
.note-mark { display: grid; width: 15px; height: 15px; flex: 0 0 15px; place-items: center; border-radius: 50%; background: var(--gold); color: white; font: italic 700 11px Georgia, serif; }
.reset-button { width: 100%; margin-top: 12px; padding: 9px 10px; border: 1px solid #d5e0e6; border-radius: 8px; background: #fff; color: var(--navy); font-size: 11px; font-weight: 650; cursor: pointer; }
.reset-button:hover { border-color: var(--teal); color: var(--teal); }
.privacy-note { display: flex; gap: 7px; align-items: center; margin: 13px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.privacy-icon { color: var(--teal); font-size: 12px; }

.learning-area { min-width: 0; overflow: hidden; }
.module-nav { display: flex; min-height: 57px; align-items: stretch; gap: 3px; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(248,251,252,.84); }
.module-nav button { position: relative; display: inline-flex; gap: 8px; align-items: center; padding: 0 13px; border: 0; background: transparent; color: #687987; font-size: 12px; white-space: nowrap; cursor: pointer; }
.module-nav button span { color: #a7b3bb; font: 11px Georgia, serif; }
.module-nav button[aria-selected="true"] { color: var(--navy); font-weight: 750; }
.module-nav button[aria-selected="true"] span { color: var(--coral); }
.module-nav button[aria-selected="true"]::after { position: absolute; right: 12px; bottom: -1px; left: 12px; height: 3px; border-radius: 3px 3px 0 0; background: var(--teal); content: ""; }
.content-frame { min-height: 650px; padding: 24px 25px 27px; }
.module-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.module-heading h2 { margin: 0; color: var(--navy); font-size: 23px; letter-spacing: -.04em; }
.module-heading p { max-width: 700px; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.module-index { color: rgba(21,50,75,.12); font: 700 44px/.9 Georgia, serif; }
.hint-box { display: flex; gap: 11px; align-items: flex-start; padding: 13px 15px; margin: 0 0 18px; border-left: 4px solid var(--teal); border-radius: 5px 9px 9px 5px; background: #eef5f8; color: #35576a; font-size: 12px; line-height: 1.6; }
.hint-box .hint-symbol { color: var(--teal); font-size: 14px; font-weight: 800; }
.chart-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.chart-grid.two { grid-template-columns: minmax(0,2.35fr) minmax(230px,1fr); }
.chart-grid.single { grid-template-columns: minmax(0,1fr); }
.chart-card { min-width: 0; padding: 10px 10px 7px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(180deg,#fff,#fcfefe); }
.chart-card h3 { margin: 2px 5px 0; color: var(--navy); font-size: 12px; font-weight: 750; }
.chart-card .chart-subtitle { margin: 4px 5px 0; color: var(--muted); font-size: 10px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.metrics-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 15px 0; }
.database-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; gap: 8px; margin: 0; }
.database-metrics .metric-card:last-child { grid-column: 1 / -1; }
.metric-card { padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.metric-card .metric-label { display: block; color: var(--muted); font-size: 10px; line-height: 1.35; }
.metric-card strong { display: block; margin-top: 5px; color: var(--navy); font: 700 20px/1.1 Georgia, "Microsoft YaHei", serif; font-variant-numeric: tabular-nums; }
.metric-card em { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-style: normal; }
.metric-card.accent strong { color: var(--teal); }
.metric-card.warning strong { color: var(--coral); }
.explanation-card { padding: 15px 17px; border-radius: 9px; background: #f6f9fa; color: #425462; font-size: 12px; line-height: 1.75; }
.explanation-card strong { color: var(--navy); }
.explanation-card code { padding: 1px 4px; border-radius: 4px; background: #eaf0f3; color: var(--navy); font-family: Georgia, serif; }
.caption-line { margin: 10px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.warning-box { padding: 12px 14px; border-left: 4px solid var(--gold); border-radius: 5px 8px 8px 5px; background: #fff8e8; color: #685923; font-size: 11px; line-height: 1.65; }
.success-box { padding: 12px 14px; border-left: 4px solid var(--teal); border-radius: 5px 8px 8px 5px; background: #eef7f5; color: #315f5c; font-size: 11px; line-height: 1.65; }
.task-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 16px 0 20px; padding: 0; list-style: none; counter-reset: tasks; }
.task-list li { position: relative; min-height: 88px; padding: 15px 15px 13px 49px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #384b59; font-size: 12px; line-height: 1.65; counter-increment: tasks; }
.task-list li::before { position: absolute; top: 14px; left: 15px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px 7px 7px 2px; background: var(--navy); color: #fff; font: 700 12px Georgia, serif; content: counter(tasks, decimal-leading-zero); }
.reflection-card { padding: 17px 18px; border-radius: 10px; background: var(--navy); color: #fff; }
.reflection-card h3 { margin: 0 0 10px; color: #fff; font-size: 14px; }
.reflection-card ol { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 0; padding-left: 18px; color: #d6e3ea; font-size: 11px; line-height: 1.65; }
.calculation-status { min-height: 17px; padding-top: 8px; color: var(--muted); text-align: right; font-size: 10px; }
.calculation-status:empty { display: none; }
.calculation-status.loading::before { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--teal); content: ""; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; transform: scale(.75); } }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 19px 3px 30px; color: #83909a; font-size: 10px; }
.site-footer span:first-child { color: var(--navy); font-weight: 650; }

@media (max-width: 1120px) {
  .page-shell { width: min(100% - 40px, 1000px); }
  .app-layout { grid-template-columns: 260px minmax(0,1fr); gap: 14px; }
  .controls-panel { padding: 19px 16px; }
  .module-nav { overflow-x: auto; padding: 0 10px; }
  .module-nav button { padding: 0 10px; }
  .content-frame { padding: 20px 18px 24px; }
  .chart-grid { gap: 9px; }
}
@media (max-width: 850px) {
  .masthead { padding: 17px 22px 14px; }
  .page-shell { width: calc(100% - 32px); }
  .page-intro { padding: 29px 2px 20px; }
  .intro-stamp { display: none; }
  .app-layout { grid-template-columns: minmax(0,1fr); }
  .controls-panel { position: static; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 15px; }
  .controls-heading, .database-controls, .control-note, .reset-button, .privacy-note { grid-column: 1 / -1; }
  .controls-heading { margin-bottom: 12px; }
  .select-field { grid-column: 1 / -1; }
  .field { margin-bottom: 13px; }
  .learning-area { min-height: 0; }
  .content-frame { min-height: 0; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid.two { grid-template-columns: 1fr; }
  .chart-card { max-width: none; }
  .chart-svg { max-height: 400px; }
}
@media (max-width: 560px) {
  .masthead { padding: 14px 16px 12px; }
  .masthead-note { font-size: 10px; }
  .masthead-divider { display: none; }
  .page-shell { width: calc(100% - 22px); }
  .page-intro { padding: 23px 2px 16px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 29px; }
  h1 span { display: block; margin: 1px 0 0; }
  .intro-copy { font-size: 12px; line-height: 1.6; }
  .controls-panel { padding: 16px 13px; border-radius: 11px; }
  .controls-heading h2 { font-size: 18px; }
  .module-nav { min-height: 52px; padding: 0 5px; }
  .module-nav button { gap: 5px; padding: 0 9px; font-size: 11px; }
  .content-frame { padding: 17px 12px 19px; }
  .module-heading h2 { font-size: 20px; }
  .module-index { font-size: 34px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .metric-card { padding: 10px; }
  .metric-card strong { font-size: 18px; }
  .task-list { grid-template-columns: 1fr; }
  .reflection-card ol { grid-template-columns: 1fr; gap: 7px; }
  .site-footer { flex-direction: column; gap: 6px; padding: 16px 3px 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
