/* =========================================================================
   CAT-ZAHNSYSTEME by T7ZIAN — Styles
   Mobile-first, organisches Design: weiche Kurven, ruhige Farbpalette.
   ========================================================================= */

:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #f0ebdf;
  --ink: #2e2b24;
  --ink-soft: #6d675a;
  --line: #e4ddcd;
  --accent: #e8a812;          /* gedecktes CAT-Gelb */
  --accent-ink: #2e2b24;
  --accent-soft: #fbedc8;
  --green: #7a8450;           /* ruhiges Oliv */
  --green-soft: #eef0e2;
  --red: #b3593f;
  --red-soft: #f7e6e0;
  --radius: 26px;
  --radius-s: 16px;
  --shadow: 0 10px 30px -18px rgba(70, 60, 30, .45);
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* dekorative, organische Hintergrundformen */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(60% 40% at 110% -10%, rgba(232,168,18,.10), transparent 70%),
    radial-gradient(50% 35% at -10% 110%, rgba(122,132,80,.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--accent); border-radius: 46% 54% 52% 48% / 55% 48% 52% 45%; }
.brand-mark svg { width: 32px; height: 32px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: .95rem; letter-spacing: .04em; white-space: nowrap; }
.brand-text small { color: var(--ink-soft); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.system-chip {
  flex: none;
  font-size: .74rem; font-weight: 600; color: var(--green);
  background: var(--green-soft);
  padding: 6px 14px; border-radius: 999px;
  white-space: nowrap;
}

/* ---------------- Layout ---------------- */
.layout { position: relative; z-index: 1; }
main {
  padding: 20px 16px calc(var(--nav-h) + 32px);
  max-width: 720px;
  margin: 0 auto;
}
.view[hidden] { display: none; }

/* ---------------- Navigation (mobil: unten) ---------------- */
.mainnav {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  z-index: 30;
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 84px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  transition: background .2s, color .2s;
}
.nav-btn svg { width: 24px; height: 24px; }
.nav-btn.active { background: var(--accent-soft); color: var(--ink); }
.nav-btn:active { transform: scale(.97); }

/* ---------------- Cards & Formen ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.organic { border-radius: 34px 44px 34px 48px / 44px 34px 48px 34px; }
.organic-soft { border-radius: 28px 36px 28px 38px / 34px 28px 38px 28px; }

.section-title { font-size: 1.5rem; margin: 28px 4px 6px; }
.section-sub { color: var(--ink-soft); margin: 0 4px 18px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px;
  padding: 12px 26px;
  border-radius: 999px;
  border: none;
  font-size: 1rem; font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px rgba(232,168,18,.8); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-big { min-height: 58px; font-size: 1.06rem; padding: 14px 30px; }
.cta-row { display: flex; justify-content: center; margin: 26px 0 8px; }

/* ---------------- Anleitung ---------------- */
.hero { margin-top: 8px; padding: 30px 26px; }
.hero h1 { font-size: 1.9rem; line-height: 1.15; margin: 0 0 10px; }
.hero p { color: var(--ink-soft); margin: 0 0 20px; max-width: 46ch; }

.steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 14px; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: start; }
.step-num {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--ink);
  font-weight: 800; font-size: 1.15rem;
  border-radius: 46% 54% 52% 48% / 55% 48% 52% 45%;
}
.step-body h3 { margin: 6px 0 6px; font-size: 1.08rem; }
.step-body p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.step-art { grid-column: 1 / -1; width: min(320px, 100%); margin: 6px auto 0; }

.tip h3 { margin-top: 0; }
.tip { margin-top: 14px; }
.tip ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.tip li { margin: 6px 0; }

/* SVG-Grundstile */
.tooth-fill { fill: var(--surface-2); stroke: var(--ink-soft); stroke-width: 2; stroke-linejoin: round; }
.tooth-line { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
.pocket { fill: var(--bg); stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 4 3; }
.sketch { stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; }
.dim line { stroke: var(--green); stroke-width: 2; }
.dim text { fill: var(--green); font-weight: 700; font-size: 15px; font-family: inherit; }
.viewlabel { fill: var(--ink-soft); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }

/* aktives Maß im Formular-Diagramm */
.dim.hot line { stroke: var(--accent); stroke-width: 3; }
.dim.hot text { fill: #b07f06; }

/* ---------------- Formular ---------------- */
.measure-grid { display: grid; gap: 16px; }
.diagram-card { padding: 16px 16px 10px; }
.diagram-card svg { width: 100%; height: auto; display: block; }
.diagram-hint { text-align: center; color: var(--ink-soft); font-size: .82rem; margin: 6px 0 4px; }

.measure-form { display: grid; gap: 18px; }
.field-group { display: grid; gap: 10px; }
.group-label { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.required-group .group-label { color: #b07f06; }

.field { display: grid; gap: 6px; }
.field-name { font-weight: 600; font-size: .95rem; }
.field-name em { font-style: normal; color: var(--ink-soft); font-weight: 400; font-size: .85rem; margin-left: 4px; }
.field-input { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 4px 14px 4px 4px; transition: border-color .2s, box-shadow .2s; }
.field-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-input input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font: inherit; font-size: 1.25rem; font-weight: 600;
  padding: 12px 10px;
  color: var(--ink);
  outline: none;
}
.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button { -webkit-appearance: none; }
.field-input input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.unit { color: var(--ink-soft); font-weight: 600; }

.checkbox-field { display: flex; align-items: center; gap: 12px; padding: 6px 2px; font-size: .95rem; color: var(--ink-soft); cursor: pointer; }
.checkbox-field input { width: 24px; height: 24px; accent-color: var(--accent); }

.form-error { background: var(--red-soft); color: var(--red); border-radius: var(--radius-s); padding: 12px 16px; font-weight: 600; margin: 0; }
.form-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.form-actions .btn-primary { flex: 1; }

/* ---------------- Ergebnis ---------------- */
.result-banner { padding: 18px 22px; margin-bottom: 16px; }
.result-banner.ok { background: var(--green-soft); border-color: #d8ddc2; }
.result-banner.warn { background: var(--accent-soft); border-color: #eed9a0; }
.result-banner.bad { background: var(--red-soft); border-color: #ecd0c6; }
.result-banner h2 { margin: 0 0 4px; font-size: 1.2rem; }
.result-banner p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.measured-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .82rem; font-weight: 600; }

.result-card { margin-bottom: 16px; overflow: hidden; }
.result-card.best { border: 2px solid var(--accent); }
.badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; margin-bottom: 10px; }
.badge.best { background: var(--accent); color: var(--accent-ink); }
.badge.alt { background: var(--surface-2); color: var(--ink-soft); }
.match-pct { float: right; font-weight: 800; color: var(--green); }

.result-head { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.result-head h3 { margin: 0; font-size: 1.25rem; }
.result-head .size-tag { font-size: 1.5rem; font-weight: 800; color: var(--accent); letter-spacing: .02em; }
.result-usage { color: var(--ink-soft); font-size: .9rem; margin: 2px 0 0; }

.result-svg { width: min(300px, 80%); margin: 10px auto; display: block; }

.numbers { display: grid; gap: 8px; margin: 14px 0; }
.number-row { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border-radius: var(--radius-s); padding: 10px 14px; }
.number-row .lbl { color: var(--ink-soft); font-size: .8rem; }
.number-row .val { font-weight: 700; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .95rem; overflow-wrap: anywhere; }

.dims-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 10px 0; }
.dims-table th, .dims-table td { padding: 8px 10px; text-align: center; }
.dims-table th { color: var(--ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1.5px solid var(--line); }
.dims-table td { border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.dims-table tr:last-child td { border-bottom: none; }
.delta-ok { color: var(--green); font-weight: 700; }
.delta-warn { color: #b07f06; font-weight: 700; }
.delta-bad { color: var(--red); font-weight: 700; }

details.extras { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
details.extras summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); font-size: .92rem; }
details.extras table { margin-top: 8px; }
.extras h4 { margin: 12px 0 4px; font-size: .92rem; }

.hint-box { background: var(--accent-soft); border-radius: var(--radius-s); padding: 10px 14px; font-size: .9rem; margin-top: 12px; }

.empty-state { text-align: center; padding: 36px 24px; }
.empty-state svg { width: 140px; margin: 0 auto 8px; display: block; }
.empty-q { font-size: 26px; font-weight: 800; fill: var(--ink-soft); }
.empty-state h3 { margin: 4px 0 6px; }
.empty-state p { color: var(--ink-soft); margin: 0 0 18px; }

.disclaimer { color: var(--ink-soft); font-size: .78rem; text-align: center; margin: 26px auto 8px; max-width: 60ch; }

/* ======================= Desktop / Tablet ======================= */
@media (min-width: 900px) {
  :root { --nav-h: 0px; }

  .layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    max-width: 1180px;
    margin: 0 auto;
    gap: 12px;
    padding: 0 20px;
  }

  .mainnav {
    position: sticky; top: 84px; bottom: auto; left: auto; transform: none;
    align-self: start;
    flex-direction: column;
    border-radius: var(--radius);
    padding: 10px;
    gap: 6px;
    margin-top: 24px;
  }
  .nav-btn { flex-direction: row; justify-content: flex-start; gap: 12px; min-width: 0; width: 100%; padding: 14px 18px; font-size: .95rem; border-radius: 18px; }

  main { max-width: none; padding: 24px 8px 60px; }

  .hero { padding: 44px 48px; }
  .hero h1 { font-size: 2.5rem; }

  .steps { grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
  .step { grid-template-rows: auto 1fr auto; }

  .measure-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .diagram-card { position: sticky; top: 90px; }

  .result-svg { width: 280px; }
  .numbers { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (max-width: 430px) {
  .system-chip { display: none; }
  .brand-text strong { white-space: normal; }
}

@media (min-width: 600px) and (max-width: 899px) {
  main { max-width: 860px; }
  .steps { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .measure-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
