:root {
  --bg: #faf9f6;
  --card: #ffffff;
  --ink: #1a1d21;
  --muted: #6b7280;
  --line: #e5e2dc;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --soft: #eef6f4;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------------------------------------------------------------- header */

.site { border-bottom: 1px solid var(--line); background: rgba(250, 249, 246, .9); }
.site .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand {
  font-weight: 700; font-size: 18px; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none;
}
.brand span { color: var(--accent); }
nav { display: flex; gap: 22px; }
nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- hero */

.hero { padding: 52px 0 28px; max-width: 720px; }
h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.1; letter-spacing: -.03em; margin: 0 0 14px; }
.lede { font-size: 17px; color: var(--muted); margin: 0; }
.lede strong { color: var(--ink); }

/* ---------------------------------------------------------------- app */

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 22px;
  align-items: start;
  margin-bottom: 64px;
}
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } }

.controls, .preview-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.group + .group { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.group h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 4px; }
.group-hint { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }

label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label span { font-weight: 400; }

input[type=number], select {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
input[type=number]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.triple { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.full { margin-bottom: 0; }

/* ---------------------------------------------------------------- preview */

.seg {
  display: inline-flex;
  background: var(--soft);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 14px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.preview {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(var(--soft) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--soft) 1px, transparent 1px) 0 0 / 20px 20px,
    #fcfcfb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.preview svg { width: 100%; height: auto; max-height: 520px; display: block; }

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
button.primary, .actions button {
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 10px 16px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer;
}
.actions button:hover { border-color: #c9c5bd; }
.actions button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.actions button.primary:hover { filter: brightness(1.08); }

.hint { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- content */

.content { max-width: 760px; padding-bottom: 40px; }
.content h2 { font-size: 22px; letter-spacing: -.02em; margin: 44px 0 12px; }
.content p { color: #3f4650; }
.steps { padding-left: 22px; color: #3f4650; }
.steps li { margin-bottom: 10px; }

.ref { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
.ref th, .ref td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.ref th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ref td:first-child { white-space: nowrap; }

.note { font-size: 13.5px; color: var(--muted); }

.links { padding-left: 20px; color: #3f4650; }
.links li { margin-bottom: 10px; }
.links a { color: var(--accent); font-weight: 600; }

details { border-bottom: 1px solid var(--line); padding: 14px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 10px 0 0; font-size: 14.5px; }

/* ---------------------------------------------------------------- footer */

footer.site { border-top: 1px solid var(--line); padding: 26px 0; margin-top: 20px; }
footer.site p { color: var(--muted); font-size: 13px; margin: 0; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #161b22; --ink: #e6edf3; --muted: #8b949e;
    --line: #262d36; --accent: #2dd4bf; --accent-ink: #062420; --soft: #1b232c;
  }
  .site { background: rgba(15, 18, 22, .9); }
  input[type=number], select { background: #0f1216; color: var(--ink); }
  .preview { background-color: #11161c; }
  .content p, .steps { color: #b8c0c9; }
}
