:root{--paper:#f7f5ef;--card:#fff;--ink:#262a24;--muted:#62695e;--line:#e4e7df;--olive:#65744f;--stage:#f4f3ef;--pink:#f6e7e5;color-scheme:light;font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Microsoft YaHei',sans-serif;font-synthesis:none}
*{box-sizing:border-box}
body{margin:0;background:var(--paper);color:var(--ink);font-size:14px;-webkit-font-smoothing:antialiased;min-height:100dvh}
button,input{font:inherit;color:inherit}
button{border:0;cursor:pointer;background:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:transform 120ms ease,background-color 120ms ease}
button:active:not(:disabled){transform:scale(.97)}
button:disabled{cursor:default;opacity:.48}
button:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--olive);outline-offset:3px}
button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
a{color:var(--olive)}
[hidden]{display:none!important}
h1,h2,h3,p{margin:0}
input{max-width:100%;border:1px solid #b9c0b2;border-radius:10px;padding:12px;background:#fff}
label{display:block}
label input{display:block;width:100%;margin-top:8px}
.primary-button,.secondary-button{min-height:44px;padding:10px 14px;border-radius:12px;font-weight:500}
.primary-button{background:var(--olive);color:#fff}
.secondary-button{background:#f1f3ed;color:#414d35;border:1px solid #e2e7da}
.text-button{min-height:44px;padding:10px 4px;font-size:13px;color:var(--muted)}
.core-header{max-width:640px;margin:auto;display:flex;justify-content:space-between;align-items:center;padding:calc(12px + env(safe-area-inset-top)) 16px 8px;gap:16px}
.core-header h1{font-size:16px;font-weight:600}
.more-button{width:44px;height:44px;display:grid;place-items:center;border-radius:50%;color:var(--ink)}
.core-main{max-width:640px;padding:8px 16px calc(24px + env(safe-area-inset-bottom));margin:auto}
.core-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:stretch}
.meal-card{min-width:0;padding:8px;background:var(--card);border:1px solid var(--line);border-radius:20px;box-shadow:0 2px 6px #26301c03;display:flex;flex-direction:column}
.card-identity{height:36px;display:flex;align-items:center;gap:7px;padding:0 4px 8px}
.identity-mark{width:24px;height:24px;border-radius:50%;background:#e9efdf;display:grid;place-items:center;color:#46553a;font-size:10px}
.identity-mark.partner{background:var(--pink);color:#83534b}
.card-identity h2{font-size:12px;font-weight:500}
.card-stage{position:relative;display:block;width:100%;aspect-ratio:1;overflow:hidden;border-radius:14px;background:var(--stage);padding:0;touch-action:pan-y;user-select:none;isolation:isolate}
.card-stage:disabled{opacity:1;color:var(--muted)}
.card-stage img{width:100%;height:100%;display:block;object-fit:contain;-webkit-user-drag:none;pointer-events:none}
.empty-meal{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:12px;position:absolute;inset:0;font-size:12px;color:var(--muted)}
.empty-meal svg{width:56px;height:56px;fill:none;stroke:#818a76;stroke-width:1.25;stroke-linecap:round}
.card-meta{padding:12px 4px 0;min-width:0}
.card-name{font-size:12px;font-weight:400;line-height:18px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.card-calories{height:28px;display:flex;gap:4px;align-items:baseline;margin-top:5px;white-space:nowrap;font-variant-numeric:tabular-nums}
.calorie-number{font-size:20px;font-weight:500;letter-spacing:-.5px}
.calorie-unit{font-size:11px;color:var(--muted)}
.calorie-status{font-size:13px;font-weight:500;line-height:26px;color:var(--muted)}
.card-pager{display:flex;height:44px;align-items:center;justify-content:space-between;margin:0 0 4px;color:var(--muted)}
.card-pager.single{visibility:hidden}
.card-pager button{width:44px;height:44px;display:grid;place-items:center;border-radius:10px}
.page-count{font-size:10px;line-height:1;font-variant-numeric:tabular-nums}
.card-action{width:100%;margin-top:auto;min-height:44px;font-size:12px;border-radius:12px}
.core-total{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px;padding:0 6px;font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}
.core-total>span{display:flex;justify-content:space-between;align-items:baseline;gap:4px}
.total-person{font-size:10px}
.sticker{position:absolute;transform:translate(-50%,-50%);z-index:2;pointer-events:none;user-select:none;line-height:1}
.sticker-glyph{display:block;font-size:22px;max-width:54px;text-align:center;overflow-wrap:anywhere;line-height:1.05;text-shadow:0 1px 2px #fff8}
.sticker:has(.sticker-glyph){pointer-events:auto}
#reaction-canvas .sticker-glyph{font-size:28px;max-width:80px}
.sticker-glyph.sticker-word{font-size:11px;max-width:48px;white-space:nowrap}
#reaction-canvas .sticker-word{font-size:15px;max-width:72px}
dialog{border:1px solid var(--line);border-radius:24px;background:var(--card);color:var(--ink);padding:20px;max-width:520px;width:calc(100% - 32px);max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior:contain;box-shadow:0 12px 70px #151d1a1c}
dialog::backdrop{background:#20281b55}
dialog[open]{animation:panel-in 220ms ease-out}
dialog[open]::backdrop{animation:backdrop-in 220ms ease-out}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.dialog-heading h2{font-size:17px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
.close-dialog{font-size:26px;width:44px;height:44px;border-radius:50%;flex:none;background:#f4f5f1;line-height:1}
.upload-zone{position:relative;min-height:148px;border:1px dashed #a9b59b;border-radius:16px;background:#f5f7f0;display:grid;place-items:center;overflow:hidden;color:#45513b}
.upload-zone input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;margin:0}
.upload-zone strong{font-size:14px;font-weight:500}
.preview-thumb{position:relative;aspect-ratio:1;background:var(--stage);border-radius:16px;overflow:hidden}
.preview-thumb img{width:100%;height:100%;object-fit:contain;display:block}
.remove-photo{position:absolute;right:8px;top:8px;width:44px;height:44px;border-radius:50%;font-size:24px;background:#fff;box-shadow:0 1px 5px #0001}
.reuse-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px;font-size:12px}
.reuse-row .text-button{text-decoration:underline;text-underline-offset:3px}
#publish{width:100%;margin-top:16px}
#upload-status,#settings-status{font-size:12px;line-height:1.6;color:#8a3d29;padding:12px 0 0}
#secondary-view h2{font-size:16px;font-weight:600;margin:24px 0 16px}
#account-name{font-size:13px;color:var(--muted);margin-bottom:16px}
.history-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.history-item{text-align:left;border:1px solid var(--line);border-radius:16px;padding:8px;min-width:0;background:var(--card)}
.history-art{height:150px;background:var(--stage);border-radius:10px;overflow:hidden}
.history-art img{width:100%;height:100%;object-fit:contain;display:block}
.history-item h3{font-size:12px;font-weight:500;line-height:1.5;margin-top:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-item p{font-size:11px;color:var(--muted);margin:4px 0;line-height:1.5}
.settings-buttons{display:flex;gap:8px;flex-wrap:wrap}
.settings-buttons button{font-size:12px}
.device-row{display:flex;justify-content:space-between;gap:12px;align-items:center;border-bottom:1px solid var(--line);min-height:56px;font-size:12px}
.device-row span{overflow-wrap:anywhere}
#devices{margin-top:16px}
#logout{margin-top:16px}
#history-more{display:block;margin:16px auto}
.detail-kcal{font-size:15px;color:var(--muted);margin:-8px 0 16px;font-variant-numeric:tabular-nums}
.detail-photo{position:relative;width:100%;min-height:80px;border-radius:14px;background:var(--stage);overflow:hidden;touch-action:pan-y}
.detail-photo img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;-webkit-user-drag:none}
.detail-actions{display:flex;gap:16px;margin-top:12px}
.sticker-picker{display:flex;justify-content:center;gap:4px;margin-top:16px;flex-wrap:wrap}
.sticker-picker button{min-width:44px;min-height:44px;padding:8px;border-radius:12px;font-size:22px}
.sticker-picker button:last-child{font-size:12px}
.sticker-picker button.selected{background:var(--pink);outline:1px solid #d7b4ad}
#reuse-list{display:grid;gap:8px}
#reuse-list .history-item{padding:12px}
#invite-dialog p{font-size:12px;line-height:1.6;color:var(--muted);margin:12px 0}
#invite-link{width:100%;font-size:12px}
#copy-invite{margin-top:12px}
#binding-panel{max-width:440px;margin:12dvh auto;padding:24px}
#binding-panel h1{font-size:22px;margin-bottom:16px}
#binding-panel p{font-size:14px;line-height:1.7;color:var(--muted);margin-bottom:20px}
#binding-form label{font-size:13px}
#binding-submit{width:100%;margin-top:16px}
#meal-notice{position:fixed;top:calc(12px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:5;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px 16px;font-size:12px;min-height:44px;box-shadow:0 4px 18px #26301c12}
#toast{position:fixed;bottom:calc(24px + env(safe-area-inset-bottom));left:50%;transform:translate(-50%,8px);opacity:0;pointer-events:none;z-index:15;font-size:12px;line-height:1.5;max-width:calc(100% - 32px);width:max-content;padding:12px 16px;background:#30372c;color:#fff;border-radius:12px;transition:opacity 180ms ease,transform 180ms ease}
#toast.visible{opacity:1;transform:translate(-50%,0)}
.reaction-wait{opacity:.6;pointer-events:none}
body:has(dialog[open]){overflow:hidden}
@keyframes panel-in{from{opacity:0;transform:translateY(8px)}
to{opacity:1;transform:translateY(0)}
}
@keyframes backdrop-in{from{opacity:0}
to{opacity:1}
}
@media(max-width:600px){dialog{margin:auto 0 0;bottom:0;top:auto;width:100%;max-width:none;max-height:calc(100dvh - env(safe-area-inset-top) - 16px);border-radius:24px 24px 0 0;padding:20px 16px calc(20px + env(safe-area-inset-bottom))}
.history-art{height:140px}
.card-calories{gap:3px}
.calorie-number{font-size:19px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
button:active:not(:disabled){transform:none}
}

