/* Centrifuge RCF ⇄ RPM — 37degrees. Scoped to .cf-root. Dark default + .cf-theme-light. */
.cf-root {
  --cf-navy-900: #082540; --cf-navy-950: #04141f; --cf-navy-700: #133b56; --cf-navy-400: #5d83a1;
  --cf-text: #dde4ed; --cf-muted: #8ba5bd; --cf-accent: #ff7bac; --cf-accent-2: #ec1f6a; --cf-green: #34d399;
  --cf-surface: rgba(4,20,31,0.55); --cf-radius: 14px; --cf-radius-sm: 10px; --cf-radius-chip: 999px;
  --cf-mono: "JetBrains Mono","SFMono-Regular",ui-monospace,Menlo,Consolas,monospace;
  --cf-font: "Nunito Sans Variable","Nunito Sans",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  position: relative; font-family: var(--cf-font); color: var(--cf-text);
  background: linear-gradient(180deg,var(--cf-navy-900) 0%,var(--cf-navy-950) 100%);
  border: 1px solid var(--cf-navy-700); border-radius: var(--cf-radius); padding: 24px;
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr);
  grid-template-areas: "header header" "rail result" "footer footer"; gap: 18px;
  box-shadow: 0 10px 40px rgba(4,20,31,0.35); box-sizing: border-box; max-width: 100%;
}
.cf-root *, .cf-root *::before, .cf-root *::after { box-sizing: border-box; }
@media (max-width: 760px) { .cf-root { grid-template-columns: 1fr; grid-template-areas: "header" "rail" "result" "footer"; } }

.cf-root.cf-theme-light {
  --cf-text: #082540; --cf-muted: #5d83a1; --cf-navy-700: #dde4ed; --cf-surface: #f7f9fc;
  background: linear-gradient(180deg,#ffffff 0%,#f1f4f8 100%); border-color: #dde4ed; box-shadow: 0 6px 24px rgba(8,37,64,0.08);
}
.cf-root.cf-theme-light .cf-card, .cf-root.cf-theme-light .cf-result, .cf-root.cf-theme-light .cf-stat,
.cf-root.cf-theme-light .cf-num, .cf-root.cf-theme-light .cf-select { background: #ffffff; border-color: #dde4ed; color: var(--cf-text); }
.cf-root.cf-theme-light .cf-viz { background: #f7f9fc; }

.cf-header { grid-area: header; display: flex; flex-direction: column; gap: 4px; }
.cf-eyebrow { font-size: 11px; letter-spacing: 3px; font-weight: 800; color: var(--cf-accent); }
.cf-title { font-size: 22px; font-weight: 800; line-height: 1.2; }
.cf-subtitle { font-size: 14px; color: var(--cf-muted); line-height: 1.45; }

.cf-rail { grid-area: rail; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cf-card { background: rgba(8,37,64,0.4); border: 1px solid var(--cf-navy-700); border-radius: var(--cf-radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.cf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto; }
.cf-label { font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--cf-muted); text-transform: uppercase; }
.cf-inline { display: flex; align-items: center; gap: 8px; }
.cf-suffix { font-size: 12px; font-weight: 700; color: var(--cf-muted); white-space: nowrap; }
.cf-conv { align-items: flex-end; gap: 12px; }
.cf-swap { font-size: 22px; color: var(--cf-accent); font-weight: 800; padding-bottom: 6px; }

.cf-num { width: 100%; font-family: var(--cf-mono); font-size: 17px; font-weight: 800; color: var(--cf-text);
  background: var(--cf-surface); border: 1px solid var(--cf-navy-700); border-radius: var(--cf-radius-sm); padding: 9px 12px; outline: none; }
.cf-num:focus { border-color: var(--cf-accent); box-shadow: 0 0 0 3px rgba(255,123,172,0.18); }
.cf-select { width: 100%; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--cf-text);
  background: var(--cf-surface); border: 1px solid var(--cf-navy-700); border-radius: var(--cf-radius-sm); padding: 9px 30px 9px 12px; outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='%238ba5bd' d='M6 8.5 1.5 4h9z'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px; }
.cf-select:focus { border-color: var(--cf-accent); box-shadow: 0 0 0 3px rgba(255,123,172,0.18); }

.cf-slider-wrap { padding-top: 2px; }
.cf-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--cf-accent), var(--cf-accent-2)); outline: none; cursor: pointer; }
.cf-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--cf-accent); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.cf-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--cf-accent); cursor: pointer; }

/* ---- Result ---- */
.cf-result { grid-area: result; background: rgba(8,37,64,0.4); border: 1px solid var(--cf-navy-700); border-radius: var(--cf-radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.cf-result-head { width: 100%; }
.cf-result-title { font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--cf-accent); text-transform: uppercase; }
.cf-big-value { font-family: var(--cf-mono); font-size: 40px; font-weight: 800; line-height: 1; color: var(--cf-text); letter-spacing: -1px; align-self: flex-start; }
.cf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.cf-stat { background: var(--cf-surface); border: 1px solid var(--cf-navy-700); border-radius: var(--cf-radius-sm); padding: 10px 12px; }
.cf-stat-label { font-size: 10px; letter-spacing: 1.5px; font-weight: 800; color: var(--cf-muted); text-transform: uppercase; }
.cf-stat-value { font-family: var(--cf-mono); font-size: 18px; font-weight: 800; color: var(--cf-text); }

/* ---- Rotor visualization ---- */
.cf-viz { width: 100%; display: flex; justify-content: center; padding: 6px 0; }
.cf-rotor { width: 230px; max-width: 70%; height: auto; }
.cf-spin { transform-origin: 120px 120px; }
@keyframes cf-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.cf-rotor-body { fill: rgba(255,123,172,0.06); stroke: var(--cf-accent); stroke-width: 2.5; }
.cf-rotor-hub { fill: var(--cf-navy-700); stroke: var(--cf-accent); stroke-width: 1.5; }
.cf-tube { fill: rgba(141,165,189,0.18); stroke: var(--cf-navy-400); stroke-width: 1.5; }
.cf-tube-hot { fill: var(--cf-accent); stroke: #fff; stroke-width: 2; }
.cf-radius-line { stroke: var(--cf-accent); stroke-width: 2.5; stroke-dasharray: 4 3; }
.cf-center-dot { fill: var(--cf-text); }
.cf-r-label { fill: var(--cf-accent); font-family: var(--cf-mono); font-size: 12px; font-weight: 800; }
.cf-root.cf-theme-light .cf-rotor-body { fill: rgba(255,123,172,0.08); }
.cf-root.cf-theme-light .cf-rotor-hub { fill: #e4ecf2; }

.cf-footer { grid-area: footer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--cf-muted); }
.cf-footer a { color: var(--cf-text); text-decoration: none; font-weight: 700; }
.cf-footer-brand { color: #ff7bac !important; font-weight: 700; }
.cf-footer-brand:hover { color: #ec1f6a !important; text-decoration: underline; }
.cf-footer-sep { opacity: 0.5; }
.cf-fatal { padding: 16px; border-radius: 10px; background: rgba(236,31,106,0.12); border: 1px solid #ec1f6a; color: #fff; }

/* ---- Expand / fullscreen ---- */
.cf-expand-icon { position: absolute; top: 14px; right: 14px; z-index: 50; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: rgba(255,123,172,0.10); color: #ec1f6a; border: 1px solid rgba(255,123,172,0.30); border-radius: 10px; cursor: pointer; padding: 0; font-family: inherit; transition: background .12s, transform .12s; }
.cf-expand-icon:hover { background: rgba(255,123,172,0.22); transform: scale(1.05); }
.cf-expand-icon-label { display: none; }
.cf-brand-mark { display: none; }
html.cf-html-locked, body.cf-body-locked { overflow: hidden !important; height: 100vh !important; }

.cf-root.cf-is-expanded {
  position: fixed; inset: 0; z-index: 99990; margin: 0; border: none; border-radius: 0; box-shadow: none;
  background: #ffffff; color: #082540;
  --cf-text: #082540; --cf-muted: #5d83a1; --cf-navy-700: #dde4ed; --cf-surface: #f7f9fc;
  grid-template-columns: 360px minmax(0,1fr); grid-template-areas: "brand result" "rail result" "footer footer";
  grid-template-rows: auto minmax(0,1fr) auto; gap: 0; padding: 0; height: 100vh; overflow: hidden;
}
.cf-root.cf-is-expanded .cf-header { display: none; }
.cf-root.cf-is-expanded .cf-rail { grid-area: rail; overflow-y: auto; padding: 18px; border-right: 1px solid #dde4ed; background: #f1f4f8; min-height: 0; }
.cf-root.cf-is-expanded .cf-result { grid-area: result; overflow-y: auto; min-height: 0; background: #fff; padding: 24px; justify-content: flex-start; }
.cf-root.cf-is-expanded .cf-card, .cf-root.cf-is-expanded .cf-stat, .cf-root.cf-is-expanded .cf-num, .cf-root.cf-is-expanded .cf-select { background: #fff; border-color: #dde4ed; color: #082540; }
.cf-root.cf-is-expanded .cf-rotor { width: 320px; }
.cf-root.cf-is-expanded .cf-expand-icon { position: fixed; top: 18px; right: 22px; z-index: 99991; }
.cf-root.cf-is-expanded .cf-rail .cf-expand-icon { position: static; top: auto; right: auto; width: 100%; height: 40px; margin-bottom: 4px; gap: 8px; justify-content: center; font-weight: 800; font-size: 13px; }
.cf-root.cf-is-expanded .cf-expand-icon-label { display: inline-block; }
.cf-root.cf-is-expanded .cf-brand-mark { grid-area: brand; display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; background: #082540; font-family: var(--cf-font); font-weight: 800; font-size: 15px; line-height: 1; padding: 14px 20px; }
.cf-root.cf-is-expanded .cf-brand-mark svg { height: 28px; width: 28px; display: block; }
.cf-root.cf-is-expanded .cf-brand-mark .cf-brand-sep { color: #ff7bac; margin: 0 2px; }
.cf-root.cf-is-expanded .cf-brand-mark .cf-tool-name { color: #ff7bac; }
.cf-root.cf-is-expanded .cf-footer { grid-area: footer; background: #082540; padding: 12px 24px; justify-content: center; margin: 0; }
.cf-root.cf-is-expanded .cf-footer, .cf-root.cf-is-expanded .cf-footer span { color: #fff; }
.cf-root.cf-is-expanded .cf-footer a { color: #ff7bac; }
@media (max-width: 960px) {
  .cf-root.cf-is-expanded { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0,1fr) auto; grid-template-areas: "brand" "rail" "result" "footer"; }
  .cf-root.cf-is-expanded .cf-rail { border-right: none; border-bottom: 1px solid #e4ecf2; max-height: 45vh; }
  .cf-root.cf-is-expanded .cf-brand-mark .cf-brand-sep, .cf-root.cf-is-expanded .cf-brand-mark .cf-tool-name { display: none; }
}

@media (prefers-reduced-motion: reduce) { .cf-spin { animation: none !important; } }
@media (max-width: 640px) { .cf-root { padding: 18px; } .cf-title { font-size: 19px; } .cf-big-value { font-size: 32px; } }
