:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #292c24;
  background: #ece5d5;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: #ece5d5 url("images/chef-preview/bamboo-board.png") center / cover fixed;
}

.chef-onboarding {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 1.5rem;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: max(1.75rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom));
  overflow: hidden;
  background: #afa597;
  color: #fff;
}
.chef-onboarding::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: 50%;
  left: 50%;
  width: min(max(100vw, 100dvh), calc(min(100vw, 100dvh) / 0.62));
  height: min(max(100vw, 100dvh), calc(min(100vw, 100dvh) / 0.62));
  transform: translate(-50%, -50%);
  background: url("images/chef-preview/stovetop.png") center / contain no-repeat;
}
.chef-onboarding::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(to bottom, rgba(16, 29, 23, 0.7216) 0%, rgba(16, 29, 23, 0.6118) 62%, rgba(16, 29, 23, 0.2824) 100%);
}
.chef-onboarding-header h1 { margin: 0; font: 600 2rem/1.2 Arial, Helvetica, sans-serif; }
.chef-onboarding-header hr { margin: 1rem 0 0; border: 0; border-top: 1px solid rgba(255, 255, 255, 0.6); }
.chef-onboarding-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chef-onboarding-content h2 { margin: 0 0 0.5rem; color: #ffe1a6; font: 600 1.25rem/1.3 Arial, Helvetica, sans-serif; }
.chef-onboarding-content p { margin: 0 0 1.5rem; color: #fff; font: 400 1rem/1.5 Arial, Helvetica, sans-serif; }
.chef-onboarding-enter { display: grid; justify-items: center; gap: 0.2rem; width: 100%; min-height: 64px; padding: 0.7rem 1rem; border: 0; border-radius: 99px; background: #3f00ff; color: #fff; font: 400 0.9rem/1.2 Arial, Helvetica, sans-serif; cursor: pointer; }
.chef-onboarding-enter strong { font-size: 1.1rem; font-weight: 700; }
.chef-onboarding-enter:hover { background: #4b16ff; }
.chef-onboarding-enter:focus-visible { outline: 2px solid #ffe1a6; outline-offset: 3px; }
.chef-onboarding[hidden], .chef-preview[hidden] { display: none; }

.chef-preview {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 420px;
  overflow: hidden;
}

.preview-navigation {
  position: absolute;
  z-index: 3;
  top: max(0.75rem, env(safe-area-inset-top));
  left: 1rem;
  right: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-back {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  color: #344d33;
  text-decoration: none;
  font-size: 0.75rem;
}

.preview-back-circle { display: grid; place-items: center; width: 1.65rem; height: 1.65rem; border: 1px solid currentColor; border-radius: 50%; }
.preview-back svg { width: 1.05rem; height: 0.55rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.preview-back:focus-visible { outline: 2px solid #344d33; outline-offset: 6px; }
.chef-header {
  position: absolute;
  z-index: 2;
  top: max(2.5rem, calc(env(safe-area-inset-top) + 2rem));
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  align-items: center;
  height: 92px;
}

.chef-header h1 { display: flex; align-items: center; justify-content: center; min-width: 0; margin: 0; overflow: visible; height: 92px; transform: translateY(-8px); }
.chef-header h1 img { display: block; width: min(100%, 260px); height: auto; max-height: none; object-fit: contain; }
.chef-spoon { width: 64px; height: 64px; object-fit: contain; justify-self: center; }
.chef-spoon-left { transform: scaleX(-1); }
.chef-spoon-button { display: grid; place-items: center; width: 76px; height: 76px; padding: 0; border: 0; border-radius: 50%; color: #344d33; background: transparent; cursor: pointer; }
.chef-spoon-button:focus-visible { outline: 2px solid #b68435; outline-offset: -4px; }

.chef-chat { position: absolute; inset: 0; }
.chef-pan-watermark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(90vw, 50vh);
  height: min(90vw, 50vh);
  object-fit: contain;
  opacity: 0.14;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.chef-composer { position: absolute; top: 50%; left: 8px; right: 8px; display: flex; align-items: flex-start; gap: 8px; transform: translateY(-50%); }
.chef-input-wrap { flex: 1; min-width: 0; }
.chef-input-wrap input { width: 100%; height: 56px; padding: 0 14px; border: 1px solid #857e67; border-radius: 4px; background: transparent; color: #292c24; font: 16px/1.4 Arial, Helvetica, sans-serif; }
.chef-input-wrap input::placeholder { color: #666251; opacity: 1; }
.chef-input-wrap input:focus { outline: 2px solid #b68435; outline-offset: -1px; }
.chef-counter { display: block; margin-top: 6px; padding-right: 12px; text-align: right; font-size: 12px; color: #666251; }
.chef-send { display: grid; place-items: center; flex: 0 0 56px; width: 56px; height: 56px; border: 0; padding: 2px; background: transparent; cursor: pointer; border-radius: 5px; }
.chef-send img { width: 52px; height: 52px; object-fit: contain; }
.chef-send:focus-visible { outline: 2px solid #b68435; outline-offset: 2px; }
.chef-send:hover { filter: brightness(1.06); }
.chef-questions, .chef-answer { position: absolute; left: 12px; right: 12px; font: 20px/1.5 Arial, Helvetica, sans-serif; overflow: auto; overflow-wrap: anywhere; }
.chef-questions { top: 160px; bottom: calc(50% + 60px); }
.chef-answer { top: calc(50% + 72px); bottom: max(20px, env(safe-area-inset-bottom)); }
.chef-questions p, .chef-answer p { margin: 0 0 1.2rem; max-width: 58rem; white-space: pre-wrap; }
.chef-questions, .chef-answer { user-select: text; -webkit-user-select: text; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.chef-library { position: fixed; inset: 0 auto 0 0; width: min(82vw, 304px); max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: max(2.6rem, env(safe-area-inset-top)) 0 max(1.6rem, env(safe-area-inset-bottom)); overflow: auto; border: 0; background: #f0f7fc; color: #171717; }
.chef-library[open] { display: flex; flex-direction: column; }
.chef-library[data-side="right"] { inset: 0 0 0 auto; }
.chef-library::backdrop { background: rgba(0, 0, 0, 0.45); }
.chef-library-close { position: absolute; top: 0.4rem; right: 0.5rem; width: 2rem; height: 2rem; padding: 0; border: 0; background: transparent; color: #344d33; font-size: 1.6rem; cursor: pointer; }
.chef-library-menu { display: grid; }
.chef-library-menu hr { width: 100%; margin: 0.4rem 0; border: 0; border-top: 1px solid #d0cbc2; }
.chef-library-item { display: flex; align-items: center; gap: 0.85rem; width: 100%; min-height: 56px; padding: 0.8rem 1rem; border: 0; background: transparent; color: #292c24; font: 400 1.25rem/1.3 Georgia, serif; text-align: left; cursor: pointer; }
.chef-library-item:hover, .chef-library-item:focus-visible { background: rgba(181, 123, 22, 0.1); outline: none; }
.chef-library-illuminated { animation: chef-library-gold 5.9s ease-in-out infinite; }
.chef-library-illuminated:nth-child(2) { animation-delay: 0.8s; }
@keyframes chef-library-gold { 0%, 28%, 100% { color: #292c24; } 12% { color: #b57b16; text-shadow: 0 0 7px #f3d99c; } }
.chef-library-icon { flex: 0 0 auto; width: 28px; height: 28px; color: #5b5846; }
.chef-rinse { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; margin-top: auto; padding: 2rem 1rem 0.3rem; border: 0; background: transparent; color: #304e3d; font: 600 1.05rem/1.3 Georgia, serif; cursor: pointer; animation: chef-rinse-pulse 4s ease-in-out infinite; }
@keyframes chef-rinse-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.chef-rinse:focus-visible { outline: 2px solid #344d33; outline-offset: -4px; }

.chef-library-page { position: fixed; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: max(1.7rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom)); overflow: hidden; border: 0; background: #fff6d2; color: #171717; }
.chef-library-page[open] { display: flex; flex-direction: column; }
.chef-library-page[data-theme="kitchen"] { background: #000; color: #fff; }
.chef-library-page[data-theme="stew"] { background: #e8f2fc; }
.chef-library-page h2 { flex: 0 0 auto; margin: 0; font: 600 2rem/1.2 Georgia, serif; letter-spacing: 0.015em; }
.chef-library-page[data-theme="stew"] h2 { text-align: center; }
.chef-library-page > hr { flex: 0 0 auto; width: 100%; margin: 0.9rem 0 1.7rem; border: 0; border-top: 1px solid currentColor; opacity: 0.6; }
.chef-page-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chef-page-content h3 { margin: 1rem 0 0.8rem; font: 600 1.35rem/1.3 Georgia, serif; }
.chef-page-content h3:first-child { margin-top: 0; }
.chef-page-content p { margin: 0 0 1.2rem; font: 400 1.15rem/1.65 Georgia, serif; overflow-wrap: anywhere; white-space: pre-line; }
.chef-library-page[data-theme="kitchen"] h3 { color: #a884ff; }
.chef-library-page[data-theme="kitchen"] p { font: 400 1rem/1.5 Arial, sans-serif; }
.chef-library-return { flex: 0 0 auto; width: 100%; margin-top: 1.25rem; padding: 1rem; border: 0; border-radius: 99px; background: #3f00ff; color: #fff; font: 600 1.15rem/1.2 Georgia, serif; cursor: pointer; }
.chef-library-return:focus-visible { outline: 2px solid #b57b16; outline-offset: 3px; }
.chef-stew-day { color: #333; font: 600 1.1rem/1.3 Georgia, serif; }
.chef-stew-entry { padding: 0.6rem 0 1.1rem; border-bottom: 1px solid #c7c5bd; }
.chef-stew-entry p { font-family: Arial, sans-serif; font-size: 1.2rem; user-select: text; -webkit-user-select: text; }
.chef-remove-entry { padding: 0.4rem 0; border: 0; background: transparent; color: #6f3b2d; font: 400 0.8rem/1.3 Arial, sans-serif; text-decoration: underline; text-underline-offset: 0.2rem; cursor: pointer; }
.chef-selection-actions { position: fixed; z-index: 100; max-width: calc(100vw - 1rem); padding: 0.25rem; border: 1px solid #b57b16; border-radius: 0.4rem; background: #fff9e9; box-shadow: 0 4px 16px #0003; }
.chef-selection-actions button { padding: 0.55rem 0.75rem; border: 0; background: transparent; color: #304e3d; font: 500 0.85rem/1.2 Arial, sans-serif; cursor: pointer; }
.chef-selection-actions[hidden], .chef-toast[hidden] { display: none; }
.chef-toast { position: fixed; z-index: 2000; bottom: max(1.2rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 2rem); padding: 0.8rem 1rem; border-radius: 0.4rem; background: #304e3d; color: #fff; font: 400 0.9rem/1.4 Arial, sans-serif; box-shadow: 0 4px 20px #0003; }
.chef-toast button { margin-left: 0.75rem; padding: 0.1rem 0.2rem; border: 0; background: transparent; color: #ffda8d; font: 600 0.85rem Arial, sans-serif; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .chef-library-illuminated, .chef-rinse { animation: none; } }

@media (max-width: 380px) {
  .chef-header { grid-template-columns: 60px minmax(0, 1fr) 60px; }
  .chef-spoon { width: 52px; height: 52px; }
  .chef-spoon-button { width: 60px; height: 76px; }
  .chef-input-wrap input { font-size: 14px; padding-inline: 10px; }
}
