/* ふたりごはん ---------------------------------------------------------
   柔らかなカラフル: cream地に navy の文字、mint / peach / gold を差し色に。
   評価スタンプは mint → peach → gold と段階ごとに色が育つのがサイン。
--------------------------------------------------------------------- */
:root {
  --navy: #17324d;
  --navy-2: #0d2843;
  --mint: #a8e6cf;
  --mint-soft: #e7f8f1;
  --peach: #ffaa8d;
  --peach-soft: #fff0e9;
  --cream: #fffdf8;
  --gold: #f7c65d;
  --gold-soft: #fdf3da;
  --paper: #ffffff;
  --muted: #6e7a83;
  --line: #e8e7df;
  --danger: #d96b5c;
  --radius: 20px;
  --shadow: 0 12px 36px rgba(37, 55, 66, 0.1);
  --shadow-soft: 0 4px 16px rgba(37, 55, 66, 0.07);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background:
    radial-gradient(640px 320px at 15% -60px, var(--mint-soft) 0%, transparent 70%),
    radial-gradient(640px 320px at 90% -80px, var(--peach-soft) 0%, transparent 70%),
    var(--cream);
  background-attachment: fixed;
  color: var(--navy);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.logo {
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--navy);
  margin: 0;
}
.logo-small { font-size: 1.15rem; }

/* [hidden] を display 指定より優先させる(ID セレクタに負けないように) */
[hidden] { display: none !important; }

/* ---------- ログイン ---------- */
#login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 6px solid var(--mint);
  padding: 32px 28px;
  text-align: center;
}
.login-mark { font-size: 2.4rem; margin: 0 0 4px; }
.login-card .logo { font-size: 1.7rem; }
.login-lead { color: var(--muted); margin: 4px 0 24px; }
.login-card form { text-align: left; }

/* ---------- フォーム共通 ---------- */
label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 14px; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  font: inherit;
  color: var(--navy);
}
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 1px;
  border-color: var(--mint);
}
.form-error { color: var(--danger); font-size: 0.85rem; font-weight: 700; }

/* ---------- ボタン ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--navy); }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- アプリシェル ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
  max-width: 640px;
  margin: 0 auto;
}
.app-header .btn-ghost { margin-left: auto; font-size: 0.8rem; }
.role-badge {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--mint-soft);
  color: var(--navy);
}
.role-badge[data-role="taster"] { background: var(--peach-soft); }

.tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 12px;
  max-width: 640px;
  margin: 0 auto;
}
.tab {
  font: inherit;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.tab.is-active { background: var(--navy); color: #fff; box-shadow: var(--shadow-soft); }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 120px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 64px 16px;
}
.empty-state .big { font-size: 2.6rem; margin-bottom: 4px; }

/* ---------- 料理カード ---------- */
.dish-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  margin-bottom: 20px;
}
.dish-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--line);
}
.dish-body { padding: 14px 16px 16px; }
.dish-top { display: flex; align-items: baseline; gap: 8px; }
.dish-title { font-size: 1.05rem; font-weight: 700; margin: 0; flex: 1; }
.dish-date { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.dish-comment { margin: 6px 0 0; font-size: 0.9rem; }
.dish-rank-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--navy);
  background: var(--gold-soft);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 6px 10px;
}

.dish-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.edit-link {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}
.edit-link:hover { color: var(--navy); }

/* ---------- ごほうびスタンプ(3段階で色が育つ) ---------- */
.stamp-row { display: flex; gap: 6px; flex-wrap: wrap; }
.stamp {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s ease;
}
.stamp[disabled] { cursor: default; }
.stamp.is-on.stamp-1 { border-color: var(--mint); background: var(--mint-soft); color: #1f6a4e; }
.stamp.is-on.stamp-2 { border-color: var(--peach); background: var(--peach-soft); color: #b05537; }
.stamp.is-on.stamp-3 {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--navy-2);
  box-shadow: 0 3px 12px rgba(247, 198, 93, 0.55);
}
.stamp:not([disabled]):hover { border-color: var(--peach); }

/* ---------- ランキング ---------- */
.ranking-header {
  display: flex;
  align-items: center;
  margin: 8px 0 16px;
}
.ranking-header h2 { font-size: 1.1rem; margin: 0; flex: 1; color: var(--navy); }

.rank-item {
  display: grid;
  grid-template-columns: 44px 72px 1fr;
  gap: 12px;
  align-items: center;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.rank-item:nth-child(-n+4) { box-shadow: var(--shadow); }
.rank-no {
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
  color: var(--muted);
}
.rank-no.top1, .rank-no.top2, .rank-no.top3 { font-size: 1.5rem; }
.rank-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--line);
}
.rank-title { font-weight: 700; margin: 0; }
.rank-comment { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  background: var(--peach);
  color: var(--navy-2);
  font: inherit;
  font-weight: 900;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  box-shadow: 0 8px 22px rgba(255, 170, 141, 0.55);
  cursor: pointer;
}
.fab:active { transform: scale(0.96); }

/* ---------- ダイアログ ---------- */
dialog {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(13, 40, 67, 0.28);
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  background: var(--paper);
  color: var(--navy);
}
dialog::backdrop { background: rgba(13, 40, 67, 0.4); }
dialog h2 { margin: 0 0 16px; font-size: 1.1rem; color: var(--navy); }
.dialog-note { margin: -8px 0 14px; font-size: 0.82rem; color: var(--muted); }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.dialog-actions .spacer { flex: 1; }

.photo-picker {
  display: grid;
  place-items: center;
  border: 2px dashed var(--mint);
  background: var(--mint-soft);
  border-radius: 16px;
  min-height: 140px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  color: var(--navy);
  font-weight: 700;
}
.photo-picker img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-picker #photo-hint {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 4px 12px;
}

.ranking-slot {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  align-items: start;
  margin-bottom: 12px;
}
.ranking-slot .slot-no { font-weight: 900; color: var(--navy); padding-top: 10px; text-align: center; }
.ranking-slot input { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
