:root {
  --bg: #0f0f14;
  --bg-card: #1e1e28;
  --bg-surface: #18181f;
  --primary: #3b82f6;
  --secondary: #2563eb;
  --accent: #60a5fa;
  --purple: #a78bfa;
  --teal: #2dd4bf;
  --green: #22c55e;
  --orange: #f97316;
  --yellow: #eab308;
  --red: #ef4444;
  --text: #e8e8f0;
  --text-muted: #9999b8;
  --text-faint: #555570;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: .85em; background: rgba(59,130,246,.1); color: #93c5fd; padding: 2px 6px; border-radius: 4px; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── HEADER ── */
.site-header { background: rgba(15,15,20,.92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 200; padding: 0 24px; height: 58px; display: flex; align-items: center; }
.header-inner { width: 100%; max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.logo-icon { width: 32px; height: 32px; flex-shrink: 0; }
.logo-text { font-size: .97rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.main-nav { display: flex; gap: 6px; }
.nav-link { padding: 5px 12px; border-radius: var(--radius-sm); font-size: .84rem; font-weight: 500; color: var(--text-muted); text-decoration: none; transition: color .15s, background .15s; }
.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(255,255,255,.06); }

/* ── LAYOUT ── */
.main-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 24px 80px; }
@media (max-width: 640px) { .main-wrap { padding: 16px 14px 60px; } }

/* ── HERO ── */
.tool-hero { text-align: center; padding: 20px 0 18px; }
.tool-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; background: rgba(59,130,246,.1); color: var(--accent); border-radius: 20px; font-size: .73rem; font-weight: 600; margin-bottom: 12px; }
.tool-title { font-size: clamp(1.7rem, 4.5vw, 2.6rem); font-weight: 900; letter-spacing: -.03em; margin-bottom: 8px; line-height: 1.1; }
.gradient-title { background: linear-gradient(135deg, var(--accent), var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.tool-subtitle { font-size: .97rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; }

/* ── AD ── */
.ad-slot { background: rgba(255,255,255,.02); border: 1px dashed rgba(255,255,255,.07); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; min-height: 90px; font-size: .75rem; color: var(--text-faint); padding: 12px; margin-bottom: 20px; }

/* ── MAIN GRID ── */
.tool-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

/* ── CARD ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.card-header { padding: 11px 16px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-icon { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card-icon svg { width: 13px; height: 13px; }
.card-icon.blue { background: rgba(59,130,246,.12); color: var(--primary); }
.card-icon.purple { background: rgba(167,139,250,.12); color: var(--purple); }
.card-icon.green { background: rgba(34,197,94,.12); color: var(--green); }
.card-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.card-body { padding: 16px; }

/* ── SERIES LIST ── */
.series-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.series-item { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .15s; }
.series-item.active-series { border-color: var(--series-color, var(--primary)); }
.series-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.series-swatch { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.series-name-input { flex: 1; background: transparent; border: none; color: var(--text); font-size: .84rem; font-weight: 600; outline: none; min-width: 0; }
.series-toggle { font-size: .7rem; color: var(--text-faint); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); background: transparent; cursor: pointer; white-space: nowrap; transition: all .15s; }
.series-toggle:hover { border-color: rgba(255,255,255,.2); color: var(--text-muted); }
.series-remove { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border); background: transparent; color: var(--text-faint); font-size: .9rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; flex-shrink: 0; }
.series-remove:hover { border-color: rgba(239,68,68,.4); color: #f87171; background: rgba(239,68,68,.06); }
.series-body { padding: 0 12px 12px; }

/* ── POINT TABLE ── */
.pt-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.pt-table thead th { text-align: left; padding: 4px 6px; font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); border-bottom: 1px solid var(--border); }
.pt-table tbody td { padding: 3px 3px; }
.pt-input { width: 100%; background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 5px; padding: 5px 7px; color: var(--text); font-family: var(--font-mono); font-size: .8rem; outline: none; transition: border-color .15s; }
.pt-input:focus { border-color: var(--primary); }
.pt-input.err { border-color: rgba(239,68,68,.4); }
.pt-label-input { width: 100%; background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 5px; padding: 5px 7px; color: var(--text-muted); font-size: .78rem; outline: none; transition: border-color .15s; }
.pt-label-input:focus { border-color: rgba(255,255,255,.2); }
.pt-del { width: 22px; height: 22px; border-radius: 4px; border: 1px solid transparent; background: transparent; color: var(--text-faint); font-size: .85rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.pt-del:hover { border-color: rgba(239,68,68,.3); color: #f87171; background: rgba(239,68,68,.05); }
.add-point-btn { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--radius-sm); font-size: .76rem; font-weight: 600; border: 1px dashed var(--border); color: var(--text-faint); cursor: pointer; transition: all .15s; margin-top: 8px; background: transparent; }
.add-point-btn:hover { border-color: var(--primary); color: var(--accent); background: rgba(59,130,246,.05); }

/* ── CHART OPTIONS ── */
.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.opt-label { font-size: .74rem; font-weight: 600; color: var(--text-faint); min-width: 60px; }
.opt-chip { padding: 4px 10px; border-radius: 999px; font-size: .73rem; font-weight: 700; border: 1px solid var(--border); color: var(--text-muted); background: transparent; cursor: pointer; transition: all .15s; white-space: nowrap; }
.opt-chip.active { background: rgba(59,130,246,.15); border-color: rgba(59,130,246,.4); color: var(--accent); }
.opt-chip:hover:not(.active) { border-color: rgba(255,255,255,.18); color: var(--text); }
.opt-field { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 8px; color: var(--text-muted); font-size: .8rem; outline: none; }
.opt-field:focus { border-color: var(--primary); }
.checkbox-row { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.checkbox-row input[type=checkbox] { accent-color: var(--primary); width: 14px; height: 14px; }

/* ── ACTION BUTTONS ── */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--primary), var(--purple)); color: #fff; font-weight: 700; font-size: .86rem; border: none; cursor: pointer; transition: opacity .15s; white-space: nowrap; }
.btn-primary:hover { opacity: .88; }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--border); color: var(--text-muted); font-size: .8rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-secondary:hover { border-color: rgba(255,255,255,.2); color: var(--text); }
.btn-primary svg, .btn-secondary svg { width: 13px; height: 13px; }

/* ── CANVAS WRAPPER ── */
.canvas-wrap { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.canvas-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02); flex-wrap: wrap; }
.canvas-title { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.canvas-spacer { flex: 1; }
#graph-canvas { display: block; width: 100%; cursor: crosshair; }

/* ── TOOLTIP ── */
.graph-tooltip { position: absolute; pointer-events: none; background: rgba(15,15,20,.95); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 11px; font-size: .78rem; color: var(--text); white-space: nowrap; z-index: 10; display: none; }
.graph-tooltip.visible { display: block; }
.tt-series { font-weight: 700; margin-bottom: 2px; }
.tt-coords { font-family: var(--font-mono); font-size: .75rem; color: var(--text-muted); }

/* ── STATS BAR ── */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); background: rgba(255,255,255,.01); }
.stat-chip { display: flex; flex-direction: column; gap: 2px; }
.stat-chip-label { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.stat-chip-val { font-size: .84rem; font-weight: 700; font-family: var(--font-mono); color: var(--accent); }

/* ── IMPORT/EXPORT ── */
.import-area { width: 100%; min-height: 90px; background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font-family: var(--font-mono); font-size: .78rem; resize: vertical; outline: none; line-height: 1.6; }
.import-area:focus { border-color: var(--primary); }
.import-area::placeholder { color: var(--text-faint); }

/* ── SECTIONS ── */
.page-section { margin-top: clamp(28px, 4vw, 48px); }
.section-head { margin-bottom: 16px; }
.section-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 5px; }
.section-desc { font-size: .86rem; color: var(--text-muted); line-height: 1.7; }
.section-divider { height: 1px; background: var(--border); margin: clamp(28px, 4vw, 48px) 0; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 11px; }
.feature-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px; }
.feature-icon { font-size: 1.3rem; margin-bottom: 9px; }
.feature-title { font-size: .86rem; font-weight: 700; margin-bottom: 4px; }
.feature-desc { font-size: .78rem; color: var(--text-muted); line-height: 1.6; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 11px; }
.step-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px; }
.step-number { width: 27px; height: 27px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--purple)); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; color: #fff; margin-bottom: 10px; }
.step-title { font-size: .86rem; font-weight: 700; margin-bottom: 4px; }
.step-desc { font-size: .78rem; color: var(--text-muted); line-height: 1.6; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-q { width: 100%; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .89rem; font-weight: 600; color: var(--text); text-align: left; transition: background .15s; }
.faq-q:hover { background: rgba(255,255,255,.025); }
.faq-icon { font-size: .9rem; color: var(--text-faint); transition: transform .25s; flex-shrink: 0; }
.faq-item.open .faq-icon { transform: rotate(45deg); color: var(--primary); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .35s ease, padding .25s ease; }
.faq-item.open .faq-a { max-height: 400px; padding: 0 16px 14px; }
.faq-a p { font-size: .85rem; color: var(--text-muted); line-height: 1.78; }

/* ── RELATED ── */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 11px; }
.related-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px; display: flex; flex-direction: column; gap: 7px; transition: all .15s; }
.related-card:hover { border-color: rgba(59,130,246,.3); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.related-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.related-icon svg { width: 15px; height: 15px; color: #fff; }
.related-name { font-size: .84rem; font-weight: 700; }
.related-desc { font-size: .76rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.related-link { font-size: .76rem; font-weight: 600; color: var(--primary); }

/* ── TOAST ── */
.toast { position: fixed; bottom: 28px; right: 28px; padding: 10px 18px; background: var(--bg-card); border: 1px solid rgba(59,130,246,.4); border-radius: var(--radius-sm); font-size: .84rem; font-weight: 600; color: var(--accent); box-shadow: 0 8px 28px rgba(0,0,0,.4); opacity: 0; transform: translateY(8px); transition: all .22s; pointer-events: none; z-index: 999; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ── FOOTER ── */
.site-footer { background: var(--bg-surface); border-top: 1px solid var(--border); padding: clamp(24px,4vw,44px) 0 18px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; margin-bottom: 32px; width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: 24px; }
.footer-brand-text { font-size: .86rem; color: var(--text-muted); line-height: 1.7; margin-top: 9px; max-width: 230px; }
.footer-heading { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: 10px; }
.footer-links { display: flex; flex-direction: column; gap: 7px; }
.footer-links a { font-size: .86rem; color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 8px; font-size: .8rem; color: var(--text-faint); width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: 24px; }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
