:root {
  --fg: #1a1a1a;
  --bg: #fdfdfd;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --accent: #b04a2c;
  --accent-bg: #faf3ee;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #ebe8e2;
    --bg: #16181a;
    --muted: #9aa0a6;
    --line: #2a2d31;
    --accent: #f08658;
    --accent-bg: #2a1f1a;
  }
}

* { box-sizing: border-box; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 0 1rem 6rem;
  line-height: 1.5;
}

main {
  max-width: 720px;
  margin: 1.5rem auto;
}

header.app {
  max-width: 720px;
  margin: 1rem auto 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: .5rem;
}

header.app a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
}

a {
  color: var(--accent);
}

h1 { font-size: 1.6rem; margin-top: 1rem; }
h2 { font-size: 1.15rem; margin-top: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .25rem; }

.muted { color: var(--muted); font-size: .9rem; }
.tag { display: inline-block; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 999px; margin-left: .25rem; }

input[type="search"] {
  width: 100%;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  border-radius: 6px;
  font-size: 1rem;
}

ul.recipe-list { list-style: none; padding: 0; margin: 0; }
ul.recipe-list li {
  padding: .5rem .25rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
}
ul.recipe-list li input[type=checkbox] { transform: scale(1.2); accent-color: var(--accent); }
ul.recipe-list li .row-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: .4rem;
  overflow: hidden;
}
ul.recipe-list li .row-title a {
  text-decoration: none;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
ul.recipe-list li .row-title a:hover { text-decoration: underline; }
ul.recipe-list li .row-title .tag { flex: 0 0 auto; }
ul.recipe-list li.hidden { display: none; }

.multiplier {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
  color: var(--muted);
}
.multiplier button {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 1.6rem;
  height: 1.6rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.multiplier button:hover { border-color: var(--accent); color: var(--accent); }
.multiplier output {
  min-width: 1.5em;
  text-align: right;
  font-weight: 600;
  color: var(--fg);
}

.category-group { margin-top: 1.25rem; }

.ingredient-list, .step-list { padding-left: 1.25rem; }
.ingredient-list li { margin: .15rem 0; }
.step-list li { margin: .5rem 0; line-height: 1.55; }

.ingredient { font-weight: 600; color: var(--accent); }
.timer, .cookware { color: var(--muted); font-style: italic; }
.qty { color: var(--muted); font-weight: normal; font-size: .9em; margin-left: .25rem; }

.changelog {
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: .5rem .75rem;
  margin: 1rem 0;
  font-size: .95rem;
}

.versions-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.versions-table th, .versions-table td {
  text-align: left;
  padding: .5rem .25rem;
  border-bottom: 1px solid var(--line);
  font-size: .95rem;
}

.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: .75rem 1rem;
  display: none;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -2px 8px rgba(0,0,0,.05);
}
.action-bar.visible { display: flex; }
.action-bar button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: .55rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}
.action-bar button:disabled { opacity: .5; cursor: not-allowed; }

.shopping-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.btn {
  display: inline-block;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .45rem .9rem;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

h3.aisle {
  margin-top: 1.25rem;
  margin-bottom: .25rem;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px dashed var(--line);
  padding-bottom: .15rem;
}
ul.shopping { list-style: none; padding: 0; margin: .25rem 0 1rem; }
ul.shopping li {
  border-bottom: 1px solid var(--line);
  padding: .5rem .25rem;
}
ul.shopping label { display: flex; align-items: baseline; gap: .55rem; cursor: pointer; }
ul.shopping input[type=checkbox] { transform: scale(1.15); accent-color: var(--accent); }
ul.shopping strong { font-variant-numeric: tabular-nums; }
.warn { color: #d4810b; cursor: help; }
.srcref {
  color: var(--muted);
  margin-left: .15em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
ol.sources {
  color: var(--muted);
  font-size: .9rem;
  padding-left: 1.5rem;
}
ol.sources li { margin: .15rem 0; }

.diff {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
  background: var(--bg);
}
.diff-line {
  display: flex;
  white-space: pre;
  line-height: 1.45;
}
.diff-line.add { background: rgba(45, 164, 78, .12); }
.diff-line.del { background: rgba(207, 34, 46, .12); }
.diff-line .ln {
  flex: 0 0 3em;
  text-align: right;
  padding: 0 .35em;
  color: var(--muted);
  border-right: 1px solid var(--line);
  user-select: none;
}
.diff-line .sigil {
  flex: 0 0 1.2em;
  text-align: center;
  color: var(--muted);
}
.diff-line .src { padding: 0 .5em; flex: 1; }
.tk-ing { color: var(--accent); font-weight: 600; }
.tk-cook { color: #6b8e23; font-weight: 500; }
.tk-timer { color: #6c757d; font-style: italic; }
.meta-line { color: #6f42c1; font-weight: 500; }

@media print {
  header.app, .shopping-actions, .action-bar, #search { display: none !important; }
  ul.shopping input[type=checkbox] { display: none; }
  body { padding: 0 .25in; color: black; background: white; }
}

@media (max-width: 480px) {
  body { padding: 0 .75rem 6rem; }
  h1 { font-size: 1.3rem; }
}
