:root {
  color-scheme: dark;
  --bg: #12100e;
  --ink: #f6f1e7;
  --muted: #c3b6a6;
  --faint: #9a8e82;
  --mark: #f0b429;
  --line: rgba(246, 241, 231, 0.14);
  --card: #221e19;
  --yolk: #f0b429;
  --yolk-2: #ffd56a;
  --on-yolk: #241804;
  --sage: #c6e3b8;
  --on-sage: #142417;
  --sage-ink: #d7f0cc;
  --sage-deep: #1c3324;
  --track: rgba(246, 241, 231, 0.14);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: system-ui, "Segoe UI", sans-serif;
  --danger: #ffb4a6;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4efe6;
    --ink: #221c15;
    --muted: #5c5348;
    --faint: #5e564c;
    --mark: #8a5600;
    --line: rgba(34, 28, 21, 0.14);
    --card: #fffdf8;
    --yolk: #e39b10;
    --yolk-2: #f0b429;
    --on-yolk: #241804;
    --sage: #1f6b3a;
    --on-sage: #f4fff6;
    --sage-ink: #14301e;
    --sage-deep: #e4f3e2;
    --track: rgba(34, 28, 21, 0.12);
    --shadow: 0 12px 30px rgba(70, 48, 20, 0.08);
    --danger: #9f2d1c;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe6;
  --ink: #221c15;
  --muted: #5c5348;
  --faint: #5e564c;
  --mark: #8a5600;
  --line: rgba(34, 28, 21, 0.14);
  --card: #fffdf8;
  --yolk: #e39b10;
  --yolk-2: #f0b429;
  --on-yolk: #241804;
  --sage: #1f6b3a;
  --on-sage: #f4fff6;
  --sage-ink: #14301e;
  --sage-deep: #e4f3e2;
  --track: rgba(34, 28, 21, 0.12);
  --shadow: 0 12px 30px rgba(70, 48, 20, 0.08);
  --danger: #9f2d1c;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12100e;
  --ink: #f6f1e7;
  --muted: #c3b6a6;
  --faint: #9a8e82;
  --mark: #f0b429;
  --line: rgba(246, 241, 231, 0.14);
  --card: #221e19;
  --yolk: #f0b429;
  --yolk-2: #ffd56a;
  --on-yolk: #241804;
  --sage: #c6e3b8;
  --on-sage: #142417;
  --sage-ink: #d7f0cc;
  --sage-deep: #1c3324;
  --track: rgba(246, 241, 231, 0.14);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --danger: #ffb4a6;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(1000px 420px at 0% -10%, rgba(240, 180, 41, 0.14), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(198, 227, 184, 0.08), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
}

button, textarea, a { font: inherit; color: inherit; }

button, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(240, 180, 41, 0.28);
}

button { cursor: pointer; }

button:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--yolk);
  outline-offset: 3px;
}

.knuckle:focus-visible,
.toggle[aria-pressed="true"]:focus-visible {
  outline-color: var(--ink);
}

#app { height: 100%; }

.screen {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.screen.shelf {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wrap {
  width: min(760px, 100%);
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.screen.shelf .wrap { width: min(1080px, 100%); }
.screen.cook .wrap { width: min(980px, 100%); }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--yolk);
  color: var(--on-yolk);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}

.skip:focus { top: 12px; }

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

.noscript {
  margin: 16px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 12px;
}

.top { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: 4px; }

.shelf .top-row {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.shelf .lede { margin-top: 14px; }

.top-row, .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.brand {
  display: inline-block;
  margin: 0;
  border: 0;
  background: none;
  padding: 4px 2px;
  text-decoration: none;
  color: inherit;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand::after {
  content: "";
  display: inline-block;
  width: 0.38em;
  height: 0.38em;
  margin-left: 0.14em;
  border-radius: 50%;
  background: var(--yolk);
  transform: translateY(-0.05em);
}

.toggles, .top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  justify-content: flex-end;
}

.toggle, .ghost, .texty, .card-edit {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.toggle { color: var(--muted); font-size: 0.92rem; }

.toggle[aria-pressed="true"] {
  background: var(--yolk);
  border-color: var(--yolk);
  color: var(--on-yolk);
}

@media (hover: hover) {
  .ghost:hover, .toggle:hover, .texty:hover, .card-edit:hover {
    border-color: var(--yolk);
    background: color-mix(in srgb, var(--yolk) 12%, transparent);
  }
  .toggle[aria-pressed="true"]:hover {
    background: var(--yolk-2);
    color: var(--on-yolk);
  }
  .card:hover {
    border-color: var(--yolk);
    transform: translateY(-2px);
  }
}

.ghost:active, .toggle:active, .texty:active, .card-edit:active, .card:active {
  transform: translateY(1px);
}

.lede {
  margin: 8px 0 0;
  max-width: 11em;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

.sub {
  margin: 10px 0 0;
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.grid > * { min-width: 0; }

@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: inset 3px 0 0 var(--yolk), var(--shadow);
  min-height: 148px;
  min-width: 0;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.card-open {
  width: 100%;
  height: 100%;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  min-height: 148px;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1.15;
  padding-right: 4px;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.card.custom .card-title,
.card.custom .note { padding-right: 76px; }

.note {
  margin: 8px 0 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}

.meta {
  align-self: flex-start;
  width: fit-content;
  margin-top: auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--yolk) 18%, transparent);
  color: var(--mark);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-edit {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
}

.card.dash {
  background: transparent;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--yolk) 55%, var(--line));
  box-shadow: none;
}

.empty-panel {
  display: grid;
  gap: 14px;
}

.empty-panel .empty {
  margin: 0;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
}

.empty-panel .card,
.empty-panel .card-open,
.empty-panel .empty { min-height: 0; }

.empty-panel .card-open { padding: 16px 18px; }

@media (min-width: 720px) {
  .empty-panel { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  .empty-panel { grid-template-columns: 1fr 1fr 1fr; }
  .empty-panel .empty { grid-column: span 2; }
}

.card.dash .card-open { min-height: 148px; justify-content: center; }

.empty {
  margin: 0 0 12px;
  color: var(--muted);
}

.foot {
  padding: 8px 0 calc(36px + env(safe-area-inset-bottom));
  color: var(--faint);
  font-size: 0.92rem;
}

.foot p { margin: 8px 0; }

.banner {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  overflow-wrap: anywhere;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
}

.banner button, .hint button {
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  min-height: 44px;
  padding: 0 4px;
  flex: none;
}

.cook-main, .edit-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-top: 8px;
  padding-bottom: 18px;
  scroll-padding-top: 12px;
  scroll-padding-bottom: 24px;
}

.cook-main { display: flex; flex-direction: column; }

.cook-stage {
  box-sizing: border-box;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cook-copy { max-width: 40rem; min-width: 0; }

@media (min-width: 900px) {
  .cook-grid.has-ring {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 36px;
    align-items: center;
  }
  .cook-grid.has-ring .ring-wrap { margin-top: 0; }
}

.recipe-name {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.kicker {
  margin: 18px 0 8px;
  color: var(--faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.kicker .num {
  color: var(--mark);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.step-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.8vw, 3.05rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.16;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.hint {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--yolk);
  background: color-mix(in srgb, var(--yolk) 8%, var(--card));
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.segs {
  display: flex;
  gap: 5px;
  margin-top: 14px;
}

.segs span {
  height: 4px;
  flex: 1;
  border-radius: 99px;
  background: var(--track);
}

.segs span.done { background: var(--yolk); opacity: 0.55; }
.segs span.now { background: var(--yolk); }

.hold {
  display: inline-flex;
  margin-top: 16px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--sage-deep);
  color: var(--sage-ink);
  font-weight: 650;
}

.ring-wrap {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.ring {
  width: min(220px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 12px;
  background: conic-gradient(var(--yolk) calc(var(--p) * 1turn), var(--track) 0);
}

.ring.is-hold { background: var(--sage); }

.ring.is-paused { background: conic-gradient(var(--faint) calc(var(--p) * 1turn), var(--track) 0); }

.ring-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.clock {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 8vw, 3.5rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
}

.clock-label {
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.listen {
  margin: 12px 0 0;
  color: var(--sage-ink);
  font-size: 0.92rem;
  min-height: 1.2em;
}

.done-kicker {
  margin-top: 28px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  font-size: 0.78rem;
}

.dock {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  padding-top: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.dock-inner { display: flex; flex-direction: column; gap: 8px; }

.knuckle {
  width: 100%;
  min-height: 76px;
  border: 0;
  border-radius: 18px;
  background: var(--yolk);
  color: var(--on-yolk);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 22px rgba(240, 180, 41, 0.22);
  transition: transform 120ms ease, background-color 120ms ease;
}

.knuckle:hover { background: var(--yolk-2); }
.knuckle:active { transform: translateY(1px) scale(0.992); }

.knuckle.is-hold {
  background: var(--sage);
  color: var(--on-sage);
}

.knuckle.is-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.knuckle.is-hold { box-shadow: 0 8px 22px rgba(198, 227, 184, 0.16); }

.wide { width: 100%; }

h1, h2 { scroll-margin-top: 16px; }

h1.edit-title {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 12px 0;
  text-wrap: balance;
}

h1.edit-title label { cursor: text; }

textarea {
  width: 100%;
  min-height: min(440px, 48dvh);
  max-height: 520px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 14px;
  line-height: 1.45;
  font-size: 16px;
}

textarea::placeholder { color: var(--faint); }

.preview { margin: 10px 0; color: var(--muted); }
.preview.bad { color: var(--danger); }

.help { margin: 0 0 12px; color: var(--faint); font-size: 0.92rem; }
.help code {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  color: var(--ink);
}

.confirm {
  margin-top: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}

.confirm p { margin: 0 0 8px; }

.danger {
  border-color: var(--danger);
  color: var(--danger);
}

@media (max-width: 420px) {
  .wrap {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .knuckle { min-height: 64px; font-size: 1.1rem; }
  .card-title { font-size: 1.3rem; }
}

@media (max-height: 740px) {
  .step-text { font-size: clamp(1.45rem, 5.2vw, 2.2rem); }
  .hint { margin-bottom: 8px; padding: 8px 10px; }
  .kicker { margin: 8px 0 4px; }
  .ring-wrap { margin-top: 12px; }
  .ring { width: min(160px, 46vw); }
  .top { padding-top: calc(14px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  .knuckle:active, .card:active, .ghost:active, .toggle:active, .texty:active, .card-edit:active {
    transform: none;
  }
  .card, .knuckle, .ghost, .toggle, .texty, .card-edit { transition: none; }
  .card:hover { transform: none; }
}

@media (pointer: fine) {
  html { overscroll-behavior: none; }
}

@media (forced-colors: active) {
  .knuckle, .card, .toggle, .ghost, .card-open, .card-edit { border: 1px solid ButtonText; }
}
