/* ===== Eieruhr, Design ===== */

:root {
  --bg: #fdf6e9;
  --card: #fffdf6;
  --card-alt: #faf3e3;
  --ink: #292524;
  --ink-soft: #57534e;
  --muted: #8a817a;
  --accent: #f7b733;
  --accent-deep: #e8960c;
  --accent-ink: #3b2f0a;
  --ring-track: #f0e6d2;
  --egg-white: #fffdf6;
  --egg-shine: rgba(255, 255, 255, 0.85);
  --pot: #64748b;
  --pot-rim: #475569;
  --pot-shine: rgba(255, 255, 255, 0.25);
  --water: #bae0f5;
  --bubble: #e8f6ff;
  --steam: #d6cdbf;
  --border: #ece2cf;
  --shadow: 0 10px 30px rgba(120, 90, 20, 0.10);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --card: #292524;
    --card-alt: #322e2a;
    --ink: #f5f0e8;
    --ink-soft: #c9c1b5;
    --muted: #a39a8d;
    --accent: #f7b733;
    --accent-deep: #fbbf24;
    --accent-ink: #3b2f0a;
    --ring-track: #3f3a34;
    --egg-white: #f8f3e7;
    --egg-shine: rgba(255, 255, 255, 0.7);
    --pot: #52525b;
    --pot-rim: #3f3f46;
    --water: #3a6d8f;
    --bubble: #9fd4ef;
    --steam: #857c70;
    --border: #3b362f;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.1rem;
}

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

/* ===== Header ===== */

.site-header { padding: 1.4rem 0 0.4rem; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-icon { flex: none; }

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tagline {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.3;
}

/* ===== App-Karte ===== */

.app-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin: 1rem 0 2.5rem;
  overflow: hidden;
}

/* --- Einstellungen --- */

.settings {
  display: grid;
  gap: 1.1rem;
}

.setting {
  border: 0;
  margin: 0;
  padding: 0;
}

.setting legend {
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink);
}

.legend-icon { color: var(--muted); }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.5rem;
}

.seg-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.65rem 0.4rem 0.55rem;
  background: var(--card-alt);
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.seg-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.seg-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
}

.seg-option:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.seg-icon { width: 44px; height: 44px; }

.seg-label {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
}

.seg-hint {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.2;
}

/* --- Höhenregler --- */

.altitude-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.altitude-row output {
  min-width: 5.6ch;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

input[type="range"] {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 8px;
  border-radius: 4px;
  background: var(--ring-track);
  outline-offset: 4px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--card);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--card);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.setting-note {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- Timer-Bühne --- */

.timer-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.6rem 0 0.4rem;
}

/* Garverlauf-Elemente weich überblenden */
#egg-white, #yolk, #yolk-drip, #yolk-shine, #yolk-cracks {
  transition: fill 0.3s linear, opacity 0.3s linear, transform 0.3s linear;
}

.dial-readout {
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.time-display {
  font-size: clamp(2.2rem, 11vw, 3rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.phase-text {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  max-width: 28ch;
  line-height: 1.3;
  min-height: 2.6em; /* Platz für zwei Zeilen, damit beim Start nichts springt */
}

.method-hint {
  margin: 1rem 0 0;
  padding: 0.6rem 0.9rem;
  background: color-mix(in srgb, var(--accent) 16%, var(--card));
  border-radius: 12px;
  font-size: 0.88rem;
  text-align: center;
}

.start-btn {
  margin-top: 1.2rem;
  min-width: 16rem;
  padding: 0.95rem 2.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: inherit;
  color: var(--accent-ink);
  background: linear-gradient(180deg, #fcd34d, var(--accent));
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232, 150, 12, 0.4);
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}

.start-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(232, 150, 12, 0.5); }
.start-btn:active { transform: translateY(0); }

.start-btn.running {
  background: var(--card-alt);
  color: var(--ink);
  box-shadow: none;
  border: 2px solid var(--border);
}

.start-btn.alarm {
  animation: pulse 1.2s ease-in-out infinite;
  background: linear-gradient(180deg, #ef4444, #dc2626);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}

.start-btn.alarm:hover {
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.5);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.mini-note {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* Platz bleibt reserviert, damit nichts springt, wenn die Notiz erscheint */
.mini-note[hidden] {
  display: block;
  visibility: hidden;
}

/* --- Topf-Szene --- */

.pot-scene {
  /* Negativer oberer Rand: die (unsichtbare) Dampfzone des SVG dient als Abstand */
  margin: -1.2rem auto 0;
  max-width: 440px;
  width: 100%;
}

.pot-svg {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none; /* Dampfzone darf Klicks auf die Einstellungen nicht schlucken */
}

.steam path, .bubbles .b { opacity: 0; }

.pot-egg { transform-origin: 210px 150px; }

/* Animationen nur wenn Timer läuft */
.cooking .steam path {
  opacity: 0.9;
  animation: steam-rise 2.6s ease-in-out infinite;
}
.cooking .steam-2 { animation-delay: 0.9s; }
.cooking .steam-3 { animation-delay: 1.7s; }

@keyframes steam-rise {
  0%   { opacity: 0; transform: translateY(8px); }
  35%  { opacity: 0.85; }
  100% { opacity: 0; transform: translateY(-14px); }
}

.cooking .bubbles .b { animation: bubble-up 1.8s linear infinite; }
.cooking .b2 { animation-delay: 0.4s; animation-duration: 1.5s; }
.cooking .b3 { animation-delay: 0.9s; }
.cooking .b4 { animation-delay: 0.2s; animation-duration: 1.4s; }
.cooking .b5 { animation-delay: 1.2s; animation-duration: 2s; }
.cooking .b6 { animation-delay: 0.7s; animation-duration: 1.3s; }

@keyframes bubble-up {
  0%   { opacity: 0; transform: translateY(0); }
  15%  { opacity: 0.95; }
  85%  { opacity: 0.85; }
  100% { opacity: 0; transform: translateY(-78px); }
}

.cooking .pot-egg { animation: egg-wobble 2.4s ease-in-out infinite; }

@keyframes egg-wobble {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .cooking .steam path, .cooking .bubbles .b, .cooking .pot-egg,
  .start-btn.alarm {
    animation: none;
  }
  .cooking .steam path { opacity: 0.8; }
  .cooking .bubbles .b { opacity: 0.9; }
  html { scroll-behavior: auto; }
}

/* Einstellungen bleiben beim Kochen an Ort und Stelle, nur gesperrt,
   damit die Seite beim Start nicht springt */
.app-card.cooking .settings {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* ===== Inhalt ===== */

.content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.6rem 1.2rem;
  margin-bottom: 1.6rem;
}

.content h2 {
  margin: 0 0 0.8rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.content h3 { margin: 0 0 0.25rem; font-size: 1.02rem; }

/* Überschrift vertikal mittig zur Schritt-Nummer */
.howto-list h3 {
  display: flex;
  align-items: center;
  min-height: 1.8rem;
}

.content p { margin: 0.4rem 0 0.9rem; }

.content a, .site-footer a {
  color: var(--accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.content a:hover, .site-footer a:hover { text-decoration-thickness: 2px; }

.howto-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: schritt;
}

.howto-list li {
  counter-increment: schritt;
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 1.1rem;
}

.howto-list li::before {
  content: counter(schritt);
  position: absolute;
  left: 0; top: 0.05rem;
  width: 1.8rem; height: 1.8rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 50%;
}

/* Tabelle */

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  min-width: 480px;
}

th, td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-size: 0.88rem;
  background: var(--card-alt);
}

tbody th { font-weight: 400; }

.th-hint { font-weight: 400; font-size: 0.75rem; color: var(--muted); }

tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

/* Formel */

.formula {
  background: var(--card-alt);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  text-align: center;
  font-size: 1.05rem;
  overflow-x: auto;
}

.formula .fr {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  margin: 0 0.3rem;
  line-height: 1.35;
}

.formula .fr span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 0.3rem; }
.formula .fr span:last-child { padding: 0 0.3rem; }

/* FAQ */

details {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0;
  margin-left: 1rem;
}

details:last-of-type { border-bottom: 0; }

summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.5rem 0.2rem;
  list-style-position: outside;
}

summary:hover { color: var(--accent-deep); }

details p { margin: 0.2rem 0.2rem 0.8rem; }

/* ===== Footer ===== */

.site-footer {
  padding: 1rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.footnote { font-size: 0.8rem; }

/* ===== Responsiv ===== */

@media (max-width: 560px) {
  .segmented {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
  }
  /* Bei ungerader Optionszahl (3) nimmt die letzte die volle Breite ein */
  .seg-option:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .seg-icon { width: 38px; height: 38px; }
  .app-card { padding: 1.1rem; }
  .content { padding: 1.2rem 1.1rem 0.9rem; }
}
