.fan-curve-tool {
  --curve-surface: #071426;
  --curve-surface-2: #0a1c34;
  --curve-border: rgba(75, 145, 242, 0.28);
  --curve-border-strong: rgba(75, 145, 242, 0.62);
  --curve-text: #f4f8ff;
  --curve-muted: #9db1cc;
  --curve-blue: #2f7df6;
  --curve-cyan: #00c8ff;
  --curve-orange: #ff6b2c;
  position: relative;
  margin: 18px 0 78px;
  overflow: hidden;
  border: 1px solid var(--curve-border);
  border-radius: 28px;
  background:
    linear-gradient(rgba(64, 139, 232, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 139, 232, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 88% 0, rgba(0, 200, 255, 0.1), transparent 28rem),
    #050d1b;
  background-size: 30px 30px, 30px 30px, 100% 100%, auto;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.22);
}

.fan-curve-tool * { box-sizing: border-box; }
.fan-curve-tool button,
.fan-curve-tool input,
.fan-curve-tool select { font: inherit; }
.fan-curve-tool button,
.fan-curve-tool select { cursor: pointer; }
.fan-curve-tool :focus-visible { outline: 3px solid rgba(0, 200, 255, 0.75); outline-offset: 2px; }

.fan-curve-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding: clamp(24px, 4vw, 48px);
  border-bottom: 1px solid var(--curve-border);
}

.fan-curve-head-copy { max-width: 780px; }
.fan-curve-head h2 {
  margin: 12px 0 14px;
  color: var(--curve-text);
  font: 800 clamp(34px, 5vw, 58px)/1.02 var(--font-display);
}
.fan-curve-head p { max-width: 730px; margin: 0; color: var(--curve-muted); font-size: 17px; line-height: 1.65; }

.fan-curve-disclaimer {
  margin: 0;
  padding: 18px clamp(24px, 4vw, 48px);
  color: #bed0e7;
  border-bottom: 1px solid var(--curve-border);
  background: rgba(9, 33, 66, 0.56);
  font-size: 14px;
  line-height: 1.65;
}
.fan-curve-disclaimer strong { color: #fff; }
.fan-curve-disclaimer { border-bottom: 0; border-top: 1px solid rgba(255, 107, 44, 0.34); background: rgba(255, 107, 44, 0.07); }

.fan-curve-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--curve-border);
  border-radius: 16px;
  background: rgba(3, 13, 27, .76);
}

.fan-curve-add-form { display: grid; grid-template-columns: minmax(240px, 1fr) 150px auto; gap: 12px; align-items: end; }
.fan-model-details {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 2px 0 0;
}
.fan-model-details div { min-width: 0; padding: 10px 11px; border: 1px solid rgba(75, 145, 242, .18); border-radius: 10px; background: rgba(7, 27, 52, .7); }
.fan-model-details dt { margin: 0 0 5px; color: #7f98b8; font: 700 9px/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.fan-model-details dd { margin: 0; overflow-wrap: anywhere; color: #eef6ff; font-size: 12px; font-weight: 800; }
.fan-curve-field { display: grid; gap: 7px; min-width: 0; }
.fan-curve-field > span,
.fan-curve-field > label,
.fan-curve-fieldset legend {
  color: #9fb4d0;
  font: 700 11px/1.2 var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.fan-curve-field input,
.fan-curve-field select,
.fan-curve-search,
.fan-duty-form input,
.fan-duty-form select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--curve-border);
  border-radius: 11px;
  color: #eef6ff;
  background: rgba(2, 10, 22, 0.82);
}
.fan-curve-field input:hover,
.fan-curve-field select:hover,
.fan-curve-search:hover,
.fan-duty-form input:hover,
.fan-duty-form select:hover { border-color: var(--curve-border-strong); }

.fan-curve-primary,
.fan-curve-secondary,
.fan-curve-icon-button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.fan-curve-primary { padding: 11px 18px; color: #fff; background: linear-gradient(135deg, #1e53d8, #009fd4); }
.fan-curve-primary:hover { background: linear-gradient(135deg, #2b67f0, #00b9ec); }
.fan-curve-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; color: #c6d7ed; border-color: var(--curve-border); background: rgba(8, 25, 48, 0.7); }
.fan-curve-secondary:hover { color: #fff; border-color: var(--curve-border-strong); background: rgba(22, 57, 105, 0.72); }
.fan-curve-secondary svg,
.fan-curve-primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.fan-curve-tools { display: grid; grid-template-columns: auto repeat(3, minmax(92px, auto)); justify-content: start; gap: 8px; align-items: stretch; }
.fan-unit-toggle { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--curve-border); border-radius: 12px; background: rgba(2, 10, 22, .78); }
.fan-unit-toggle label { cursor: pointer; }
.fan-unit-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.fan-unit-toggle span { display: grid; min-height: 38px; padding: 8px 12px; place-items: center; border-radius: 8px; color: #94a9c5; font-size: 12px; font-weight: 800; }
.fan-unit-toggle input:checked + span { color: #fff; background: rgba(47, 125, 246, .28); box-shadow: inset 0 0 0 1px rgba(77, 149, 255, .4); }

.fan-curve-message { min-height: 20px; margin: 0; color: #ffb07c; font-size: 13px; grid-column: 1 / -1; }

.fan-curve-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 20px;
  padding: clamp(20px, 3vw, 34px) clamp(24px, 4vw, 48px);
}

.fan-curve-sidebar { display: grid; align-content: start; gap: 16px; }
.fan-curve-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--curve-border);
  border-radius: 16px;
  background: rgba(3, 13, 27, .72);
}
.fan-curve-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fan-curve-panel-heading h3 { margin: 0; color: #f2f7ff; font: 700 19px/1.2 var(--font-display); }
.fan-curve-panel-heading p { margin: 5px 0 0; color: #8298b6; font-size: 12px; line-height: 1.5; }
.fan-curve-count { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #86e5ff; background: rgba(0, 200, 255, .1); font: 700 11px/1 var(--font-mono); }

.fan-series-list,
.fan-duty-list { display: grid; gap: 9px; }
.fan-series-card,
.fan-duty-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(87, 142, 219, .2);
  border-radius: 12px;
  background: rgba(10, 31, 59, .7);
}
.fan-series-card.is-muted { opacity: .48; }
.fan-series-swatch { width: 34px; height: 22px; overflow: visible; }
.fan-series-swatch line { stroke-width: 4; }
.fan-series-card strong,
.fan-duty-card strong { display: block; overflow-wrap: anywhere; color: #eaf3ff; font-size: 12px; }
.fan-series-card small,
.fan-duty-card small { display: block; margin-top: 3px; color: #8fa6c3; font: 500 10px/1.35 var(--font-mono); }
.fan-series-actions { display: flex; align-items: center; gap: 4px; }
.fan-series-actions input { width: 58px; min-height: 36px; padding: 6px 7px; border: 1px solid var(--curve-border); border-radius: 8px; color: #fff; background: #051225; text-align: center; }
.fan-curve-icon-button { display: grid; width: 38px; min-height: 38px; padding: 0; place-items: center; color: #9fb5d0; border-color: rgba(82, 140, 217, .22); background: rgba(3, 13, 27, .82); }
.fan-curve-icon-button:hover { color: #fff; border-color: rgba(255, 107, 44, .58); }
.fan-curve-icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.fan-series-toggle { display: grid; width: 38px; height: 38px; place-items: center; cursor: pointer; }
.fan-series-toggle input { position: absolute; opacity: 0; }
.fan-series-toggle span { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--curve-border-strong); border-radius: 7px; color: transparent; }
.fan-series-toggle input:checked + span { color: #fff; background: rgba(47, 125, 246, .28); }
.fan-series-toggle span::after { content: "✓"; font-size: 14px; font-weight: 900; }

.fan-duty-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.fan-duty-form .fan-curve-field:first-child { grid-column: 1 / -1; }
.fan-duty-form .fan-curve-primary { grid-column: 1 / -1; }
.fan-duty-symbol { display: block; width: 24px; height: 24px; justify-self: center; overflow: visible; }

.fan-chart-panel { display: grid; min-width: 0; align-content: start; gap: 16px; }
.fan-chart-card { position: relative; min-width: 0; padding: 18px; border: 1px solid var(--curve-border); border-radius: 18px; background: #030c19; }
.fan-chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.fan-chart-heading h3 { margin: 0; color: #f3f7ff; font: 700 21px/1.2 var(--font-display); }
.fan-chart-heading p { margin: 5px 0 0; color: #8298b6; font-size: 12px; }
.fan-chart-heading .fan-chart-reference { max-width: 860px; margin-top: 9px; color: #b8cae0; font-size: 13px; line-height: 1.55; }
.fan-chart-reference strong { color: #fff; }
.fan-chart-stage { position: relative; width: 100%; min-height: 510px; border: 1px solid rgba(75, 145, 242, .18); border-radius: 13px; background: linear-gradient(180deg, rgba(8, 28, 53, .65), rgba(2, 9, 19, .92)); }
.fan-chart-stage canvas { display: block; width: 100%; height: 510px; touch-action: pan-y; }
.fan-chart-tooltip { position: absolute; z-index: 4; max-width: 240px; padding: 9px 11px; pointer-events: none; border: 1px solid rgba(106, 164, 246, .45); border-radius: 9px; color: #eaf4ff; background: rgba(2, 10, 22, .96); box-shadow: 0 12px 28px rgba(0, 0, 0, .38); font: 600 11px/1.5 var(--font-mono); transform: translate(12px, 12px); }
.fan-chart-tooltip[hidden] { display: none; }
.fan-chart-description { margin: 12px 0 0; color: #8da3bf; font-size: 12px; line-height: 1.55; }

.fan-curve-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fan-curve-legend button { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid rgba(79, 138, 214, .24); border-radius: 10px; color: #bdcee3; background: rgba(7, 24, 46, .68); font-size: 11px; }
.fan-curve-legend button[aria-pressed="false"] { opacity: .46; }
.fan-curve-legend svg { width: 34px; height: 12px; overflow: visible; }
.fan-curve-legend line { stroke-width: 4; }

.fan-curve-section { padding: 8px clamp(24px, 4vw, 48px) 42px; }
.fan-curve-section + .fan-curve-section { padding-top: 34px; border-top: 1px solid var(--curve-border); }
.fan-curve-section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.fan-curve-section-head h3 { margin: 8px 0 0; color: #f3f7ff; font: 700 clamp(25px, 3.3vw, 36px)/1.1 var(--font-display); }
.fan-curve-section-head p { max-width: 620px; margin: 0; color: #91a7c3; line-height: 1.55; }
.fan-curve-section-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.fan-table-scroll { overflow-x: auto; border: 1px solid var(--curve-border); border-radius: 15px; background: rgba(3, 13, 27, .72); scrollbar-color: #245aa5 #071426; }
.fan-data-table { width: 100%; min-width: 1080px; border-collapse: collapse; color: #dbe7f5; font-size: 12px; }
.fan-data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fan-data-table th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; color: #91aaca; background: #0a1b33; font: 700 10px/1.3 var(--font-mono); letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.fan-data-table td { padding: 12px; border-top: 1px solid rgba(80, 137, 211, .15); vertical-align: middle; }
.fan-data-table tbody tr:hover { background: rgba(30, 83, 216, .08); }
.fan-data-table strong { color: #fff; }
.fan-data-table small { color: #8ba1bc; }
.fan-data-table .is-numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fan-downloads { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.fan-download-link,
.fan-download-missing { display: inline-grid; min-width: 42px; min-height: 38px; padding: 7px 9px; place-items: center; border-radius: 8px; font: 800 10px/1 var(--font-mono); }
.fan-download-link { color: #dceaff; border: 1px solid rgba(67, 137, 235, .34); background: rgba(24, 70, 139, .28); }
.fan-download-link:hover { color: #fff; border-color: #4a96ff; background: rgba(34, 91, 181, .46); }
.fan-download-missing { color: #667991; border: 1px dashed rgba(94, 127, 169, .25); cursor: not-allowed; }
.fan-download-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.fan-model-search-wrap { min-width: min(100%, 340px); }

.fan-empty { margin: 0; padding: 14px; color: #8fa5c1; border: 1px dashed rgba(78, 142, 226, .26); border-radius: 10px; font-size: 12px; text-align: center; }
.fan-empty[hidden] { display: none; }

@media (max-width: 1020px) {
  .fan-curve-head { display: grid; }
  .fan-curve-head .resource-tool-brand { justify-self: start; }
  .fan-curve-tools { justify-content: flex-start; }
  .fan-curve-workspace { grid-template-columns: 1fr; }
  .fan-curve-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .fan-curve-tool { margin-inline: -2px; border-radius: 20px; }
  .fan-curve-head,
  .fan-curve-workspace,
  .fan-curve-section { padding-left: 17px; padding-right: 17px; }
  .fan-curve-head h2 { font-size: 34px; }
  .fan-curve-add-form { grid-template-columns: 1fr 100px; }
  .fan-curve-add-form .fan-curve-primary { grid-column: 1 / -1; }
  .fan-curve-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fan-unit-toggle { grid-column: 1 / -1; }
  .fan-unit-toggle label { flex: 1; }
  .fan-curve-tools .fan-curve-secondary { min-width: 0; padding-inline: 7px; font-size: 11px; }
  .fan-curve-sidebar { grid-template-columns: 1fr; }
  .fan-chart-card { padding: 10px; }
  .fan-chart-heading { display: grid; }
  .fan-chart-stage,
  .fan-chart-stage canvas { min-height: 390px; height: 390px; }
  .fan-curve-section-head { display: grid; align-items: start; }
  .fan-curve-section-actions { justify-content: flex-start; }
  .fan-model-search-wrap { min-width: 0; width: 100%; }
  .fan-duty-form { grid-template-columns: 1fr; }
  .fan-duty-form .fan-curve-field:first-child,
  .fan-duty-form .fan-curve-primary { grid-column: auto; }
  .fan-model-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .fan-curve-tool *, .fan-curve-tool *::before, .fan-curve-tool *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
