:root {
  color-scheme: light;
  --bg: #fff8ef;
  --bg-soft: #f4e8d8;
  --surface: #fffdf9;
  --text: #1f1a16;
  --muted: #6b6158;
  --accent: #a53f1d;
  --accent-2: #d37a2f;
  --line: #e5d7c7;
  --ok: #1e7d47;
  --chat-grad-top: #fffefb;
  --chat-grad-bottom: #fbf3e8;
  --header-bg: rgba(255, 248, 239, 0.96);
  --chat-input-bg: #fff;
  --bg-glow-1: #fddfb8;
  --bg-glow-2: #ffd6c6;
  --panel-bg: #fffdf9;
  --panel-subtle: #fff8f1;
  --input-bg: #fffaf3;
  --input-border: #d8c4ac;
  --msg-border: #eedec8;
  --msg-head: #6a4f39;
  --chat-app-height: 100dvh;
  --chat-header-h: 56px;
  --chat-presence-h: 42px;
  --chat-form-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151311;
    --bg-soft: #24201c;
    --surface: #1d1916;
    --text: #f3e6d8;
    --muted: #c3b4a3;
    --accent: #e98255;
    --accent-2: #ca6d2a;
    --line: #3a322a;
    --ok: #59c986;
    --chat-grad-top: #1a1714;
    --chat-grad-bottom: #171412;
    --header-bg: rgba(21, 19, 17, 0.94);
    --chat-input-bg: #1e1a16;
    --bg-glow-1: #2a2018;
    --bg-glow-2: #221914;
    --panel-bg: #211c18;
    --panel-subtle: #191512;
    --input-bg: #2a2622;
    --input-border: #56483d;
    --msg-border: #6a5849;
    --msg-head: #d7c4b0;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, var(--bg-glow-1) 0%, transparent 35%),
    radial-gradient(circle at bottom left, var(--bg-glow-2) 0%, transparent 30%),
    var(--bg);
  font-family: "Manrope", sans-serif;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Playfair Display", serif;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
}

.brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

main {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 20px 14px 90px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.hero-copy,
.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}

.hero-copy h2 {
  margin: 8px 0 10px;
  font-size: clamp(24px, 4.5vw, 42px);
}

.hero-copy p {
  color: var(--muted);
}

.hero-card ul {
  padding-left: 18px;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.recipes-section {
  margin-top: 18px;
}

.section-title p {
  margin-top: 6px;
  color: var(--muted);
}

.recipe-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 18px rgba(58, 38, 18, 0.12);
}

.recipe-card h4 {
  margin: 0 0 7px;
  font-size: 17px;
}

.recipe-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.chip {
  display: inline-block;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(1060px, 100%);
  margin: 0 auto 10px;
  padding: 10px 14px 25px;
  color: var(--muted);
}

.recipe-detail {
  max-width: 900px;
  margin: 4px auto 0;
}

.recipe-detail-card {
  margin-top: 12px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.recipe-detail-card h2 {
  margin-top: 6px;
  font-size: clamp(30px, 5vw, 48px);
}

.detail-image {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 8px;
}

.recipe-detail-card h3 {
  margin-top: 18px;
  font-size: 22px;
}

.recipe-detail-card ul,
.recipe-detail-card ol {
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 7px;
}

.btn-primary,
.btn-secondary,
.btn-quiet,
.btn-link {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(130deg, var(--accent), var(--accent-2));
}

.btn-secondary {
  background: var(--bg-soft);
}

.btn-quiet {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-link {
  background: transparent;
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 12, 6, 0.56);
  z-index: 30;
}

.modal-card {
  position: relative;
  width: min(460px, 100%);
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 30px;
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.stack {
  display: grid;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

.muted {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.status-text {
  min-height: 18px;
  margin-top: 10px;
  font-size: 13px;
}

.status-ok {
  color: var(--ok);
}

.status-err {
  color: #a32020;
}

.chat-shell {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-bg);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.chat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-bg);
}

.online-users {
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-subtle);
}

.chat-messages {
  height: auto;
  max-height: none;
  overflow-y: auto;
  padding: 12px;
  background: linear-gradient(180deg, var(--chat-grad-top) 0%, var(--chat-grad-bottom) 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding-bottom: 16px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.msg {
  max-width: 86%;
  background: var(--surface);
  border: 1px solid var(--msg-border);
  border-radius: 12px;
  padding: 8px 10px;
  align-self: flex-start;
}

.msg.mine {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent-2) 22%, var(--surface));
}

.msg-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--msg-head);
}

.msg p {
  margin: 0;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--chat-input-bg);
  position: relative;
  z-index: 6;
}

body.chat-mode .site-header,
body.chat-mode .site-footer,
body.chat-mode #storefront,
body.chat-mode #recipeDetailSection {
  display: none !important;
}

body.chat-mode main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

body.chat-mode .chat-shell {
  display: flex !important;
  flex-direction: column;
  margin: 0;
  border: 0;
  border-radius: 0;
  height: var(--chat-app-height);
  min-height: var(--chat-app-height);
  max-height: var(--chat-app-height);
  display: grid !important;
  grid-template-rows: auto auto 1fr auto;
}

body.chat-mode .chat-top {
  padding: 12px;
}

body.chat-mode .online-users {
  padding: 9px 12px;
}

body.chat-mode .chat-messages {
  flex: unset;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  padding-bottom: 16px;
}

body.chat-mode .chat-form {
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--chat-input-bg);
  border-top: 1px solid var(--line);
}

.privacy-blank {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #110f0d;
  color: #f8e8d8;
  text-align: center;
  padding: 24px;
}

.privacy-blank button {
  margin-top: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding: 10px 12px;
    align-items: flex-start;
    gap: 12px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .chat-top {
    padding: 10px 12px;
  }

  .online-users {
    padding: 8px 12px;
  }

  .chat-form {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    grid-template-columns: 1fr auto;
  }

  .chat-form button {
    min-width: 66px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
.recipe-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 8px;
}
