:root {
  --brand-primary: #1e3a8a;
  --brand-primary-hover: #1d4ed8;
  --brand-accent: #0d9488;
  --text-dark: #0f172a;
  --gray-mid: #64748b;
  --gray-light: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
  --radius-xl: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text-dark);
  background:
    radial-gradient(circle at top left, #dbeafe 0%, transparent 35%),
    radial-gradient(circle at 90% 10%, #ccfbf1 0%, transparent 35%),
    var(--bg);
}
main { flex: 1 0 auto; }

.container { width: min(1100px, 92vw); margin: 0 auto; }
.section { padding: 2rem 0; }
.narrow { max-width: 760px; }
.eyebrow {
  display: inline-block;
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--brand-primary);
  letter-spacing: 0.08em;
}

.site-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--gray-light);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.nav-wrap { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 0; }
nav a { margin-left: 1rem; color: var(--text-dark); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--brand-primary); }

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text-dark); text-decoration: none; font-size: 1.15rem; }
.brand-icon {
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-primary);
  color: var(--white);
  border-radius: 5px;
  font-weight: 700;
}
.w500 { font-weight: 500; }
.w700 { font-weight: 700; }

.hero { padding: 2rem 0 1rem; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: center; }
.hero h1 { font-size: clamp(1.8rem, 4.8vw, 3rem); line-height: 1.15; margin: 0 0 1rem; }
.hero img, .tool-hero img, .about-image { width: 100%; border-radius: var(--radius-xl); border: 1px solid var(--gray-light); }
.hero-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; margin: 0.85rem 0 1rem; }
.hero-chips span {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 0.24rem 0.65rem;
  font-size: 0.82rem;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.section-head a { color: var(--brand-primary); font-weight: 600; text-decoration: none; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.quick-card {
  text-decoration: none;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 75%);
  padding: 1rem;
  color: var(--text-dark);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30, 58, 138, 0.12); }

.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.card {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-xl);
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.card-hover { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  padding: 0.58rem 0.95rem;
  text-decoration: none;
  border: 0;
  cursor: pointer;
}
.btn.primary { background: var(--brand-primary); color: var(--white); }
.btn.primary:hover { background: var(--brand-primary-hover); }
.btn.secondary { border: 2px solid var(--brand-primary); color: var(--brand-primary); background: transparent; }

.cta-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.authority ul { padding-left: 1rem; }

.tool-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.calc-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1rem; }
.calc-card { position: sticky; top: 88px; align-self: start; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  padding: 0.65rem;
  font: inherit;
}
.result-card {
  margin-top: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.8rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.result-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--gray-mid);
}
.result-value {
  margin: 0 0 0.6rem;
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  font-weight: 700;
  color: var(--brand-primary);
}
.status-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
}
.status-guaranteed { background: #dcfce7; color: #166534; }
.status-possible { background: #dbeafe; color: #1e3a8a; }
.status-impossible { background: #fee2e2; color: #991b1b; }
.result-list {
  margin: 0.5rem 0 0;
  padding-left: 1rem;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.92rem;
}
.result-table th, .result-table td {
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  padding: 0.35rem 0.25rem;
}
.result-message {
  margin: 0.5rem 0 0;
  color: var(--gray-mid);
}
.form-field { display: grid; gap: 0.35rem; margin-bottom: 0.7rem; }
.form-field span { font-size: 0.9rem; color: var(--gray-mid); }
.row-block { border: 1px solid var(--gray-light); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.8rem; }
.row-block h3 { margin-top: 0; }
.row-item { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; align-items: end; margin-bottom: 0.6rem; }
.toggle-row { display: inline-flex; gap: 0.45rem; align-items: center; margin-top: 0.2rem; margin-bottom: 0.8rem; }

.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.related-list { columns: 2; }
.related-list li { margin-bottom: 0.5rem; }
.faq-list details { background: var(--white); border: 1px solid var(--gray-light); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.6rem; }
.breadcrumbs { color: var(--gray-mid); font-size: 0.92rem; }
.authority-list li { margin-bottom: 0.5rem; }
.study-tip {
  margin-top: 1rem;
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  border-radius: 10px;
  padding: 0.8rem;
}
.study-tip h3 { margin: 0 0 0.35rem; color: #0f766e; }
.search-wrap { display: grid; gap: 0.35rem; margin: 0.8rem 0 1rem; }
.search-wrap span { color: var(--gray-mid); font-size: 0.9rem; }

.form-stack { display: grid; gap: 0.8rem; }
.hp { position: absolute; left: -10000px; }
.error { color: #b91c1c; }
.success { color: #065f46; }
.small { font-size: 0.9rem; color: var(--gray-mid); }
#share-url { word-break: break-all; }
.example-output {
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  margin: 0.5rem 0 0.35rem;
  color: var(--text-dark);
}
.font-medium { font-weight: 600; }
.example-grid ol li {
  overflow-wrap: anywhere;
  word-break: normal;
}

.site-footer { border-top: 1px solid var(--gray-light); margin-top: auto; background: var(--white); }
.footer-wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; flex-wrap: wrap; }
.footer-links a { margin-right: 0.9rem; color: var(--gray-mid); text-decoration: none; }

@media (max-width: 980px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .tool-hero, .calc-layout, .example-grid, .quick-grid { grid-template-columns: 1fr; }
  .row-item { grid-template-columns: 1fr; }
  .calc-card { position: static; }
}
@media (max-width: 620px) {
  .tool-grid { grid-template-columns: 1fr; }
  nav a { margin-left: 0.7rem; }
}
