:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #101828;
  --muted: #64748b;
  --line: #e5eaf2;
  --primary: #5b5cf0;
  --primary-dark: #4546d7;
  --primary-soft: #eef0ff;
  --cyan-soft: #eafbff;
  --success: #047857;
  --danger: #b42318;
  --shadow: 0 20px 60px rgba(15, 23, 42, .08);
  --radius: 20px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 500; background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 12px; }

.site-header { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 60; backdrop-filter: blur(12px); }
.nav-shell { width: min(1160px, calc(100% - 32px)); min-height: 66px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { display: block; width: 122px; height: auto; }
.top-nav { display: flex; gap: 28px; align-items: center; }
.top-nav a { font-size: 13px; font-weight: 750; color: #475569; text-decoration: none; }
.top-nav a:hover { color: var(--primary); }
.mobile-menu-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 10px; cursor: pointer; }
.mobile-menu-button span { display: block; height: 2px; background: #334155; border-radius: 2px; margin: 4px 0; }
.mobile-menu { border-top: 1px solid var(--line); padding: 10px 16px 16px; background: #fff; }
.mobile-menu a { display: block; padding: 10px; font-weight: 750; color: #475569; text-decoration: none; }

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background:
  radial-gradient(circle at 8% 15%, rgba(91,92,240,.13), transparent 28%),
  radial-gradient(circle at 91% 18%, rgba(34,211,238,.14), transparent 30%),
  linear-gradient(180deg, #fff 0%, #f7f8ff 100%); }
.hero::before, .hero::after { content: ""; position: absolute; border: 28px solid rgba(91,92,240,.055); border-radius: 50%; width: 180px; height: 180px; }
.hero::before { left: -120px; bottom: -110px; }
.hero::after { right: -110px; top: -85px; }
.hero-inner { width: min(980px, calc(100% - 32px)); margin: 0 auto; text-align: center; padding: 62px 0 42px; position: relative; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #dfe2ff; border-radius: 999px; padding: 5px 10px; background: rgba(255,255,255,.8); font-size: 11px; font-weight: 800; color: var(--primary); }
.eyebrow span { background: var(--primary); color: #fff; border-radius: 999px; padding: 3px 8px; }
.hero h1 { margin: 18px 0 8px; font-size: clamp(40px, 5vw, 62px); line-height: 1.02; letter-spacing: -.045em; }
.hero > .hero-inner > p { max-width: 760px; margin: 0 auto; color: #526175; font-size: 16px; line-height: 1.55; }
.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.trust-row span { display: inline-flex; align-items: center; min-height: 31px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; background: rgba(255,255,255,.9); color: #475569; font-size: 11px; font-weight: 750; box-shadow: 0 3px 12px rgba(15,23,42,.03); }
.quote-card { margin: 24px auto 0; max-width: 760px; min-height: 52px; padding: 13px 17px; display: flex; align-items: center; gap: 11px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.84); box-shadow: 0 8px 30px rgba(15,23,42,.04); }
.quote-mark { color: var(--primary); font-size: 25px; line-height: 1; font-weight: 900; }
.quote-card p { margin: 0; color: #536277; font-size: 13px; }

.page-grid { width: min(1490px, calc(100% - 24px)); margin: 28px auto 42px; display: grid; grid-template-columns: 160px minmax(0, 1160px) 160px; grid-template-areas: "left main right"; justify-content: center; align-items: start; gap: 18px; }
.side-rail-left { grid-area: left; }
.side-rail-right { grid-area: right; }
.workspace { grid-area: main; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.side-rail { position: sticky; top: 86px; min-width: 0; }
.ad-box { min-height: 600px; border: 1px dashed #d7dfea; border-radius: 15px; display: grid; place-items: center; background: rgba(255,255,255,.7); color: #9aa6b6; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; overflow: hidden; }
.ad-box ins { width: 100%; min-height: 600px; }

.workspace-head { padding: 24px 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; border-bottom: 1px solid var(--line); }
.workspace-head h2 { margin: 4px 0 5px; font-size: 25px; letter-spacing: -.025em; }
.workspace-head p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.section-kicker, .card-kicker { margin: 0; color: var(--primary); text-transform: uppercase; letter-spacing: .12em; font-weight: 900; font-size: 10px; }
.calculator-jump { display: flex; gap: 8px; overflow-x: auto; padding: 13px 20px; border-bottom: 1px solid var(--line); background: #fbfcff; scrollbar-width: thin; }
.calculator-jump a { flex: 0 0 auto; text-decoration: none; color: #4b5563; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 11px; font-weight: 800; }
.calculator-jump a:hover { color: var(--primary); border-color: #cfd3ff; background: var(--primary-soft); }
.calculator-stack { padding: 20px; display: grid; gap: 16px; background: #f9fbfe; }
.calculator-card { scroll-margin-top: 90px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 5px 24px rgba(15,23,42,.035); }
.feature-card { border-color: #dfe2ff; box-shadow: 0 10px 34px rgba(91,92,240,.07); }
.card-heading { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 18px; }
.card-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 19px; font-weight: 900; }
.card-heading h2 { margin: 2px 0 4px; font-size: 21px; letter-spacing: -.02em; }
.card-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.compact-heading { margin-bottom: 15px; }
.compact-heading h2 { font-size: 19px; }

.equation-form { display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr) auto minmax(140px, 1fr); gap: 10px; align-items: end; }
.input-group { display: block; min-width: 0; }
.input-group > span:first-child { display: block; margin-bottom: 6px; color: #64748b; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.input-group input, .input-group select, .phrase-equation input { width: 100%; min-width: 0; min-height: 47px; border: 1px solid #dbe2eb; border-radius: 11px; background: #fff; color: #111827; padding: 10px 12px; outline: none; font-size: 15px; }
.input-group input:focus, .input-group select:focus, .phrase-equation input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,92,240,.10); }
.input-wrap { position: relative; min-width: 0; }
.suffix-wrap input { padding-right: 34px; }
.suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #64748b; font-weight: 800; pointer-events: none; }
.equation-word { align-self: end; min-height: 47px; display: grid; place-items: center; color: #64748b; font-weight: 800; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 9px; margin-top: 4px; }
.button { min-height: 42px; border-radius: 11px; border: 1px solid transparent; font-weight: 800; cursor: pointer; padding: 9px 14px; transition: transform .16s, box-shadow .16s, background .16s, border-color .16s; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .copy-button:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(91,92,240,.22); outline-offset: 2px; }
.button-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91,92,240,.18); }
.button-primary:hover { background: var(--primary-dark); }
.button-ghost { background: #fff; border-color: var(--line); color: #475569; }
.button-ghost:hover { background: #f8fafc; }
.button-full { width: 100%; }

.result-panel { margin-top: 14px; min-height: 78px; border: 1px solid #d9e5ff; border-radius: 14px; background: linear-gradient(135deg, #f7f8ff, #f3fdff); padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.result-panel > div { min-width: 0; }
.result-label { display: block; color: #64748b; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .11em; }
.result-value { display: block; margin-top: 2px; color: #172554; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.result-formula { display: block; margin-top: 4px; color: #64748b; font-size: 11px; line-height: 1.45; }
.result-panel.is-error { background: #fff7f6; border-color: #f2c7c2; }
.result-panel.is-error .result-value { color: var(--danger); font-size: 15px; }
.result-panel-small .result-value { font-size: 19px; }
.copy-button { flex: 0 0 auto; border: 1px solid #dfe5ee; background: #fff; color: #526175; border-radius: 9px; padding: 7px 10px; font-size: 10px; font-weight: 850; cursor: pointer; }
.copy-button:hover { color: var(--primary); border-color: #cfd3ff; }

.phrase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.phrase-card { border: 1px solid var(--line); border-radius: 15px; padding: 15px; background: #fbfcff; }
.phrase-card h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: -.01em; }
.phrase-card h3 em { color: var(--primary); font-style: normal; }
.phrase-equation { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; margin-bottom: 10px; }
.phrase-equation > span { color: #64748b; font-size: 10px; font-weight: 800; text-align: center; }
.phrase-equation input { min-height: 42px; font-size: 13px; padding: 8px 9px; }
.mini-result { margin-top: 10px; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px; min-height: 70px; }
.mini-result span, .mini-result strong, .mini-result small { display: block; }
.mini-result span { color: #64748b; text-transform: uppercase; letter-spacing: .1em; font-size: 8px; font-weight: 900; }
.mini-result strong { color: #172554; font-size: 18px; margin-top: 2px; overflow-wrap: anywhere; }
.mini-result small { color: #8491a4; font-size: 9px; margin-top: 3px; }
.mini-result.is-error strong { color: var(--danger); font-size: 12px; }

.dual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.simple-form { display: grid; gap: 11px; }
.two-input-grid, .change-middle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.simple-form .form-actions { grid-column: auto; margin-top: 1px; }

.history-panel { border-top: 1px solid var(--line); padding: 22px 24px 24px; }
.history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.history-head h2 { margin: 4px 0 4px; font-size: 20px; }
.history-head p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.text-button { border: 0; background: transparent; color: var(--primary); font-size: 11px; font-weight: 850; cursor: pointer; padding: 7px; }
.history-list { margin-top: 13px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.history-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcff; }
.history-item strong { display: block; font-size: 12px; color: #334155; overflow-wrap: anywhere; }
.history-item small { display: block; color: #94a3b8; margin-top: 2px; font-size: 9px; }
.history-empty { grid-column: 1 / -1; margin: 0; padding: 13px; text-align: center; color: #94a3b8; font-size: 11px; border: 1px dashed #d9e1ec; border-radius: 11px; }

.content-section { background: #fff; border-top: 1px solid var(--line); }
.content-inner { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 64px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.info-grid h2 { margin: 12px 0 7px; font-size: 18px; }
.info-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.info-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.seo-copy { margin-top: 42px; display: grid; grid-template-columns: 1.25fr .75fr; gap: 42px; align-items: start; }
.seo-copy h2, .faq-block h2, .related-tools h2 { margin: 6px 0 13px; font-size: 29px; letter-spacing: -.025em; }
.seo-copy p { color: #526175; font-size: 14px; line-height: 1.65; }
.formula-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.formula-card h3 { margin: 0 0 12px; font-size: 16px; }
.formula-card dl { margin: 0; display: grid; gap: 0; }
.formula-card dl > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.formula-card dt { color: #64748b; font-size: 11px; font-weight: 750; }
.formula-card dd { margin: 0; text-align: right; color: #334155; font-size: 11px; font-weight: 850; }
.faq-block { margin-top: 45px; max-width: 900px; }
.faq-block details { border-top: 1px solid var(--line); padding: 15px 0; }
.faq-block details:last-child { border-bottom: 1px solid var(--line); }
.faq-block summary { cursor: pointer; font-weight: 800; font-size: 14px; }
.faq-block details p { color: var(--muted); margin-bottom: 0; font-size: 13px; line-height: 1.6; }
.related-tools { margin-top: 46px; }
.section-heading-row { display: flex; justify-content: space-between; gap: 20px; align-items: end; }
.section-heading-row a { color: var(--primary); font-weight: 800; text-decoration: none; font-size: 13px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.related-card { padding: 17px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; display: flex; gap: 13px; align-items: center; transition: transform .16s, box-shadow .16s; }
.related-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15,23,42,.06); }
.related-card > span { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 20px; font-weight: 900; }
.related-card strong, .related-card small { display: block; }
.related-card strong { font-size: 13px; }
.related-card small { color: var(--muted); margin-top: 2px; font-size: 10px; }

.site-footer { background: #0b1220; color: #cbd5e1; }
.footer-inner { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0; display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 30px; align-items: center; }
.footer-brand img { filter: brightness(0) invert(1); width: 120px; height: auto; }
.footer-brand p { margin: 9px 0 0; color: #94a3b8; font-size: 13px; max-width: 380px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 11px 18px; font-size: 12px; }
.footer-links a { color: #cbd5e1; text-decoration: none; }
.footer-links a:hover { color: #fff; }
.visitor-card { min-width: 118px; text-align: center; border: 1px solid #263246; border-radius: 13px; padding: 10px 14px; background: #101a2b; }
.visitor-card span { display: block; color: #94a3b8; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.visitor-card strong { color: #fff; font-size: 18px; }
.footer-bottom { border-top: 1px solid #1d293a; text-align: center; padding: 14px 16px; color: #728096; font-size: 11px; }

.cookie-banner { position: fixed; z-index: 100; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(860px, calc(100% - 24px)); background: #111827; color: #fff; border: 1px solid #273449; box-shadow: 0 20px 60px rgba(0,0,0,.32); border-radius: 16px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.cookie-banner[hidden] { display: none; }
.cookie-banner strong { font-size: 14px; }
.cookie-banner p { margin: 4px 0 0; color: #cbd5e1; font-size: 12px; }
.cookie-banner a { color: #fff; }
.cookie-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.cookie-banner .button-ghost { background: transparent; color: #e5e7eb; border-color: #435069; }
.toast { position: fixed; z-index: 120; right: 18px; bottom: 18px; max-width: 340px; background: #111827; color: #fff; border-radius: 12px; padding: 12px 15px; box-shadow: 0 14px 40px rgba(0,0,0,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; font-size: 13px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.noscript { position: fixed; inset: auto 12px 12px; z-index: 200; background: #7f1d1d; color: #fff; padding: 14px; border-radius: 12px; text-align: center; }

@media (max-width: 1420px) {
  .page-grid { grid-template-columns: 140px minmax(0, 1050px) 140px; gap: 12px; }
}
@media (max-width: 1240px) {
  .page-grid { display: block; width: min(1160px, calc(100% - 24px)); }
  .workspace { width: 100%; }
  .side-rail { position: static; min-height: 92px; margin: 12px 0; }
  .side-rail-left { display: none; }
  .side-rail-right { margin-top: 16px; }
  .ad-box { min-height: 92px; }
  .ad-box ins { min-height: 90px; }
}
@media (max-width: 880px) {
  .top-nav { display: none; }
  .mobile-menu-button { display: block; }
  .equation-form { grid-template-columns: 1fr auto 1fr; }
  .equation-form .input-group:nth-of-type(3) { grid-column: 1 / 4; }
  .equation-form .equation-word:nth-of-type(2) { display: none; }
  .phrase-grid { grid-template-columns: 1fr; }
  .dual-grid { grid-template-columns: 1fr; }
  .seo-copy { grid-template-columns: 1fr; gap: 20px; }
  .info-grid, .related-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .visitor-card { width: 128px; }
}
@media (max-width: 620px) {
  .nav-shell { min-height: 62px; width: calc(100% - 20px); }
  .brand img { width: 112px; }
  .hero-inner { width: calc(100% - 24px); padding: 40px 0 32px; }
  .hero h1 { font-size: 40px; }
  .hero > .hero-inner > p { font-size: 14px; }
  .page-grid { width: calc(100% - 12px); margin-top: 14px; }
  .workspace { border-radius: 16px; }
  .workspace-head { padding: 18px 16px; display: block; }
  .workspace-head .button { margin-top: 13px; }
  .calculator-stack { padding: 10px; }
  .calculator-card { padding: 15px; border-radius: 15px; }
  .card-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .card-heading h2 { font-size: 18px; }
  .equation-form { grid-template-columns: 1fr; }
  .equation-form .input-group:nth-of-type(3) { grid-column: auto; }
  .equation-word { display: none; }
  .form-actions { flex-direction: column; }
  .form-actions .button { width: 100%; }
  .two-input-grid, .change-middle { grid-template-columns: 1fr; }
  .phrase-equation { grid-template-columns: 1fr; }
  .phrase-equation > span { padding: 1px 0; }
  .result-panel { align-items: flex-start; }
  .result-value { font-size: 19px; }
  .history-panel { padding: 18px 15px; }
  .history-head { display: block; }
  .history-head .text-button { padding-left: 0; margin-top: 7px; }
  .history-list { grid-template-columns: 1fr; }
  .content-inner { width: calc(100% - 24px); padding: 42px 0 50px; }
  .seo-copy h2, .faq-block h2, .related-tools h2 { font-size: 25px; }
  .section-heading-row { align-items: flex-start; flex-direction: column; gap: 3px; }
  .cookie-banner { bottom: 10px; display: block; }
  .cookie-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; }
  .cookie-actions .button { min-height: 40px; padding: 8px 9px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
