@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;700&display=swap");

:root {
  --p50: #F6F5FE; --p100: #EEEDFE; --p200: #CECBF6; --p300: #AFA9EC;
  --p400: #7F77DD; --p600: #534AB7; --p800: #3C3489; --p900: #26215C;
  --bg: #FBFAFF; --card: #FFFFFF; --text: #26215C; --muted: #6E6A9A;
  --line: #E6E3FA; --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Rubik", "Google Sans", system-ui, sans-serif; }
body { min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select { font: inherit; color: var(--text); }
h1, h2, h3 { margin: 0; font-weight: 500; }

/* ---------- shell ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 6px; }
.top h1 { font-size: 20px; }
.top .sub { font-size: 13px; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; color: var(--p600); background: var(--p100); }
main { padding: 8px 16px calc(96px + var(--safe-b)); max-width: 520px; margin: 0 auto; }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 8px 6px calc(8px + var(--safe-b)); backdrop-filter: blur(8px); z-index: 10; }
nav.tabs a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border-radius: 12px; }
nav.tabs a .i { font-size: 22px; line-height: 1; filter: grayscale(1) opacity(.6); }
nav.tabs a.on { color: var(--p600); font-weight: 500; }
nav.tabs a.on .i { filter: none; }

/* ---------- common ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.chips { display: flex; gap: 10px; }
.chip { flex: 1; background: var(--p100); color: var(--p800); border-radius: 14px; padding: 10px 12px; }
.chip .l { font-size: 12px; color: var(--p600); }
.chip .v { font-size: 17px; font-weight: 500; margin-top: 2px; }
.bar { height: 6px; background: var(--p200); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--p600); border-radius: 3px; transition: width .4s ease; }
.btn { background: var(--p100); color: var(--p800); border-radius: 14px; padding: 11px 16px; font-weight: 500; }
.btn.main { background: var(--p600); color: #fff; }
.btn.ghost { background: transparent; color: var(--p600); }
.btn:active, .chip:active, .food:active { transform: scale(.97); }
.section-t { font-size: 15px; font-weight: 500; margin: 22px 2px 10px; display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .n { font-size: 15px; }
.row .k { color: var(--muted); font-size: 14px; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.field input, .field select { border: 1px solid var(--p200); border-radius: 12px; padding: 11px 12px; font-size: 16px; background: #fff; }
.field input:focus { outline: 2px solid var(--p300); border-color: var(--p400); }
.err { color: var(--p800); background: var(--p100); border-radius: 10px; padding: 8px 10px; font-size: 14px; }

/* ---------- toast & sheet ---------- */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--p900); color: #fff; border-radius: 999px; padding: 10px 14px 10px 18px; font-size: 14px; display: flex; gap: 12px; align-items: center; z-index: 30; box-shadow: 0 6px 20px rgba(38,33,92,.25); animation: up .2s ease; white-space: nowrap; }
.toast button { color: var(--p200); font-weight: 500; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 10px); } }
.sheet-bg { position: fixed; inset: 0; background: rgba(38,33,92,.35); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: #fff; width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); max-height: 88dvh; overflow: auto; animation: slide .2s ease; }
.sheet h3 { font-size: 18px; margin-bottom: 14px; }
.sheet .opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sheet .opts .btn { flex: 1 1 30%; }
.sheet .opts .btn.on { background: var(--p600); color: #fff; }
.sheet .actions { display: flex; gap: 8px; margin-top: 8px; }
.sheet .actions .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(40px); } }

/* ---------- cup ---------- */
.cup-wrap { display: flex; flex-direction: column; align-items: center; margin: 18px 0 6px; }
.cup { width: 150px; height: 190px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cup:active { transform: scale(.97); }
.cup .water { transition: y .45s cubic-bezier(.3,1.3,.5,1), height .45s cubic-bezier(.3,1.3,.5,1); }
.cup-btns { display: flex; gap: 10px; margin-top: 12px; }
.party { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.party i { position: absolute; bottom: 30%; width: 12px; height: 12px; border-radius: 50%; background: var(--p300); animation: pop 1.4s ease-out forwards; }
@keyframes pop { to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }

/* ---------- food grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.food { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; min-height: 132px; }
.food .pic { width: 64px; height: 64px; border-radius: 14px; background: var(--p100); display: grid; place-items: center; font-size: 34px; overflow: hidden; }
.food .pic img { width: 100%; height: 100%; object-fit: cover; }
.food .nm { font-size: 14px; font-weight: 500; line-height: 1.25; }
.food .kc { font-size: 12px; color: var(--muted); }
.food .more { position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); font-size: 18px; }
.food .tag { position: absolute; top: 8px; right: 8px; font-size: 10px; background: var(--p100); color: var(--p600); border-radius: 6px; padding: 2px 5px; }
.food.new { border-style: dashed; border-color: var(--p300); color: var(--p600); justify-content: center; }
.combos { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.combo { flex: 0 0 auto; background: var(--p100); color: var(--p800); border-radius: 16px; padding: 12px 14px; min-width: 140px; text-align: right; }
.combo .nm { font-weight: 500; }
.combo .kc { font-size: 12px; color: var(--p600); margin-top: 2px; }
.combo.new { background: transparent; border: 1px dashed var(--p300); color: var(--p600); }

/* ---------- fitness ---------- */
.rings { display: flex; justify-content: space-around; text-align: center; }
.rings .r { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; }
.rings .r b { font-weight: 500; }

/* ---------- auth pages ---------- */
.auth { max-width: 360px; margin: 0 auto; padding: 14vh 24px 24px; text-align: center; }
.auth .logo { font-size: 54px; }
.auth h1 { font-size: 28px; margin: 6px 0 4px; color: var(--p600); }
.auth form { text-align: right; margin-top: 26px; }
.auth .btn { width: 100%; padding: 14px; font-size: 16px; }
