/* 暗い台所でも眩しくないダークテーマ。調理中の画面だけ文字を大きく取る。 */
:root {
  --bg: #14181d;
  --panel: #1c222a;
  --panel-2: #232b35;
  --line: #313b47;
  --text: #e7edf3;
  --muted: #9aa8b8;
  --accent: #ff9a4d;
  --accent-dim: #7a4a22;
  --ok: #57c98a;
  --danger: #ff6b6b;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overscroll-behavior-y: contain;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent); }

/* ---- 骨組み ---- */
#app { padding: 0 0 76px; max-width: 1100px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; background: rgba(20,24,29,.94);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; margin: 0; white-space: nowrap; }
.search { flex: 1; min-width: 0; }
.search input {
  width: 100%; padding: 9px 12px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.search input:focus { outline: 2px solid var(--accent-dim); }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status.offline { color: var(--danger); }
.view { padding: 14px; }
.hidden { display: none !important; }

/* ---- 一覧 ---- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  padding: 5px 12px; border-radius: 999px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent-dim); color: var(--text); border-color: var(--accent); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-align: left; display: flex; flex-direction: column;
}
.card:hover { border-color: var(--accent); }
.card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--panel-2); }
.card .noimg { aspect-ratio: 4/3; display: grid; place-items: center; color: var(--muted); font-size: 28px; background: var(--panel-2); }
.card .body { padding: 9px 11px 11px; }
.card h3 { margin: 0 0 4px; font-size: 15px; line-height: 1.35; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--muted); text-align: center; padding: 48px 12px; }

/* ---- 詳細 ---- */
.detail-head { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-head img { width: 260px; max-width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
.detail-head h2 { margin: 0 0 8px; font-size: 22px; }
.meta-row { color: var(--muted); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.btn {
  padding: 9px 15px; border-radius: 9px; background: var(--panel-2);
  border: 1px solid var(--line);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #1a1005; border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--danger); }
.cols { display: grid; gap: 22px; grid-template-columns: minmax(240px, 1fr) 2fr; align-items: start; }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; } }
section h3 { font-size: 15px; color: var(--accent); margin: 0 0 8px; }
.servings { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.servings button { width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.servings .value { min-width: 62px; text-align: center; }
.ing-group { color: var(--muted); font-size: 13px; margin: 12px 0 4px; border-bottom: 1px dashed var(--line); }
ul.ings { list-style: none; margin: 0; padding: 0; }
ul.ings li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #232b35; }
ul.ings li.checked { opacity: .45; text-decoration: line-through; }
ul.ings .name { flex: 1; }
ul.ings .amount { color: var(--accent); white-space: nowrap; }
ol.steps { margin: 0; padding-left: 1.4em; }
ol.steps li { margin-bottom: 12px; }
.notes { white-space: pre-wrap; color: var(--muted); }
.stars { font-size: 20px; letter-spacing: 2px; }
.stars button { color: var(--muted); }
.stars button.on { color: var(--accent); }

/* ---- 調理モード ---- */
#cook {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; padding: 12px 16px 16px;
}
#cook .cook-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
#cook .step-text { flex: 1; display: flex; align-items: center; font-size: clamp(20px, 4.4vw, 30px); line-height: 1.75; overflow-y: auto; padding: 14px 0; }
#cook .step-text > div { max-width: 24em; margin: 0 auto; }
#cook .cook-nav { display: flex; gap: 10px; }
#cook .cook-nav .btn { flex: 1; padding: 16px; font-size: 17px; }
.timer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.timer-display { font-size: 26px; font-variant-numeric: tabular-nums; color: var(--accent); }
.timer-display.done { color: var(--danger); }
.cook-ings { max-height: 30vh; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 8px; }

/* ---- 買い物リスト ---- */
.aisle { margin-bottom: 18px; }
.aisle h3 { position: sticky; top: 52px; background: var(--bg); padding: 4px 0; }
.shop-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid #232b35; }
.shop-item.checked { opacity: .4; text-decoration: line-through; }
.shop-item .from { font-size: 12px; color: var(--muted); }
.shop-item .grow { flex: 1; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 2px; }

/* ---- 編集 ---- */
.form label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.form input[type="text"], .form textarea, .form select {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.form textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* ---- 下部ナビ ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { flex: 1; padding: 11px 4px; color: var(--muted); font-size: 12px; }
.tabbar button[aria-current="true"] { color: var(--accent); }
.tabbar .icon { display: block; font-size: 19px; line-height: 1.2; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #1a1005; font-size: 11px; font-weight: 700;
}
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--text);
  padding: 9px 16px; border-radius: 999px; z-index: 60; font-size: 14px;
}
