:root {
  color-scheme: dark;
  --bg: #08111d;
  --bg-2: #0c1725;
  --panel: #101e2e;
  --panel-2: #132337;
  --line: #23384d;
  --line-soft: rgba(135, 166, 194, .16);
  --text: #e8f0f7;
  --muted: #93a8bb;
  --teal: #55d6be;
  --blue: #7aa2ff;
  --amber: #eab96b;
  --coral: #ff7185;
  --green: #70d6a6;
  --shadow: 0 18px 48px rgba(0, 0, 0, .24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 18% -10%, rgba(60, 115, 143, .18), transparent 34%), linear-gradient(180deg, #091321 0%, #07101a 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app-shell { width: min(1600px, 100%); margin: 0 auto; padding: 0 24px 40px; }
.topbar { min-height: 76px; display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #07141d; font-weight: 900; background: linear-gradient(135deg, var(--teal), #7aa2ff); box-shadow: 0 5px 18px rgba(85, 214, 190, .18); }
.brand strong { display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.brand small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.module-nav { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: thin; padding: 8px 0; }
.module-nav a { flex: 0 0 auto; padding: 9px 11px; border-radius: 9px; color: #9fb2c5; font-size: 11px; font-weight: 650; transition: .2s ease; }
.module-nav a:hover, .module-nav a.active { color: var(--text); background: #172b40; }
.module-nav a.active { box-shadow: inset 0 -2px 0 var(--teal); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(112, 214, 166, .22); border-radius: 999px; color: #9ce5c0; font-size: 10px; white-space: nowrap; background: rgba(112, 214, 166, .07); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.btn { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; color: var(--text); background: #17283b; font-size: 11px; font-weight: 700; transition: .18s ease; }
.btn:hover { border-color: #52728e; background: #1c344b; }
.btn-primary { border-color: rgba(85, 214, 190, .38); color: #071b1b; background: var(--teal); }
.btn-primary:hover { background: #79e4d0; }
.btn-quiet { background: transparent; }
.btn-small { padding: 7px 9px; font-size: 10px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 30px 0 22px; }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 8px 0 7px; max-width: 850px; font-size: clamp(24px, 3vw, 36px); line-height: 1.12; letter-spacing: -.035em; }
.hero p { margin: 0; max-width: 760px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.hero-metrics { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.hero-metric { min-width: 110px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(16, 30, 46, .62); }
.hero-metric span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.hero-metric strong { display: block; margin-top: 5px; font-size: 17px; font-variant-numeric: tabular-nums; }
.workspace { display: grid; grid-template-columns: minmax(225px, 270px) minmax(0, 1fr) minmax(215px, 250px); gap: 14px; align-items: start; }
.panel { border: 1px solid var(--line-soft); border-radius: 15px; background: linear-gradient(180deg, rgba(17, 32, 49, .97), rgba(12, 24, 38, .97)); box-shadow: var(--shadow); }
.controls-panel, .insight-panel { padding: 16px; }
.panel-heading, .visual-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h2, .visual-head h2 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.panel-heading p, .visual-head p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.control-group { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.control-group:first-child { border-top: 0; padding-top: 0; margin-top: 12px; }
.group-title { margin: 0 0 12px; color: #c7d6e3; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.control { margin: 0 0 13px; }
.control:last-child { margin-bottom: 0; }
.control-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; color: #b9c9d7; font-size: 10px; }
.control-label output { color: var(--teal); font-weight: 800; font-variant-numeric: tabular-nums; }
input[type=range] { display: block; width: 100%; height: 4px; appearance: none; border-radius: 10px; outline: none; background: #2a4055; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border: 2px solid #07151e; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px rgba(85, 214, 190, .16); }
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #07151e; border-radius: 50%; background: var(--teal); }
select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #0d1b2a; font-size: 11px; }
.control-note { margin: 5px 0 0; color: #70889d; font-size: 9px; line-height: 1.4; }
.panel-actions { display: flex; gap: 7px; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.panel-actions .btn { flex: 1; }
.visual-panel { min-width: 0; overflow: hidden; }
.visual-head { padding: 16px 18px 13px; border-bottom: 1px solid var(--line-soft); }
.visual-stage { position: relative; min-height: 390px; padding: 12px; background: radial-gradient(ellipse at 50% 45%, rgba(35, 69, 91, .18), transparent 70%); }
.visual-stage canvas { display: block; width: 100%; height: 365px; }
.visual-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 18px 14px; color: var(--muted); font-size: 9px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 3px; display: inline-block; }
.metric-card { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.metric-card:first-child { padding-top: 2px; }
.metric-card:last-child { border-bottom: 0; }
.metric-label { display: block; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.metric-value { display: block; margin-top: 5px; font-size: 21px; font-weight: 760; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-sub { display: block; margin-top: 4px; color: #7890a5; font-size: 9px; line-height: 1.4; }
.insight-block { margin-top: 14px; padding: 12px; border: 1px solid rgba(122, 162, 255, .16); border-radius: 11px; background: rgba(122, 162, 255, .055); }
.insight-block h3 { margin: 0 0 7px; color: #b9d0ff; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.insight-block p { margin: 0; color: #9db0c1; font-size: 10px; line-height: 1.55; }
.insight-block strong { color: #e1edf7; }
.lower-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-top: 14px; }
.lower-card { padding: 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(14, 27, 42, .8); }
.lower-card h2 { margin: 0 0 9px; font-size: 12px; }
.lower-card p, .lower-card li { color: var(--muted); font-size: 10px; line-height: 1.6; }
.lower-card p { margin: 0; }
.lower-card ul { margin: 8px 0 0; padding-left: 17px; }
.equation { overflow-x: auto; margin: 9px 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 9px; color: #d7e8f5; background: #0a1725; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.7; white-space: nowrap; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th, .data-table td { padding: 8px 7px; border-bottom: 1px solid var(--line-soft); text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.preset-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.preset-row .btn { flex: 1 1 90px; }
.challenge-status { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.challenge-status.success { border-color: rgba(112, 214, 166, .38); color: #a7e9c7; background: rgba(112, 214, 166, .07); }
.challenge-status.warning { border-color: rgba(234, 185, 107, .35); color: #eacb98; background: rgba(234, 185, 107, .06); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; padding: 11px 14px; border: 1px solid rgba(85, 214, 190, .28); border-radius: 10px; color: #dffbf5; background: #12332f; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: #637c91; font-size: 9px; }
.home-shell { padding-top: 25px; }
.home-hero { padding: 34px; border: 1px solid var(--line-soft); border-radius: 18px; background: linear-gradient(120deg, rgba(22, 51, 66, .88), rgba(17, 29, 47, .9)); box-shadow: var(--shadow); }
.home-hero h1 { max-width: 850px; margin: 10px 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.06; letter-spacing: -.045em; }
.home-hero p { max-width: 780px; color: #a5b8c8; font-size: 13px; line-height: 1.7; }
.home-stats { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.home-stat { padding: 11px 14px; border: 1px solid rgba(180, 210, 230, .12); border-radius: 10px; background: rgba(7, 19, 30, .34); }
.home-stat strong { display: block; font-size: 17px; }
.home-stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-top: 18px; }
.module-card { min-height: 190px; padding: 17px; border: 1px solid var(--line-soft); border-radius: 14px; background: linear-gradient(160deg, rgba(18, 35, 53, .95), rgba(11, 22, 35, .95)); transition: .2s ease; }
.module-card:hover { transform: translateY(-3px); border-color: rgba(85, 214, 190, .42); box-shadow: 0 15px 35px rgba(0,0,0,.18); }
.module-num { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--teal); background: rgba(85, 214, 190, .1); font-size: 10px; font-weight: 800; }
.module-card h2 { margin: 15px 0 7px; font-size: 14px; line-height: 1.3; }
.module-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.module-card small { display: inline-block; margin-top: 15px; color: var(--teal); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; padding: 12px 0; gap: 10px; }
  .brand { min-width: 180px; }
  .module-nav { order: 3; flex-basis: 100%; }
  .top-actions { margin-left: auto; }
  .workspace { grid-template-columns: 240px minmax(0, 1fr); }
  .insight-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .insight-block { margin-top: 0; }
  .metric-card { padding: 8px 10px; border: 0; border-right: 1px solid var(--line-soft); }
  .metric-card:last-child { border: 0; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 13px 28px; }
  .brand { min-width: 0; }
  .status-pill { display: none; }
  .top-actions .btn { padding: 8px 9px; }
  .hero { display: block; padding: 24px 0 16px; }
  .hero-metrics { justify-content: start; margin-top: 15px; }
  .hero-metric { min-width: 90px; }
  .workspace { grid-template-columns: 1fr; }
  .controls-panel { order: 2; }
  .visual-panel { order: 1; }
  .insight-panel { order: 3; grid-column: auto; grid-template-columns: 1fr 1fr; }
  .visual-stage { min-height: 300px; }
  .visual-stage canvas { height: 285px; }
  .lower-grid { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .home-hero { padding: 23px; }
  .footer { flex-direction: column; }
}
@media (max-width: 420px) {
  .insight-panel { grid-template-columns: 1fr; }
  .hero-metric { flex: 1; }
  .top-actions { gap: 5px; }
  .top-actions .btn { font-size: 10px; }
}
