/* Don't Order In — warm earthy dark theme */

:root {
  --bg: #16120e;
  --bg-card: #1f1a14;
  --bg-elevated: #2a221a;
  --border: #3a2e22;
  --text: #f0e8dc;
  --text-muted: #9a8a78;
  --accent: #e8874a;
  --accent-glow: rgba(232, 135, 74, 0.18);
  --green: #6fcf97;
  --radius: 16px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* ---- App shell ---- */
.app-shell {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
}

/* ---- Header ---- */
.site-header {
  text-align: center;
  padding-top: 8px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.logo-icon { font-size: 1.4rem; }

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tagline {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Steps ---- */
.step {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fade-in 0.25s ease;
}

.step[data-active="true"] { display: flex; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Upload ---- */
.upload-area {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
}

.upload-icon { font-size: 3rem; }

.upload-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.upload-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

#photo-preview[hidden] { display: none; }

/* ---- Buttons ---- */
.btn-next,
.btn-restart {
  background: var(--accent);
  color: #16120e;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 28px;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 24px var(--accent-glow);
  align-self: stretch;
}

.btn-next:hover, .btn-restart:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--accent-glow);
}

.btn-next[hidden] { display: none; }

/* ---- Tier grid ---- */
.step-heading {
  font-family: 'Instrument Serif', serif;
  font-size: 1.6rem;
  font-style: italic;
  text-align: center;
  color: var(--text);
}

.tier-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tier-btn {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 12px;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.tier-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateX(4px);
}

.tier-emoji {
  grid-row: 1 / 3;
  font-size: 2rem;
  line-height: 1;
}

.tier-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.tier-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ---- Loading ---- */
#step-loading {
  align-items: center;
  padding: 60px 0;
}

.loading-ring {
  width: 56px;
  height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 20px;
}

.loading-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

/* ---- Recipe card ---- */
.recipe-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.recipe-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
}

.recipe-tier-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border-radius: 6px;
  padding: 3px 10px;
  margin-bottom: 10px;
}

.recipe-dish {
  font-family: 'Instrument Serif', serif;
  font-size: 1.7rem;
  line-height: 1.2;
  color: var(--text);
}

.recipe-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.recipe-section:last-of-type { border-bottom: none; }

.recipe-section h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.ingredient-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingredient-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.ingredient-list li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Highlight "missing" ingredients injected in correction flow */
.ingredient-list li.added::before {
  content: '+';
  color: var(--accent);
}

.steps-list {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  counter-reset: step-counter;
}

.steps-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 0.92rem;
  line-height: 1.55;
  counter-increment: step-counter;
}

.steps-list li::before {
  content: counter(step-counter);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---- Correction flow ---- */
.correction-zone {
  padding: 20px 24px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

.correction-prompt {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}

.correction-row {
  display: flex;
  gap: 8px;
}

.correction-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.correction-input:focus {
  border-color: var(--accent);
}

.correction-input::placeholder {
  color: var(--text-muted);
}

.btn-correct {
  background: var(--bg-elevated);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.btn-correct:hover {
  background: var(--accent);
  color: #16120e;
}

/* ---- Error banner ---- */
.error-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #3a1a1a;
  border: 1px solid #7a3030;
  color: #f8a0a0;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  max-width: 440px;
  width: calc(100% - 40px);
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.error-banner[hidden] { display: none; }

#error-dismiss {
  background: none;
  border: none;
  color: #f8a0a0;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* ---- Responsive tweaks ---- */
@media (min-width: 420px) {
  .tier-grid {
    gap: 14px;
  }
}
