:root {
  color-scheme: light;
  --ink: #241c14;
  --muted: #6d6256;
  --line: #e3d5c2;
  --paper: #f3ecdf;
  --card: #fffaf3;
  --green: #1d6b4a;
  --green-ink: #f4fff8;
  --brass: #8a5a12;
  --bad: #8d2d36;
  --shadow: 0 14px 40px rgba(48, 32, 14, 0.08);
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.voice {
  color-scheme: dark;
  --ink: #f6f1e7;
  --muted: #b7ab9a;
  --paper: #16130f;
  --card: #241d16;
  --green: #8fbf9f;
  --brass: #e2b15a;
  --bad: #e07a72;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(226, 177, 90, 0.16), transparent 55%),
    var(--paper);
  display: flex;
  justify-content: center;
}

.voice-shell, .board-shell {
  width: min(880px, 100%);
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
}

.voice-shell { display: flex; flex-direction: column; min-height: 100dvh; }
.eyebrow, .nav a, .meta, .hint, .reason { font-family: ui-sans-serif, system-ui, sans-serif; }
.eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--brass);
  margin: 0 0 8px;
}
h1 { font-size: clamp(4.2rem, 14vw, 7rem); font-weight: 500; letter-spacing: -0.04em; margin: 0; line-height: 0.85; }
#state { font-size: 1.35rem; margin: 18px 0 8px; min-height: 1.4em; }
.phrase { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 8px 0 18px; }
.meter { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--brass); border-radius: inherit; }
#log { list-style: none; padding: 0; margin: 22px 0; display: flex; flex-direction: column; gap: 10px; min-height: 4rem; }
#log li { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.98rem; line-height: 1.4; }
#log .you { color: var(--muted); }
#log .kelly { color: var(--ink); }
.actions, .row, .tabs, .qty, .card-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions { margin-top: auto; }
button, .linkish {
  border: 1px solid transparent;
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 14px 18px;
  min-height: 48px;
  text-decoration: none;
  cursor: pointer;
}
button.primary { background: var(--green); color: #f7fff9; }
.voice button.primary { color: #14241c; }
button.quiet, a.quiet { background: transparent; border-color: rgba(127, 127, 127, 0.35); }
.hint { color: var(--muted); font-size: 0.92rem; line-height: 1.45; max-width: 38rem; }
.banner {
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: rgba(224, 122, 114, 0.12);
  border: 1px solid rgba(224, 122, 114, 0.35);
  padding: 12px 14px;
  border-radius: 14px;
  margin: 12px 0;
}
.gate {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 8, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 5;
}
.gate form, .shade {
  background: var(--card);
  color: var(--ink);
}
.gate form { width: min(420px, 100%); padding: 22px; border-radius: 22px; }
.gate label, .add label, .edit label { display: block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.85rem; margin: 12px 0 6px; }
input, select {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 48px;
}
.shade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #000;
  color: #d7d0c4;
  display: grid;
  place-items: end center;
  z-index: 6;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  font-size: 1rem;
}
.hidden { display: none !important; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}
.top h1 { font-size: clamp(3rem, 8vw, 4.6rem); }
.nav { display: flex; gap: 14px; font-family: ui-sans-serif, system-ui, sans-serif; }
.nav a { color: var(--green); text-decoration: none; }
.tabs { margin: 8px 0 18px; }
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.add, .card, .empty {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.add { padding: 16px; margin-bottom: 18px; }
.add-grid, .edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.card { padding: 16px 16px 14px; border: 1px solid transparent; }
.card header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card h3 { margin: 0; font-size: 1.55rem; font-weight: 500; text-transform: capitalize; }
.loc, .pill { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card .when { margin: 8px 0; color: var(--muted); font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.92rem; }
.card.low { border-color: rgba(138, 90, 18, 0.45); }
.card.expired, .card.empty-item { border-color: rgba(141, 45, 54, 0.4); }
.qty button { min-width: 48px; padding: 10px 14px; background: var(--paper); }
.qty strong { min-width: 2ch; text-align: center; font-size: 1.4rem; }
details { margin-top: 8px; }
summary { cursor: pointer; font-family: ui-sans-serif, system-ui, sans-serif; color: var(--green); }
.empty { padding: 22px; }
.reason { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 640px) {
  .top { align-items: start; flex-direction: column; }
  .add-grid { grid-template-columns: 1fr 1fr; }
}
