:root {
  color-scheme: light;
  --canvas: #faf8f2;
  --paper: #fffefa;
  --ink: #302b25;
  --muted: #685f53;
  --line: #ebe4d8;
  --accent: #f2ad54;
  --accent-hover: #eba043;
  --amber-soft: #fff0d7;
  --green-soft: #e9efdf;
  --green: #405a37;
  --radius: 23px;
  --shadow: 0 4px 20px #6b543608;
  font: 15px/1.65 -apple-system,BlinkMacSystemFont,"Hiragino Sans","Yu Gothic UI","Meiryo",sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #865000; outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
a { color: #735022; text-underline-offset: .18em; }
[hidden] { display: none !important; }

.top { background: #fffdfa; border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1120px; min-height: 78px; padding: 0 28px; margin: auto; display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px; background: #f7c275; color: #593717; transform: rotate(-5deg); flex: 0 0 auto; }
.brand-icon svg { transform: rotate(5deg); }
.brand strong { display: block; font-size: 21px; font-weight: 800; line-height: 1.25; letter-spacing: .08em; }
.brand small { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); letter-spacing: .05em; }
.nav { display: flex; align-items: center; gap: 5px; margin-inline: auto; }
.nav button { border: 0; border-radius: 999px; padding: 10px 15px; font-size: 13px; font-weight: 700; background: transparent; color: var(--muted); display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.nav button:hover { background: #f7f3eb; }
.nav button.active { background: var(--amber-soft); color: #683c14; }
.viewer { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.avatar { width: 34px; height: 34px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; border-radius: 50%; font-size: 14px; }

.main { max-width: 1120px; margin: auto; padding: 36px 28px 55px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(28px,3.3vw,39px); line-height: 1.25; font-weight: 850; letter-spacing: .04em; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 7px; }
.demo { margin-bottom: 15px; font-size: 11px; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid transparent; border-radius: 12px; padding: 8px 16px; font-weight: 750; font-size: 13px; white-space: nowrap; }
.primary { background: var(--accent); color: #34200f; border-color: #e9a44a; box-shadow: 0 2px 0 #bd742421; }
.primary:hover { background: var(--accent-hover); }
.pale { background: #fffaf0; border-color: #e7d7bb; color: #67451f; }
.pale:hover { background: #fff3da; }
.text-button { background: transparent; color: #7a4b23; }
.text-button:hover { background: #faf2e4; }
.full { width: 100%; }
.quick-record { padding: 16px 20px; margin-bottom: 15px; }
.quick-top, .quick-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quick-top p { color: var(--muted); font-size: 12px; }
.quick-time { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
#quick-form .quick-time select { width: auto; min-width: 64px; margin: 0; padding: 4px 5px; }
.quick-groups { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 18px; }
.quick-groups h3 { margin-bottom: 4px; font-size: 12px; font-weight: 800; }
.quick-menu { display: grid; gap: 5px; }
.quick-recent { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-food { min-width: 0; min-height: 42px; display: flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid var(--line); background: #fffdfa; border-radius: 9px; color: var(--ink); text-align: left; font-size: 12px; }
.quick-food b { overflow-wrap: anywhere; }
.quick-food .tag { margin-left: auto; }
.quick-food:hover { border-color: #e7c899; }
.quick-food.picked { background: #fff2d9; border-color: #d6a760; }
.quick-check { width: 23px; height: 23px; flex: 0 0 auto; display: grid; place-items: center; color: #80572e; border-radius: 50%; background: #f6f1e8; }
.picked .quick-check { background: #885921; color: white; }
.quick-actions { justify-content: flex-start; flex-wrap: wrap; }
.quick-actions .button { padding-inline: 12px; }
.quick-actions .text-button { font-size: 12px; padding-inline: 6px; }
.hero { overflow: hidden; position: relative; display: grid; grid-template-columns: 1.3fr 1fr; align-items: stretch; min-height: 250px; background: #fdeac7; border: 1px solid #f5dfa9; border-radius: 28px; isolation: isolate; }
.hero-copy { padding: 30px 36px; align-self: center; position: relative; z-index: 1; }
.hero-copy h2 { font-size: clamp(25px,3vw,36px); color: #472e20; line-height: 1.3; margin: 12px 0 7px; font-weight: 850; letter-spacing: .035em; }
.hero-copy p { max-width: 37ch; color: #604934; font-size: 14px; margin-bottom: 17px; }
.hero-art, .login-art { background: center / cover no-repeat url('/hero.webp'); }
.hero-art { position: relative; }
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg,#fdeac7 0%,#fdeac700 28%); pointer-events: none; }
.tag { display: inline-flex; align-items: center; gap: 7px; width: fit-content; border-radius: 100px; padding: 5px 10px; font-size: 11px; font-weight: 750; line-height: 1.35; white-space: nowrap; }
.tag.amber, .mini-icon.amber { background: var(--amber-soft); color: #6a451f; }
.hero .tag { background: #fffcf0; }
.tag.green, .mini-icon.green { background: var(--green-soft); color: var(--green); }
.tag.plain { background: #f1eee7; color: var(--muted); }
.dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .65; }

.columns { display: grid; grid-template-columns: 1.65fr 1fr; gap: 17px; margin-top: 17px; align-items: start; }
.side { display: grid; gap: 13px; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.journal { padding: 18px 20px; }
.card-head, .section-title, .date-step { display: flex; align-items: center; }
.card-head { justify-content: space-between; gap: 10px; }
.section-title { gap: 8px; }
.section-title h2 { font-size: 16px; font-weight: 800; }
.mini-icon { width: 35px; height: 35px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; }
.date-step { gap: 2px; background: #f8f5ed; border: 1px solid #eeeadf; border-radius: 10px; }
.icon-button { display: grid; place-items: center; border: 0; background: transparent; min-width: 35px; min-height: 35px; border-radius: 9px; color: var(--muted); }
.icon-button:hover { background: #f2eadf; color: var(--ink); }
.date-input { position: relative; display: grid; place-items: center; min-height: 34px; min-width: 78px; font-size: 12px; font-weight: 700; }
.date-input input { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; opacity: 0; padding: 0; cursor: pointer; }
.date-input input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.date-input:focus-within { outline: 2px solid #865000; outline-offset: 2px; border-radius: 5px; }
.empty { margin-top: 14px; min-height: 172px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; background: #fcfaf4; border: 1px dashed #eae0cf; border-radius: 16px; padding: 14px; color: var(--muted); font-size: 13px; }
.empty-icon { color: #9c672d; background: #fff0d6; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; }
.empty .button { min-height: 37px; }
.food-count, .settings-card { padding: 16px 18px; }
.count { font-size: 36px; font-weight: 850; line-height: 1.2; margin: 9px 0 5px; }
.count span { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.inline-link { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; color: #765227; font-size: 12px; font-weight: 750; }
.inline-link:hover { text-decoration: underline; }

.meal-list { display: grid; gap: 9px; margin-top: 12px; }
.meal { background: #fbf9f2; border: 1px solid #eee7da; border-radius: 15px; padding: 11px 12px; overflow-wrap: anywhere; }
.meal-head { display: flex; align-items: center; gap: 8px; }
.meal-head b { display: flex; align-items: center; gap: 5px; margin-right: auto; }
.meal-head span, .meal-note { font-size: 12px; color: var(--muted); }
.meal-note { margin-top: 6px; white-space: pre-wrap; }
.food-pills, .dates, .filters, .suggestions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.food-pills { margin-top: 5px; }
.observation { margin-top: 7px; }
.dates { margin: 12px 0 0; font-size: 11px; color: var(--muted); }
.chip { display: inline-flex; gap: 4px; align-items: center; justify-content: center; max-width: 100%; border: 1px solid var(--line); background: #fffdfa; border-radius: 999px; padding: 4px 11px; min-height: 34px; font-weight: 700; font-size: 12px; overflow-wrap: anywhere; text-align: center; }
button.chip:hover { background: #fff0db; }
.chip.selected { border-color: #e7c899; background: #fff0d7; color: #6a3e18; }
.chip.eaten { color: var(--green); background: var(--green-soft); border-color: #e0e8d5; }
.chip.untasted { color: var(--muted); background: #f0ede6; }
.dates .chip { min-height: 28px; font-size: 11px; }
.food-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 14px; align-items: start; }
.food-group { padding: 14px 18px 8px; }
.food-group h2 { font-size: 17px; padding-bottom: 7px; }
.food-row { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 8px; border: 0; border-top: 1px solid #f0ebe2; border-radius: 0; padding: 9px 0; min-height: 46px; background: transparent; text-align: left; }
.food-row:hover { background: #faf6ed; }
.food-row > svg { color: var(--muted); }
.food-row b, .food-row small { display: block; overflow-wrap: anywhere; }
.food-row b { font-size: 13px; }
.food-row small, .food-status { font-size: 11px; color: var(--muted); }
.food-mark { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #ece7de; border-radius: 50%; color: #8c8274; background: #f6f3ed; }
.food-mark.done { background: var(--green-soft); color: var(--green); border-color: #e0e8d5; }
.food-status.done { color: var(--green); font-weight: 750; }
.history-line, .history-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.history-line { font-size: 13px; }
.history-meta { margin-top: 6px; color: var(--muted); }
.history-meta small { font-size: 11px; }

.phase-picker { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.phase-card { min-width: 0; padding: 11px 6px; border: 1px solid var(--line); background: var(--paper); border-radius: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.4; white-space: normal; }
.phase-card strong { font-size: 15px; }
.phase-card span { font-size: 11px; }
.phase-card small { color: var(--muted); font-size: 10px; }
.phase-card:hover, .phase-card.chosen { border-color: #e5bc81; background: var(--amber-soft); }
.guide-card, .guide-facts { padding: 19px 20px; }
.guide-card h2 { margin: 8px 0 3px; font-size: 23px; }
.guide-card > p, .guide-facts p, .settings-card p { margin: 5px 0 9px; color: var(--muted); font-size: 13px; }
.week-picker { margin: 12px 0; }
.model-meal { background: #f9f6ee; padding: 10px 12px; border-radius: 12px; margin-top: 11px; }
.model-meal h3 { font-size: 14px; margin-bottom: 5px; }
.model-meal > div { border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 6px 0; font-size: 13px; }
.model-meal p { font-size: 11px; color: var(--muted); margin-top: 5px; }
.guide-facts dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 12px 0; font-size: 13px; }
.guide-facts dt { color: var(--muted); }
.guide-facts dd { margin: 0; font-weight: 700; }
.guide-facts a { display: flex; align-items: center; gap: 5px; font-size: 12px; margin-top: 7px; width: fit-content; }
.settings-card { max-width: 500px; }
.log-out { display: flex; margin-top: 8px; }

.login-wrap { max-width: 445px; margin: 0 auto; padding: 30px 18px; }
.login-wrap > .brand { margin: 0 0 17px 5px; }
.login-card { border: 1px solid var(--line); border-radius: 24px; background: var(--paper); overflow: hidden; box-shadow: var(--shadow); }
.login-art { height: 188px; background-color: #fdeac7; background-position: center 57%; }
.login-body { padding: 22px 25px 25px; }
.login-body h1 { margin: 7px 0; font-size: 28px; line-height: 1.4; }
.login-body > p { margin-bottom: 13px; font-size: 13px; color: var(--muted); }
.loading { margin: 3rem auto; text-align: center; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink); padding: 19px; width: min(510px,calc(100vw - 26px)); max-height: min(86dvh,740px); overflow: auto; box-shadow: 0 12px 70px #43301f35; }
dialog::backdrop { background: #3e312965; }
.dialog-head { display: flex; justify-content: space-between; gap: 5px; align-items: center; margin-bottom: 12px; }
.dialog-head h2 { font-size: 20px; }
dialog p { font-size: 13px; color: var(--muted); }
form { display: grid; gap: 11px; }
form label, dialog > label { display: block; min-width: 0; font-size: 13px; font-weight: 700; }
label small { font-size: 10px; margin-left: 4px; color: var(--muted); }
form input:not([type=checkbox]), form select, form textarea, dialog > label input { width: 100%; min-width: 0; border: 1px solid #d9d0c2; border-radius: 10px; background: #fffdfa; margin: 4px 0 0; padding: 7px 10px; min-height: 43px; font-weight: 500; font-size: 16px; }
form textarea { display: block; resize: vertical; }
dialog > label { margin: 9px 0; }
.form-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 9px; }
.ingredients { background: #faf7ef; border: 1px solid #eee7d9; border-radius: 12px; padding: 10px; }
.ingredients h3 { font-size: 14px; }
.ingredients p { font-size: 11px; margin: 2px 0 6px; }
.suggestions { margin-top: 7px; }
.add-food { min-height: 36px; }
.add-food.custom { border-color: #dcb16d; }
.selected-food { display: grid; grid-template-columns: minmax(0,1fr) 132px 33px; align-items: center; gap: 4px; border-top: 1px solid var(--line); padding: 3px 0; font-size: 12px; }
.selected-food b { overflow-wrap: anywhere; }
.selected-food select { font-size: 13px; margin: 0; min-height: 35px; }
label.check-line { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.check-line input { width: 17px; height: 17px; accent-color: #96632b; }
.form-error { color: #9b3522; font-size: 12px; }
.form-error:empty { display: none; }
.delete-button { color: #9b3522; }
.danger { background: #a53c2d; color: white; }
.form-buttons { display: flex; justify-content: end; gap: 8px; margin-top: 12px; }
#toast { position: fixed; z-index: 2; left: 50%; bottom: 25px; width: max-content; max-width: calc(100vw - 28px); padding: 9px 14px; border-radius: 10px; background: #3d352d; color: white; text-align: center; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%,10px); transition: .2s ease; }
#toast.visible { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 720px) {
  .top-inner { min-height: 62px; padding: 0 17px; justify-content: space-between; }
  .brand-icon { width: 37px; height: 37px; border-radius: 12px; }
  .brand { gap: 9px; }
  .brand strong { font-size: 19px; }
  .viewer { font-size: 11px; }
  .avatar { width: 30px; height: 30px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; padding: 5px 9px calc(5px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4,1fr); gap: 4px; background: #fffdfa; border-top: 1px solid var(--line); }
  .nav button { flex-direction: column; gap: 2px; padding: 5px 0; font-size: 10px; min-height: 45px; border-radius: 11px; }
  .main { padding: 21px 14px calc(82px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 15px; align-items: center; }
  .page-head h1 { font-size: 27px; }
  .page-head p { font-size: 12px; margin-top: 3px; }
  .top-add { padding: 6px 10px; gap: 4px; font-size: 12px; }
  .quick-record { padding: 11px; margin-bottom: 11px; }
  .quick-groups { grid-template-columns: 1fr; gap: 8px; }
  .quick-food { min-height: 44px; }
  .quick-actions .text-button { white-space: normal; justify-content: flex-start; }
  .hero { min-height: 205px; grid-template-columns: 1fr; border-radius: 20px; }
  .hero-copy { padding: 15px 15px 15px; }
  .hero-copy h2 { max-width: 70%; font-size: 22px; margin-top: 9px; }
  .hero-copy p { max-width: 68%; font-size: 12px; margin-bottom: 12px; }
  .hero-copy .button { min-height: 36px; font-size: 11px; padding: 5px 8px; }
  .hero-art { position: absolute; width: 57%; inset: 0 0 0 auto; background-position: 51% center; }
  .hero-art::after { background: linear-gradient(90deg,#fdeac7 0%,#fdeac7db 13%,#fdeac700 48%); }
  .columns { grid-template-columns: 1fr; gap: 10px; margin-top: 11px; }
  .side { gap: 9px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .journal { padding: 11px; }
  .section-title h2 { font-size: 14px; }
  .mini-icon { width: 30px; height: 30px; }
  .card { border-radius: 16px; }
  .empty { margin-top: 10px; min-height: 126px; }
  .empty-icon { width: 40px; height: 40px; }
  .empty-icon svg { width: 25px; height: 25px; }
  .food-count, .settings-card { padding: 10px; }
  .food-grid { grid-template-columns: 1fr; gap: 9px; }
  .guide-card, .guide-facts { padding: 14px; }
  .phase-picker { gap: 4px; }
  .phase-card { padding-inline: 3px; }
  .phase-card span, .phase-card small { font-size: 9px; }
  #toast { bottom: calc(64px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .date-input { min-width: 67px; }
  .date-step .icon-button { min-width: 28px; }
  .side .section-title { gap: 4px; }
  .side .section-title h2 { font-size: 13px; }
  .hero-copy h2 { max-width: 75%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
