:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --field: #f6f6f6;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --text: #f2f2f2;
    --muted: #9a9a9a;
    --line: #2c2c2c;
    --field: #1b1b1b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(64px + env(safe-area-inset-bottom));
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tagline {
  margin-top: 40px;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 600;
}

section {
  margin-top: 32px;
}

h2 {
  margin-bottom: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.button.primary {
  width: 100%;
  margin-top: 32px;
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
}

.button.primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.button:focus-within,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.photos {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photos:empty {
  display: none;
}

.photos li {
  position: relative;
  aspect-ratio: 1;
}

.photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.photos button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.7);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.segments {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segments button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.segments button:first-child {
  border-left: 0;
}

.segments button[aria-checked="true"] {
  background: var(--text);
  color: var(--bg);
}

.field input {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  font: inherit;
}

footer {
  margin-top: 64px;
  font-size: 0.875rem;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

h1 a {
  text-decoration: none;
}

.prose section p + p {
  margin-top: 12px;
}

.budget-hint {
  margin-top: 8px;
}

.status {
  margin-top: 12px;
  text-align: center;
}

.error,
.note {
  margin-top: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--text);
  font-size: 0.95rem;
}

#results {
  margin-top: 48px;
}

.spotted {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
}

.spotted dt {
  color: var(--muted);
}

.spotted .guess {
  color: var(--muted);
}

.spotted + .hint {
  margin-top: 8px;
}

.recipe {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.recipe:last-child {
  border-bottom: 1px solid var(--line);
}

.recipe h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.recipe .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.recipe .summary {
  margin-top: 8px;
}

.recipe .needs {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.recipe .needs strong {
  color: var(--text);
  font-weight: 500;
}

.recipe details {
  margin-top: 8px;
}

.recipe summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  list-style: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.recipe summary::-webkit-details-marker {
  display: none;
}

.recipe details[open] summary {
  display: none;
}

.recipe ol {
  padding-left: 1.25rem;
  display: grid;
  gap: 8px;
}

.about {
  margin-top: 48px;
}

.about p {
  color: var(--muted);
  font-size: 0.9rem;
}

.about p + p {
  margin-top: 8px;
}

.noscript {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 32px;
}
