:root {
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
  color: #252921;
  background: #e9e7de;
  --paper: #fcfaf5;
  --ink: #252921;
  --muted: #626157;
  --green: #304536;
  --brick: #9d432e;
  --line: #d9d6ca;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, .messages:focus-visible { outline: 3px solid var(--brick); outline-offset: 3px; }
.icons { position: absolute; width: 0; height: 0; }
svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 29rem; margin-inline: auto; background: var(--paper); min-height: 100dvh; }
.topbar { display: flex; align-items: center; min-height: 3.5rem; padding-inline: 1.4rem; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem; padding: 0; border: 0; background: transparent; color: inherit; text-decoration: none; font-size: 1.28rem; letter-spacing: .09em; font-weight: 700; }
.wordmark img { flex: none; border-radius: .4rem; }
.cover { display: block; width: 100%; height: clamp(12rem, 31dvh, 17rem); object-fit: cover; object-position: 50% 56%; }
.recipe-content { padding: 1.5rem 1.4rem max(1.2rem, env(safe-area-inset-bottom)); }
#recipe-title { max-width: 12em; margin-bottom: 1.35rem; font-size: clamp(1.75rem, 7.8vw, 2.1rem); font-weight: 700; line-height: 1.43; letter-spacing: -.035em; line-break: strict; }
.title-word { white-space: nowrap; }
.section-heading, .facts div { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; }
.section-heading { padding-bottom: .45rem; border-bottom: 1px solid var(--line); }
.section-heading h2 { font-size: .945rem; font-weight: 650; }
.section-heading span, .facts dd { color: var(--muted); font-size: .875rem; }
.facts div { padding-block: .49rem; border-bottom: 1px solid var(--line); font-size: .93rem; }
.facts dd { font-variant-numeric: tabular-nums; white-space: nowrap; }
.recipe-actions { display: grid; gap: .2rem; margin-top: 1.3rem; }
.primary, .text-button { min-height: 2.75rem; width: 100%; border: 0; }
.primary { min-height: 3.2rem; padding: .65rem 1rem; border-radius: .4rem; background: var(--brick); color: white; font-weight: 650; }
.text-button { background: transparent; color: var(--muted); font-size: .875rem; }
.icon-button { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; background: transparent; border: 0; border-radius: 50%; }

.cooking-bar { gap: .5rem; padding-left: .55rem; }
.cooking-bar h1 { font-size: 1rem; font-weight: 650; }
.cooking-bar h1:focus { outline: none; }
.cooking-bar .wordmark { margin-inline-start: auto; }
#cooking { display: flex; flex-direction: column; height: 100dvh; }
#cooking > .topbar { flex-shrink: 0; }
.cooking-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: .9rem 1.4rem .65rem;
}
.timer { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; min-height: 3.75rem; padding: .65rem .75rem; margin-bottom: 1rem; border-block: 1px solid var(--line); color: var(--green); }
.timer h2 { font-size: .885rem; font-weight: 650; }
.timer output { font-variant-numeric: tabular-nums; font-size: 1.65rem; font-weight: 650; letter-spacing: -.035em; }
.timer.expired { color: #802f1d; background: #f7e9df; border-color: #e4c8b8; }
.feedback { margin-bottom: 1rem; padding-left: .65rem; border-left: 2px solid var(--line); color: var(--muted); font-size: .9rem; line-height: 1.55; }
.voice-dock {
  position: sticky;
  z-index: 1;
  bottom: 0;
  display: grid;
  flex-shrink: 0;
  gap: .2rem;
  margin-top: auto;
  padding: .65rem 1.4rem max(.4rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.mic-button {
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  width: 100%;
  min-height: 3.6rem;
  padding: .65rem 1.05rem;
  border: 1px solid #b5c6b0;
  border-radius: 2rem;
  background: #e6eee2;
  box-shadow: 0 2px 6px #30453614;
  color: var(--green);
  text-align: left;
}
.mic-button:disabled { opacity: .65; cursor: default; }
.mic-button[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 2px 6px #30453629;
  color: #fff;
}
.mic-icon { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; color: #47664e; }
.mic-button[aria-pressed="true"] .mic-icon { display: none; }
#voice-status { font-weight: 650; overflow-wrap: anywhere; }
.voice-wave { display: flex; justify-content: center; align-items: center; gap: .19rem; width: 2.2rem; height: 2rem; color: #47664e; }
.mic-button[aria-pressed="true"] .voice-wave { color: #c9e3c6; }
.voice-wave i { width: .19rem; height: .55rem; border-radius: 1rem; background: currentColor; }
.voice-wave i:nth-child(even) { height: .9rem; }
.voice-wave i:nth-child(3) { height: 1.25rem; }
.mic-button[data-state="listening"] .voice-wave i { animation: wave-pulse 1s ease-in-out infinite alternate; }
.mic-button[data-state="listening"] .voice-wave i:nth-child(even) { animation-delay: -.43s; }
.mic-button[data-state="listening"] .voice-wave i:nth-child(3) { animation-delay: -.76s; }
.voice-stop { display: flex; align-items: center; gap: .36rem; padding: .32rem .55rem; border-radius: 1rem; background: #17291d; font-size: .8rem; }
.voice-stop::before { content: ""; width: .45rem; height: .45rem; border-radius: .08rem; background: currentColor; }
@keyframes wave-pulse { from { transform: scaleY(.48); } to { transform: scaleY(1.2); } }
@media (prefers-reduced-motion: reduce) {
  .mic-button[data-state="listening"] .voice-wave i { animation: none; }
}
.fallbacks { display: flex; gap: .35rem; }
.fallbacks .text-button { color: var(--green); }
.fallbacks .interrupt { background: #e6eee2; border-radius: .5rem; font-weight: 700; }
.fallbacks .text-button:focus-visible { outline-offset: -4px; }
.messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .75rem;
  min-height: 0;
  margin: 0;
  padding: .15rem .15rem .4rem;
  list-style: none;
  overflow-y: auto;
}
.messages li {
  align-self: start;
  max-width: 90%;
  padding: .65rem .85rem;
  border-radius: .25rem 1rem 1rem;
  background: #eee9de;
  line-height: 1.6;
  line-break: strict;
  overflow-wrap: anywhere;
}
.messages li.assistant:last-child { background: #eef1e9; }
.messages li.user { align-self: end; border-radius: 1rem .25rem 1rem 1rem; background: #e0eadc; }
.messages small { display: flex; align-items: center; gap: .3rem; margin-bottom: .2rem; color: var(--muted); font-size: .8125rem; }
.messages .assistant small::before {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: .25rem;
  background: url("./assets/mimichef-icon.png") center / cover;
  content: "";
}

dialog { max-width: min(29rem, 100vw); width: 100%; max-height: 81dvh; margin: auto auto 0; padding: 1rem 1.4rem max(1rem, env(safe-area-inset-bottom)); border: 0; border-radius: 1.1rem 1.1rem 0 0; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #20282070; }
.sheet-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.sheet-heading h2 { font-size: 1.2rem; }
dialog h3 { margin: .7rem 0 .2rem; font-size: 1rem; }
dialog p { padding-block: .35rem .8rem; line-height: 1.55; }
#turn { display: grid; gap: .75rem; }
#turn input { min-height: 3.1rem; min-width: 0; padding: .65rem; border: 1px solid #8a7d6c; background: white; color: var(--ink); border-radius: .45rem; }
@media (min-width: 40rem) {
  body { padding: 1.25rem; }
  .app { min-height: calc(100dvh - 2.5rem); border: 1px solid #dad7cc; border-radius: 1rem; overflow: clip; }
  #cooking { height: calc(100dvh - 2.5rem - 2px); }
  dialog { margin-bottom: 1.25rem; border-radius: 1.1rem; }
}
