:root {
  --bg: #f6f8fc;
  --bg-soft: #eef2f9;
  --bg-card: #ffffff;
  --bg-input: #f4f7fc;
  --border: #dfe6f1;
  --border-soft: #e8edf6;
  --text: #16213a;
  --text-dim: #53617c;
  --text-faint: #8b97ad;
  --accent: #2563eb;
  --accent-2: #0891b2;
  --green: #059669;
  --amber: #b45309;
  --red: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 10px 34px rgba(23, 45, 90, 0.08);
  --shadow-card-lg: 0 22px 60px rgba(23, 45, 90, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "SF Mono", SFMono-Regular, ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Aurora animated background ---------- */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.bg-aurora .blob-1 {
  width: 560px; height: 560px;
  top: -160px; left: -120px;
  background: radial-gradient(circle at 30% 30%, #93c5fd, transparent 65%);
  animation: drift-1 26s ease-in-out infinite;
}
.bg-aurora .blob-2 {
  width: 480px; height: 480px;
  top: 8%; right: -140px;
  background: radial-gradient(circle at 60% 40%, #a5f3fc, transparent 65%);
  animation: drift-2 32s ease-in-out infinite;
}
.bg-aurora .blob-3 {
  width: 520px; height: 520px;
  bottom: -180px; left: 30%;
  background: radial-gradient(circle at 50% 50%, #c7d2fe, transparent 65%);
  animation: drift-3 38s ease-in-out infinite;
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 75%);
}
@keyframes drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(90px, 70px) scale(1.12); }
  66% { transform: translate(-40px, 110px) scale(0.94); }
}
@keyframes drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(-110px, 60px) scale(1.08); }
  75% { transform: translate(-30px, -70px) scale(0.9); }
}
@keyframes drift-3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  30% { transform: translate(120px, -60px) scale(1.1); }
  70% { transform: translate(-90px, 30px) scale(0.92); }
}

/* ---------- Mouse spotlight ---------- */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
  background: radial-gradient(640px circle at var(--mx, 50%) var(--my, 30%), rgba(37, 99, 235, 0.09), transparent 62%);
}
html.has-mouse .spotlight { opacity: 1; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.site-header.scrolled {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--border-soft);
  box-shadow: 0 8px 30px rgba(23, 45, 90, 0.08);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand svg { width: 26px; height: 26px; flex: none; transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.brand:hover svg { transform: rotate(-8deg) scale(1.12); }
.brand span em { color: var(--accent-2); font-style: normal; }
.site-nav { display: flex; gap: 22px; font-size: 0.92rem; align-items: center; }
.site-nav a { color: var(--text-dim); position: relative; padding: 4px 0; }
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a:hover::after { transform: scaleX(1); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 30px; text-align: center; position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: -0.025em;
  line-height: 1.12;
  opacity: 0;
  transform: translateY(26px);
  animation: hero-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s forwards;
}
.hero h1 .grad {
  background: linear-gradient(92deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 690px;
  margin: 16px auto 0;
  color: var(--text-dim);
  font-size: 1.06rem;
  opacity: 0;
  transform: translateY(20px);
  animation: hero-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.22s forwards;
}
.hero .badges {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0;
  animation: hero-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.36s forwards;
}
@keyframes hero-in { to { opacity: 1; transform: none; } }
.badge {
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
}
.badge b { color: var(--green); font-weight: 600; }

/* ---------- Tool card ---------- */
.tool-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 26px 0;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  transform: translateY(26px);
  opacity: 0;
  animation: hero-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.45s forwards;
}
.tool-card:hover { box-shadow: var(--shadow-card-lg); }

.tool-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
@media (max-width: 860px) { .tool-grid { grid-template-columns: 1fr; } }

.panel { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); margin-bottom: 8px; font-weight: 600; }

textarea#input-text {
  width: 100%;
  min-height: 264px;
  resize: vertical;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.55;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
textarea#input-text:hover { border-color: #ccd7ea; }
textarea#input-text:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.toolbar { margin-top: 11px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .chars { margin-left: auto; font-size: 0.8rem; color: var(--text-faint); font-family: var(--mono); }

.btn {
  appearance: none;
  border: 1px solid var(--border-strong, #d4dded);
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.16s ease, border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.btn:hover {
  border-color: var(--accent);
  background: #f4f7ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(90deg, var(--accent), #3b82f6); border: none; color: #fff; }
.btn-primary:hover { background: linear-gradient(90deg, #1d4fd7, #2f6cf0); }

select, input[type="number"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.hint { font-size: 0.74rem; color: var(--text-faint); margin-top: 5px; }

/* ---------- Results ---------- */
.results { border-top: 1px solid var(--border-soft); margin-top: 22px; padding-top: 20px; }
.results-title { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; margin-bottom: 13px; display: flex; align-items: center; gap: 8px; }
.results-title .spin {
  width: 13px; height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
.results-title.loading .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s;
}
.stat:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(23, 45, 90, 0.1); }
.stat .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); }
.stat .value { font-size: 1.5rem; font-weight: 700; font-family: var(--mono); margin-top: 3px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 0.8rem; color: var(--text-dim); font-weight: 500; }
.stat.tokens { border-color: rgba(37, 99, 235, 0.45); background: linear-gradient(160deg, #f2f6ff, #f6fbff); }
.stat.tokens .value { color: var(--accent); }
.stat.pulse { animation: stat-pulse 0.5s ease; }
@keyframes stat-pulse { 0% { transform: scale(1); } 35% { transform: scale(1.045); } 100% { transform: scale(1); } }

.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 13px; }
.cost {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.cost:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(23, 45, 90, 0.1); }
.cost .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); }
.cost .value { font-size: 1.05rem; font-weight: 600; font-family: var(--mono); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cost.total { border-color: rgba(5, 150, 105, 0.4); background: linear-gradient(160deg, #f0fdf9, #f6fbfa); }
.cost.total .value { color: var(--green); font-size: 1.25rem; }

.pricing-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.pricing-row .field { margin-bottom: 0; flex: 1 1 180px; }
.pricing-row .field small { display: block; font-size: 0.72rem; color: var(--text-faint); margin-top: 4px; }

.copy-bar { margin-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copy-bar .note { font-size: 0.78rem; color: var(--text-faint); }
.copy-bar .note b { color: var(--green); font-weight: 600; }

/* ---------- Ad slots ---------- */
.ad-slot {
  position: relative;
  z-index: 1;
  margin: 28px auto;
  max-width: 1080px;
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.5);
}

/* ---------- Sections ---------- */
.section { padding: 40px 0; position: relative; z-index: 1; }
.section h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin-bottom: 8px; }
.section .lead { color: var(--text-dim); max-width: 760px; margin-bottom: 24px; font-size: 0.98rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.26s, border-color 0.26s;
  will-change: transform;
}
.card:hover {
  transform: translateY(-6px);
  border-color: #c7d7f5;
  box-shadow: 0 18px 40px rgba(23, 45, 90, 0.13);
}
.card h3 { font-size: 1rem; margin-bottom: 9px; display: flex; align-items: center; gap: 10px; }
.card p { color: var(--text-dim); font-size: 0.9rem; }
.card .emoji {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(150deg, #eaf1ff, #e6fbff);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  flex: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card:hover .emoji { transform: scale(1.15) rotate(-6deg); }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: #fff; box-shadow: 0 6px 20px rgba(23, 45, 90, 0.05); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); padding: 12px 15px; background: var(--bg-soft); border-bottom: 1px solid var(--border-soft);
}
tbody td { padding: 12px 15px; border-bottom: 1px solid var(--border-soft); color: var(--text-dim); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: #f4f8ff; }
tbody tr.group-row td { background: var(--bg-soft); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); border-bottom: 1px solid var(--border-soft); }
tbody tr.group-row:hover td { background: var(--bg-soft); }
tbody td .note { display: block; font-size: 0.62rem; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 3px; }
td.mono { font-family: var(--mono); color: var(--text); }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 0.72rem; font-family: var(--mono);
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-dim);
}
.tag.ok { background: #eafbea; border-color: #bde3bd; color: #1f7a1f; }

/* FAQ */
.faq details {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 15px 19px;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.faq details:hover { border-color: #c7d7f5; box-shadow: 0 8px 20px rgba(23, 45, 90, 0.08); }
.faq details[open] { border-color: #c7d7f5; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 0.96rem; list-style: none; position: relative; padding-right: 26px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0; top: 0;
  color: var(--accent); font-size: 1.15rem; font-weight: 700;
  transition: transform 0.25s ease;
}
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary::after { transform: scale(1.1); }
.faq details p { margin-top: 10px; color: var(--text-dim); font-size: 0.92rem; }

/* footer */
.site-footer { border-top: 1px solid var(--border-soft); margin-top: 46px; padding: 32px 0; position: relative; z-index: 1; }
.site-footer .container { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: 0.84rem; color: var(--text-faint); }
.site-footer .cols > div { max-width: 420px; }

/* status banner */
.status-banner { display: none; margin-top: 12px; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.85rem; border: 1px solid; }
.status-banner.error { display: block; background: #fef2f2; border-color: #fecaca; color: var(--red); }
.status-banner.info { display: block; background: #fffbeb; border-color: #fde68a; color: var(--amber); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .site-nav { display: none; }
  .stat .value { font-size: 1.25rem; }
  .tool-card { padding: 17px; }
}