:root {
  --bg: #0f0d0b;
  --panel: #1a1714;
  --panel2: #221e19;
  --line: #322c25;
  --text: #f2ede6;
  --muted: #a89e91;
  --accent: #c9963f;
  --accent2: #e3b45f;
  --alert: #7a2f2f;
  --ok: #3f6b4a;
  --radius: 14px;
  --max: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Inter", "Segoe UI", system-ui, sans-serif;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(15, 13, 11, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.brand:hover { text-decoration: none; }

.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar nav a { color: var(--text); font-size: 15px; }
.topbar nav a.quiet { color: var(--muted); }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 16px 60px;
}

footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

h1 { font-size: 30px; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 18px 0 6px;
}
p { margin: 0 0 12px; }

.quiet { color: var(--muted); }
.small { font-size: 13px; }
.lede { font-size: 17px; color: #ded5c8; }
.error { color: #f0a0a0; }
.warn {
  background: rgba(122, 47, 47, 0.28);
  border: 1px solid var(--alert);
  border-radius: 10px;
  padding: 10px 12px;
}

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack.tight { gap: 8px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.alert { border-color: #5a3b22; background: var(--panel2); }

.label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 4px;
}

form { display: flex; flex-direction: column; gap: 10px; }

label { font-size: 14px; color: var(--muted); }

input[type="text"],
input[type="search"],
input[type="password"],
input[type="file"],
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
  display: inline-block;
  padding: 12px 18px;
  background: var(--accent);
  color: #1a1206;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
}
button:hover, .button:hover { background: var(--accent2); text-decoration: none; }

.searchbar { flex-direction: row; gap: 10px; }
.searchbar input, .searchbar select { flex: 1; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
}
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile img, .tile-blank {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--panel2);
}
.tile-body { padding: 14px; }
.tile-body h2 { font-size: 16px; margin-bottom: 8px; }

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
}

.tagrow { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
}
.tag.allergen { border-color: var(--accent); color: var(--accent2); }
.tag.allergen:hover { background: var(--accent); color: #1a1206; text-decoration: none; }

.tag.flag { border-color: var(--alert); color: #f0b7b7; background: rgba(122, 47, 47, 0.25); }

button.danger { background: #7a2f2f; color: #f7e9e9; }
button.danger:hover { background: #9a3b3b; }

.pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.certain { border-color: var(--ok); color: #9ed3ad; }
.pill.probable { border-color: #6b5a2f; color: var(--accent2); }
.pill.locked { border-color: var(--accent); color: var(--accent2); }
.pill.sub { border-color: #4a4034; }

.carrier-line { margin: 6px 0 0; font-size: 14px; color: #ded5c8; }
.carrier-line strong { color: var(--accent2); margin-right: 6px; }

.carriers { list-style: none; margin: 0; padding: 0; }
.carriers li { padding: 8px 0; border-top: 1px solid var(--line); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.gallery img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.shot { margin: 0; }
.shot figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 12px;
}
.shot figcaption .pill { margin-left: 0; }
.shot figcaption form { display: inline; }

button.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
button.linkish:hover { background: none; color: #f0a0a0; }

.photoform input[type="file"] { padding: 10px; }

.columns {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  align-items: start;
}

.row { display: flex; gap: 14px; align-items: flex-start; }
.thumb {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.prewrap { white-space: pre-wrap; }

table { width: 100%; border-collapse: collapse; }
.ingredients td, .results td {
  padding: 9px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: 15px;
}
.ingredients td.amt { text-align: right; white-space: nowrap; color: var(--muted); }
.ingredients tr.component td {
  border-top: 0;
  padding: 2px 0 2px 18px;
  font-size: 13px;
  color: var(--muted);
}
.ingredients tr.component td.amt { padding-right: 0; }
.results td { padding-right: 12px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
}
legend { color: var(--accent2); font-size: 14px; padding: 0 6px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  color: var(--text);
  font-size: 15px;
}
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.back { font-size: 14px; color: var(--muted); }

@media (max-width: 820px) {
  .columns { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  main { padding: 18px 14px 50px; }
}
