:root {
  --gutter: 12px; --r-surface: 20px; --r-tail: 8px; --r-control: 10px;
  --paper: #f4f2eb;
  --card: #fffefa;
  --ink: #20241f;
  --muted: #70766f;
  --line: #dcdcd2;
  --green: #3e684f;
  --green-dark: #294837;
  --sage: #dfe8dc;
  --lime: #b8d36c;
  --amber: #c98b37;
  --red: #a84b43;
  --shadow: 0 9px 32px rgba(42, 51, 40, .075);
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100dvh; font-size: 16px; line-height: 1.6; line-break: strict; background: var(--paper); padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
button, input, select, textarea { color: inherit; font: inherit; }
button, label[for] { cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
main { position: relative; z-index: 2; width: min(100%, 640px); margin: 0 auto; }
.view { display: none; min-height: calc(100dvh - 70px - env(safe-area-inset-bottom)); }
.view.active { display: block; animation: appear .16s ease; }
@keyframes appear { from { opacity: 0; transform: translateY(3px); } }
.hidden { display: none !important; }
.wordmark { display: inline-flex; align-items: baseline; gap: 8px; font: italic 700 26px/1 Georgia, "Yu Mincho", serif; letter-spacing: -.04em; color: var(--ink); }
.wordmark .yomi { font: 600 11px/1 -apple-system, "Hiragino Sans", sans-serif; font-style: normal; letter-spacing: .12em; color: var(--muted); }
.user-pill { height: 32px; display: inline-grid; align-content: center; padding: 0 14px; border-radius: 999px; color: var(--green-dark); font-size: 13px; font-weight: 800; background: rgba(255,255,255,.36); border: 1px solid rgba(255,255,255,.6); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 18px rgba(30,40,30,.10); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.compact { margin: 5px 0 0; font-size: 14px; }
.eyebrow, .section-number { color: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .18em; margin: 0 0 4px; }
h1 { font: 700 28px/1.15 Georgia, "Yu Mincho", serif; letter-spacing: -.025em; margin: 0; }
h2 { font-size: 21px; line-height: 1.35; margin: 0; }
.nav-button, .icon-button { width: 44px; height: 44px; padding: 0; border-radius: 50%; color: var(--ink); font-size: 24px; line-height: 1; background: rgba(255,255,255,.36); border: 1px solid rgba(255,255,255,.6); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 18px rgba(30,40,30,.10); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.icon-button { font-size: 19px; }

/* Okudosan scene */
.scene { position: fixed; z-index: 0; inset: 0; width: 100%; height: 100dvh; overflow: hidden; pointer-events: none; opacity: 0; visibility: hidden; background: #e9e2d7; }
body.scene-active:not(.settings-open) .scene { opacity: 1; visibility: visible; }
.scene-plate, .scene-light, .scene-sun, .scene-lamp, .figure, .figure-image { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-plate { background: url("/static/scene/plate.jpg") center / cover no-repeat; }
.figure { z-index: 1; transform-origin: 25% 84.5%; transition: filter 60s linear; will-change: transform, filter; }
.figure-image { object-fit: cover; object-position: center; opacity: 0; transition: opacity 400ms ease; user-select: none; -webkit-user-drag: none; }
.figure-image.active { opacity: 1; }
.scene-light { z-index: 2; opacity: 0; background: linear-gradient(110deg, rgba(244,181,102,1) 0%, rgba(244,181,102,.54) 46%, rgba(244,181,102,0) 100%); mix-blend-mode: multiply; transition: opacity 60s linear, background 60s linear; }
.scene-sun { z-index: 3; opacity: 0; background: linear-gradient(118deg, transparent 15%, rgba(255,244,204,.9) 32%, rgba(255,255,255,.18) 48%, transparent 62%); mix-blend-mode: soft-light; transition: opacity 60s linear; }
.scene-lamp { z-index: 4; opacity: 0; background: radial-gradient(circle at 86% 82%, rgba(255,190,99,.78), rgba(255,175,76,.18) 25%, transparent 52%); mix-blend-mode: screen; transition: opacity 60s linear; }
.scene-morning .scene-light { opacity: .5; }
.scene-morning .scene-sun { opacity: .85; }
.scene-morning .figure { filter: brightness(1.06) drop-shadow(18px 14px 15px rgba(76,55,34,.28)); }
.scene-day .scene-light, .scene-day .scene-sun, .scene-day .scene-lamp { opacity: 0; }
.scene-day .figure { filter: drop-shadow(-4px 6px 6px rgba(51,43,34,.22)); }
.scene-evening .scene-light { opacity: .6; background: linear-gradient(110deg, rgba(190,105,38,.9) 0%, rgba(206,125,45,.58) 48%, rgba(206,125,45,.08) 100%); }
.scene-evening .figure { filter: sepia(.25) brightness(.95) drop-shadow(13px 8px 11px rgba(72,43,24,.34)); }
.scene-night .scene-light { opacity: .85; background: linear-gradient(110deg, rgba(72,91,112,.95) 0%, rgba(80,96,117,.72) 50%, rgba(70,83,105,.5) 100%); }
.scene-night .scene-lamp { opacity: .72; }
.scene-night .figure { filter: brightness(.62) contrast(1.05) drop-shadow(9px 10px 13px rgba(12,17,24,.58)); }
body.scene-initial .scene-light, body.scene-initial .scene-sun, body.scene-initial .scene-lamp, body.scene-initial .figure { transition: none; }
body.scene-effects-disabled .scene-light, body.scene-effects-disabled .scene-sun, body.scene-effects-disabled .scene-lamp { opacity: 0; transition: none; }
body.scene-effects-disabled .figure { filter: drop-shadow(-4px 6px 6px rgba(51,43,34,.22)); transition: none; }
body.scene-effects-disabled .figure-image { transition: none; }
@keyframes rock {
  0% { transform: rotate(0); }
  20% { transform: rotate(1.8deg); }
  40% { transform: rotate(-1.3deg); }
  60% { transform: rotate(.8deg); }
  80% { transform: rotate(-.4deg); }
  100% { transform: rotate(0); }
}
@keyframes idle { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
.figure.idle { animation: idle 2.4s ease-in-out infinite alternate; }
.figure.rock { animation: rock .9s cubic-bezier(.3,.7,.3,1) 1; }

/* Chat */
.chat-view { padding-bottom: calc(184px + env(safe-area-inset-bottom)); }
.chat-header { position: sticky; z-index: 8; top: 0; padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 8px; background: transparent; border: 0; }
.brand-row { height: 30px; display: flex; align-items: center; justify-content: flex-start; margin-bottom: 6px; }
.welcome-mark { margin-bottom: 14px; }
.welcome-mark .wordmark { font-size: 34px; }
.character-name { font: 700 24px/1.1 Georgia, "Yu Mincho", serif; letter-spacing: -.025em; }
.date-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; justify-items: center; text-align: center; }
.date-nav strong { display: block; font-size: 18px; }
.date-nav small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.chat-messages { display: flex; flex-direction: column; gap: 12px; padding: 12px var(--gutter) 168px; }
.message { display: flex; flex-direction: column; max-width: 100%; }
.message.user { align-items: flex-end; }
.message.assistant { align-items: flex-start; }
.message-label { color: var(--muted); font-size: 12px; margin: 0 8px 4px; }
.bubble { max-width: 86%; padding: 12px 16px; border-radius: var(--r-surface); font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; line-break: strict; }
.reply-copy { display: grid; gap: 8px; white-space: normal; line-break: strict; }
.reply-copy p { margin: 0; }
.num { white-space: nowrap; }
.user .bubble { color: #fff; background: rgba(62,104,79,.6); border: 1px solid rgba(255,255,255,.38); border-bottom-right-radius: var(--r-tail); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 8px 24px rgba(30,40,30,.14); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.assistant .bubble { border-bottom-left-radius: var(--r-tail); background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 0 rgba(0,0,0,.04), 0 10px 28px rgba(30,40,30,.12); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.bubble.error { color: #713b36; background: #faece9; border-color: #ecd0cb; }
.bubble .retry-button { display: block; margin-top: 8px; border: 0; border-radius: var(--r-control); background: #f0d8d4; color: var(--red); padding: 8px 12px; font-size: 14px; font-weight: 800; }
.photo-bubble { width: min(64vw, 260px); overflow: hidden; padding: 4px; background: rgba(255,255,255,.84); border: 1px solid rgba(255,255,255,.78); border-right: 3px solid rgba(62,104,79,.72); border-radius: 18px 18px 5px 18px; box-shadow: 0 5px 18px rgba(42,51,40,.07); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.photo-bubble img { display: block; width: 100%; max-height: 240px; aspect-ratio: 4 / 3; border-radius: 14px; object-fit: cover; background: #d9ded7; }
.photo-bubble p { margin: 7px 9px 8px; color: var(--ink); font-size: 16px; line-height: 1.65; }
.meal-card, .weight-card, .report-card { width: min(94%, 510px); border-radius: var(--r-surface) var(--r-surface) var(--r-surface) var(--r-tail); padding: 16px; background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 0 rgba(0,0,0,.04), 0 10px 28px rgba(30,40,30,.12); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.card-kicker { color: var(--green); font-size: 13px; font-weight: 850; letter-spacing: .05em; }
.meal-card h3, .weight-card h3, .report-card h3 { margin: 5px 0 2px; font-size: 20px; line-height: 1.6; }
.card-total { font: 700 22px/1.2 Georgia, serif; white-space: nowrap; }
.card-total small { color: var(--muted); font: 500 13px/1 sans-serif; }
.meal-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.meal-items { display: grid; gap: 7px; margin: 11px 0; }
.meal-item-line { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 8px; font-size: 14px; }
.meal-item-line span { min-width: 0; overflow-wrap: anywhere; }
.meal-item-line small { color: var(--muted); }
.low-confidence { color: var(--amber); font-weight: 800; }
.macro-line { color: var(--muted); font-size: 13px; letter-spacing: .03em; }
.card-assumption { margin: 10px 0 0; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; line-break: strict; }
.card-assumption b { margin-right: 7px; color: var(--ink); }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-actions button { border: 0; border-radius: var(--r-control); padding: 8px 12px; background: var(--sage); color: var(--green-dark); font-size: 14px; font-weight: 800; }
.card-actions .cancel { color: var(--red); background: #f5e4e1; }
.meal-card.deleted { box-shadow: none; opacity: .55; }
.meal-card.pending { opacity: .42; }
.weight-main { display: flex; justify-content: space-between; align-items: baseline; margin-top: 7px; }
.weight-number { font: 700 34px/1 Georgia, serif; }
.weight-number small { color: var(--muted); font: 500 14px sans-serif; }
.weight-meta { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.report-card { border-left: 3px solid var(--green); }
.report-card .reply-copy { margin-top: 10px; font-size: 16px; line-height: 1.85; }
.chat-empty { margin: 48px auto 0; width: 76%; font-size: 15px; line-height: 1.8; text-align: center; padding: 12px 16px; border-radius: var(--r-surface); color: #41463f; background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 0 rgba(0,0,0,.04), 0 10px 28px rgba(30,40,30,.12); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.typing::after { content: ""; display: inline-block; width: 6px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--green); animation: blink .75s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer-shell { position: fixed; z-index: 12; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(100%, 640px); padding: 0 var(--gutter); background: none; }
.quick-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 8px calc(var(--gutter) + 132px); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chips button { flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 999px; color: var(--green-dark); font-size: 13px; font-weight: 750; background: rgba(255,255,255,.36); border: 1px solid rgba(255,255,255,.6); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 18px rgba(30,40,30,.10); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.chat-form { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: end; gap: 6px; margin-left: 132px; padding: 6px; border-radius: 28px; background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 0 rgba(0,0,0,.04), 0 10px 28px rgba(30,40,30,.12); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.library-button { position: relative; overflow: hidden; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; color: var(--green-dark); background: var(--sage); line-height: 1; cursor: pointer; }
.library-button .icon { width: 22px; height: 22px; display: block; }
.library-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.chat-form textarea { width: 100%; min-height: 40px; max-height: 104px; border: 0; outline: 0; resize: none; background: none; padding: 9px 4px 8px; font-size: 17px; line-height: 1.4; }
.send-button { width: 40px; height: 40px; border: 0; border-radius: 50%; color: white; background: var(--green); font-size: 20px; font-weight: 800; }
.photo-preview { position: relative; width: 94px; margin: 0 0 2px 136px; }
.photo-preview img { display: block; width: 94px; height: 70px; border-radius: 12px; object-fit: cover; border: 2px solid white; box-shadow: var(--shadow); }
.photo-preview button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border: 0; border-radius: 50%; color: white; background: #252925; }
.past-notice { margin: 5px 2px 2px; padding: 9px 11px; border-radius: 11px; background: #ece8dd; color: #696354; font-size: 13px; line-height: 1.6; }

/* Dashboard */
.dashboard-view { padding: 0 16px 42px; }
.dashboard-header { position: sticky; top: 0; z-index: 7; display: flex; align-items: center; justify-content: space-between; height: calc(64px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); background: rgba(244,242,235,.94); backdrop-filter: blur(18px); }
.dashboard-date-row { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; text-align: center; padding: 13px 0 20px; }
.dashboard-date-row h1 { font-size: 25px; }
.card { padding: 16px; border: 1px solid rgba(210,210,198,.9); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.energy-card { padding: 19px; }
.energy-main { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; }
.big-number { font: 700 42px/1 Georgia, serif; letter-spacing: -.04em; }
.unit { color: var(--muted); font-size: 14px; }
.ring { --p: 0%; --ring-color: var(--green); position: relative; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: conic-gradient(var(--ring-color) var(--p), var(--sage) 0); }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--card); }
.ring span { z-index: 1; font-size: 16px; font-weight: 850; }
.nutrient-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.nutrient:last-child { grid-column: 1 / -1; }
.nutrient strong { display: flex; justify-content: space-between; font-size: 14px; }
.nutrient small { color: var(--muted); font-size: 12px; }
.bar { height: 5px; overflow: hidden; margin-top: 6px; border-radius: 6px; background: #e7e6dd; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 29px 2px 11px; }
.section-number { margin-bottom: 3px; font-size: 12px; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 9px; box-shadow: none; }
.inline-form label > span:first-child { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.input-with-unit { display: flex; align-items: baseline; gap: 2px; border-bottom: 1px solid var(--line); }
.input-with-unit input { width: 64px; padding: 5px 0; border: 0; outline: 0; background: none; font-size: 19px; font-weight: 750; }
.input-with-unit b { color: var(--muted); font-size: 12px; }
.small-button, .primary, .secondary, .danger { border: 0; border-radius: 11px; padding: 11px 13px; font-size: 14px; font-weight: 850; }
.small-button, .primary { color: white; background: var(--green); }
.secondary { color: var(--green-dark); background: var(--sage); }
.danger { color: var(--red); background: #f5e4e1; }
.wide { width: 100%; margin-top: 11px; padding-block: 13px; }
.range-row { display: flex; justify-content: flex-end; gap: 3px; margin: 10px 1px 7px; }
.range-row button { min-width: 45px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.range-row button.active { color: var(--green-dark); background: var(--sage); }
.chart-card { box-shadow: none; }
.chart-heading { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.chart { width: 100%; min-height: 150px; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.empty { padding: 23px 12px; border: 1px dashed #c6c8bd; border-radius: 14px; color: var(--muted); font-size: 14px; line-height: 1.7; text-align: center; }
.meal-list { display: grid; gap: 9px; }
.meal-entry { border: 1px solid var(--line); border-radius: 15px; background: var(--card); overflow: hidden; }
.meal-entry[open] { box-shadow: var(--shadow); }
.meal-entry > summary { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 13px; list-style: none; cursor: pointer; }
.meal-entry > summary::-webkit-details-marker { display: none; }
.meal-time { color: var(--green); font-size: 12px; font-weight: 850; text-align: center; }
.meal-time b { display: block; margin-top: 2px; color: var(--ink); font-size: 16px; }
.meal-names { min-width: 0; font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-macros { margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.meal-kcal { font: 700 20px Georgia, serif; white-space: nowrap; }
.meal-kcal small { color: var(--muted); font: 500 12px sans-serif; }
.meal-editor { padding: 3px 13px 14px; border-top: 1px solid var(--line); background: #fbfaf5; }
.editor-top { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 5px; margin-top: 11px; }
.field > span, .editor-item label > span { color: var(--muted); font-size: 12px; font-weight: 750; }
.field input, .field textarea, .field select, .editor-item input, .editor-item select { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: white; font-size: 16px; }
.field input:focus, .field textarea:focus, .field select:focus, .editor-item input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(62,104,79,.09); }
.editor-items { display: grid; gap: 9px; margin-top: 10px; }
.editor-item { padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.editor-item-head { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 6px; }
.editor-item-head button { align-self: end; height: 34px; border: 0; border-radius: 8px; color: var(--red); background: #f7e9e6; }
.editor-nutrients { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.editor-nutrients label { min-width: 0; }
.editor-nutrients input { margin-top: 3px; padding: 7px; font-size: 14px; }
.editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.add-item { width: 100%; margin-top: 9px; padding: 9px; border: 1px dashed #aeb9aa; border-radius: 9px; color: var(--green); background: transparent; font-size: 13px; font-weight: 800; }
.editing-note { margin: 10px 0 0; color: var(--amber); font-size: 12px; }
.weekly-list { display: grid; gap: 5px; margin-top: 8px; }
.week-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 10px 3px; border-bottom: 1px solid var(--line); font-size: 13px; }
.week-row b { font-size: 16px; }
.report-list { display: grid; gap: 8px; }
.report-entry { border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.report-entry summary { display: flex; justify-content: space-between; padding: 13px; list-style: none; cursor: pointer; font-size: 16px; font-weight: 800; }
.report-entry summary::-webkit-details-marker { display: none; }
.report-body { padding: 0 13px 13px; color: #41463f; font-size: 14px; line-height: 1.85; }
.report-body .reply-copy { margin-top: 8px; }
.report-metrics { margin-bottom: 8px; color: var(--green); font-weight: 800; }
.report-body button { margin-top: 10px; border: 0; background: none; color: var(--green); font-size: 13px; font-weight: 800; }

/* Shared overlays and settings */
.tabbar { position: fixed; z-index: 20; left: var(--gutter); right: var(--gutter); bottom: calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(2, 1fr); height: 64px; padding: 6px; border-radius: 32px; background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 0 rgba(0,0,0,.04), 0 10px 28px rgba(30,40,30,.12); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.tabbar button { position: relative; display: grid; place-items: center; gap: 2px; margin: 0; padding: 4px 8px; border: 0; border-radius: 26px; background: none; color: #4a504a; font-size: 12px; font-weight: 800; transition: background .2s, color .2s, box-shadow .2s; }
.tabbar button.active { background: rgba(255,255,255,.62); color: var(--green-dark); box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(0,0,0,.04), 0 4px 14px rgba(30,40,30,.12); }
.tabbar button.active .tab-label { font-weight: 850; }
.tab-icon { display: block; height: 24px; line-height: 0; }
.tab-icon .icon { width: 24px; height: 24px; }
.icon { display: inline-block; vertical-align: middle; }
.unread-dot { position: absolute; top: 6px; left: calc(50% + 16px); width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: var(--amber); }
.overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.welcome-card { width: min(100%, 380px); text-align: center; }
.welcome-card h1 { margin: 4px 0 12px; }
.welcome-card p { font-size: 16px; line-height: 1.8; }
.logo-mark { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 24px; border-radius: 22px; color: white; background: var(--green); font: italic 700 43px Georgia, serif; }
.user-choices { display: grid; gap: 10px; margin-top: 23px; }
.user-choices button { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 850; box-shadow: var(--shadow); }
.user-choices button:first-child { color: white; border-color: var(--green); background: var(--green); }
dialog { width: 100%; max-width: 620px; height: 100%; max-height: 100%; margin: 0 0 0 auto; padding: 0; border: 0; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: rgba(20, 30, 22, .38); }
.dialog-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(18px + env(safe-area-inset-top)) 18px 12px; background: rgba(244,242,235,.94); backdrop-filter: blur(15px); }
.settings-body { padding: 2px 17px 42px; }
.settings-body section, .settings-body > form { padding: 18px 0; border-bottom: 1px solid var(--line); }
.settings-body h2 { margin-bottom: 11px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); padding: 3px; border-radius: 11px; background: #e5e4dc; }
.segmented button { padding: 9px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 800; }
.segmented button.active { background: white; box-shadow: 0 1px 6px rgba(0,0,0,.09); }
.settings-body details { margin-top: 14px; }
.settings-body summary { color: var(--green); font-size: 14px; font-weight: 800; }
.target-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.target-grid label { color: var(--muted); font-size: 12px; }
.target-grid input { display: block; width: 100%; margin-top: 3px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; }
.toggle-row span { display: grid; gap: 3px; font-size: 14px; }
.toggle-row small { color: var(--muted); }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--green); }
.medical-box { padding: 13px; border-radius: 11px; color: #6c6554; background: #ebe7dc; font-size: 12px; line-height: 1.75; }
#toast { position: fixed; z-index: 200; left: 50%; bottom: calc(81px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 11px; max-width: 92vw; padding: 10px 14px; border-radius: 22px; color: white; background: #222722; box-shadow: 0 7px 25px rgba(0,0,0,.2); font-size: 14px; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: .2s; white-space: nowrap; }
#toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#toast button { padding: 2px 0; border: 0; color: #d9ee9a; background: none; font-size: 14px; font-weight: 850; }
@media (min-width: 700px) {
  dialog { box-shadow: -20px 0 60px rgba(0,0,0,.15); }
  .dashboard-view { padding-inline: 22px; }
}


/* 送信中・考え中のフィードバック */
.send-button { position: relative; display: grid; place-items: center; }
.send-button .send-spinner { display: none; width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
.send-button.sending .send-glyph { display: none; }
.send-button.sending .send-spinner { display: block; }
.send-button:disabled { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }
.message.pending .bubble { opacity: .65; }
.message.pending .message-label { color: var(--amber); }
.bubble.thinking { display: inline-flex; gap: 6px; align-items: center; min-width: 64px; min-height: 44px; padding: 14px 18px; }
.bubble.thinking span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); opacity: .35; animation: blink 1.2s infinite ease-in-out; }
.bubble.thinking span:nth-child(2) { animation-delay: .2s; }
.bubble.thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .bubble.thinking span, .send-button .send-spinner { animation: none; } .bubble.thinking span { opacity: .7; } }

body.scene-night.scene-active .character-name,
body.scene-night.scene-active .chat-header .date-nav strong,
body.scene-night.scene-active .chat-header .date-nav small,
body.scene-night.scene-active .chat-messages .message-label { color: #f1ede2; }
body.scene-night.scene-active .chat-header { background: transparent; border: 0; }
body.scene-night.scene-active .chat-header .nav-button { color: #f1ede2; border-color: rgba(241,237,226,.35); background: rgba(40,47,54,.48); }

@media (prefers-reduced-motion: reduce) {
  .figure, .figure.idle, .figure.rock { animation: none !important; transform: none !important; }
  .figure-image { transition: none; }
}

/* Public login, invitation, legal, and account controls */
.public-entry { display: grid; min-height: 100dvh; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 15% 10%, rgba(184,211,108,.28), transparent 35%), radial-gradient(circle at 90% 85%, rgba(62,104,79,.18), transparent 42%), var(--paper); }
.entry-shell { display: grid; place-items: center; width: 100%; max-width: none; }
.entry-card { width: min(100%, 420px); padding: 30px 24px; border: 1px solid rgba(255,255,255,.74); border-radius: 28px; background: rgba(255,255,255,.5); box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 22px 60px rgba(36,52,40,.14); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.entry-wordmark { margin-bottom: 30px; font-size: 36px; }
.entry-card h1 { margin-bottom: 14px; font-size: 31px; line-height: 1.3; }
.entry-copy { margin: 0 0 24px; color: #4f564f; line-height: 1.8; }
.google-login { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; box-shadow: var(--shadow); font-weight: 850; text-decoration: none; }
.google-login span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: white; background: var(--green); font: 700 15px Georgia, serif; }
.consent-copy { margin: 15px 6px 0; color: var(--muted); font-size: 12px; line-height: 1.75; text-align: center; }
.consent-copy a, .entry-secondary-link { color: var(--green-dark); }
.dev-login { display: none; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.dev-login.dev-login-visible { display: block; }
.entry-secondary-link { display: block; margin-top: 20px; font-size: 14px; font-weight: 750; text-align: center; }
.form-error { min-height: 26px; margin: 10px 0 0; color: var(--red); font-size: 14px; }
.terms-page { padding: max(28px, env(safe-area-inset-top)) 18px max(42px, env(safe-area-inset-bottom)); }
.legal-shell { width: min(100%, 720px); }
.legal-shell .entry-wordmark { display: flex; width: max-content; margin-top: 28px; }
.legal-shell h1 { margin: 0 0 8px; font-size: 32px; }
.legal-shell section { padding: 22px 0; border-top: 1px solid var(--line); }
.legal-shell section:first-of-type { margin-top: 26px; }
.legal-shell section p { margin: 9px 0 0; line-height: 1.9; }
.account-settings .account-link { display: block; margin-top: 10px; text-align: center; text-decoration: none; }
.confirm-dialog { width: min(calc(100% - 32px), 430px); height: auto; margin: auto; border-radius: 24px; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.confirm-card { padding: 24px; }
.confirm-card h1 { margin-bottom: 12px; }
.confirm-card p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; margin-top: 20px; }
.confirm-actions button { padding: 12px 10px; }

/* --- 2026-09-10: 置物は元写真に焼き込み(固定)。切り抜きレイヤーは使わない --- */
.figure { display: none !important; }
.date-nav > div { padding: 6px 20px; border-radius: 999px; min-height: 44px; display: grid; align-content: center; background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.62); box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -1px 0 rgba(0,0,0,.04), 0 10px 28px rgba(30,40,30,.12); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
.date-nav strong { font-size: 17px; }
.date-nav small { font-size: 11px; }
