/*
 * なにたべよ — Phase 1
 * モバイルファースト。基準幅 375px、デスクトップは 640px で中央寄せ。
 * 外部リソース（Webフォント・CDN・画像）は一切読み込まない。初回表示速度を最優先。
 */

:root {
  --bg: #fffaf5;
  --surface: #ffffff;
  --border: #eadfd4;
  --text: #24201d;
  --text-dim: #7a6f66;
  --accent: #f6511d;
  --accent-text: #ffffff;
  --radius: 14px;
  --gap: 12px;
  --tap: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --surface: #221d18;
    --border: #362e26;
    --text: #f2ece6;
    --text-dim: #a2968b;
    --accent: #ff6a3c;
    --accent-text: #1a0d07;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

/* ---------- 画面切替 ---------- */

.screen[hidden] { display: none; }

.screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fade .12s ease-out;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

/* ---------- ボタン ---------- */

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.actions--sub { margin-top: 4px; }

.btn {
  font: inherit;
  font-weight: 700;
  min-height: var(--tap);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: transform .06s ease-out;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.985); }

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.06rem;
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn--text {
  background: none;
  color: var(--text-dim);
  border: none;
  min-height: 44px;
  font-weight: 500;
  font-size: .92rem;
}

/* ---------- トップ ---------- */

.hero { padding-top: 28px; }

.hero__title {
  margin: 0 0 12px;
  font-size: 1.75rem;
  line-height: 1.4;
  letter-spacing: .01em;
}

.hero__lead {
  margin: 0;
  color: var(--text-dim);
  font-size: .95rem;
}

/* ---------- 質問 ---------- */

.qhead { display: flex; flex-direction: column; gap: 8px; }

.qhead__progress {
  margin: 0;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .08em;
}

.qhead__bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.qhead__bar span {
  display: block;
  height: 100%;
  width: 33.3%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .18s ease-out;
}

.qtitle {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.45;
}

/* ---------- 結果 ---------- */

.rtitle {
  margin: 0;
  font-size: 1.35rem;
}

.rnote {
  margin: -14px 0 0;
  font-size: .86rem;
  color: var(--text-dim);
}

.rnote:empty { display: none; }

/* 候補が縦に伸びても「決めて」が画面外に沈まないようにする */
.cta {
  position: sticky;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 2;
}

.cta .btn {
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
}

.dishes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.dish {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.dish__name {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 700;
}

.dish__meta {
  margin: 4px 0 0;
  font-size: .82rem;
  color: var(--text-dim);
}

.dish__link {
  display: inline-block;
  margin-top: 8px;
  font-size: .84rem;
  color: var(--accent);
  font-weight: 600;
}

.dish__recipe {
  margin-top: 10px;
  font-size: .88rem;
}

.dish__recipe summary {
  cursor: pointer;
  color: var(--text-dim);
  font-weight: 600;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.dish__recipe h4 {
  margin: 12px 0 4px;
  font-size: .82rem;
  color: var(--text-dim);
  letter-spacing: .06em;
}

.dish__recipe ul,
.dish__recipe ol {
  margin: 0;
  padding-left: 1.3em;
  color: var(--text);
}

/* ---------- 決定 ---------- */

.dlabel {
  margin: 24px 0 0;
  text-align: center;
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--text-dim);
}

.decided {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 20px;
  padding: 32px 20px;
  text-align: center;
}

.decided__name {
  margin: 0;
  font-size: 2rem;
  line-height: 1.35;
  font-weight: 800;
}

.decided__meta {
  margin: 12px 0 0;
  font-size: .9rem;
  color: var(--text-dim);
}

.decided .dish__link { margin-top: 14px; }

.decided .dish__recipe { text-align: left; margin-top: 20px; }

/* ---------- フッター ---------- */

.foot {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .76rem;
  line-height: 1.6;
}

.foot p { margin: 0 0 6px; }

/* ---------- デスクトップ ---------- */

@media (min-width: 600px) {
  .hero__title { font-size: 2.1rem; }
  .decided__name { font-size: 2.4rem; }
  .actions--stack { gap: 14px; }
}
