:root {
  --bg: #fff6ef;
  --card: #ffffff;
  --ink: #2d2a26;
  --muted: #8a817a;
  --brand: #ff6b35;
  --brand2: #ff9f43;
  --green: #1dd1a1;
  --red-on: #ff5e57;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(255, 107, 53, 0.12);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #ff6b35, #ff9f43);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 30px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 1px; }
.brand p { margin: 0; font-size: 12px; opacity: .9; }
.header-actions { display: flex; align-items: center; gap: 8px; position: relative; }

main { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
h2 { margin: 0 0 10px; font-size: 16px; }

/* buttons */
.btn {
  border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 14px; border-radius: 12px;
  background: #f1ede8; color: var(--ink);
  transition: transform .05s ease, background .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #ff6b35, #ff9f43); color: #fff; box-shadow: 0 6px 14px rgba(255,107,53,.3); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.28); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 10px; }
.btn.big { font-size: 18px; padding: 14px 22px; width: 100%; }
.btn.danger { background: #ffe6e4; color: var(--red-on); }

/* settings */
.settings-wrap { position: relative; }
.settings-wrap summary { list-style: none; }
.settings-wrap summary::-webkit-details-marker { display: none; }
.settings-panel {
  position: absolute; right: 0; top: 46px; width: 260px;
  background: #fff; color: var(--ink); border-radius: 14px;
  padding: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.18);
  z-index: 60;
}
.field-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.field-row label { font-size: 13px; font-weight: 600; flex: 1; }
.field-row input { width: 62px; padding: 6px; border: 1px solid #eae2da; border-radius: 8px; font: inherit; }
.field-row select { padding: 6px; border: 1px solid #eae2da; border-radius: 8px; font: inherit; background: #fff; }
.check-line { font-size: 13px; display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.hint-sm { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* chips filters */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid #eae2da; background: #fff;
  padding: 7px 13px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
  color: var(--muted); transition: .12s;
}
.chip.active { background: linear-gradient(135deg,#ff6b35,#ff9f43); color: #fff; border-color: transparent; font-weight: 600; }

/* wheel */
.wheel-card { text-align: center; }
#wheel { display: block; margin: 0 auto; }
.pool-meta { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* section head */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.muted { color: var(--muted); font-size: 12px; }

/* food list */
.food-list { display: flex; flex-direction: column; gap: 10px; }
.food-card { border: 1px solid #f0e8e0; border-radius: 14px; padding: 12px; }
.food-card.marked-eaten { border-left: 4px solid var(--green); background: #f5fffc; }
.food-card.marked-unwanted { border-left: 4px solid var(--red-on); background: #fff6f5; }
.food-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.food-head strong { font-size: 16px; }
.mark-badge { font-size: 11px; background: #fff3e0; color: #d9730d; border-radius: 999px; padding: 2px 8px; }
.marked-eaten .mark-badge { background: #e3faf2; color: #0f9d76; }
.marked-unwanted .mark-badge { background: #ffe6e4; color: var(--red-on); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { background: #fff0e5; color: #c96a2a; border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.tag.alt { background: #eef4ff; color: #3b7bd6; }
.note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.food-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* marks */
.marks-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.marks-list { display: flex; flex-direction: column; gap: 8px; }
.mark-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: #faf6f1; }
.mark-row.m-eaten { background: #f0fcf7; }
.mark-row.m-unwanted { background: #fff2f0; }
.mark-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.m-eaten .mark-dot { background: var(--green); }
.m-unwanted .mark-dot { background: var(--red-on); }
.mark-info { flex: 1; }
.mark-info strong { display: block; font-size: 14px; }
.mark-info small { color: var(--muted); }

.empty { color: var(--muted); text-align: center; padding: 18px 10px; font-size: 14px; }

/* modals */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); padding: 16px; opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 100;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 20px; padding: 22px; width: 100%; max-width: 400px;
  max-height: 90vh; overflow-y: auto; position: relative;
  transform: translateY(12px); transition: transform .18s;
}
.overlay.show .modal { transform: none; }
.modal-close { position: absolute; top: 12px; right: 12px; border: 0; background: #f1ede8; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.result-badge { text-align: center; font-size: 14px; color: var(--brand); font-weight: 700; }
.result-modal h2 { text-align: center; font-size: 26px; margin: 8px 0; }
.result-modal .tags { justify-content: center; margin: 6px 0; }
#result-note { text-align: center; color: var(--muted); }
.mark-line { text-align: center; margin: 8px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.modal-actions .btn { flex: 1; }
.guide-box { background: #f0fcf7; border: 1px solid #cdeee0; border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 14px; color: #136f52; }
.guide-box.good { background: #fff4e8; border-color: #ffd8b0; color: #b5641a; }
.recipe-block { border-top: 1px solid #f0e8e0; margin-top: 12px; padding-top: 12px; }
.recipe-block h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); }
.recipe-block ol { margin: 0; padding-left: 20px; }
.recipe-block li { margin: 4px 0; line-height: 1.55; }

/* add form */
.field { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.field input, .field textarea { display: block; width: 100%; margin-top: 6px; padding: 10px; border: 1px solid #eae2da; border-radius: 10px; font: inherit; font-weight: 400; }
.field textarea { resize: vertical; }
.field .chips label { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; border: 1px solid #eae2da; border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.field .chips input { width: auto; margin: 0; }
.field .chips label:has(input:checked) { background: #ffefe4; border-color: var(--brand); color: #c15a22; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.82); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 200; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (min-width: 600px) {
  .food-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  main { padding: 20px; }
}
