:root {
  --forest: #1c3a2e;
  --forest-deep: #13261e;
  --forest-soft: #2d5a48;
  --gold: #c4a35a;
  --gold-bright: #d4b56c;
  --gold-shadow: #8a7030;
  --cream: #f4efe4;
  --cream-dark: #e8dfd0;
  --copper: #b87333;
  --copper-soft: #c4894a;
  --ink: #1a241f;
  --muted: #5c6b63;
  --card: #fffdf8;
  --line: rgba(28, 58, 46, 0.12);
  --loved: #2d5a48;
  --maybe: #8a6a32;
  --never: #8b3a3a;
  --radius: 18px;
  --tap: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  background: var(--forest-deep);
}

body {
  font-family: Nunito, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--forest-deep);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  user-select: none;
}

h1,
h2,
h3,
.brand,
.serif {
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  min-height: 100vh;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(28, 58, 46, 0.045) 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.35);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: var(--forest);
  padding: 8px 12px;
  z-index: 20;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

#top {
  position: sticky;
  top: 0;
  z-index: 30;
}

#main {
  flex: 1;
  padding: 18px 18px 28px;
  padding-bottom: calc(28px + var(--safe-bot));
}

.site-foot {
  padding: 14px 20px calc(16px + var(--safe-bot));
  background: var(--forest);
  color: rgba(244, 239, 228, 0.72);
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
}

.site-foot p {
  margin: 0;
}

/* ----- top bars ----- */

.hero {
  background: var(--forest);
  color: var(--cream);
  text-align: center;
  padding: calc(22px + var(--safe-top)) 22px 30px;
  border-radius: 0 0 28px 28px;
  box-shadow: 0 8px 24px rgba(19, 38, 30, 0.25);
}

.hero-icon {
  width: 148px;
  height: 148px;
  margin: 0 auto;
  border-radius: 32px;
  object-fit: cover;
  border: 3px solid var(--gold);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  background: var(--forest-soft);
}

.hero h1 {
  margin: 16px 0 6px;
  color: var(--gold);
  font-size: 1.85rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.hero .tagline {
  margin: 0;
  color: var(--cream);
  opacity: 0.88;
  font-size: 1.05rem;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--forest);
  color: var(--cream);
  padding: calc(10px + var(--safe-top)) 12px 12px;
  min-height: calc(52px + var(--safe-top));
}

.topbar .brand {
  flex: 1;
  margin: 0;
  color: var(--gold);
  font-size: 1.05rem;
  letter-spacing: 0.07em;
  font-weight: 700;
  text-align: center;
}

.topbar .brand.home-hit {
  border: 0;
  background: transparent;
  min-height: var(--tap);
  padding: 0 6px;
}

.home-logo {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
}

.topbar .mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid var(--gold);
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  border: 0;
  border-radius: 14px;
  background: rgba(244, 239, 228, 0.08);
  color: var(--gold);
  font-size: 1.4rem;
  display: grid;
  place-items: center;
}

.icon-btn:active {
  background: rgba(196, 163, 90, 0.22);
}

.ghost-space {
  width: var(--tap);
  min-width: var(--tap);
}

/* ----- type ----- */

.screen-title {
  margin: 4px 0 8px;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--forest);
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.02rem;
}

.kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--copper);
}

/* ----- buttons ----- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.gold {
  background: var(--gold);
  color: var(--forest);
  box-shadow: 0 5px 0 var(--gold-shadow);
}

.btn.gold:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--gold-shadow);
}

.btn.forest {
  background: var(--forest);
  color: var(--cream);
  box-shadow: 0 5px 0 #0c1c16;
}

.btn.forest:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #0c1c16;
}

.btn.ghost {
  background: transparent;
  color: var(--forest);
  border: 2px solid var(--forest);
}

.btn.ghost:active:not(:disabled) {
  background: var(--cream-dark);
}

.btn.copper {
  background: var(--copper);
  color: #fff8ee;
  box-shadow: 0 5px 0 #8a5520;
}

.btn.copper:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #8a5520;
}

.btn.surprise {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--forest);
  font-family: Fraunces, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  min-height: 68px;
  margin-bottom: 16px;
  box-shadow: 0 6px 0 var(--gold-shadow);
  letter-spacing: 0.02em;
}

.btn.surprise:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--gold-shadow);
}

.btn-dinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 76px;
  margin: 8px 0 18px;
  border: 0;
  border-radius: 20px;
  background: var(--gold);
  color: var(--forest);
  font-family: Fraunces, Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 7px 0 var(--gold-shadow), 0 12px 28px rgba(28, 58, 46, 0.18);
}

.btn-dinner:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--gold-shadow), 0 6px 16px rgba(28, 58, 46, 0.16);
}

.btn-row {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.btn-row.two {
  grid-template-columns: 1fr 1fr;
}

.linkish {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: 0;
  color: var(--forest-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  min-height: 44px;
}

/* ----- home ----- */

.home-pad {
  padding-top: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--cream-dark);
  color: var(--forest);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill.loading::before,
.status-pill.ready::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--copper);
}

.status-pill.ready::before {
  background: var(--forest-soft);
}

.tonight-card,
.folder-card,
.choice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 0 rgba(28, 58, 46, 0.06);
}

.tonight-card {
  padding: 16px;
  margin-bottom: 16px;
}

.tonight-card h3 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: var(--forest);
}

.muted {
  color: var(--muted);
  margin: 0;
}

.folder-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 8px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  text-align: left;
  background: var(--card);
}

.folder-card .count {
  margin-left: auto;
  background: var(--cream-dark);
  color: var(--forest);
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.folder-card .emoji {
  font-size: 1.5rem;
}

.folder-card .name {
  font-weight: 800;
  color: var(--forest);
}

/* ----- steps ----- */

.step-dots {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
}

.step-dots span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--cream-dark);
}

.step-dots span.on {
  background: var(--gold);
}

.step-dots span.done {
  background: var(--forest-soft);
}

/* ----- protein ----- */

.protein-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.protein {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--forest);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.15;
  text-align: center;
}

.protein .emoji {
  font-size: 1.55rem;
  line-height: 1;
}

.protein:active {
  transform: scale(0.98);
  background: var(--cream-dark);
  border-color: var(--gold);
}

.protein.is-on {
  border-color: var(--gold);
  background: #fff8e8;
  box-shadow: 0 0 0 2px var(--gold);
}

.other-card {
  margin-top: 16px;
  padding: 14px;
  background: var(--card);
  border: 1px dashed var(--copper);
  border-radius: var(--radius);
}

.other-card label {
  display: block;
  font-weight: 800;
  color: var(--forest);
  margin-bottom: 8px;
}

.other-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.other-row input {
  min-height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  width: 100%;
}

.other-row input:focus {
  outline: 3px solid rgba(196, 163, 90, 0.45);
  border-color: var(--gold);
}

.other-row .btn {
  width: auto;
  min-width: 76px;
  padding: 0 16px;
}

/* ----- choice lists ----- */

.choice-list {
  display: grid;
  gap: 10px;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 14px;
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  text-align: left;
}

.choice.plain {
  grid-template-columns: 1fr;
}

.choice .num {
  grid-row: 1 / span 2;
  align-self: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--forest);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.choice .clabel {
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--forest);
}

.choice .blurb {
  color: var(--muted);
  font-size: 0.92rem;
}

.choice:active {
  border-color: var(--gold);
  background: #fff8e8;
}

/* ----- people ----- */

.stepper-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 8px;
  margin-bottom: 12px;
}

.stepper {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  min-height: 72px;
}

.stepper .who {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--forest);
}

.stepper .sub {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
}

.stepper .n {
  width: 48px;
  text-align: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--forest);
}

.stepper .nudge {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--forest);
  color: var(--gold);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.stepper .nudge:disabled {
  opacity: 0.35;
}

.stepper + .stepper {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.scale-note {
  margin: 8px 2px 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.scale-note strong {
  color: var(--forest);
}

/* ----- recipe ----- */

.banner {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3e6c8;
  color: var(--forest);
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.banner.warn {
  background: #f3ddd3;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.chip {
  background: var(--cream-dark);
  color: var(--forest);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.dish {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 14px;
  background: var(--forest);
}

.recipe h2 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  color: var(--forest);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.source a {
  color: var(--copper);
  font-weight: 800;
  text-underline-offset: 2px;
}

.source {
  margin: 0 0 16px;
  font-size: 0.92rem;
}

.block-title {
  margin: 18px 0 8px;
  font-size: 1.15rem;
  color: var(--forest);
}

.ingredients {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ingredients li {
  position: relative;
  padding: 8px 8px 8px 28px;
  border-bottom: 1px solid var(--line);
}

.ingredients li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: var(--gold);
  font-weight: 800;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.steps li::before {
  content: counter(step);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--forest);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
}

.empty {
  text-align: center;
  padding: 28px 10px 10px;
}

.empty .hat {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  border-radius: 24px;
  object-fit: cover;
  border: 2px solid var(--gold);
}

/* ----- rate ----- */

.rate-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.rate-btn {
  min-height: 72px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff8ee;
}

.rate-btn.never {
  background: var(--never);
}

.rate-btn.maybe {
  background: var(--maybe);
}

.rate-btn.loved {
  background: var(--loved);
}

.rate-btn.skipped {
  background: var(--cream-dark);
  color: var(--forest);
  border: 2px solid var(--forest);
}

.rate-btn:active {
  filter: brightness(0.92);
  transform: translateY(2px);
}

/* ----- folders ----- */

.recipe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  margin-bottom: 8px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.recipe-row .thumb {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--forest);
  flex-shrink: 0;
}

.recipe-row .title {
  font-weight: 800;
  color: var(--forest);
}

.recipe-row .sub {
  color: var(--muted);
  font-size: 0.82rem;
}

.install-hint {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.hat-list {
  display: grid;
  gap: 12px;
}

.hat-name {
  width: 100%;
  min-height: 72px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--forest);
  font-family: Fraunces, Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: left;
  line-height: 1.25;
  box-shadow: 0 3px 0 rgba(28, 58, 46, 0.08);
}

.hat-name:active {
  border-color: var(--gold);
  background: #fff8e8;
}

.side-card,
.grocery-block {
  margin-top: 18px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.side-card h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--forest);
}

.side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.side-head .btn {
  width: auto;
  min-width: 72px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.store-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}

.chip-btn {
  border: 1px solid var(--line);
  background: var(--cream-dark);
  color: var(--forest);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.82rem;
}

.chip-btn.on {
  background: var(--forest);
  color: var(--gold);
  border-color: var(--forest);
}

.total-card {
  text-align: center;
  padding: 12px;
  background: var(--forest);
  color: var(--cream);
  border-radius: 16px;
  margin-bottom: 12px;
}

.total-card .kicker {
  color: var(--gold);
}

.total-price {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
}

.grocery-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.grocery-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.grocery-list a {
  color: var(--forest);
}

.gname {
  color: var(--forest);
}

.gsku,
.gbuy {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.gprice {
  color: var(--copper);
  white-space: nowrap;
  font-size: 1.05rem;
}

.approx-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f3e6c8;
  color: var(--gold-shadow);
  border-radius: 6px;
  padding: 1px 6px;
  margin-right: 4px;
}

.dinner-share {
  margin: 8px 0 0;
  color: var(--cream);
  font-weight: 700;
}

.specific-block {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.auth-form {
  display: grid;
  gap: 12px;
  margin: 12px 0 16px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  color: var(--forest);
}

.auth-form input {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  font: inherit;
  background: var(--card);
}

.recovery-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 16px;
  background: var(--card);
  border: 2px dashed var(--gold);
  border-radius: 16px;
  color: var(--forest);
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-dinner,
  .protein,
  .rate-btn {
    transition: none;
  }

  .btn.gold:active,
  .btn.forest:active,
  .btn.surprise:active,
  .btn-dinner:active {
    transform: none;
  }
}
