:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --surface: #ffffff;
  --ink: #111715;
  --muted: #5e6662;
  --line: #cfd5d1;
  --accent: #176d5b;
  --accent-ink: #ffffff;
  --warning: #a55b0a;
  --danger: #b83e32;
  --success: #237c5d;
  --radius: 10px;
  --shadow: 0 16px 45px rgb(20 31 27 / 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  min-width: 320px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
summary,
label[for] {
  cursor: pointer;
}

a {
  color: inherit;
}

.site-header {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4vw;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
}

.header-note,
.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 42px clamp(18px, 4vw, 64px) 64px;
}

.page-intro {
  margin-bottom: 28px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  font-size: clamp(2rem, 4.6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  margin-bottom: 16px;
}

h2 {
  letter-spacing: -0.025em;
}

.lede {
  max-width: 820px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.55;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 30px);
  box-shadow: var(--shadow);
}

.panel-head,
.result-head,
.action-row,
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field label,
.field-label {
  font-size: 0.88rem;
  font-weight: 750;
}

.hint,
.fine-print {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 3px);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.55;
}

textarea:focus,
input:focus,
select:focus,
button:focus-visible,
summary:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.primary,
.secondary,
.ghost {
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 3px);
  padding: 12px 18px;
  font-weight: 780;
}

.primary {
  color: var(--accent-ink);
  background: var(--accent);
}

.primary:hover {
  filter: brightness(0.94);
}

.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.ghost {
  color: var(--muted);
  background: transparent;
}

.primary:disabled,
.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: calc(var(--radius) - 3px);
  padding: 26px;
  text-align: center;
}

.metric {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.metric:last-child {
  border-bottom: 0;
}

.metric strong {
  font-size: 1.12rem;
}

.status {
  font-weight: 800;
}

.status[data-tone="good"] {
  color: var(--success);
}

.status[data-tone="warn"] {
  color: var(--warning);
}

.status[data-tone="danger"] {
  color: var(--danger);
}

.output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--ink) 4%, var(--surface));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 3px);
  padding: 16px;
  min-height: 120px;
  font: 0.87rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.guide-grid .panel {
  box-shadow: none;
}

.guide-grid li {
  margin-bottom: 8px;
  line-height: 1.55;
}

details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

details:first-of-type {
  border-top: 0;
}

summary {
  font-weight: 720;
}

details p {
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding: 22px 0 0;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .tool-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.2rem, 10vw, 4rem);
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 12px 18px;
  }

  .header-note {
    display: none;
  }

  .page-shell {
    padding-top: 28px;
  }

  .panel-head,
  .result-head,
  .action-row,
  .metric-row {
    align-items: stretch;
    flex-direction: column;
  }

  .primary,
  .secondary {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
