* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #f0ece0;
  min-height: 100vh;
  padding: 2rem 1rem;
}
.header { text-align: center; margin-bottom: 2rem; }
.header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #e8c96a;
  letter-spacing: 0.02em;
}
.header p { color: #888; font-size: 0.95rem; margin-top: 0.4rem; }

.form-card {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 720px;
  margin: 0 auto 2rem;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e8c96a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
input, select, textarea {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #f0ece0;
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #e8c96a; }
textarea { resize: vertical; min-height: 72px; }
select option { background: #1a1a1a; }

.btn {
  width: 100%;
  padding: 0.85rem;
  background: #e8c96a;
  color: #0f0f0f;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1.25rem;
  letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: #f0d87a; }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: #444; color: #888; cursor: not-allowed; }

/* ── Quick-pick ingredient chips ── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.chip {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 20px;
  color: #ccc;
  font-size: 0.8rem;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
  white-space: nowrap;
}
.chip:hover { background: #2a2a2a; border-color: #555; color: #f0ece0; }
.chip.active {
  background: #2a2200;
  border-color: #e8c96a;
  color: #e8c96a;
}
.chip.veg { border-color: #2a4a2a; }
.chip.veg:hover { border-color: #4a8a4a; }
.chip.veg.active { background: #0f2a0f; border-color: #6abf6a; color: #6abf6a; }

/* ── Results ── */
.results { max-width: 720px; margin: 0 auto; }
.results-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e8c96a;
  margin-bottom: 1rem;
  text-align: center;
}

/* ── Dish summary grid ── */
.dish-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.dish-card {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.dish-card:hover, .dish-card:focus {
  transform: translateY(-4px);
  border-color: #e8c96a55;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.dish-photo {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.dish-photo-placeholder {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: #111;
}
.dish-card-body { padding: 0.85rem; }
.dish-name { font-size: 1rem; font-weight: 700; color: #f0ece0; margin-bottom: 0.35rem; }
.dish-desc {
  color: #888;
  font-size: 0.78rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.dish-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
  margin-bottom: 0.35rem;
}
.dish-card-serves { font-size: 0.72rem; color: #a78bce; }
.dish-card-cook-time { font-size: 0.72rem; color: #7ab8d4; }
.dish-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.dish-card-hint { font-size: 0.7rem; color: #555; }

/* ── Shared detail styles ── */
.dish-name-cn { font-size: 0.9rem; color: #e8c96a; margin-top: 2px; }
.calorie-badge {
  background: #2a2200;
  border: 1px solid #e8c96a44;
  color: #e8c96a;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
}
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e8c96a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.ingredients-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.ingredient-tag {
  background: #252525;
  border: 1px solid #333;
  color: #ccc;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}
.steps-list { list-style: none; counter-reset: steps; }
.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  align-items: flex-start;
  font-size: 0.88rem;
  color: #ccc;
  line-height: 1.6;
}
.steps-list li::before {
  content: counter(steps);
  background: #e8c96a22;
  color: #e8c96a;
  font-weight: 700;
  font-size: 0.75rem;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Dish detail modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #141414;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.25s ease;
}
.modal-close {
  position: sticky;
  top: 0.75rem;
  float: right;
  margin: 0.75rem 0.75rem 0 0;
  background: #2a2a2a;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: #333; color: #f0ece0; }
.modal-photo {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  border-radius: 20px 20px 0 0;
}
.modal-body-content { padding: 1.25rem 1.5rem 2rem; }
.modal-dish-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.modal-dish-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: 1rem;
}
.serves-badge {
  background: #1a0d2e;
  border: 1px solid #a78bce44;
  color: #a78bce;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
}
.cook-time-badge {
  background: #0d2233;
  border: 1px solid #7ab8d444;
  color: #7ab8d4;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
}
.modal-body-content .dish-desc {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

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

/* ── Loader / Error ── */
.loader { text-align: center; padding: 3rem 2rem; }
.loader-chef {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  animation: chefBounce 1s ease-in-out infinite;
}
.loader-text {
  color: #888;
  font-size: 0.92rem;
  margin-bottom: 1rem;
  min-height: 1.2em;
  transition: opacity 0.3s;
}
.loader-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
}
.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e8c96a;
  animation: dotFade 1.4s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chefBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes dotFade {
  0%, 80%, 100% { opacity: 0.15; transform: scale(0.75); }
  40%           { opacity: 1;    transform: scale(1); }
}
.error-msg {
  background: #2a0f0f;
  border: 1px solid #8b2020;
  color: #f09090;
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.9rem;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Hamburger button ── */
.menu-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 10px;
  cursor: pointer;
  width: 42px;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.2s;
}
.menu-btn:hover { background: #252525; }
.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #e8c96a;
  border-radius: 2px;
  transition: transform 0.22s, opacity 0.22s;
}
.menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Drawer overlay ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.drawer-overlay.active { opacity: 1; pointer-events: all; }

/* ── Drawer ── */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 288px;
  height: 100vh;
  background: #141414;
  border-right: 1px solid #2a2a2a;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 1.1rem 0.9rem;
  border-bottom: 1px solid #222;
  min-height: 56px;
}
.drawer-back {
  background: none;
  border: none;
  color: #e8c96a;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem 0.4rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
}
.drawer-back:hover { background: #1f1f1f; }
.drawer-title { font-size: 0.98rem; font-weight: 700; color: #f0ece0; flex: 1; }
.drawer-close {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 6px;
  transition: color 0.15s;
}
.drawer-close:hover { color: #f0ece0; }
.drawer-body { padding: 0.75rem; flex: 1; overflow-y: auto; }
.drawer-footer {
  padding: 0.6rem;
  text-align: center;
  font-size: 0.68rem;
  color: #2e2e2e;
  letter-spacing: 0.06em;
  border-top: 1px solid #1c1c1c;
}

/* ── Menu nav ── */
.menu-nav { list-style: none; }
.menu-nav li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  color: #bbb;
  font-size: 0.93rem;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.menu-nav li:hover { background: #1e1e1e; color: #f0ece0; }
.menu-nav .nav-icon { font-size: 1.05rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.menu-nav .nav-arrow { margin-left: auto; color: #3a3a3a; font-size: 0.8rem; }

/* ── Settings ── */
.settings-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.5rem 0.25rem 0.5rem;
}
.lang-options { display: flex; flex-direction: column; gap: 0.5rem; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
  user-select: none;
}
.lang-option:hover { background: #1e1e1e; }
.lang-option.selected { border-color: #e8c96a; }
.lang-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #444;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
}
.lang-option.selected .lang-radio { border-color: #e8c96a; background: #e8c96a; }
.lang-text-en { font-size: 0.9rem; color: #f0ece0; }
.lang-text-sub { font-size: 0.78rem; color: #555; margin-top: 1px; }

/* ── History ── */
.history-empty { color: #444; font-size: 0.88rem; text-align: center; padding: 2.5rem 0; line-height: 1.7; }
.history-dish {
  background: #1a1a1a;
  border: 1px solid #252525;
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.5rem;
}
.history-dish-name { font-size: 0.9rem; font-weight: 700; color: #f0ece0; }
.history-dish-cn { font-size: 0.78rem; color: #e8c96a; margin-top: 2px; }
.history-dish-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.55rem; }
.history-dish-cal { font-size: 0.75rem; color: #666; }
.history-dish-date { font-size: 0.7rem; color: #444; }

@media (max-width: 500px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  body { padding: 1.25rem 0.75rem; }
}

/* ── Language selection splash ── */
.lang-splash {
  position: fixed;
  inset: 0;
  background: #0f0f0f;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lang-splash.hidden { display: none !important; }
.lang-splash-card {
  text-align: center;
  max-width: 420px;
  width: 100%;
}
.lang-splash-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1.25rem;
  animation: chefBounce 2s ease-in-out infinite;
}
.lang-splash-app-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e8c96a;
  letter-spacing: 0.02em;
}
.lang-splash-app-name-cn {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e8c96a;
  margin-top: 0.2rem;
  margin-bottom: 0.9rem;
}
.lang-splash-prompt {
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 2rem;
  letter-spacing: 0.04em;
}
.lang-splash-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.lang-splash-btn {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 14px;
  padding: 1.5rem 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, background 0.15s, transform 0.15s;
  text-align: center;
}
.lang-splash-btn:hover {
  border-color: #e8c96a;
  background: #1e1e1e;
  transform: translateY(-3px);
}
.lang-splash-btn-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0ece0;
  margin-bottom: 0.4rem;
}
.lang-splash-btn-sub {
  font-size: 0.75rem;
  color: #666;
  line-height: 1.4;
}

.hidden { display: none !important; }

/* ── Ad banner ── */
.ad-container {
  max-width: 720px;
  margin: 2rem auto 1rem;
  padding: 0 1rem;
  text-align: center;
}
