@font-face { font-family: DM Sans; src: url("./fonts/dm-sans.woff2") format("woff2"); font-weight: 400 750; font-display: swap; }
@font-face { font-family: Barlow Condensed; src: url("./fonts/barlow-condensed.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #20251d;
  background: #f4f5ef;
  --green: #d1f65a;
  --ink: #20251d;
  --muted: #60695b;
  --line: #e1e5d9;
  --forest: #232b1d;
  --soft: #f1f5e7;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #587525; outline-offset: 4px; }
h1, h2, p { margin: 0; }
h2 { font-size: 1.19rem; letter-spacing: -.035em; font-weight: 750; }
svg { flex: 0 0 auto; }
.loading { padding: 2rem; text-align: center; }
.topbar { background: #20261c; color: #fff; }
.top-inner { width: min(1100px, calc(100% - 64px)); min-height: 68px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; position: relative; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; font-size: 1.38rem; font-weight: 750; letter-spacing: -.065em; }
.brand-mark { color: #26301c; background: var(--green); width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; transform: rotate(-5deg); }
.brand-accent { color: var(--green); }
nav { display: flex; gap: 5px; }
nav button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; color: inherit; border-radius: 9px; }
nav button { color: #c3c9bd; padding: 10px 15px; font-size: .89rem; font-weight: 650; }
nav button:hover, nav .current { color: var(--green); background: #343e2a; }
.topbar :focus-visible { outline-color: var(--green); }
.account { display: flex; align-items: center; gap: 9px; font-size: .85rem; }
.user-name { overflow: hidden; text-overflow: ellipsis; max-width: 118px; white-space: nowrap; color: #d3dacd; }
.preview-tag { border: 1px solid #58634f; padding: 5px 8px; border-radius: 7px; color: #e2ead9; font-size: .72rem; }
.icon-button { width: 36px; height: 36px; }
.icon-button:hover { background: #e9ecdf; color: var(--ink); }
.wrap { width: min(1100px, calc(100% - 64px)); margin: 28px auto 36px; }
.hero {
  min-height: 273px;
  display: flex;
  align-items: center;
  border-radius: 22px;
  overflow: hidden;
  color: #fbfcf7;
  background:
    linear-gradient(90deg, #252e20 0%, #252e20 31%, #252e20ee 43%, #252e2030 72%, #252e200c 100%),
    url("./meal.webp") right 47% / min(73%, 810px) auto no-repeat #252e20;
}
.hero-copy { display: grid; justify-items: start; position: relative; padding: 27px 39px 30px; }
.hero-label { display: inline-flex; align-items: center; gap: 7px; color: #dbfa88; background: #37492a; border: 1px solid #61714d; padding: 5px 10px; border-radius: 30px; font-size: .71rem; font-weight: 750; }
.hero h1, .diary-heading h1 { font-family: "Barlow Condensed", Impact, sans-serif; font-size: clamp(3.25rem, 6vw, 5.05rem); text-transform: uppercase; line-height: .89; letter-spacing: -.012em; }
.hero h1 { margin: 12px 0 14px; }
.hero h1 span { color: var(--green); }
.hero p { color: #d9e0d3; max-width: 36ch; font-size: .95rem; line-height: 1.48; }
.workspace { margin-top: 24px; }
.workspace-date { display: flex; align-items: center; gap: 7px; margin: 0 2px 13px; font-size: .79rem; color: var(--muted); font-weight: 700; }
.workspace-date::first-letter { text-transform: uppercase; }
.columns { display: grid; grid-template-columns: minmax(0, 1.36fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 21px; box-shadow: 0 2px 5px #2a422205; }
.section-head { display: flex; gap: 11px; align-items: center; margin-bottom: 17px; }
.section-head p, .day-card p { color: var(--muted); font-size: .83rem; margin-top: 2px; }
.section-icon { display: grid; place-items: center; color: #40582c; background: #edf4dd; border-radius: 11px; width: 43px; height: 43px; flex: 0 0 auto; }
.section-icon.warm { color: #8d501f; background: #fcf0df; }
.methods { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: var(--soft); border-radius: 10px; margin-bottom: 15px; }
.methods button { display: flex; justify-content: center; align-items: center; gap: 7px; padding: 8px 5px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 700; font-size: .84rem; }
.methods [aria-pressed="true"] { background: #fff; border-color: #e0e7d5; color: #36492a; box-shadow: 0 1px 3px #403a2718; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
label { font-size: .84rem; font-weight: 750; }
#count, .hint, .muted { color: var(--muted); }
#count { font-size: .7rem; }
textarea, input:not([type=file]) { color: var(--ink); width: 100%; background: #fbfcf8; border: 1px solid #dfe5d5; border-radius: 9px; padding: 11px 12px; }
textarea { display: block; min-height: 105px; resize: vertical; line-height: 1.5; font-size: .9rem; }
textarea::placeholder { color: #6b7464; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; font-size: .73rem; color: var(--muted); }
.examples > span { margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; color: #3d532c; border: 1px solid #dfebd0; background: #f4f8ee; border-radius: 30px; padding: 4px 8px; font-size: .73rem; font-weight: 650; }
.chip:hover { background: #e5f1d5; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 13px; border-radius: 10px; min-height: 40px; font-weight: 750; }
.primary { border: 1px solid #bfeb42; background: var(--green); color: #202b18; }
.primary:hover:not(:disabled) { background: #c2ee46; }
.secondary { border: 1px solid #dfe6d7; background: #f9fbf5; color: #35452c; font-size: .82rem; }
.secondary:hover { background: #eff5e5; }
.estimate-button { display: flex; width: 100%; margin-top: 15px; min-height: 47px; }
.estimate-button svg:last-child { margin-left: auto; }
.result-panel { min-height: 284px; }
.empty-result { min-height: 204px; display: grid; justify-items: center; align-content: center; text-align: center; gap: 8px; border: 1px dashed #dfe6d5; border-radius: 13px; background: #fbfcf8; padding: 18px; }
.empty-result p { max-width: 29ch; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.empty-result strong { font-size: .93rem; }
.empty-icon { display: grid; place-items: center; background: #eef4e5; color: #637957; border-radius: 14px; width: 51px; height: 51px; margin-bottom: 3px; }
.result-total { border-radius: 12px; padding: 14px; background: #f0f7df; color: #3b5228; font-weight: 750; }
.result-total strong { font-size: 2.26rem; line-height: 1; letter-spacing: -.055em; }
.result-name { font-weight: 750; margin-top: 12px; }
.food-list { list-style: none; padding: 0; margin: 5px 0 12px; }
.food-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.food-list li > span:first-child { display: grid; gap: 2px; overflow-wrap: anywhere; }
.food-list strong { font-size: .87rem; }
.food-list small { color: var(--muted); font-size: .76rem; }
.food-kcal { white-space: nowrap; font-weight: 750; }
.estimate-result button { width: 100%; margin-top: 8px; }
.result-note { margin: 5px 0 9px; }
.day-card { margin-top: 17px; display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.day-right { margin-left: auto; display: flex; align-items: center; gap: 14px; white-space: nowrap; font-size: .8rem; color: #46573a; }
.day-right strong { font-size: 1.22rem; }
.footnote { font-size: .73rem; color: var(--muted); margin-top: 13px; }
.hint { font-size: .77rem; line-height: 1.45; }
.photo-area { margin-bottom: 12px; }
.photo-area .hint { margin-top: 6px; }
.upload-area { background: #fafcf6; border: 1px dashed #cbd8bc; color: #405334; border-radius: 11px; padding: 14px; display: grid; justify-items: center; gap: 8px; }
.upload-area strong { font-size: .88rem; text-align: center; }
.upload-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; }
.file-button { min-height: 35px; padding: 6px 9px; cursor: pointer; }
.upload-actions input { width: 1px; height: 1px; margin: 0; position: absolute; opacity: 0; }
.file-button:has(+ input:focus-visible) { outline: 2px solid #587525; outline-offset: 3px; }
.file-button:has(+ input:disabled) { cursor: wait; opacity: .6; }
.photo-preview { position: relative; }
.photo-preview img { width: 100%; height: 184px; display: block; object-fit: contain; background: var(--soft); border-radius: 11px; }
.photo-preview .icon-button { position: absolute; top: 7px; right: 7px; background: #fff; color: var(--ink); }
.notice, .error { display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 650; }
.notice { background: #e9f4d7; color: #365629; padding: 8px 10px; border-radius: 9px; margin-bottom: 11px; }
.error:not(:empty) { color: #8c3023; background: #fff3ee; padding: 8px 10px; border-radius: 9px; margin-top: 9px; }
.spinner { display: inline-block; width: 17px; height: 17px; border: 2px solid #6a7d43; border-top-color: transparent; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.diary-layout { max-width: 850px; }
.diary-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 35px 0 20px; }
.diary-heading h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.diary-heading p { margin-top: 8px; }
.date-label { display: grid; gap: 4px; }
.diary-total { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.diary-total > span:last-child { margin-left: auto; white-space: nowrap; color: #40542e; font-size: 1.3rem; font-weight: 750; }
.diary-empty .secondary { margin-top: 4px; }
.meal-entry { display: flex; align-items: start; gap: 8px; border-top: 1px solid var(--line); }
.meal-entry details { flex: 1; min-width: 0; }
.meal-entry details .hint { margin-bottom: 10px; }
.meal-entry summary { cursor: pointer; padding: 11px 0; overflow-wrap: anywhere; }
.meal-entry summary span { font-weight: 750; margin-right: 8px; }
.meal-entry summary strong { color: #4c613c; white-space: nowrap; font-size: .85rem; }
.remove-meal { margin-top: 3px; color: #7a4d42; }
.login-panel { max-width: 430px; margin: 20px auto; }
.login-panel form { display: grid; gap: 8px; margin-top: 14px; }
.login-panel input { margin-bottom: 4px; }
.login-panel h2 { margin-bottom: 5px; }
.login-panel .primary { margin-top: 6px; }

@media (max-width: 780px) {
  .top-inner, .wrap { width: calc(100% - 38px); }
  .hero { min-height: 251px; }
  .hero-copy { padding-left: 25px; }
  .columns { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; }
  .panel { padding: 16px; }
  .top-inner { gap: 12px; }
  .user-name { display: none; }
}
@media (max-width: 600px) {
  .top-inner, .wrap { width: calc(100% - 28px); }
  .top-inner { flex-wrap: wrap; gap: 0; padding-top: 11px; }
  .top-inner nav { order: 3; width: 100%; padding: 8px 0; }
  nav button { flex: 1; min-height: 40px; }
  .top-inner:has(.brand:only-child) { padding-top: 0; min-height: 60px; }
  .wrap { margin-top: 15px; }
  .hero { border-radius: 17px; min-height: 224px; background:
    linear-gradient(90deg, #252e20 0%, #252e20ed 24%, #252e20b8 54%, #252e2030 100%),
    url("./meal.webp") 72% center / cover no-repeat #252e20; }
  .hero-copy { padding: 20px 15px; }
  .hero h1 { font-size: clamp(2.95rem, 11vw, 4rem); }
  .hero p { max-width: 30ch; font-size: .83rem; }
  .workspace { margin-top: 16px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .result-panel { min-height: unset; }
  .empty-result { min-height: 154px; }
  .day-card { flex-wrap: wrap; }
  .day-right { flex: 1 0 100%; justify-content: space-between; }
  .diary-heading { align-items: start; flex-direction: column; margin-top: 22px; }
  .diary-total h2 { font-size: 1rem; }
  input, textarea { font-size: 16px !important; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
