:root {
  --bg: #eef1f7;
  --paper: #ffffff;
  --paper-soft: #f7f9fc;
  --ink: #152032;
  --muted: #667487;
  --navy: #1d3557;
  --navy-deep: #0f2038;
  --blue: #3f72af;
  --green: #58a86b;
  --orange: #d28d3d;
  --red: #b14f56;
  --line: rgba(29, 53, 87, 0.12);
  --shadow: 0 24px 60px rgba(21, 32, 50, 0.1);
  --radius: 24px;
  --radius-sm: 16px;
  --sans: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --screen: #c8f4b7;
  --screen-ink: #233b1d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(63, 114, 175, 0.12), transparent 22%),
    radial-gradient(circle at left top, rgba(88, 168, 107, 0.1), transparent 20%),
    var(--bg);
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
.container { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(18px);
  background: rgba(238, 241, 247, 0.92);
  border-bottom: 1px solid rgba(29, 53, 87, 0.08);
}
.nav-shell { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding: 1rem 0; }
.brandmark { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.brandmark strong, h1, h2, h3 { font-family: var(--serif); letter-spacing: -0.02em; }
.brandmark-kicker, .eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.76rem; color: var(--blue); font-weight: 800;
}
.site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 1rem; }
.site-nav a { padding: 0.55rem 0.8rem; border-radius: 999px; color: var(--muted); font-weight: 700; }
.site-nav a.is-active, .site-nav a:hover { background: rgba(29, 53, 87, 0.08); color: var(--navy-deep); }
.hero, .page-hero, .section { padding: 2rem 0 4rem; }
.hero { padding-top: 4.5rem; }
.page-hero { padding-top: 4rem; padding-bottom: 1.5rem; }
.hero-grid, .simulator-grid, .tool-panels, .feature-grid, .guide-grid, .two-column, .footer-grid, .article-layout {
  display: grid; gap: 1.4rem;
}
.hero-grid { grid-template-columns: 1.1fr 0.9fr; align-items: center; }
.hero h1, .page-hero h1 { font-size: clamp(2.5rem, 4.4vw, 4.7rem); line-height: 0.98; margin: 0.35rem 0 1rem; max-width: 12ch; }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 70ch; }
.hero-card, .simulator-shell, .side-card, .tool-card, .feature-card, .guide-card, .stat-card, .article-main, .prose-shell, .cookie-card, .cookie-panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.hero-card, .simulator-shell, .side-card, .tool-card, .feature-card, .guide-card, .article-main, .cookie-card, .cookie-panel { padding: 1.5rem; }
.button-row, .cookie-actions, .filter-buttons, .stat-grid, .analysis-grid, .meta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px; padding: 0.92rem 1.35rem;
  background: var(--navy); color: white; font-weight: 700; cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}
.button:hover { transform: translateY(-2px); background: var(--navy-deep); }
.button-secondary, .button-ghost { background: transparent; color: var(--navy-deep); border: 1px solid rgba(29, 53, 87, 0.18); }
.button-secondary:hover, .button-ghost:hover { background: rgba(29, 53, 87, 0.06); }
.stat-grid { margin-top: 1.3rem; }
.stat-card { padding: 1rem 1.1rem; border-radius: var(--radius-sm); background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,249,252,0.98)); border: 1px solid var(--line); }
.stat-card strong, .analysis-item strong { display: block; font-size: 1.3rem; color: var(--navy-deep); margin-bottom: 0.2rem; }
.check-list { padding-left: 1.1rem; margin: 0; }
.check-list li { margin: 0.45rem 0; }
.feature-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature-card h3, .guide-card h3 { margin: 0.35rem 0 0.6rem; font-size: 1.28rem; }
.feature-card p, .guide-card p, .microcopy, .history-empty, .ai-output, .steps-box { color: var(--muted); }
.meta-row { justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.94rem; }
.meta-row a, .text-link { color: var(--blue); font-weight: 700; }
.simulator-grid, .tool-panels, .two-column, .footer-grid, .article-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.simulator-grid { align-items: start; }
.tool-panels { align-items: start; }
.simulator-header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.disclaimer-pill {
  padding: 0.55rem 0.85rem; border-radius: 999px; background: rgba(177,79,86,0.09); color: var(--red); font-size: 0.84rem; font-weight: 700; border: 1px solid rgba(177,79,86,0.14);
}
.simulator-frame {
  background: linear-gradient(180deg, #2c3442, #1d2531);
  border-radius: 28px; padding: 1rem; border: 1px solid rgba(255,255,255,0.08);
}
.screen-panel {
  background: linear-gradient(180deg, #d5f9c9, #b9e9a8);
  color: var(--screen-ink);
  border-radius: 18px; padding: 1rem; border: 2px solid rgba(35,59,29,0.18); min-height: 132px;
  box-shadow: inset 0 -10px 24px rgba(35,59,29,0.12);
}
.screen-top { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.8rem; }
.screen-expression { font-size: 1.6rem; font-weight: 800; word-break: break-all; min-height: 2.2rem; }
.screen-result { margin-top: 0.8rem; font-size: 1rem; min-height: 1.5rem; }
.keypad-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.calc-key {
  border: none; border-radius: 14px; padding: 0.95rem 0.4rem; font: inherit; font-weight: 800; cursor: pointer;
  background: #f1f4f8; color: var(--ink); box-shadow: 0 10px 18px rgba(0,0,0,0.16);
}
.calc-key:active { transform: translateY(1px); }
.calc-key.is-gray { background: #bcc5d1; }
.calc-key.is-blue { background: #6b8fbe; color: white; }
.calc-key.is-dark { background: #2e3644; color: white; }
.calc-key.is-enter { background: var(--orange); color: white; }
.side-stack { display: grid; gap: 1rem; align-content: start; grid-auto-rows: min-content; }
.history-list { display: grid; gap: 0.55rem; min-height: 120px; align-content: start; }
.history-row { padding: 0.8rem 0.85rem; border-radius: 14px; background: rgba(29,53,87,0.05); border: 1px solid rgba(29,53,87,0.08); }
.history-expression { font-weight: 700; color: var(--navy-deep); }
.field-label { display: flex; flex-direction: column; gap: 0.45rem; font-weight: 700; color: var(--navy-deep); }
input[type="text"], input[type="search"] {
  width: 100%; padding: 0.95rem 1rem; border-radius: 16px; border: 1px solid rgba(29,53,87,0.16); background: white; color: var(--ink); font: inherit;
}
.graph-canvas { width: 100%; border-radius: 18px; border: 1px solid rgba(29,53,87,0.12); background: #fff; margin-top: 1rem; }
.analysis-grid { margin-top: 1rem; }
.analysis-item {
  flex: 1 1 180px; padding: 0.9rem 1rem; border-radius: 16px; background: rgba(29,53,87,0.05); border: 1px solid rgba(29,53,87,0.08);
}
.analysis-item span { color: var(--muted); display: block; margin-bottom: 0.25rem; }
.steps-box, .ai-output {
  margin-top: 1rem; border-radius: 18px; padding: 1rem; background: rgba(29,53,87,0.05); border: 1px solid rgba(29,53,87,0.08);
  white-space: pre-wrap;
}
.faq-item { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 1rem 1.2rem; }
.faq-item summary { cursor: pointer; font-weight: 700; color: var(--navy-deep); }
.faq-item p { color: var(--muted); }
.filter-bar { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.badge, .pill, .pill-locked {
  display: inline-flex; align-items: center; justify-content: center; padding: 0.42rem 0.8rem; border-radius: 999px;
  background: rgba(29,53,87,0.08); color: var(--navy-deep); font-size: 0.84rem; font-weight: 700; border: 1px solid rgba(29,53,87,0.1);
}
.pill.is-active { background: var(--navy); color: white; }
.section-heading { max-width: 52rem; margin-bottom: 1.4rem; }
.section-heading h2, .simulator-header h2, .tool-card h2, .page-hero h1 { margin: 0.35rem 0 0.7rem; font-size: clamp(1.9rem, 3vw, 2.9rem); }
.article-main { padding: 1.7rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 0.7rem; color: var(--muted); align-items: center; margin-bottom: 1rem; }
.prose-shell { padding: 2rem; }
.prose-block { margin-bottom: 2rem; padding-bottom: 1.4rem; border-bottom: 1px solid rgba(29,53,87,0.08); }
.prose-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.takeaway-block { background: rgba(29,53,87,0.04); padding: 1rem 1.2rem; border-radius: 18px; }
.ad-placeholder {
  min-height: 120px; border-radius: 18px; border: 1px dashed rgba(29,53,87,0.28); display: grid; place-items: center;
  text-align: center; padding: 1rem; background: repeating-linear-gradient(-45deg, rgba(29,53,87,0.06), rgba(29,53,87,0.06) 14px, rgba(255,255,255,0.75) 14px, rgba(255,255,255,0.75) 28px); color: var(--navy-deep); font-weight: 700;
}
.code-block {
  margin: 0; padding: 1rem; overflow: auto; border-radius: 16px; background: #111925; color: #d6e7ff; font-family: Consolas, monospace; font-size: 0.92rem;
}
.site-footer {
  padding: 2rem 0 3.2rem; background: linear-gradient(180deg, rgba(15,32,56,0.96), rgba(15,32,56,1)); color: rgba(255,255,255,0.9);
}
.footer-brand { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 0.6rem; }
.footer-heading { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.76rem; color: rgba(255,255,255,0.68); font-weight: 800; margin-bottom: 0.8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.footer-copy, .footer-mail { color: rgba(255,255,255,0.76); }
.cookie-banner { position: fixed; inset: auto 1rem 1rem 1rem; z-index: 40; }
.cookie-card { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: 1.2rem; }
.cookie-dialog { border: none; padding: 0; background: transparent; width: min(720px, calc(100% - 2rem)); }
.cookie-dialog::backdrop { background: rgba(21,32,50,0.48); }
.cookie-panel { padding: 1.5rem; }
.dialog-header, .cookie-option { display: flex; justify-content: space-between; gap: 1rem; }
.dialog-header { align-items: start; margin-bottom: 1rem; }
.dialog-close { width: 42px; height: 42px; border-radius: 999px; border: none; font-size: 1.35rem; background: rgba(29,53,87,0.08); cursor: pointer; }
.cookie-option { align-items: center; padding: 1rem 0; border-top: 1px solid rgba(29,53,87,0.08); }
.cookie-option:first-of-type { border-top: none; padding-top: 0.4rem; }
.pill-locked { background: rgba(210,141,61,0.12); color: #8a5a18; }
[data-reveal] { opacity: 1; transform: none; transition: opacity 500ms ease, transform 500ms ease; }
.enhanced [data-reveal] { opacity: 0; transform: translateY(18px); }
.enhanced [data-reveal].is-visible { opacity: 1; transform: translateY(0); }
@media (max-width: 1024px) {
  .hero-grid, .simulator-grid, .tool-panels, .feature-grid, .guide-grid, .two-column, .footer-grid, .article-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .container { width: min(100% - 1rem, 1180px); }
  .nav-shell { flex-direction: column; align-items: flex-start; }
  .site-nav { justify-content: flex-start; }
  .cookie-card { grid-template-columns: 1fr; }
  .keypad-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero, .page-hero, .section { padding-top: 1.6rem; }
  .hero h1, .page-hero h1 { max-width: none; }
  .simulator-header { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .button { transition: none; }
}
