:root {
  --c-bg: #0F1218;
  --c-surface: #161B25;
  --c-surface-2: #1A1F2E;
  --c-border: #2A3142;
  --c-text: #E8E6E1;
  --c-muted: #8E94A3;
  --c-gold: #C9A961;
  --c-gold-soft: #D9BC7A;
  --c-bronze: #7B5E3A;
  --c-accent: #C9A961;
  --c-error: #E07A5F;
  --c-success: #88B596;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow-1: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-2: 0 12px 32px rgba(0,0,0,0.35);
  --font-display: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(201, 169, 97, 0.06), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(123, 94, 58, 0.05), transparent 45%);
}

a { color: var(--c-gold); text-decoration: none; }
a:hover { color: var(--c-gold-soft); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }

/* Top bar */
.tool-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--c-border);
  background: rgba(15, 18, 24, 0.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--c-text); }
.brand-mark { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; letter-spacing: -0.02em; }
.brand-logo { width: 32px; height: 32px; border-radius: 6px; }
.tool-nav { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { color: var(--c-muted); font-size: .92rem; }
.nav-link:hover { color: var(--c-text); }
.nav-cta {
  background: var(--c-gold); color: #1A1F2E !important;
  padding: .5rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}
.nav-cta:hover { background: var(--c-gold-soft); }

/* Tool shell */
.tool-shell { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem 4rem; }

.tool-hero { text-align: center; max-width: 720px; margin: 0 auto 3rem; }
.eyebrow {
  display: inline-block; padding: .35rem .8rem; margin-bottom: 1rem;
  border: 1px solid var(--c-border); border-radius: 99px;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--c-gold); background: rgba(201,169,97,0.06);
}
.lede { color: var(--c-muted); font-size: 1.12rem; max-width: 60ch; margin: 0 auto; }

/* Workbench */
.workbench {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-2);
  position: relative;
}
.workbench::before {
  content: ""; position: absolute; top: 0; left: 2rem; right: 2rem; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
  opacity: .5;
}

.bench-row { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .bench-row { grid-template-columns: 1fr; } }

.upload-zone {
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  background: var(--c-bg);
  min-height: 240px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
  overflow: hidden;
}
.upload-zone:hover { border-color: var(--c-gold); background: var(--c-surface-2); }
.upload-zone.is-drag { border-color: var(--c-gold); background: rgba(201,169,97,0.08); }
.upload-empty { text-align: center; color: var(--c-muted); padding: 1rem; }
.upload-empty strong { display: block; color: var(--c-text); margin: .5rem 0 .25rem; font-size: 1rem; }
.upload-empty small { color: var(--c-muted); }
.upload-icon {
  display: inline-flex; width: 48px; height: 48px; border-radius: 50%;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  align-items: center; justify-content: center; font-size: 1.6rem; color: var(--c-gold);
}
.upload-filled { width: 100%; height: 100%; position: relative; }
.upload-filled img { width: 100%; height: 100%; object-fit: cover; }
.upload-clear {
  position: absolute; top: .5rem; right: .5rem; width: 28px; height: 28px;
  border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0;
  cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.upload-clear:hover { background: rgba(0,0,0,.85); }

.bench-fields { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field span { font-size: .82rem; color: var(--c-muted); text-transform: uppercase; letter-spacing: .08em; }
.field textarea, .field select, .field input[type=text] {
  font-family: var(--font-body); font-size: .95rem;
  background: var(--c-bg); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: .65rem .8rem; resize: vertical;
}
.field textarea:focus, .field select:focus { outline: 2px solid var(--c-gold); border-color: var(--c-gold); }

.bench-action {
  margin-top: 1.5rem; display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  flex-wrap: wrap;
}
.bench-meter { color: var(--c-muted); font-size: .85rem; }

.btn-primary {
  background: var(--c-gold); color: #1A1F2E;
  border: 0; padding: .85rem 1.6rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn-primary:hover { background: var(--c-gold-soft); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: var(--c-border); color: var(--c-muted); cursor: not-allowed; }

.btn-secondary {
  background: transparent; color: var(--c-text);
  border: 1px solid var(--c-border); padding: .55rem 1rem; border-radius: var(--radius-sm);
  font-size: .9rem; cursor: pointer; transition: border-color .2s, color .2s;
}
.btn-secondary:hover { border-color: var(--c-gold); color: var(--c-gold); }

/* Result */
.result-area { margin-top: 2.5rem; }
.result-loading {
  text-align: center; padding: 2rem; color: var(--c-muted);
}
.spinner {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid var(--c-border); border-top-color: var(--c-gold);
  border-radius: 50%; animation: spin .9s linear infinite;
  margin-bottom: .75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.recipe-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-1);
}
.recipe-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; border-bottom: 1px solid var(--c-border);
  padding-bottom: 1.25rem; margin-bottom: 1.25rem;
}
.recipe-eyebrow {
  display: inline-block; font-size: .75rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--c-gold); margin-bottom: .35rem;
}
.recipe-summary { color: var(--c-muted); margin: 0; max-width: 60ch; }
.recipe-actions { display: flex; gap: .5rem; }

.recipe-zones { display: flex; flex-direction: column; gap: 1.25rem; }
.zone {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 1.25rem; background: var(--c-surface);
}
.zone-head { display: flex; align-items: center; gap: .85rem; margin-bottom: .85rem; }
.zone-swatch {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--c-border);
  flex-shrink: 0;
}
.zone-title { font-family: var(--font-display); font-size: 1.2rem; margin: 0; }
.zone-desc { color: var(--c-muted); font-size: .9rem; margin: 0 0 .85rem; }

.layer-row {
  display: grid; grid-template-columns: 110px 1fr; gap: .5rem 1rem;
  padding: .65rem 0; border-bottom: 1px dashed var(--c-border);
  font-size: .92rem;
}
.layer-row:last-child { border-bottom: 0; }
.layer-label { color: var(--c-gold); font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .1em; align-self: center; }
.layer-detail strong { display: block; font-family: var(--font-mono); color: var(--c-text); font-size: .9rem; }
.layer-brands {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem;
}
.brand-chip {
  font-family: var(--font-mono); font-size: .78rem;
  padding: .2rem .55rem; background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: 99px; color: var(--c-muted);
}
.brand-chip strong { color: var(--c-gold); font-weight: 600; margin-right: .35rem; }
.zone-technique {
  margin-top: .85rem; padding-top: .85rem; border-top: 1px dashed var(--c-border);
  font-size: .9rem; color: var(--c-muted);
}
.zone-technique strong { color: var(--c-gold-soft); }

.recipe-foot { margin-top: 1.5rem; color: var(--c-muted); font-size: .82rem; }
.result-error {
  background: rgba(224, 122, 95, 0.08); border: 1px solid var(--c-error);
  color: var(--c-error); padding: 1rem 1.25rem; border-radius: var(--radius);
  margin-top: 1rem;
}

/* How it works */
.how-row { margin-top: 3rem; padding: 2rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.how-list { padding-left: 1.25rem; color: var(--c-muted); margin: 0; }
.how-list li { margin-bottom: .6rem; }
.how-list strong { color: var(--c-text); }

/* Capture */
.capture-row { margin-top: 2.5rem; }
.capture-card {
  background: linear-gradient(135deg, var(--c-surface-2), var(--c-surface));
  border: 1px solid var(--c-border); border-radius: var(--radius); padding: 2.25rem;
  text-align: center; max-width: 640px; margin: 0 auto;
}
.capture-card h3 { margin-bottom: .5rem; }
.capture-form {
  display: flex; gap: .5rem; max-width: 460px; margin: 1.25rem auto 0;
  flex-wrap: wrap;
}
.capture-form input {
  flex: 1; min-width: 220px;
  font-size: .98rem; padding: .85rem 1rem;
  background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  color: var(--c-text);
}
.capture-form input:focus { outline: 2px solid var(--c-gold); border-color: var(--c-gold); }
.capture-note { margin-top: .85rem; color: var(--c-gold-soft); min-height: 1.2em; }

/* Footer */
.tool-foot {
  text-align: center; padding: 2rem 1rem; color: var(--c-muted); font-size: .85rem;
  border-top: 1px solid var(--c-border); margin-top: 4rem;
  display: flex; justify-content: space-between; max-width: 1100px; margin-left: auto; margin-right: auto;
}
.tool-foot a { color: var(--c-muted); }
.tool-foot a:hover { color: var(--c-gold); }
@media (max-width: 540px) { .tool-foot { flex-direction: column; gap: .5rem; } }
