*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg, none); background-color: var(--bg-solid); color: var(--ink);
  font-family: var(--body-font); font-size: var(--body-size, 15px);
  -webkit-tap-highlight-color: transparent; user-select: none; overscroll-behavior: none;
  font-variant-numeric: lining-nums;
}
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: var(--grain, .06); mix-blend-mode: overlay;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
.center { text-align: center; }
.glyph { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.good { color: var(--zone); } .bad { color: var(--ceil); } .meh { color: var(--muted); }
.stateBig, .mark, .heroMark, .step h2, .zoneSummary { text-shadow: 0 1px 0 var(--emboss-light), 0 -1px 0 var(--emboss-dark); }

.frame { height: 100dvh; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 20px 0; }
header { display: flex; align-items: center; gap: 10px; padding: 12px 0 0; flex: none; }
.brandBtn { flex: 1; display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0; min-height: 44px; }
.barName { font-family: var(--caps-font); font-size: 10.5px; line-height: 1; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mark { flex: none; white-space: nowrap; font-family: var(--mark-font); font-weight: var(--mark-weight, 700); font-size: var(--mark-size, 21px); letter-spacing: var(--mark-track, .02em); color: var(--mark-color, var(--accent)); line-height: 1; }
.ghostbtn { width: 44px; height: 44px; border-radius: 50%; font-size: 22px; color: var(--muted); display: grid; place-items: center; }
/* The header's right side is the same in every bar: one face, one pill. */
.ghostbtn.info { position: relative; width: 30px; height: 30px; border: 1px solid var(--chip-line, var(--line)); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; font-weight: 400; font-style: normal; }
.tonightChip { position: relative; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--chip-line, var(--line)); color: var(--ink); opacity: .82;
  font-family: 'Inter', system-ui, sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
/* Invisible boxes stretch small controls to a 44px touch target. */
.tonightChip::after, .ghostbtn.info::after, .glassBtn::after { content: ''; position: absolute; inset: -8px; }

main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.status { text-align: center; padding: 18px 0 2px; flex: none; }
.eyebrow { font-family: var(--caps-font); font-size: var(--caps-size, 10.5px); letter-spacing: var(--caps-track, .22em); text-transform: uppercase; color: var(--muted); min-height: 14px; }
.eyebrow.bad { color: var(--ceil); }
.stateBig { font-family: var(--num-font); font-size: var(--big-size, 60px); line-height: 1.08; margin-top: 4px; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.stateBig small { font-size: var(--unit-size, .36em); margin-left: .1em; letter-spacing: .04em; }
.stateBig.word { font-family: var(--display-font); font-size: var(--word-size, 46px); }
.stateSub { font-family: var(--sub-font, var(--body-font)); font-size: var(--sub-size, 13px); color: var(--muted); margin-top: 3px; min-height: 18px; }
body[data-state=go] .stateBig { color: var(--accent); }

.tonightCard { display: flex; flex-direction: column; gap: 8px; flex: none; padding-top: 4px; }
.q { font-family: var(--caps-font); font-size: var(--caps-size, 10.5px); letter-spacing: var(--caps-track, .2em); text-transform: uppercase; color: var(--muted); margin-top: 8px; line-height: 14px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; min-height: 44px; padding: 13px 4px; font-family: var(--control-font, var(--body-font)); font-size: var(--control-size, 14px); line-height: 18px; color: var(--muted); transition: background .15s, color .15s, box-shadow .15s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--sel-bg); color: var(--sel-ink); box-shadow: var(--sel-shadow, none); }
.seg button.on:first-child { border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px); }
.seg button.on:last-child, .seg button.on:has(+ [hidden]:last-child) { border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0; }
.seg[data-name=vibe] button small { display: block; margin-top: 2px; font-size: 11px; line-height: 14px; opacity: .85; letter-spacing: .04em; }
.seg.wide { width: 100%; }

.chartWrap { position: relative; flex: 1; min-height: 230px; margin: 6px 0 4px; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

footer { flex: none; padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.drinkStrip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; touch-action: none; }
.drinkStrip button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 70px; border-radius: var(--radius); color: var(--muted); transition: color .15s, transform .08s; position: relative; }
.drinkStrip button:active { transform: scale(.9); color: var(--ink); }
.drinkStrip button:active .glyph { transform: translateY(-3px); transition: transform .1s; }
.drinkStrip button span { font-family: var(--caps-font); font-size: var(--strip-size, 10px); letter-spacing: var(--strip-track, .06em); }
.drinkStrip .glyph { width: 30px; height: 30px; }
.drinkStrip button.on { color: var(--ink); }
.drinkStrip button.on .glyph { color: var(--accent); }
.drinkStrip button.lifted { opacity: .25; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 10; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 480px; margin: 0 auto;
  background: var(--sheet-bg); border-top: 1px solid var(--line); border-radius: var(--sheet-radius, 12px) var(--sheet-radius, 12px) 0 0;
  padding: 22px 20px calc(26px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px;
  animation: rise .22s cubic-bezier(.2,.8,.2,1); }
.sheet h3 { margin: 0 0 4px; font-family: var(--display-font); font-weight: 400; font-size: 20px; text-align: center; }
.sheet.tall { max-height: 86vh; overflow-y: auto; }
.row { display: flex; gap: 10px; }
.row button { flex: 1; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--control-font, var(--body-font)); font-size: var(--control-size, 15px); }
.danger { color: var(--ceil); }
.fine { color: var(--muted); font-size: 11.5px; line-height: 1.55; margin: 8px 2px 0; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.infoBody { display: flex; flex-direction: column; gap: 16px; }
.infoItem { display: flex; gap: 14px; align-items: flex-start; }
.infoItem b { font-family: var(--display-font); font-weight: 600; font-size: var(--item-title, 16px); }
.infoItem p { margin: 3px 0 0; color: var(--muted); font-family: var(--sub-font, var(--body-font)); font-size: var(--info-size, 13.5px); line-height: 1.5; }
.sw { flex: none; width: 34px; height: 24px; margin-top: 2px; border-radius: var(--radius); border: 1px solid var(--line); position: relative; overflow: hidden; }
.sw.curve::after { content: ''; position: absolute; left: 3px; right: 3px; top: 6px; bottom: 4px; border-top: 1.5px solid var(--ink); border-radius: 60% 60% 0 0; }
.sw.zone { background: linear-gradient(transparent 30%, color-mix(in srgb, var(--zone) 30%, transparent) 30% 70%, transparent 70%); }
.sw.next::after { content: ''; position: absolute; left: 4px; right: 4px; top: 11px; border-top: 2px dotted var(--ink); }
.sw.record::after { content: ''; position: absolute; left: 8px; bottom: 4px; width: 9px; height: 12px; border: 1.25px solid var(--ink); border-top: 0; }
.sw.food::after { content: ''; position: absolute; left: 8px; right: 8px; top: 5px; bottom: 5px; border: 1.5px solid var(--muted); border-radius: 50%; }
.youGrid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.youGrid > div { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px; text-align: center; }
.youGrid > div + div { border-left: 1px solid var(--line); }
.youGrid b { font-family: var(--num-font); font-weight: 500; font-size: var(--you-size, 20px); font-variant-numeric: lining-nums tabular-nums; }
.youGrid small { color: var(--muted); font-size: 10.5px; }

.onboard { position: fixed; inset: 0; z-index: 20; background: var(--bg, none); background-color: var(--bg-solid); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.obTop { display: flex; align-items: center; gap: 10px; padding: 10px 14px 0; max-width: 480px; width: 100%; margin: 0 auto; }
.obSpacer { width: 40px; }
.progress { flex: 1; height: 1.5px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .35s cubic-bezier(.2,.8,.2,1); }
.step { display: none; flex: 1; flex-direction: column; justify-content: space-between; gap: 20px;
  max-width: 480px; width: 100%; margin: 0 auto; padding: 24px 24px 28px; overflow-y: auto; }
.step.on { display: flex; animation: stepIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } }
.stepBody { display: flex; flex-direction: column; gap: 14px; }
.stepBody.center { align-items: center; text-align: center; margin: auto 0; }
.step h2 { font-family: var(--display-font); font-weight: 400; font-size: var(--h2-size, 28px); line-height: 1.2; margin: 8px 0 0; }
.sub { color: var(--muted); margin: 0; line-height: 1.5; font-family: var(--sub-font, var(--body-font)); font-size: var(--sub-lg, 15px); }

.heroMark { font-family: var(--mark-font); font-weight: var(--mark-weight, 700); font-size: var(--hero-size, 84px); color: var(--mark-color, var(--accent));
  letter-spacing: .02em; line-height: 1; margin-bottom: 44px; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 6px; }
.barCard { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px;
  height: 172px; padding: 16px 10px 14px; overflow: hidden; transition: transform .15s, box-shadow .2s, border-color .2s; }
.barCard.on { transform: translateY(-3px); }
.barArt { position: absolute; top: 22px; left: 50%; width: 100px; margin-left: -50px; fill: none; }
.miniBars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.miniBar { height: 64px; display: grid; place-items: center; padding: 0 8px; }
.miniBar b { font-weight: 400; }
/* A card or chip carries its own bar's data-theme, so it shows that bar's colours under any page. */
.barCard, .miniBar { background: var(--pick-bg); color: var(--ink); border: 1px solid var(--pick-line); border-radius: var(--pick-radius);
  box-shadow: inset 0 0 0 4px var(--pick-bg), inset 0 0 0 5px var(--pick-ring); }
.barCard.on, .miniBar.on { border-color: var(--accent); }

.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.choices button { display: flex; align-items: baseline; justify-content: space-between; padding: 19px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px);
  font-family: var(--choice-font, var(--body-font)); font-size: var(--choice-size, 17px); text-align: left; transition: background .15s, color .15s, border-color .15s; }
.choices button.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--sel-line, var(--sel-bg)); }

.wheels { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 8px; margin-top: 18px; }
.wheels > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wheels small { font-family: var(--caps-font); color: var(--muted); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; }
.wheel { position: relative; width: 100%; height: 220px;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.wheel::after { content: ''; position: absolute; left: 4px; right: 4px; top: 88px; height: 44px; pointer-events: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wheelList { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; padding: 88px 0; scrollbar-width: none; overscroll-behavior: contain; }
.wheelList::-webkit-scrollbar { display: none; }
.wheelItem { height: 44px; display: grid; place-items: center; scroll-snap-align: center; font-family: var(--num-font); font-size: var(--wheel-size, 20px);
  color: var(--muted); transition: color .12s, transform .12s; font-variant-numeric: lining-nums tabular-nums; }
.wheelItem.sel { color: var(--ink); transform: scale(1.12); }

.tol { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.tolRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 14px 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); }
.tolRow > div:first-child { display: flex; flex-direction: column; gap: 10px; }
.tolRow b { font-family: var(--choice-font, var(--body-font)); font-weight: 500; font-size: var(--choice-size, 17px); }
.counter { display: flex; align-items: center; gap: 12px; }
.counter b { font-family: var(--num-font); font-weight: 400; font-size: 38px; line-height: 1; min-width: 1.2em; text-align: center; font-variant-numeric: lining-nums tabular-nums; }
.counter button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--chip-line, var(--line)); font-family: var(--control-font, var(--body-font)); font-size: 20px; color: var(--ink); }
.counter button:active { background: var(--line); }
.glasses { display: flex; flex-wrap: wrap; gap: 1px; min-height: 16px; }
.glasses .glyph { width: 16px; height: 16px; color: var(--accent); opacity: .85; animation: fade .2s; }

.zoneSummary { font-family: var(--display-font); font-size: var(--zone-size, 40px); line-height: 1.15; margin: 4px 0; }
.ciSummary { font-family: var(--sub-font, var(--body-font)); font-size: 17px; line-height: 1.6; margin: 0 0 10px; }
.primary { width: 100%; padding: 18px; border-radius: var(--radius); background: var(--pour-bg); color: var(--pour-ink); box-shadow: var(--pour-shadow, none);
  font-family: var(--pour-font, var(--display-font)); font-size: var(--pour-size, 18px); letter-spacing: var(--pour-track, 0); text-shadow: var(--pour-text-shadow, none); transition: transform .08s; }
.primary:active { transform: scale(.98); }
.link { display: block; margin: 0 auto; color: var(--muted); padding: 10px 18px; }

.dragGlyph { position: fixed; z-index: 40; pointer-events: none; width: 46px; height: 46px; margin: -84px 0 0 -23px;
  display: grid; place-items: center; border-radius: var(--medal-radius, 50%); color: var(--medal-ink, var(--accent));
  background: var(--sheet-bg); border: 1px solid var(--medal-line, var(--accent)); box-shadow: var(--medal-shadow, 0 6px 16px rgba(0,0,0,.45)); }
.dragGlyph .glyph { width: 28px; height: 28px; }
.dragGlyph.cancel { opacity: .35; }
body[data-state=placing] .stateBig { color: var(--ink); text-shadow: none; }
.glassBtn { position: relative; margin-top: 10px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); font-family: var(--control-font, var(--body-font)); font-size: 13px; color: var(--ink); }
.glassBtn:active { background: var(--sel-bg); }

.feelChoices { display: flex; flex-direction: column; gap: 10px; }
.feelChoices button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 15px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg, 12px); text-align: left; }
.feelChoices b { font-family: var(--display-font); font-weight: 500; font-size: 18px; }
.feelChoices small { color: var(--muted); font-size: 12px; }
.feelChoices button:active { background: var(--sel-bg); }

.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 12; width: min(86vw, 380px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet-bg); border-right: 1px solid var(--line); padding: calc(18px + env(safe-area-inset-top)) 20px calc(30px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; transform: translateX(-100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.drawer.open { transform: none; }
.drawerHead { height: 34px; display: flex; align-items: center; }
.drawer .q { margin-top: 16px; }
.rowBtn { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--control-font, var(--body-font)); font-size: var(--control-size, 14px); line-height: 18px; color: var(--ink); text-align: center; }
.rowBtn:disabled { color: var(--muted); opacity: .6; }
.rowBtn.danger { color: var(--ceil); }
.history { display: flex; flex-direction: column; }
.night { display: grid; grid-template-columns: 1fr 84px 76px; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.night b { display: block; font-weight: 500; font-size: 14px; }
.night small { color: var(--muted); font-size: 11px; }
.night .nums { text-align: right; }
.spark { width: 84px; height: 28px; display: block; }
.spark polyline { fill: none; stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark rect { fill: var(--zone); opacity: .18; }
.profileGrid { display: flex; flex-direction: column; gap: 8px; }
.stepRow { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.stepRow span { flex: 1; font-size: 14px; color: var(--muted); }
.stepRow b { min-width: 72px; text-align: center; font-family: var(--num-font); font-weight: 500; font-variant-numeric: lining-nums tabular-nums; }
.stepRow button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--chip-line, var(--line)); font-family: var(--control-font, var(--body-font)); font-size: 18px; color: var(--ink); }
.drawer > * { flex-shrink: 0; }

.gh { display: inline-flex; align-items: center; gap: 10px; margin-top: 34px; padding: 10px 14px; color: var(--muted); font-family: var(--caps-font); font-size: 13px; letter-spacing: .04em; text-decoration: none; }
.gh svg { width: 20px; height: 20px; fill: currentColor; }
.gh:active { color: var(--ink); }
