:root {
  --bg: #0f1419;
  --bg-elev: #1a222d;
  --surface: #243041;
  --ink: #f4f7fb;
  --muted: #9aa8b8;
  --accent: #3dd68c;
  --accent-ink: #062416;
  --accent-dim: #1e8a55;
  --warn: #f5c542;
  --border: #334155;
  --danger: #f07178;
  --radius: 14px;
  --tap: 48px;
  --max: 560px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
}

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

img { max-width: 100%; height: auto; display: block; }

header.app-bar,
footer.site-foot,
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1rem;
}

header.app-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-size: 1.15rem;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.tag {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

h1 {
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0.35rem 0 0.65rem;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.lead {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin: 0 0 1rem;
}

.panel-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.75rem 1.1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  width: 100%;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  width: 100%;
  font-weight: 600;
}
.btn-buy {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  flex: 1 1 calc(50% - 0.3rem);
  min-width: 140px;
}
.btn-buy.full { flex: 1 1 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover, .chip:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  min-height: var(--tap);
  padding: 0.65rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
}
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.preview-wrap {
  display: none;
  margin-top: 0.75rem;
}
.preview-wrap.show { display: block; }
.preview-wrap img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.65rem 0 0;
}
.note strong { color: var(--warn); }

.size-display {
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0.25rem 0 0.35rem;
}
.size-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.25rem 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.hidden { display: none !important; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  vertical-align: middle;
}

.guides {
  margin-top: 1.5rem;
}
.guides .card-link {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 0.65rem;
}
.guides .card-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.guides .card-link strong { display: block; margin-bottom: 0.2rem; }
.guides .card-link span { color: var(--muted); font-size: 0.85rem; }

footer.site-foot {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  padding-bottom: 2rem;
}
footer.site-foot a { color: var(--muted); }

/* Guide / article pages (secondary) */
body.article {
  background: #f4f6f8;
  color: #15202b;
}
body.article header,
body.article footer,
body.article main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}
body.article header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid #d7dee7;
}
body.article .brand { color: #15202b; }
body.article .brand:hover { color: #0f6b4c; }
body.article a { color: #0f6b4c; }
body.article .lead { color: #4a5a6a; }
body.article .meta { color: #5c6b7a; font-size: 0.85rem; }
body.article .card {
  background: #fff;
  border: 1px solid #d7dee7;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
body.article .grid { display: grid; gap: 0.75rem; }
@media (min-width: 640px) {
  body.article .grid.two { grid-template-columns: 1fr 1fr; }
}
body.article ul.checklist { padding-left: 1.1rem; }
body.article .cta {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.65rem 1rem;
  background: #0f6b4c;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}
body.article .cta:hover { text-decoration: none; filter: brightness(1.05); }
body.article table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.92rem;
}
body.article th, body.article td {
  border: 1px solid #d7dee7;
  padding: 0.55rem 0.65rem;
  text-align: left;
}
body.article th { background: #e8eef4; }
body.article footer {
  border-top: 1px solid #d7dee7;
  color: #5c6b7a;
  font-size: 0.85rem;
}
body.article nav a { margin-right: 0.85rem; text-decoration: none; }
body.article h1 { font-size: 1.85rem; }
body.article h2 { font-size: 1.25rem; margin-top: 2rem; }
body.article code {
  background: #e8eef4;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.92em;
}

/* Print card page */
body.print-page {
  background: #fff;
  color: #111;
}
body.print-page main {
  max-width: 420px;
}
.print-card {
  border: 2px solid #111;
  border-radius: 8px;
  padding: 1.25rem;
  background: #fff;
}
.print-card h1 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  letter-spacing: 0;
}
.print-size {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 0.5rem 0;
  text-align: center;
}
.print-meta {
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.arrow-box {
  border: 2px dashed #333;
  border-radius: 8px;
  padding: 0.85rem;
  text-align: center;
  margin: 1rem 0;
  font-weight: 700;
}
.arrow-box .arrow {
  font-size: 1.75rem;
  line-height: 1;
  margin: 0.25rem 0;
}
.checklist-print {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}
.checklist-print li { margin: 0.35rem 0; }
.no-print { margin-top: 1rem; }
@media print {
  .no-print { display: none !important; }
  body.print-page { background: #fff; }
  body.print-page main { max-width: none; padding: 0; }
  .print-card { border-width: 2px; }
}

/* Legacy aliases so untouched guide markup still looks ok if body.article missing */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.grid { display: grid; gap: 0.75rem; }
.meta { color: var(--muted); font-size: 0.85rem; }
.cta {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
}
