:root {
  --bg: #fff8f5;
  --surface: rgba(255,255,255,.86);
  --surface-solid: #ffffff;
  --ink: #241f1d;
  --muted: #847873;
  --line: #eee4df;
  --brand: #ff5e78;
  --brand-deep: #eb3f61;
  --brand-soft: #ffe6eb;
  --peach: #ffd5c7;
  --shadow: 0 20px 55px rgba(83, 48, 40, .10);
  --shadow-soft: 0 10px 30px rgba(83, 48, 40, .08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 4%, rgba(255, 193, 181, .35), transparent 27rem),
    radial-gradient(circle at 92% 12%, rgba(255, 226, 220, .7), transparent 24rem),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.visually-hidden { position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

.eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .18em; color: var(--brand-deep); }
.eyebrow.light { color: rgba(255,255,255,.72); }
.subtle { color: var(--muted); }

.brand-mark {
  width: 42px; height: 42px; border-radius: 14px; display:grid; place-items:center;
  background: linear-gradient(145deg, #ff7c90, #f34567); color:white; font-weight: 800;
  box-shadow: 0 9px 20px rgba(239,63,97,.24);
}
.brand-mark.large { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }

/* Setup */
.setup-view { min-height:100vh; display:grid; place-items:center; padding:24px; }
.setup-card { max-width:620px; background:white; border:1px solid var(--line); border-radius:28px; padding:34px; box-shadow:var(--shadow); }
.setup-card h1 { margin:12px 0; font-size:clamp(24px,4vw,36px); }
.setup-card p { color:var(--muted); line-height:1.8; }
.setup-card code { background:#fff1f4; color:#c62d4e; padding:2px 6px; border-radius:6px; }
.setup-files { display:flex; flex-wrap:wrap; gap:8px; margin-top:18px; }
.setup-files span { padding:8px 11px; border-radius:999px; background:#f7f2ef; font-size:12px; font-weight:700; }

/* Auth */
.auth-view { min-height:100vh; padding:22px; display:grid; place-items:center; }
.auth-shell { width:min(1080px,100%); min-height:680px; border-radius:36px; overflow:hidden; display:grid; grid-template-columns:1.08fr .92fr; background:white; box-shadow:var(--shadow); border:1px solid rgba(255,255,255,.9); }
.auth-visual { position:relative; overflow:hidden; padding:56px; color:white; background:
  linear-gradient(150deg, rgba(86,33,27,.12), rgba(45,14,10,.26)),
  radial-gradient(circle at 25% 20%, #ff9b8c 0, #ff6d79 35%, #e94362 100%); }
.auth-visual::after { content:""; position:absolute; inset:auto -80px -120px auto; width:430px; height:430px; border-radius:50%; background:rgba(255,255,255,.10); filter:blur(1px); }
.auth-visual-content { position:relative; z-index:2; max-width:470px; }
.auth-visual h1 { font-size:clamp(38px,5.2vw,64px); letter-spacing:-.04em; line-height:1.18; margin:26px 0 18px; }
.auth-visual p { line-height:1.9; color:rgba(255,255,255,.85); }
.food-orbs span { position:absolute; border-radius:50%; background:rgba(255,255,255,.13); border:1px solid rgba(255,255,255,.18); backdrop-filter:blur(12px); }
.food-orbs span:nth-child(1){ width:145px;height:145px;right:62px;top:70px; }
.food-orbs span:nth-child(2){ width:82px;height:82px;right:170px;bottom:90px; }
.food-orbs span:nth-child(3){ width:210px;height:210px;left:-90px;bottom:-40px; }
.auth-panel { display:grid; place-items:center; padding:52px; }
.auth-panel-inner { width:min(380px,100%); }
.auth-panel h2 { margin:0; font-size:34px; letter-spacing:-.03em; }
.mobile-brand { display:none; align-items:center; gap:12px; margin-bottom:34px; }
.google-button { width:100%; min-height:52px; margin-top:26px; border:1px solid #ded7d3; border-radius:14px; background:#fff; color:#332d2a; display:flex; align-items:center; justify-content:center; gap:11px; font-weight:700; box-shadow:0 7px 20px rgba(83,48,40,.05); transition:.18s ease; }
.google-button:hover { background:#fffaf8; border-color:#cfc5c0; transform:translateY(-1px); box-shadow:0 10px 24px rgba(83,48,40,.08); }
.google-button:disabled { opacity:.6; cursor:not-allowed; transform:none; }
.google-icon { width:22px; height:22px; display:grid; place-items:center; flex:0 0 auto; }
.auth-divider { display:flex; align-items:center; gap:12px; margin:22px 0 0; color:#a0948f; font-size:11px; }
.auth-divider::before,.auth-divider::after { content:""; height:1px; flex:1; background:var(--line); }
.auth-divider span { white-space:nowrap; }
.form-stack { display:grid; gap:18px; margin-top:28px; }
.form-stack label > span, .form-grid label > span { display:block; margin-bottom:8px; font-size:13px; font-weight:700; color:#5f5652; }
input, textarea { width:100%; border:1px solid var(--line); border-radius:14px; padding:14px 15px; background:#fffdfc; color:var(--ink); outline:none; transition:.2s ease; }
input:focus, textarea:focus { border-color:#ff8798; box-shadow:0 0 0 4px rgba(255,94,120,.10); background:white; }
.password-wrap { position:relative; }
.password-wrap input { padding-right:62px; }
.icon-button.inside { position:absolute; right:8px; top:50%; transform:translateY(-50%); font-size:11px; }
.primary-button { border:0; color:white; background:linear-gradient(135deg,var(--brand),var(--brand-deep)); border-radius:14px; min-height:50px; padding:0 20px; font-weight:800; box-shadow:0 12px 25px rgba(235,63,97,.20); }
.primary-button:hover { filter:brightness(.98); transform:translateY(-1px); }
.primary-button:disabled { opacity:.6; cursor:not-allowed; transform:none; }
.primary-button.small { min-height:44px; }
.text-button { width:100%; border:0; background:transparent; color:var(--brand-deep); font-weight:700; margin-top:18px; padding:10px; }
.form-message { min-height:22px; margin:10px 0 0; font-size:12px; color:#bb3751; line-height:1.6; }

/* App */
.topbar { position:sticky; top:0; z-index:20; height:78px; padding:0 max(22px,calc((100vw - 1180px)/2)); display:flex; align-items:center; justify-content:space-between; background:rgba(255,248,245,.82); backdrop-filter:blur(18px); border-bottom:1px solid rgba(238,228,223,.75); }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--ink); }
.brand strong { display:block; font-size:18px; letter-spacing:-.02em; }
.brand small { color:var(--muted); text-transform:uppercase; letter-spacing:.12em; font-size:8px; }
.topbar-actions { display:flex; align-items:center; gap:10px; }
.compact-add { border:0; border-radius:999px; background:#241f1d; color:white; padding:11px 16px; font-size:12px; font-weight:800; }
.avatar-button { width:42px; height:42px; border-radius:50%; border:1px solid var(--line); background:white; font-weight:800; color:var(--brand-deep); box-shadow:var(--shadow-soft); }
.profile-menu { position:fixed; z-index:40; top:70px; right:max(22px,calc((100vw - 1180px)/2)); min-width:250px; padding:16px; border:1px solid var(--line); background:white; border-radius:18px; box-shadow:var(--shadow); }
.profile-menu p { font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
.profile-menu button { width:100%; border:0; border-radius:12px; background:#fff0f3; color:#be2d4b; padding:11px; font-weight:700; }

.hero { width:min(1180px,calc(100% - 44px)); margin:44px auto 24px; min-height:260px; border-radius:34px; padding:42px; display:flex; align-items:flex-end; justify-content:space-between; gap:30px; background:
  linear-gradient(110deg, rgba(255,255,255,.94), rgba(255,246,243,.79)),
  radial-gradient(circle at 90% 20%, #ffb6ad, transparent 18rem); border:1px solid rgba(255,255,255,.9); box-shadow:var(--shadow-soft); overflow:hidden; position:relative; }
.hero::before { content:""; position:absolute; width:310px; height:310px; right:-80px; top:-100px; border-radius:50%; background:linear-gradient(145deg,#ffb3ae,#ff7288); opacity:.35; }
.hero::after { content:""; position:absolute; width:160px; height:160px; right:220px; bottom:-100px; border-radius:50%; background:#ffd6cd; opacity:.55; }
.hero > * { position:relative; z-index:2; }
.hero h1 { font-size:clamp(30px,4.6vw,54px); line-height:1.22; letter-spacing:-.045em; margin:0 0 14px; }
.hero p:not(.eyebrow) { margin:0; max-width:650px; color:var(--muted); line-height:1.8; }
.hero-add { flex:0 0 auto; display:flex; align-items:center; gap:12px; min-width:215px; padding:14px; border:0; background:#241f1d; color:white; border-radius:18px; box-shadow:0 12px 28px rgba(36,31,29,.18); text-align:left; }
.hero-add-icon { width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:var(--brand);font-size:26px; }
.hero-add strong,.hero-add small { display:block; }
.hero-add small { color:#cfc9c6; margin-top:2px; font-size:10px; }

.content-shell { width:min(1180px,calc(100% - 44px)); margin:0 auto 110px; }
.section-heading { display:flex; justify-content:space-between; align-items:end; gap:20px; padding:22px 2px; }
.section-heading h2 { margin:0; font-size:28px; letter-spacing:-.035em; }
.view-tools { display:flex; gap:10px; align-items:center; }
.search-box { min-width:290px; display:flex; align-items:center; gap:8px; padding:0 12px; background:white; border:1px solid var(--line); border-radius:14px; }
.search-box input { border:0; box-shadow:none!important; padding:11px 0; background:transparent; }
.secondary-button { border:1px solid var(--line); border-radius:14px; background:white; padding:11px 15px; font-weight:700; color:#625853; }

.timeline-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
.meal-card { min-width:0; background:white; border:1px solid var(--line); border-radius:24px; overflow:hidden; box-shadow:var(--shadow-soft); transition:.18s ease; }
.meal-card:hover { transform:translateY(-3px); box-shadow:var(--shadow); }
.meal-cover { position:relative; aspect-ratio:4/3; overflow:hidden; background:#f3ece9; cursor:pointer; }
.meal-cover img { width:100%; height:100%; object-fit:cover; display:block; transition:.25s ease; }
.meal-card:hover .meal-cover img { transform:scale(1.025); }
.photo-count { position:absolute; right:12px; bottom:12px; padding:6px 9px; border-radius:999px; background:rgba(28,24,23,.72); color:white; font-size:10px; backdrop-filter:blur(10px); }
.meal-body { padding:18px; }
.meal-meta { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--muted); font-size:10px; }
.meal-card h3 { margin:8px 0 7px; font-size:19px; line-height:1.45; letter-spacing:-.02em; }
.meal-note { color:#766c67; font-size:12px; line-height:1.7; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:40px; }
.meal-actions { display:flex; justify-content:space-between; align-items:center; margin-top:15px; }
.view-entry { border:0; background:var(--brand-soft); color:var(--brand-deep); border-radius:999px; padding:8px 12px; font-size:11px; font-weight:800; }
.delete-entry { border:0; background:transparent; color:#a09691; padding:7px; font-size:11px; }
.delete-entry:hover { color:#c93050; }

.state-card,.empty-state { min-height:300px; border:1px dashed #dfd2cc; border-radius:24px; display:grid; place-items:center; align-content:center; text-align:center; color:var(--muted); background:rgba(255,255,255,.55); }
.spinner { width:30px;height:30px;border-radius:50%;border:3px solid #f5d8dd;border-top-color:var(--brand);animation:spin .7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.empty-icon { width:58px;height:58px;border-radius:20px;background:var(--brand-soft);color:var(--brand);display:grid;place-items:center;font-size:28px;margin-bottom:8px; }
.empty-state h3 { margin:4px 0; color:var(--ink); }
.empty-state p { margin:4px 0 18px; }

.bottom-nav { display:none; }

/* Modal */
.modal { border:0; padding:0; background:transparent; max-width:none; max-height:none; width:100%; height:100%; }
.modal::backdrop { background:rgba(35,28,25,.45); backdrop-filter:blur(8px); }
.modal-card { width:min(720px,calc(100% - 28px)); max-height:calc(100vh - 40px); overflow:auto; margin:20px auto; background:#fffdfc; border-radius:28px; box-shadow:0 32px 90px rgba(33,24,21,.24); padding:26px; }
.modal-header { display:flex; justify-content:space-between; align-items:start; gap:20px; margin-bottom:18px; }
.modal-header h2 { margin:0; font-size:28px; }
.icon-button { border:0; background:#f4efec; color:#625853; min-width:38px; height:38px; border-radius:12px; font-weight:800; }
.photo-actions { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.photo-action { min-height:98px; border:1px solid var(--line); border-radius:20px; padding:16px; display:flex; align-items:center; gap:13px; text-align:left; background:white; }
.photo-action:hover { border-color:#ffb2bd; background:#fff9fa; }
.action-icon { width:44px;height:44px;border-radius:15px;display:grid;place-items:center;background:var(--brand-soft);color:var(--brand-deep); }
.photo-action strong,.photo-action small { display:block; }
.photo-action small { color:var(--muted); margin-top:3px; font-size:10px; }
.preview-area { margin-top:18px; padding:15px; border-radius:20px; background:#f8f3f0; }
.preview-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; font-size:12px; font-weight:700; }
.preview-heading button { border:0; background:transparent; color:#b83852; font-size:11px; }
.preview-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.preview-item { position:relative; aspect-ratio:1; border-radius:14px; overflow:hidden; background:#eadfd9; }
.preview-item img { width:100%;height:100%;object-fit:cover;display:block; }
.preview-item button { position:absolute;right:5px;top:5px;width:26px;height:26px;border:0;border-radius:50%;background:rgba(35,30,28,.72);color:white; }
.form-grid { display:grid; grid-template-columns:1fr; gap:14px; margin-top:20px; }
.form-grid label.wide { grid-column:1/-1; }
.form-grid em { font-style:normal; color:#a39791; font-weight:500; }
textarea { resize:vertical; min-height:98px; }
.modal-footer { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:20px; }
.upload-status { color:var(--muted); font-size:11px; line-height:1.6; }

.detail-card { position:relative; padding:0; overflow:hidden; }
.detail-close { position:absolute; top:14px; right:14px; z-index:3; background:rgba(255,255,255,.9); }
.detail-gallery { display:grid; grid-template-columns:2fr 1fr; gap:3px; max-height:430px; overflow:hidden; background:#eee6e2; }
.detail-gallery img { width:100%;height:100%;object-fit:cover;min-height:210px; }
.detail-gallery img:first-child { grid-row:span 2; }
.detail-info { padding:26px; }
.detail-info h2 { font-size:30px; margin:0 0 8px; }
.detail-date { color:var(--muted); font-size:12px; }
.detail-note { white-space:pre-wrap; line-height:1.9; color:#635a56; margin-top:18px; }
.detail-delete { margin-top:22px; border:0; background:#fff0f3; color:#c43150; border-radius:12px; padding:11px 14px; font-weight:700; }

.toast { position:fixed; left:50%; bottom:28px; transform:translate(-50%,20px); z-index:100; max-width:min(520px,calc(100% - 30px)); background:#282321; color:white; border-radius:14px; padding:12px 16px; font-size:12px; opacity:0; pointer-events:none; transition:.25s ease; box-shadow:var(--shadow); }
.toast.show { opacity:1; transform:translate(-50%,0); }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns:1fr; min-height:auto; max-width:560px; }
  .auth-visual { display:none; }
  .auth-panel { padding:38px 28px; }
  .mobile-brand { display:flex; }
  .timeline-grid { grid-template-columns:repeat(2,1fr); }
  .hero { align-items:start; padding:32px; }
  .hero-add { min-width:auto; }
}

@media (max-width: 640px) {
  body { padding-bottom:74px; }
  .topbar { height:66px; padding:0 16px; }
  .brand-mark { width:38px;height:38px;border-radius:13px; }
  .brand small { display:none; }
  .brand strong { font-size:17px; }
  .compact-add { display:none; }
  .profile-menu { right:14px; top:62px; }
  .hero { width:calc(100% - 24px); margin:20px auto 10px; min-height:230px; padding:24px; border-radius:27px; align-items:start; flex-direction:column; justify-content:space-between; }
  .hero h1 { font-size:34px; }
  .hero p:not(.eyebrow) { font-size:12px; }
  .desktop-break { display:none; }
  .hero-add { width:100%; }
  .content-shell { width:calc(100% - 24px); margin-bottom:28px; }
  .section-heading { align-items:stretch; flex-direction:column; padding-top:20px; }
  .view-tools { width:100%; }
  .search-box { min-width:0; flex:1; }
  .secondary-button { display:none; }
  .timeline-grid { grid-template-columns:1fr; gap:14px; }
  .meal-card { display:grid; grid-template-columns:128px 1fr; border-radius:20px; }
  .meal-cover { aspect-ratio:auto; min-height:168px; }
  .meal-body { padding:14px; min-width:0; }
  .meal-card h3 { font-size:16px; }
  .meal-note { font-size:11px; -webkit-line-clamp:2; min-height:36px; }
  .photo-count { right:7px; bottom:7px; }
  .bottom-nav { position:fixed; left:50%; bottom:10px; transform:translateX(-50%); z-index:30; width:calc(100% - 24px); height:62px; display:grid; grid-template-columns:1fr 1fr 1fr; align-items:center; padding:6px; border:1px solid rgba(235,226,221,.9); border-radius:22px; background:rgba(255,255,255,.92); backdrop-filter:blur(18px); box-shadow:0 12px 40px rgba(60,40,34,.15); }
  .bottom-nav button { height:50px; border:0; border-radius:16px; background:transparent; color:#8e817c; display:grid; place-items:center; align-content:center; gap:2px; }
  .bottom-nav button.active { color:var(--brand-deep); background:#fff1f4; }
  .bottom-nav button span { font-size:18px; }
  .bottom-nav button small { font-size:9px; font-weight:700; }
  .bottom-nav .nav-add { color:white; background:linear-gradient(135deg,var(--brand),var(--brand-deep)); margin:-16px 10px 0; height:54px; box-shadow:0 10px 24px rgba(235,63,97,.22); }
  .modal-card { width:100%; max-height:90vh; margin:10vh 0 0; border-radius:28px 28px 0 0; min-height:calc(90vh); padding:20px; }
  .photo-actions { grid-template-columns:1fr 1fr; }
  .photo-action { min-height:90px; padding:12px; align-items:flex-start; flex-direction:column; gap:8px; }
  .action-icon { width:36px;height:36px;border-radius:12px; }
  .preview-grid { grid-template-columns:repeat(3,1fr); }
  .modal-footer { position:sticky; bottom:-20px; background:#fffdfc; padding:12px 0 20px; flex-direction:column; align-items:stretch; }
  .detail-card { padding:0; }
  .detail-gallery { max-height:360px; }
  .detail-info { padding:22px; }
  .detail-info h2 { font-size:25px; }
}
