/* ── 多巴胺小舖 · design system ───────────────────────────── */
:root{
  --bg:#faf7f3; --surface:#fff; --surface-2:#f4efe9;
  --ink:#241f1c; --ink-2:#5c534c; --muted:#9a9089;
  --line:#e8e0d7;
  --accent:#8c3a52; --accent-soft:#f8ecef; --accent-ink:#6d2740;
  --gold:#b8935a; --ok:#3f7d5c;
  --serif:Georgia,"Times New Roman","Songti TC","Songti SC",serif;
  --sans:-apple-system,BlinkMacSystemFont,"PingFang TC","PingFang SC","Helvetica Neue",Arial,sans-serif;
  --r:16px; --r-sm:11px;
  --shadow:0 1px 2px rgba(60,40,30,.05),0 8px 24px -12px rgba(60,40,30,.16);
  --ease:cubic-bezier(.32,.72,0,1);
  --tab-h:60px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;height:100%}
body{
  background:var(--bg); color:var(--ink); font-family:var(--sans);
  font-size:15px; line-height:1.5; overscroll-behavior-y:none;
  -webkit-font-smoothing:antialiased;
}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer}
img,svg{display:block;max-width:100%}

.phone{
  max-width:480px; margin:0 auto; min-height:100%;
  display:flex; flex-direction:column; background:var(--bg);
  position:relative;
}

/* ── top bar ─────────────────────────────────────────────── */
.topbar{
  position:sticky; top:0; z-index:30;
  padding:calc(env(safe-area-inset-top) + 12px) 18px 12px;
  background:rgba(250,247,243,.86); backdrop-filter:blur(14px);
  border-bottom:1px solid transparent; transition:border-color .2s;
  display:flex; align-items:center; gap:12px; min-height:56px;
}
.topbar.bordered{border-bottom-color:var(--line)}
.topbar h1{font-family:var(--serif); font-size:19px; margin:0; font-weight:400; letter-spacing:.5px}
.topbar .sub{font-size:11px; color:var(--muted); letter-spacing:.3px}
.back{
  width:34px;height:34px;border-radius:50%;background:var(--surface);
  display:grid;place-items:center;box-shadow:var(--shadow);flex:none;
  font-size:17px;transition:transform .18s var(--ease)
}
.back:active{transform:scale(.9)}

/* ── screen ──────────────────────────────────────────────── */
.screen{
  flex:1; padding:4px 0 calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
  animation:screen-in .34s var(--ease);
}
@keyframes screen-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.pad{padding:0 18px}

/* ── install banner (Android) ────────────────────────────── */
.install{
  display:flex; align-items:center; gap:12px; text-align:left;
  width:calc(100% - 36px); margin:6px 18px 0; padding:13px 15px;
  border-radius:var(--r); background:var(--accent-soft);
  border:1px solid rgba(140,58,82,.16);
  transition:transform .18s var(--ease);
}
.install:active{transform:scale(.98)}
.install .ico{
  width:34px; height:34px; border-radius:50%; flex:none;
  background:var(--accent); color:#fff; display:grid; place-items:center; font-size:15px;
}
.install .txt{flex:1; min-width:0}
.install .txt b{display:block; font-size:13.5px; font-weight:600; color:var(--accent-ink)}
.install .txt small{display:block; font-size:11px; color:var(--ink-2); margin-top:1px}
.install .go{color:var(--accent); font-size:19px; flex:none}

/* ── wallet ──────────────────────────────────────────────── */
.wallet{
  margin:6px 18px 20px; padding:16px 18px; border-radius:var(--r);
  background:linear-gradient(118deg,#2b2320,#4a3b33 58%,#6b5347);
  color:#f7f0e8; box-shadow:var(--shadow); position:relative; overflow:hidden;
}
.wallet::after{
  content:""; position:absolute; inset:-40% -20% auto auto; width:180px; height:180px;
  background:radial-gradient(circle,rgba(255,220,170,.34),transparent 68%);
}
.wallet .lbl{font-size:10.5px; letter-spacing:1.6px; opacity:.62; text-transform:uppercase}
.wallet .amt{font-family:var(--serif); font-size:30px; margin-top:3px; letter-spacing:.5px}
.wallet .note{font-size:11px; opacity:.6; margin-top:5px}

/* ── section heads ───────────────────────────────────────── */
.sec{margin:26px 0 10px; padding:0 18px; display:flex; align-items:baseline; gap:9px}
.sec h2{
  font-family:var(--serif); font-size:16.5px; font-weight:400; margin:0; letter-spacing:.4px;
  flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sec .en{
  font-size:10.5px; color:var(--muted); letter-spacing:1.3px; text-transform:uppercase;
  flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sec .more{margin-left:auto; font-size:12px; color:var(--accent); flex:none; white-space:nowrap}

/* 360px Androids: the brand tagline + 全部 button together force the heading
   onto three lines. The tagline is decorative — drop it, keep the name. */
@media (max-width:389px){
  .sec-brand .en{display:none}
}

/* ── horizontal rails ────────────────────────────────────── */
.rail{
  display:flex; gap:11px; overflow-x:auto; padding:2px 18px 6px;
  scroll-snap-type:x proximity; -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.rail::-webkit-scrollbar{display:none}
.rail>*{scroll-snap-align:start; flex:none}

.chip{
  padding:8px 15px; border-radius:99px; background:var(--surface);
  border:1px solid var(--line); font-size:13px; white-space:nowrap;
  transition:transform .16s var(--ease), background .16s;
}
.chip:active{transform:scale(.94)}
.chip.on{background:var(--ink); color:#fff; border-color:var(--ink)}

/* ── product card ────────────────────────────────────────── */
.card{
  width:136px; background:var(--surface); border-radius:var(--r);
  padding:9px 9px 12px; box-shadow:var(--shadow); text-align:left;
  transition:transform .18s var(--ease); display:block;
}
.card:active{transform:scale(.96)}
.card .bottle{width:100%; height:110px; margin:2px auto 8px}
.card .b{font-size:9.5px; letter-spacing:1.1px; color:var(--muted); text-transform:uppercase}
.card .n{font-size:12.5px; line-height:1.3; margin:2px 0 1px; height:32px; overflow:hidden}
.card .z{font-size:10.5px; color:var(--muted); margin-bottom:5px}
.card .p{font-family:var(--serif); font-size:14.5px; color:var(--accent-ink)}

.grid{display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:6px 18px}
.grid .card{width:auto}
.grid .card .bottle{height:128px}

/* ── product detail ──────────────────────────────────────── */
.hero{
  background:var(--surface); border-radius:22px; margin:6px 18px 0;
  padding:22px; box-shadow:var(--shadow); text-align:center;
}
.hero .bottle{width:56%; height:210px; margin:0 auto; animation:float 5s ease-in-out infinite}
@keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-7px)}}
.detail{padding:20px 18px 0}
.detail .b{font-size:11px; letter-spacing:2px; color:var(--accent); text-transform:uppercase}
.detail h2{font-family:var(--serif); font-size:23px; font-weight:400; margin:6px 0 2px; line-height:1.25}
.detail .z{color:var(--ink-2); font-size:14px}
.detail .size{font-size:12px; color:var(--muted); margin-top:3px}
.detail .price{font-family:var(--serif); font-size:29px; color:var(--accent-ink); margin:16px 0 4px}
.detail .blurb{
  background:var(--accent-soft); border-radius:var(--r-sm); padding:13px 15px;
  font-size:13.5px; color:var(--ink-2); margin-top:16px; line-height:1.65;
}

/* ── buttons ─────────────────────────────────────────────── */
.btn{
  display:block; width:100%; padding:16px; border-radius:14px;
  background:var(--ink); color:#fff; font-size:15px; font-weight:500;
  letter-spacing:1px; transition:transform .16s var(--ease), opacity .16s;
  box-shadow:0 6px 18px -8px rgba(36,31,28,.6);
}
.btn:active{transform:scale(.975)}
.btn.accent{background:var(--accent); box-shadow:0 6px 18px -8px rgba(140,58,82,.7)}
.btn.ghost{background:var(--surface); color:var(--ink); box-shadow:var(--shadow)}
.btn[disabled]{opacity:.4; pointer-events:none}
.btn-wrap{padding:22px 18px 6px}
.sticky-buy{
  position:sticky; bottom:calc(env(safe-area-inset-bottom) + 8px);
  padding:12px 18px; margin-top:20px;
}

/* ── cart ────────────────────────────────────────────────── */
.line{
  display:flex; gap:13px; align-items:center; background:var(--surface);
  border-radius:var(--r); padding:11px 13px; margin:0 18px 11px; box-shadow:var(--shadow);
}
.line .bottle{width:46px; height:62px; flex:none}
.line .info{flex:1; min-width:0}
.line .info .b{font-size:9.5px; letter-spacing:1.1px; color:var(--muted); text-transform:uppercase}
.line .info .n{font-size:13px; line-height:1.3}
.line .info .p{font-family:var(--serif); font-size:14px; color:var(--accent-ink); margin-top:3px}
.qty{display:flex; align-items:center; gap:9px; flex:none}
.qty button{
  width:29px;height:29px;border-radius:50%;background:var(--surface-2);
  display:grid;place-items:center;font-size:16px;line-height:1;
  transition:transform .15s var(--ease)
}
.qty button:active{transform:scale(.85)}
.qty span{min-width:16px;text-align:center;font-size:14px;font-variant-numeric:tabular-nums}

.total{
  margin:22px 18px 0; padding:18px; border-radius:var(--r);
  background:var(--surface); box-shadow:var(--shadow);
}
.total .row{display:flex; justify-content:space-between; align-items:baseline; font-size:13.5px; color:var(--ink-2); margin-bottom:9px}
.total .row.big{
  font-size:15px; color:var(--ink); border-top:1px solid var(--line);
  padding-top:13px; margin:13px 0 0;
}
.total .row.big b{font-family:var(--serif); font-size:27px; color:var(--accent-ink); font-weight:400}
.total .free{color:var(--ok)}

/* ── tracking ────────────────────────────────────────────── */
.track-head{text-align:center; padding:14px 18px 4px}
.track-head .eta{font-family:var(--serif); font-size:30px; letter-spacing:.5px}
.track-head .no{font-size:11px; color:var(--muted); letter-spacing:1.3px; margin-top:5px}

.parcel-stage{display:grid; place-items:center; height:190px; position:relative}
.parcel{width:118px; height:118px; position:relative; animation:bob 2.6s ease-in-out infinite}
@keyframes bob{0%,100%{transform:translateY(0) rotate(-2deg)}50%{transform:translateY(-10px) rotate(2deg)}}
.parcel.moving{animation:bob 1.1s ease-in-out infinite}

.stages{padding:8px 18px 0}
.stage{display:flex; gap:15px; align-items:flex-start; position:relative; padding-bottom:22px}
.stage:last-child{padding-bottom:4px}
.stage .dot{
  width:22px;height:22px;border-radius:50%;background:var(--surface-2);
  border:2px solid var(--line); flex:none; display:grid; place-items:center;
  font-size:11px; color:#fff; transition:all .45s var(--ease); z-index:2;
}
.stage:not(:last-child)::before{
  content:""; position:absolute; left:10px; top:22px; bottom:0; width:2px;
  background:var(--line);
}
.stage.done::before{background:var(--ok)}
.stage.done .dot{background:var(--ok); border-color:var(--ok)}
.stage.now .dot{
  background:var(--accent); border-color:var(--accent);
  box-shadow:0 0 0 0 rgba(140,58,82,.45); animation:pulse 1.7s infinite;
}
@keyframes pulse{
  0%{box-shadow:0 0 0 0 rgba(140,58,82,.45)}
  70%{box-shadow:0 0 0 13px rgba(140,58,82,0)}
  100%{box-shadow:0 0 0 0 rgba(140,58,82,0)}
}
.stage .txt{flex:1; padding-top:1px}
.stage .txt .zh{font-size:14.5px; transition:color .3s}
.stage .txt .en{font-size:10.5px; color:var(--muted); letter-spacing:1.1px; text-transform:uppercase; margin-top:1px}
.stage .txt .t{font-size:11px; color:var(--muted); margin-top:3px; font-variant-numeric:tabular-nums}
.stage:not(.done):not(.now) .txt .zh{color:var(--muted)}

/* ── unboxing ────────────────────────────────────────────── */
.unbox{
  min-height:46vh; display:flex; flex-direction:column;
  align-items:center; justify-content:flex-start; gap:6px;
  padding:26px 18px 4px; text-align:center;
}
.unbox .hint{font-size:13px; color:var(--muted); margin-top:18px; animation:blink 2s infinite}
.unbox .hint:empty{display:none}   /* don't reserve a line once opened */
@keyframes blink{0%,100%{opacity:.45}50%{opacity:1}}
.box-tap{
  width:170px; height:170px; position:relative; display:grid; place-items:center;
  transition:transform .2s var(--ease);
}
.box-tap .parcel{width:150px; height:150px}
.box-tap:active{transform:scale(.93)}
.box-tap.opened .lid{animation:lid-fly .75s var(--ease) forwards}
@keyframes lid-fly{to{transform:translateY(-115px) rotate(-24deg); opacity:0}}

.loot{display:flex; flex-wrap:wrap; gap:12px; justify-content:center; margin-top:14px; min-height:10px}
.loot .item{
  width:98px; background:var(--surface); border-radius:14px; padding:9px;
  box-shadow:var(--shadow); opacity:0; transform:translateY(28px) scale(.82);
  animation:pop .62s var(--ease) forwards;
}
@keyframes pop{
  60%{opacity:1; transform:translateY(-7px) scale(1.05)}
  100%{opacity:1; transform:none}
}
.loot .item .bottle{height:78px}
.loot .item .n{font-size:10px; line-height:1.25; margin-top:5px; color:var(--ink-2)}

.spark{position:absolute; pointer-events:none; font-size:17px; animation:spark .95s ease-out forwards}
@keyframes spark{
  0%{opacity:1; transform:translate(0,0) scale(.4)}
  100%{opacity:0; transform:translate(var(--dx),var(--dy)) scale(1.25)}
}

/* ── shelf ───────────────────────────────────────────────── */
.shelf-stat{
  display:flex; gap:11px; padding:6px 18px 4px;
}
.stat{
  flex:1 1 0; min-width:0; background:var(--surface); border-radius:var(--r); padding:14px 8px;
  box-shadow:var(--shadow); text-align:center;
}
.stat .v{font-family:var(--serif); font-size:22px; color:var(--accent-ink)}
.stat .k{
  font-size:9.5px; color:var(--muted); letter-spacing:.4px; margin-top:3px;
  white-space:nowrap;   /* 360px-wide Androids wrapped "總件數 ITEMS" onto two lines */
}

.shelf-row{
  margin:0 18px 14px; padding:14px 12px 0; background:var(--surface);
  border-radius:var(--r) var(--r) 13px 13px; box-shadow:var(--shadow);
}
.shelf-items{display:flex; gap:6px; align-items:flex-end; min-height:96px}
.shelf-item{
  /* fixed basis, not flex-grow — otherwise a partial last row centres its
     lone bottle instead of sitting at the left of the plank */
  flex:0 0 calc(25% - 4.5px); min-width:0; text-align:center;
  transition:transform .18s var(--ease);
}
.shelf-item:active{transform:scale(.92)}
.shelf-item .bottle{width:100%; max-width:62px; height:84px; margin:0 auto}
.shelf-item span{
  display:block; font-size:8.5px; letter-spacing:.6px; color:var(--muted);
  text-transform:uppercase; margin-top:3px; overflow:hidden;
  white-space:nowrap; text-overflow:ellipsis;
}
.shelf-plank{
  height:9px; background:linear-gradient(#e4d7c6,#c7b49c);
  border-radius:0 0 13px 13px; margin:6px -12px 0;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.5);
}

/* ── orders ──────────────────────────────────────────────── */
.order{
  /* a <button> shrinks to fit — force it to span like a card would */
  display:block; width:calc(100% - 36px); text-align:left;
  margin:0 18px 12px; background:var(--surface); border-radius:var(--r);
  padding:14px 15px; box-shadow:var(--shadow);
  transition:transform .18s var(--ease);
}
.order:active{transform:scale(.98)}
.order .top{display:flex; justify-content:space-between; align-items:baseline; gap:8px}
.order .no{font-size:10.5px; letter-spacing:1.2px; color:var(--muted)}
.order .st{font-size:11px; padding:3px 9px; border-radius:99px; background:var(--accent-soft); color:var(--accent-ink); flex:none}
.order .st.done{background:#e9f3ee; color:var(--ok)}
.order .thumbs{display:flex; gap:5px; margin:10px 0 8px}
.order .thumbs .bottle{width:34px; height:46px}
.order .foot{display:flex; justify-content:space-between; align-items:baseline; gap:10px; font-size:12px; color:var(--muted)}
.order .foot b{font-family:var(--serif); font-size:16px; color:var(--accent-ink); font-weight:400}

.ledger{
  margin:6px 18px 20px; padding:16px 18px; border-radius:var(--r);
  background:var(--surface); box-shadow:var(--shadow);
}
.ledger .row{display:flex; justify-content:space-between; align-items:baseline; padding:5px 0}
.ledger .row span{font-size:13px; color:var(--ink-2)}
.ledger .row b{font-family:var(--serif); font-weight:400; font-size:19px}
.ledger .row.spent b{color:var(--accent-ink)}
.ledger .row.real b{color:var(--ok)}
.ledger .joke{font-size:11.5px; color:var(--muted); margin-top:9px; border-top:1px solid var(--line); padding-top:9px; line-height:1.6}

/* ── empty ───────────────────────────────────────────────── */
.empty{text-align:center; padding:70px 34px; color:var(--muted)}
.empty .ico{font-size:42px; margin-bottom:14px; opacity:.5}
.empty p{font-size:13.5px; line-height:1.7; margin:0 0 20px}

/* ── tab bar ─────────────────────────────────────────────── */
.tabbar{
  position:fixed; bottom:0; left:50%; transform:translateX(-50%);
  width:100%; max-width:480px; z-index:40;
  height:calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom:env(safe-area-inset-bottom);
  background:rgba(255,255,255,.9); backdrop-filter:blur(16px);
  border-top:1px solid var(--line); display:flex;
}
.tabbar button{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; font-size:10px; color:var(--muted); position:relative;
  transition:color .2s;
}
.tabbar button .ico{font-size:19px; line-height:1; transition:transform .22s var(--ease)}
.tabbar button.on{color:var(--ink)}
.tabbar button.on .ico{transform:translateY(-2px) scale(1.1)}
.tabbar .badge{
  position:absolute; top:7px; left:calc(50% + 7px);
  min-width:16px; height:16px; padding:0 4px; border-radius:99px;
  background:var(--accent); color:#fff; font-size:9.5px; line-height:16px;
  text-align:center; animation:pop-in .3s var(--ease);
}
@keyframes pop-in{from{transform:scale(0)}to{transform:scale(1)}}

/* ── toast ───────────────────────────────────────────────── */
.toast{
  position:fixed; left:50%; bottom:calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px);
  transform:translate(-50%,14px); z-index:60;
  background:var(--ink); color:#fff; padding:11px 20px; border-radius:99px;
  font-size:13px; opacity:0; pointer-events:none; transition:all .3s var(--ease);
  box-shadow:0 8px 26px -10px rgba(0,0,0,.5); white-space:nowrap;
}
.toast.show{opacity:1; transform:translate(-50%,0)}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
