*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1a6b9a;
  --brand-light: #4dadd9;
  --brand-dark:  #0d4a6e;
  --bg:          #f8f9fa;
  --surface:     #ffffff;
  --border:      #dee2e6;
  --text:        #212529;
  --muted:       #6c757d;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,.08);
  --max-width:   860px;
  --green:       #2e7d32;
  --green-bg:    #e8f5e9;
  --yellow:      #f57f17;
  --yellow-bg:   #fff8e1;
  --red:         #c62828;
  --red-bg:      #ffebee;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Ad slots ─────────────────────────────────────────────── */
.ad-slot { width: 100%; }
.ad-slot--top {
  min-height: 90px;
  background: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.ad-slot--inline { min-width: 300px; min-height: 250px; flex-shrink: 0; }
.ad-placeholder { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ad-placeholder--box {
  width: 300px; height: 250px; background: #f1f1f1;
  border: 1px dashed var(--border); display: flex;
  align-items: center; justify-content: center;
  font-size: .75rem; color: var(--muted);
}

/* ── Layout ─────────────────────────────────────────────── */
main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1rem 4rem; }
header { margin-bottom: 1.75rem; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; color: var(--brand-dark); margin-bottom: .4rem; }
h2 { font-size: 1.1rem; font-weight: 600; color: var(--brand-dark); margin-bottom: 1rem; }
.subtitle { color: var(--muted); font-size: .95rem; }

/* ── Cards ──────────────────────────────────────────────── */
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); margin-bottom: 1.25rem;
}

/* ── Situation grid ─────────────────────────────────────── */
.situation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.situation-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: .25rem; padding: .9rem .5rem;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  font-size: inherit;
}
.situation-btn:hover {
  border-color: var(--brand-light);
  background: #f0f8ff;
}
.situation-btn.selected {
  border-color: var(--brand);
  background: #e8f4fc;
}
.situation-btn:active { transform: scale(.97); }

.situation-icon { font-size: 1.6rem; line-height: 1; }
.situation-name { font-size: .8rem; font-weight: 700; color: var(--brand-dark); text-align: center; }
.situation-db   { font-size: .75rem; color: var(--muted); }

/* ── dB slider ──────────────────────────────────────────── */
.db-slider-wrapper { display: flex; flex-direction: column; gap: .4rem; }
.db-slider-labels {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--muted);
}
.db-display { font-size: 1.1rem; font-weight: 700; color: var(--brand-dark); }

input[type="range"] {
  width: 100%; accent-color: var(--brand); cursor: pointer;
  height: 6px;
}

/* ── Duration form ──────────────────────────────────────── */
.form-row { margin-bottom: 1.25rem; }
.field-group { display: flex; flex-direction: column; gap: .35rem; }
.field-group label { font-weight: 600; font-size: .9rem; }
.field-note { font-size: .8rem; color: var(--muted); }

.input-suffix-wrapper {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); overflow: hidden;
  max-width: 240px;
}
.input-suffix-wrapper:focus-within {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(77,173,217,.2);
}
.input-suffix-wrapper input {
  flex: 1; border: none; background: transparent;
  padding: .5rem .75rem; font-size: .95rem; color: var(--text);
  min-width: 0;
}
.input-suffix-wrapper input:focus { outline: none; }
.input-suffix {
  padding: .5rem .65rem; background: #eef2f5;
  border-left: 1px solid var(--border); color: var(--muted);
  font-size: .9rem; font-weight: 600; user-select: none;
  white-space: nowrap;
}

select, input[type="number"] {
  padding: .5rem .75rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .95rem; background: var(--bg); color: var(--text);
  width: 100%;
}
select:focus, input:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(77,173,217,.2); }

/* ── Buttons ────────────────────────────────────────────── */
button {
  padding: .7rem 2rem; border: none; border-radius: 6px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .1s;
}
button:active { transform: scale(.98); }
#calc-btn { background: var(--brand); color: #fff; width: 100%; }
#calc-btn:hover { background: var(--brand-dark); }

/* ── Results ────────────────────────────────────────────── */
.results-row { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.results-card {
  flex: 1; min-width: 280px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}

.safe-time-info {
  font-size: .95rem; color: var(--text);
  margin-bottom: 1.25rem; line-height: 1.6;
}

/* ── Progress bar ───────────────────────────────────────── */
.progress-wrapper { margin-bottom: 1rem; }
.progress-label-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem; color: var(--muted); margin-bottom: .4rem;
}
.progress-pct { font-weight: 700; color: var(--text); }
.progress-bar-track {
  width: 100%; height: 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 999px;
  transition: width .4s ease, background .3s;
  background: var(--brand);
  min-width: 2px;
}
.bar--gruen { background: var(--green); }
.bar--gelb  { background: var(--yellow); }
.bar--rot   { background: var(--red); }

/* ── Traffic light ──────────────────────────────────────── */
.ampel {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  margin-bottom: .75rem;
}
.ampel-dot {
  width: 20px; height: 20px; border-radius: 50%;
  flex-shrink: 0;
}
.ampel--gruen { background: var(--green); box-shadow: 0 0 8px rgba(46,125,50,.4); }
.ampel--gelb  { background: var(--yellow); box-shadow: 0 0 8px rgba(245,127,23,.4); }
.ampel--rot   { background: var(--red); box-shadow: 0 0 8px rgba(198,40,40,.4); }
.ampel-label  { font-weight: 600; font-size: .95rem; }

/* ── Remaining info ─────────────────────────────────────── */
.remaining-info {
  font-size: .9rem; color: var(--text);
  padding: .65rem .9rem;
  background: var(--bg);
  border-radius: 6px;
  line-height: 1.5;
}
.remaining--warn { color: var(--red); font-weight: 500; }

/* ── CTA box (placeholder – commented out in HTML) ──────── */
.cta-box {
  margin-top: 1rem; padding: .85rem 1rem;
  background: var(--yellow-bg); border: 1px solid #ffe082;
  border-radius: 8px; text-align: center;
}
.cta-box p { font-size: .9rem; margin-bottom: .5rem; }
.cta-btn {
  display: inline-block; padding: .5rem 1.25rem;
  background: var(--brand); color: #fff;
  border-radius: 6px; font-weight: 700; font-size: .9rem;
  text-decoration: none; transition: background .15s;
}
.cta-btn:hover { background: var(--brand-dark); }

/* ── Validation ─────────────────────────────────────────── */
.error { color: #c0392b; font-size: .85rem; margin-top: .3rem; }
.invalid { border-color: #c0392b !important; }

/* ── FAQ ────────────────────────────────────────────────── */
.faq { margin-top: 2.5rem; }
details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .75rem;
}
details[open] { box-shadow: var(--shadow); }
summary {
  cursor: pointer; font-weight: 600; font-size: .95rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
summary::after { content: "+"; font-size: 1.2rem; color: var(--brand); }
details[open] summary::after { content: "−"; }
details p { margin-top: .75rem; color: var(--muted); font-size: .9rem; line-height: 1.7; }

/* ── Footer ─────────────────────────────────────────────── */
footer { text-align: center; padding: 1.5rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }

@media (max-width: 600px) {
  .situation-grid { grid-template-columns: repeat(2, 1fr); }
  .results-row { flex-direction: column; }
  .ad-slot--inline { min-width: 100%; }
  .ad-placeholder--box { width: 100%; }
}
