:root {
  --ink: #183153;
  --muted: #60738c;
  --paper: #fffdf7;
  --cream: #fff7df;
  --orange: #ff914d;
  --yellow: #ffd45a;
  --blue: #2f80ed;
  --cyan: #2ec4c7;
  --purple: #7b61ff;
  --red: #ef5b5b;
  --grid: #dce8f0;
  --shadow: 0 12px 30px rgba(39, 68, 99, .12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Arial Rounded MT Bold", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }

.hero {
  min-height: 210px;
  padding: 36px max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.7) 0 6px, transparent 7px),
    radial-gradient(circle at 42% 70%, rgba(255,255,255,.5) 0 4px, transparent 5px),
    linear-gradient(120deg, #ffe07b, #ffb95c);
}
.hero-copy { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 10px; font-size: 13px; letter-spacing: 2px; font-weight: 800; color: #8c551b; }
h1 { margin: 0; font-size: clamp(36px, 6vw, 66px); line-height: 1; letter-spacing: -3px; }
.hero-copy > p:last-child { margin: 16px 0 0; font-size: 18px; }
.mascot {
  width: 150px; height: 150px; flex: 0 0 auto; position: relative;
  border: 6px solid var(--ink); border-radius: 48% 52% 44% 56%;
  background: var(--cyan); transform: rotate(7deg); box-shadow: 10px 10px 0 rgba(255,255,255,.55);
}
.eye { position: absolute; top: 43px; width: 13px; height: 17px; border-radius: 50%; background: var(--ink); }
.eye.left { left: 40px; } .eye.right { right: 40px; }
.smile { position: absolute; left: 51px; top: 58px; font: 54px/1 sans-serif; transform: rotate(-5deg); }

main { max-width: 1180px; margin: 0 auto; padding: 34px 24px 54px; }
.section-heading, .graph-head, .control-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading > div, .graph-head > div, .control-title { display: flex; align-items: center; gap: 12px; }
h2 { margin: 0; font-size: 22px; }
.section-heading p, .graph-head p, .control-title p { margin: 3px 0 0; color: var(--muted); font-family: system-ui, sans-serif; font-size: 14px; }
.step {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--ink); color: white; font-weight: 900;
}
.function-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 18px; }
.function-tab {
  min-height: 78px; padding: 11px 8px; border: 2px solid #dce6ed; border-radius: 17px;
  background: white; cursor: pointer; transition: .18s ease;
}
.function-tab:hover { transform: translateY(-2px); border-color: #a7bfd0; }
.function-tab[aria-selected="true"] { border-color: var(--orange); background: #fff7ef; box-shadow: 0 5px 0 #ffd1ad; transform: translateY(-2px); }
.function-tab b, .function-tab small { display: block; }
.function-tab b { font-size: 15px; }
.function-tab small { margin-top: 5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.lab { display: grid; grid-template-columns: 320px 1fr; gap: 22px; margin-top: 30px; align-items: stretch; }
.controls, .graph-card { border: 2px solid #e0e9ef; border-radius: 24px; background: white; box-shadow: var(--shadow); }
.controls { padding: 23px; }
.formula-card { margin-top: 20px; padding: 15px 17px; border-radius: 15px; background: var(--cream); border: 2px dashed #f3bd4c; }
.formula-card span { display: block; font: 13px system-ui, sans-serif; color: var(--muted); }
.formula-card strong { display: block; margin-top: 5px; font: 700 23px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sliders { margin-top: 22px; }
.slider-row { margin-bottom: 20px; }
.slider-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.slider-label label { font-size: 14px; }
.slider-label output { min-width: 44px; padding: 2px 8px; text-align: center; border-radius: 8px; background: #eaf6ff; color: #1866aa; font: 700 14px ui-monospace, monospace; }
input[type="range"] { width: 100%; accent-color: var(--orange); cursor: grab; }
.reset { width: 100%; padding: 11px; border: 2px solid #cddbe4; border-radius: 12px; background: white; cursor: pointer; }
.reset:hover { background: #f3f8fb; }
.mission { display: flex; gap: 10px; margin-top: 20px; padding: 13px; border-radius: 13px; background: #eefaf8; font-family: system-ui, sans-serif; }
.mission strong { font-size: 13px; } .mission p { margin: 3px 0 0; color: #3c6868; font-size: 12px; line-height: 1.5; }

.graph-card { padding: 23px; min-width: 0; }
.graph-tools { display: flex; align-items: center; gap: 7px; }
.graph-tools button { width: 34px; height: 34px; border: 1px solid #ccdbe5; border-radius: 10px; background: white; cursor: pointer; font-size: 20px; }
.graph-tools span { font: 12px system-ui, sans-serif; color: var(--muted); }
.canvas-wrap { position: relative; margin-top: 18px; height: 470px; overflow: hidden; border: 2px solid #dce8ef; border-radius: 17px; background: #fbfdff; }
canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.point-tip { position: absolute; left: 12px; top: 12px; padding: 7px 10px; border-radius: 9px; background: rgba(24,49,83,.88); color: white; font: 12px system-ui, sans-serif; pointer-events: none; }
.legend { display: flex; gap: 22px; margin-top: 13px; font: 13px system-ui, sans-serif; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 7px; }
.line-swatch { width: 28px; border-top: 4px solid var(--orange); border-radius: 4px; }
.dot-swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--purple); }

.story { display: flex; align-items: center; gap: 18px; margin-top: 25px; padding: 20px 24px; border-radius: 20px; background: #f1edff; }
.story-icon { font-size: 36px; }
.story strong { font-size: 17px; }
.story p { margin: 5px 0 0; color: #5f5680; font-family: system-ui, sans-serif; }
footer { padding: 24px; text-align: center; background: var(--ink); color: #dbe9f6; font: 14px system-ui, sans-serif; }

@media (max-width: 820px) {
  .hero { min-height: 180px; } .mascot { width: 110px; height: 110px; }
  .eye { top: 29px; } .eye.left { left: 28px; } .eye.right { right: 28px; } .smile { left: 36px; top: 42px; font-size: 40px; }
  .function-tabs { grid-template-columns: repeat(3, 1fr); }
  .lab { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hero { padding: 28px 20px; } .mascot { display: none; }
  main { padding: 28px 14px 40px; }
  .section-heading { align-items: flex-start; } .section-heading > p { display: none; }
  .function-tabs { grid-template-columns: repeat(2, 1fr); }
  .controls, .graph-card { border-radius: 18px; padding: 16px; }
  .canvas-wrap { height: 390px; }
  .graph-head { align-items: flex-start; flex-direction: column; }
}
