@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

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

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #161616;
  --border: #222222;
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.08);
  --text: #f0f0f0;
  --muted: #888888;
  --radius: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Background effects ── */
.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

.glow {
  position: fixed;
  top: -30vh;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  height: 60vh;
  background: radial-gradient(ellipse, rgba(74, 222, 128, 0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

header, main, footer, .notice-card { position: relative; z-index: 1; }

/* ── Header ── */
header {
  padding: 1.4rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
}

.logo {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.logo span { color: var(--green); }

.back-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover { color: var(--green); }

/* ── Main ── */
main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.hero {
  max-width: 100%;
}

.card,
.btn-primary,
.loading,
#results {
  max-width: 680px;
  width: 100%;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card, .btn-primary, .notice-card {
  animation: fadeUp 0.5s ease both;
}

.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.btn-primary       { animation-delay: 0.15s; }

/* ── Hero ── */
.hero {
  padding: 3rem 0 1.5rem;
  animation: fadeUp 0.5s ease both;
}

.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(3.5rem, 9vw, 6rem);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.green { color: var(--green); }

.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 300;
  max-width: 420px;
  line-height: 1.65;
}

/* ── Notice card ── */
.notice-card {
  border-color: rgba(74, 222, 128, 0.2) !important;
  background: rgba(74, 222, 128, 0.05) !important;
}

.notice-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.6rem;
}

.notice-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notice-list li {
  font-size: 0.875rem;
  font-weight: 500;
  color: #ccc;
  line-height: 1.6;
  padding-left: 1.1rem;
  position: relative;
}

.notice-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--green);
  font-size: 0.75rem;
  top: 0.05rem;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.step-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.5rem;
}

.card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* ── Drop zone ── */
.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  overflow: hidden;
  cursor: pointer;
}

.drop-zone.drag-over {
  border-color: var(--green);
  background: var(--green-dim);
}

.drop-zone.has-image {
  border-style: solid;
  border-color: var(--green);
  min-height: unset;
}

.drop-inner {
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drop-icon { font-size: 2rem; }
.drop-inner p { font-size: 0.9rem; color: var(--muted); }
.or { font-size: 0.75rem !important; color: #444 !important; }

.upload-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

#preview {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 0.5rem;
  text-decoration: underline;
}

.btn-clear:hover { color: #f87171; }

/* ── Diet input ── */
#diet-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

#diet-input:focus { border-color: var(--green); }
#diet-input::placeholder { color: #333; }

/* ── Buttons ── */
.btn-primary {
  background: var(--green);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--radius);
  padding: 1rem 2rem;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-primary:hover:not(:disabled) { opacity: 0.85; transform: translateY(-2px); }
.btn-primary:disabled { opacity: 0.2; cursor: not-allowed; }

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-outline.small { font-size: 0.78rem; padding: 0.4rem 0.85rem; }

/* ── Loading ── */
.loading {
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Results ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.results-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.section-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.75rem;
}

.ingredients-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.18);
  color: var(--green);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: 99px;
}

/* ── Recipe cards ── */
.recipes { display: flex; flex-direction: column; gap: 1rem; }

.recipe-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.recipe-card:hover { border-color: #333; }

.recipe-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.recipe-header:hover { background: var(--bg3); }
.recipe-title-row { display: flex; flex-direction: column; gap: 0.3rem; }

.recipe-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.recipe-meta { display: flex; gap: 0.75rem; font-size: 0.78rem; color: var(--muted); }

.match-badge {
  font-family: 'Syne', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  color: #000;
  background: var(--green);
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  white-space: nowrap;
}

.chevron {
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.25s;
  margin-left: 1rem;
  flex-shrink: 0;
}

.recipe-card.open .chevron { transform: rotate(180deg); }

.recipe-body {
  display: none;
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
}

.recipe-card.open .recipe-body { display: block; }

.missing-row { margin: 1rem 0 0.75rem; font-size: 0.82rem; color: var(--muted); }
.missing-row span { color: #f87171; }

.steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.steps-list li { display: flex; gap: 0.85rem; font-size: 0.88rem; line-height: 1.6; }

.step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #000;
  font-family: 'Syne', sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

/* ── Footer ── */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: #333;
  border-top: 1px solid var(--border);
}

footer a { color: var(--green); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 480px) {
  main { padding: 1.5rem 1rem 3rem; }
  .card { padding: 1.25rem; }
  header { padding: 1rem; }
}
