:root {
  --bg: #f4efe4;
  --bg-alt: #fbf7ef;
  --ink: #162133;
  --ink-soft: #516076;
  --line: rgba(22, 33, 51, 0.12);
  --line-strong: rgba(22, 33, 51, 0.22);
  --panel: rgba(255, 252, 247, 0.82);
  --panel-strong: rgba(255, 250, 242, 0.94);
  --accent: #2f6df6;
  --accent-soft: rgba(47, 109, 246, 0.26);
  --accent-deep: #c74b30;
  --teal: #1f7a8c;
  --gold: #f5a623;
  --gold-soft: rgba(245, 166, 35, 0.26);
  --gold-line: rgba(245, 166, 35, 0.46);
  --success: #20684f;
  --warning: #8f5f00;
  --danger: #8d2b2b;
  --shadow: 0 24px 60px rgba(20, 28, 44, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(240, 93, 61, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 122, 140, 0.14), transparent 26%),
    linear-gradient(180deg, #f9f4e8 0%, #f2eadb 100%);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 32px 20px 36px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  left: 16px;
  top: -80px;
  padding: 12px 16px;
  background: #fff;
  color: #000;
  border: 2px solid #000;
}

.skip-link:focus {
  top: 16px;
}

.privacy-note {
  margin: -12px 0 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.hero {
  display: grid;
  gap: 18px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow,
.section-kicker,
.status-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.hero h1,
.panel-head h2,
.card-head h3 {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
}

.hero h1 {
  max-width: 14ch;
  font-size: clamp(2.4rem, 5vw, 4.9rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 64ch;
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.workspace {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(360px, 530px) minmax(0, 1fr);
}

.control-column {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.control-panel,
.graph-panel {
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel-head,
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.panel-head h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}

.single-line-title {
  white-space: nowrap;
}

.panel-head p,
.card-head p,
.plot-caption,
.status-tile p {
  margin: 6px 0 0;
  line-height: 1.5;
  color: var(--ink-soft);
}

.card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.objective-card {
  background:
    linear-gradient(180deg, rgba(255, 249, 239, 0.7), rgba(255, 231, 190, 0.84)),
    var(--gold-soft);
  border-color: var(--gold-line);
}

.status-card {
  background:
    linear-gradient(180deg, rgba(31, 122, 140, 0.08), rgba(255, 255, 255, 0.75)),
    var(--panel-strong);
}

.card-head h3 {
  font-size: 1.12rem;
}

.card-head.compact {
  margin-bottom: 14px;
}

.pill-row,
.button-row,
.examples {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.spotlight-button {
  min-width: 220px;
}

.return-link-button,
.return-link-button:visited,
.return-link-button:hover,
.return-link-button:active {
  color: var(--ink);
  text-decoration: none;
}

.return-link-button {
  background: #dce7e6;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.return-link-button:hover {
  background: #d3e0de;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-deep);
  background: rgba(240, 93, 61, 0.1);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  background: rgba(31, 122, 140, 0.12);
  transition:
    transform 0.16s ease,
    background-color 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
  background: rgba(31, 122, 140, 0.2);
}

.button:focus,
input:focus,
select:focus {
  outline: 2px solid rgba(31, 122, 140, 0.35);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.field-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.slider-control {
  gap: 10px;
}

.slider-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.manual-field {
  max-width: 180px;
}

.manual-value-input {
  min-height: 40px;
}

.value-chip {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(22, 33, 51, 0.08);
}

.status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.readout-grid .status-tile {
  min-height: 100%;
}

.readout-grid .status-label {
  margin-bottom: 6px;
}

.status-tile {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.status-tile.wide {
  grid-column: 1 / -1;
}

.status-label {
  display: block;
  margin-bottom: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-badge.success {
  color: var(--success);
  background: rgba(32, 104, 79, 0.14);
}

.status-badge.warning {
  color: var(--warning);
  background: rgba(245, 166, 35, 0.18);
}

.status-badge.danger {
  color: var(--danger);
  background: rgba(141, 43, 43, 0.14);
}

.status-badge.neutral {
  color: var(--ink-soft);
  background: rgba(22, 33, 51, 0.08);
}

#questionText,
#answerText {
  margin: 0;
  font-size: 1rem;
}

.practice-feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border-left: 5px solid var(--teal);
  background: rgba(31, 122, 140, 0.09);
  color: var(--ink-soft);
  line-height: 1.5;
}

@media print {
  body {
    background: #fff;
  }

  .return-link-row,
  .button-row,
  .privacy-note {
    display: none;
  }

  .panel {
    box-shadow: none;
  }
}

#questionText {
  font-weight: 700;
  color: var(--ink);
}

#answerText {
  font-weight: 700;
  color: #0d4572;
}

.graph-head {
  align-items: end;
}

.graph-hint {
  margin: 0;
  align-self: center;
  font-weight: 600;
  color: var(--accent-deep);
}

.plot-shell {
  border-radius: 24px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 244, 235, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.65);
}

#tSvg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  user-select: none;
  touch-action: none;
  cursor: default;
  background:
    radial-gradient(circle at top left, rgba(31, 122, 140, 0.08), transparent 30%),
    linear-gradient(180deg, #fffef8 0%, #faf5ec 100%);
}

body.is-dragging #tSvg {
  cursor: grabbing;
}

.plot-caption {
  font-size: 0.96rem;
}

@media (max-width: 1160px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page-shell {
    padding: 18px 14px 24px;
  }

  .control-panel,
  .graph-panel {
    padding: 18px;
  }

  .panel-head,
  .card-head {
    flex-direction: column;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    max-width: none;
  }

  .single-line-title {
    white-space: normal;
  }
}
/* Teaching flow additions; scoped to preserve the shared course theme. */
[hidden] { display: none !important; }
.hero { grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr); }
.hero h1 { max-width: 18ch; font-size: clamp(2.2rem, 4vw, 3.8rem); line-height: 1.04; }
#explorer.workspace { grid-template-columns: minmax(280px, var(--controls-width, 350px)) 24px minmax(0, 1fr); gap: 0; align-items: start; }
.control-panel, .graph-panel { min-width: 0; padding: 22px; }
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.parameter-grid label { min-width: 0; }
.form-grid { gap: 15px; }
.field-hint { color: var(--ink-soft); font-size: .85rem; line-height: 1.5; margin: 0; }
.input-error { padding: 12px; border: 1px solid var(--danger); border-radius: 8px; color: var(--danger); background: #fff1f1; line-height: 1.45; }
.slider-control { display: grid; gap: 8px; }
input[type=range] { min-height: 24px; padding: 0; accent-color: var(--accent); }
.graph-head { align-items: start; flex-wrap: wrap; }
.graph-head .value-chip { font-size: .85rem; }
.plot-shell { padding: 3px; }
.plot-caption { margin: 0; font-size: .86rem; }
#results { display: grid; gap: 18px; }
#questionText { font-size: clamp(1.1rem, 2vw, 1.45rem); margin: 0; }
.standard-question { color: var(--ink-soft); margin: 8px 0 12px; }
#answerText { font-size: 1.05rem; margin: 8px 0 0; line-height: 1.5; }
.working-card h3, .excel-card h3 { margin: 0; font-size: 1.2rem; }
.working-steps { display: grid; gap: 18px; padding-left: 25px; margin-bottom: 0; }
.working-steps li::marker { color: var(--accent); font-weight: 700; }
.math-line { white-space: pre-line; overflow-wrap: anywhere; font-family: "Cambria Math", Cambria, Georgia, serif; font-size: 1.07rem; line-height: 1.6; margin: 5px 0 0; }
.excel-formulas { display: grid; gap: 16px; margin: 18px 0; }
.formula-group { min-width: 0; }
.formula-group h4 { margin: 0 0 8px; color: var(--ink-soft); font-size: .85rem; }
.formula-row { display: flex; gap: 8px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.75); }
.formula-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: .91rem/1.6 Consolas, monospace; user-select: all; }
.copy-button { border: 1px solid var(--line-strong); background: white; color: var(--ink); padding: 5px 9px; border-radius: 5px; cursor: pointer; font-size: .75rem; }
.formula-result { margin: 5px 0 12px; font-size: .86rem; color: var(--ink-soft); }
.excel-card > .field-hint + .field-hint { margin-top: 8px; }
summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 16px; }
.function-guide dt { font: bold .9rem Consolas, monospace; overflow-wrap: anywhere; }
.function-guide dd { margin: 5px 0 18px; line-height: 1.5; }
.function-guide p { font-size: .9rem; line-height: 1.55; color: var(--ink-soft); }
#practicePanel .button { margin-top: 12px; }
#estimateFeedback { font-size: .86rem; line-height: 1.5; }
.return-link-button { display: inline-block; padding: 10px; font-size: .85rem; border-radius: 8px; }
@media (max-width: 1000px) { #explorer.workspace { grid-template-columns: 1fr; gap: 22px; } .column-resizer { display: none; } .hero { grid-template-columns: 1fr; } .control-panel > .form-grid { grid-template-columns: 1fr 1fr; align-items: start; } .parameter-grid, #inputError, #regionHint { grid-column: 1 / -1; } }
@media (max-width: 600px) { .control-panel > .form-grid { grid-template-columns: 1fr; } .control-panel, .graph-panel { padding: 15px; } .card { padding: 15px; } .page-shell { padding: 18px 10px; } .formula-row { padding: 9px; } .hero h1 { font-size: 2.5rem; } }
@media print { .column-resizer, .control-panel, .copy-button, .function-guide, #copyStatus { display: none !important; } .workspace { display: block; } .graph-panel { box-shadow: none; border: 0; padding: 0; } .hero { margin-bottom: 12px; } .hero h1 { font-size: 24pt; } .hero-copy, .privacy-note { display: none; } .card { break-inside: avoid; } .plot-shell { max-width: 650px; margin: auto; } }

/* The gutter is a full-height drag target; the grip stays visible while scrolling. */
.column-resizer { position: relative; align-self: stretch; min-width: 24px; cursor: col-resize; touch-action: none; user-select: none; color: var(--ink-soft); border-radius: 8px; }
.column-resizer::before { content: ""; position: absolute; top: 16px; bottom: 16px; left: 11px; width: 2px; background: var(--line); transition: background .15s; }
.resize-grip { position: sticky; top: 42vh; display: block; width: 8px; height: 52px; margin: 20px auto 0; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel-strong); box-shadow: 0 0 0 3px var(--bg); }
.resize-grip::after { content: ""; position: absolute; top: 15px; left: 2px; width: 2px; height: 20px; border-radius: 2px; background: currentColor; }
.column-resizer:hover, .column-resizer:focus-visible, .is-resizing-columns .column-resizer { color: var(--accent); background: var(--accent-soft); }
.column-resizer:hover::before, .column-resizer:focus-visible::before { background: var(--accent); }
.column-resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
body.is-resizing-columns, body.is-resizing-columns * { cursor: col-resize !important; user-select: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

#questionText, #answerText { overflow-wrap: anywhere; }
@media print { #explorer.workspace { display: block !important; } }
