/* ThePerfectEgg – Stil
   Palette: Dampf (Hintergrund), Tinte (Text), Dotter (Akzent). Keine externen Schriften. */
:root {
  --bg: #E6EFF2;
  --track: #D3E2E8;
  --ink: #14232B;
  --muted: #4D6570;
  --yolk: #F5B82E;
  --on-yolk: #14232B;
  --ring-track: #C9DBE1;
  --shell: #FFFFFF;
  --shell-edge: #AFC4CC;
  --focus: #14232B;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1D24;
    --track: #1B2E38;
    --ink: #E8F1F4;
    --muted: #95ADB7;
    --ring-track: #243B47;
    --shell: #F4F8F9;
    --shell-edge: #5F7F8C;
    --focus: #E8F1F4;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN",
        system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; touch-action: manipulation; user-select: none; -webkit-touch-callout: none; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.app {
  --egg: clamp(110px, 22svh, 210px);
  min-height: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.app:not([data-state="idle"]) { --egg: min(80vw, 44svh, 340px); }

.brand { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }

/* Bühne: Ei, Zeit, Hinweis */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 0;
}
.egg { width: var(--egg); height: var(--egg); overflow: visible; transition: width .35s ease, height .35s ease; }

.ring-track, .ring-bar { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--ring-track); }
.ring-bar {
  stroke: var(--yolk);
  stroke-linecap: round;
  stroke-dasharray: 100 100;
  stroke-dashoffset: 0;
  transform: rotate(-90deg);
  transform-origin: 120px 120px;
  opacity: 0;
  transition: opacity .3s, stroke-dashoffset .3s linear;
}
.app:not([data-state="idle"]) .ring-bar { opacity: 1; }

.shell { fill: var(--shell); stroke: var(--shell-edge); stroke-width: 2; }
.yolk { fill: #F4C34E; transition: fill .3s; }
.core { fill: #F1A21C; transition: fill .3s; }
.app[data-goal="weich"]  .yolk { fill: #F6B531; }
.app[data-goal="weich"]  .core { fill: #E9830A; }
.app[data-goal="mittel"] .yolk { fill: #F4C34E; }
.app[data-goal="mittel"] .core { fill: #F1A21C; }
.app[data-goal="hart"]   .yolk { fill: #F1D673; }
.app[data-goal="hart"]   .core { fill: #F1D673; }

.egg-body { transform-box: fill-box; transform-origin: 50% 100%; }

.time {
  display: block;
  margin-top: 10px;
  font-size: clamp(48px, 15vw, 76px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hint { margin: 10px 0 0; min-height: 1.4em; color: var(--muted); font-size: 15px; }

/* Einstellungen */
.controls { display: grid; gap: 12px; margin: 4px 0 14px; }
.app:not([data-state="idle"]) .controls { display: none; }

.group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.label { font-size: 15px; font-weight: 700; color: var(--muted); }

.stepper { display: flex; align-items: center; gap: 10px; }
.step {
  width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--track); color: var(--ink);
  font-size: 22px; font-weight: 700; line-height: 1;
}
.w-val { min-width: 3.2em; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--track);
  border-radius: 16px;
}
.seg button {
  min-height: 50px;
  padding: 6px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.seg button[aria-pressed="true"] { background: var(--yolk); color: var(--on-yolk); }
.seg .m { font-size: 17px; font-weight: 800; }
.seg .s { font-size: 12.5px; opacity: .75; }

/* Hauptknopf */
.go {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: var(--ink);
  color: var(--bg);
  font-size: 19px;
  font-weight: 800;
  transition: background .2s, color .2s, transform .1s;
}
.go:active { transform: scale(.98); }
.app[data-state="running"] .go { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.app[data-state="done"] .go { background: var(--yolk); color: var(--on-yolk); }

/* Ein Moment: das Ei wackelt, wenn es fertig ist */
@keyframes wobble {
  0%, 40%, 100% { transform: rotate(0); }
  8%  { transform: rotate(-7deg); }
  16% { transform: rotate(6deg); }
  24% { transform: rotate(-4deg); }
  32% { transform: rotate(2deg); }
}
@media (prefers-reduced-motion: no-preference) {
  .app[data-state="done"] .egg-body { animation: wobble 2.4s ease-in-out infinite; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
