:root {
  color-scheme: light;
  --bg: #f5f0e8;
  --card: #fffdf9;
  --ink: #2b241c;
  --muted: #746858;
  --brand: #6b4f2a;
  --brand-2: #a77b47;
  --line: #e4d8c7;
  --ok: #316d4d;
  --warn: #9b5d17;
  --shadow: 0 12px 28px rgba(75, 52, 26, .10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #fbf7ef 0, var(--bg) 42%, #eee5d8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.topbar {
  max-width: 900px;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px 12px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}
.eyebrow { margin: 0 0 6px; font-size: .72rem; font-weight: 800; letter-spacing: .18em; color: var(--brand-2); }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1; }
.subtitle { margin: 10px 0 0; color: var(--muted); max-width: 580px; }
main { max-width: 900px; margin: 0 auto; padding: 12px 18px 48px; }
.card {
  background: rgba(255,253,249,.95);
  border: 1px solid rgba(107,79,42,.12);
  border-radius: 24px;
  padding: 22px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.hero-card { border-top: 5px solid var(--brand); }
.section-title { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 20px; }
.section-title h2 { margin: 0 0 4px; font-size: 1.25rem; }
.section-title p { margin: 0; color: var(--muted); font-size: .93rem; }
.step {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: white; font-weight: 800;
}
.step.check { background: var(--ok); }
label { display: block; margin: 0 0 7px; font-weight: 750; font-size: .9rem; }
input, select {
  width: 100%; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 13px; background: #fff; color: var(--ink);
  font: inherit; font-size: 1rem; outline: none;
}
input:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(167,123,71,.13); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.compact { margin-top: 14px; }
.flour-info {
  margin-top: 16px; padding: 15px; border-radius: 16px;
  background: #f6efe3; border: 1px solid #eadac3;
}
.flour-info strong { color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { padding: 6px 10px; background: white; border: 1px solid var(--line); border-radius: 999px; font-size: .83rem; }
button { border: 0; border-radius: 16px; font: inherit; font-weight: 850; cursor: pointer; }
.primary {
  width: 100%; padding: 17px; margin: 4px 0 0;
  color: white; background: linear-gradient(135deg, var(--brand), #8a6034);
  letter-spacing: .07em; box-shadow: 0 9px 18px rgba(107,79,42,.24);
}
.secondary, .ghost { padding: 12px 15px; background: #efe5d7; color: var(--brand); }
.ghost { background: transparent; border: 1px solid var(--line); white-space: nowrap; }
.feeding-box { margin-top: 18px; border: 1px dashed #d5c3a9; border-radius: 15px; padding: 13px; }
.feeding-box summary { cursor: pointer; font-weight: 750; }
.results { border-top: 5px solid var(--ok); }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.result-grid article {
  padding: 16px 10px; text-align: center; border-radius: 17px;
  background: #f6f1e8; border: 1px solid #e7dccc;
}
.result-grid span, .add-grid span { display: block; color: var(--muted); font-size: .78rem; }
.result-grid strong { display: inline-block; margin-top: 5px; font-size: 1.55rem; }
.result-grid small { margin-left: 3px; color: var(--muted); }
h3 { margin: 24px 0 10px; font-size: .98rem; }
.add-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.add-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.add-grid strong { display: block; margin-top: 5px; }
.warning { margin-top: 18px; padding: 14px; border-radius: 14px; background: #fff2df; color: #78430b; border: 1px solid #efc98f; }
.feeding-result { margin-top: 18px; padding: 14px; border-left: 4px solid var(--brand-2); background: #f7f1e8; border-radius: 10px; }
.small-card p { color: var(--muted); line-height: 1.55; }
footer { max-width: 900px; margin: 0 auto; padding: 0 20px max(28px, env(safe-area-inset-bottom)); color: var(--muted); text-align: center; font-size: .8rem; }
@media (max-width: 650px) {
  .topbar { align-items: center; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .add-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; border-radius: 20px; }
}
.hint { margin: 12px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.scale-note { margin: 14px 0 0; color: var(--muted); font-size: .78rem; }
#applyActualHyd { margin-top: 12px; }
.small-card button + button { margin-left: 10px; }
.feeding-result b { color: var(--brand); }
.feeding-result small { display: block; margin-top: 8px; color: var(--muted); }
.warning div + div { margin-top: 8px; }
@media (max-width: 650px) {
  .small-card button { width: 100%; margin: 8px 0 0; }
  .small-card button + button { margin-left: 0; }
}
.presets-card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.preset-row { display: flex; gap: 10px; flex-wrap: wrap; }
.preset-row button { flex: 1 1 140px; padding: 14px 12px; }
#scaleBtn { margin-top: 16px; }
.hyd-card { border-top: 5px solid var(--brand-2); }
#hydBtn { margin-top: 16px; }
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 600; }
.check-row input { width: 22px; height: 22px; flex: 0 0 22px; padding: 0; }
.peak-box { margin-top: 14px; padding: 14px; border-radius: 14px; background: #eef3ec; border: 1px solid #cfe0d2; }
.peak-box strong { color: var(--ok); }
.peak-box small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.5; }
.timing-card { border-top: 5px solid var(--ok); }
.timeline { margin-top: 20px; }
.tl-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-row:last-child { border-bottom: 0; }
.tl-time { flex: 0 0 96px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.tl-body strong { display: block; font-size: .97rem; }
.tl-body small { display: block; margin-top: 3px; color: var(--muted); }
input:disabled { background: #f2ece2; color: var(--muted); }
@media (max-width: 650px) { .tl-time { flex: 0 0 86px; font-size: .9rem; } }
.tl-night { background: #fdf1e3; border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.tl-night .tl-time { color: #b5651d; }
.tl-night .tl-body strong::after { content: ' 🌙'; }
#nightFitBtn { margin-top: 14px; width: 100%; }

/* iOS Safari a datetime-local és time mezőt középre igazítja és saját
   megjelenést ad neki – ezzel hozzáigazítjuk a többi mezőhöz. */
input[type="datetime-local"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
  min-height: 52px;
  line-height: 1.2;
}
input[type="datetime-local"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: .55;
  margin-left: auto;
}

/* Végigvezető */
.guide-card { border-top: 5px solid var(--ok); }
.guide-label { display: block; font-size: .72rem; letter-spacing: .09em;
  text-transform: uppercase; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.guide-now, .guide-next, .guide-prep, .guide-rest {
  border-radius: 16px; padding: 16px; margin-top: 14px; }
.guide-now { background: #f1efe9; border: 1px solid var(--line); }
.guide-now.before { background: #eef3ec; border-color: #cfe0d2; }
.guide-now.done { background: #eef3ec; border-color: #cfe0d2; }
.guide-now.late { background: #fdf1e3; border-color: #e8c9a0; }
.guide-now strong, .guide-next strong { display: block; font-size: 1.15rem; line-height: 1.3; }
.guide-when { margin-top: 6px; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.guide-next { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.guide-next .guide-label { color: rgba(255,255,255,.75); }
.guide-next .guide-when { color: rgba(255,255,255,.85); }
.guide-next.soon { background: #7a4f18; }
.guide-note { margin-top: 8px; font-size: .9rem; color: rgba(255,255,255,.9); }
.guide-late { margin-top: 10px; font-size: .88rem; color: #8a5a1e; }
.guide-prep { background: #fffdf9; border: 1px dashed var(--brand-2); }
.guide-prep p { margin: 0; font-size: .94rem; line-height: 1.55; }
.guide-rest { background: transparent; border: 0; padding: 16px 2px 0; }
.guide-rest-row { display: flex; gap: 14px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: .92rem; }
.guide-rest-row span:first-child { flex: 0 0 92px; font-weight: 700;
  color: var(--brand); font-variant-numeric: tabular-nums; }
.guide-rest-row:last-child { border-bottom: 0; }
#guideRefresh { margin-top: 16px; width: 100%; }
.guide-actions { margin-top: 18px; }
.guide-actions .primary { width: 100%; }
.guide-actions-row { display: flex; gap: 10px; margin-top: 10px; }
.guide-actions-row button { flex: 1; padding: 12px 8px; font-size: .85rem; }
button:disabled { opacity: .45; }
.guide-timer { margin-top: 14px; padding: 16px; border-radius: 16px;
  background: #eef3ec; border: 1px solid #cfe0d2; }
.guide-timer .guide-label { margin-bottom: 4px; }
.timer-main strong { display: block; font-size: 2.1rem; font-weight: 800;
  color: var(--ok); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.timer-bar { height: 8px; border-radius: 999px; background: #d9e5db;
  margin-top: 12px; overflow: hidden; }
.timer-bar span { display: block; height: 100%; width: 0;
  background: var(--ok); border-radius: 999px; transition: width .9s linear; }
.timer-sub { margin-top: 8px; font-size: .82rem; color: var(--muted); }
.guide-timer.soon { background: #fdf1e3; border-color: #e8c9a0; }
.guide-timer.soon .timer-main strong { color: #b5651d; }
.guide-timer.soon .timer-bar span { background: #b5651d; }
.guide-timer.over { background: #fbeceb; border-color: #e6bdb8; }
.guide-timer.over .timer-main strong { color: #a33b30; }
.guide-timer.over .timer-bar span { background: #a33b30; }
.guide-next.overdue { background: #8c3b30; border-color: #8c3b30; }
.guide-recipe { padding: 14px 16px; border-radius: 16px; background: var(--brand);
  color: #fff; margin-bottom: 4px; }
.guide-recipe .guide-label { color: rgba(255,255,255,.72); }
.guide-recipe strong { display: block; font-size: 1.2rem; line-height: 1.3; }
.guide-recipe-meta { margin-top: 6px; font-size: .86rem; color: rgba(255,255,255,.85); }
[hidden] { display: none !important; }
.choice-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.choice-row button { flex: 1 1 150px; padding: 13px 10px; font-size: .85rem; }

/* Lenyitható ütemterv-sorok */
details.tl-row { display: block; padding: 0; }
details.tl-row > summary {
  display: flex; gap: 14px; padding: 12px 0; cursor: pointer;
  list-style: none; align-items: flex-start;
}
details.tl-row > summary::-webkit-details-marker { display: none; }
details.tl-row > summary::after {
  content: '▾'; margin-left: auto; color: var(--brand-2);
  font-size: .85rem; transition: transform .15s ease; padding-top: 2px;
}
details.tl-row[open] > summary::after { transform: rotate(180deg); }
.tl-how {
  margin: 0 0 14px; padding: 14px 16px 14px 34px; border-radius: 14px;
  background: #f6f2ea; border: 1px solid var(--line);
}
.tl-how li { margin: 0 0 9px; font-size: .92rem; line-height: 1.55; }
.tl-how li:last-child { margin-bottom: 0; }
details.tl-night > summary { background: #fdf1e3; border-radius: 10px; padding-left: 10px; padding-right: 10px; }
