:root {
  --cream: #FBF4E9;
  --foam: #FFFDF8;
  --latte: #EAD7BF;
  --latte-deep: #D9BF9E;
  --espresso: #3B2618;
  --coffee: #7B4A2D;
  --muted: #8A7362;
  --zac: #E4572E;
  --zac-soft: #FCE6DD;
  --jay: #2FA382;
  --jay-soft: #DAF2EA;
  --radius: 22px;
  --shadow: 0 2px 0 rgba(59,38,24,.06), 0 10px 30px -12px rgba(59,38,24,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--espresso);
  background-color: var(--cream);
  background-image: radial-gradient(rgba(123,74,45,.09) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  min-height: 100vh;
  padding-bottom: 40px;
}
h1, h2, h3, .fredoka { font-family: "Fredoka", "Nunito", sans-serif; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1320px; margin: 0 auto; padding: 18px 24px 4px;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -.5px; }
.logo .b2 { color: var(--coffee); }
.logo svg { width: 38px; height: 38px; }
.me-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--foam); border: 2px solid var(--latte); border-radius: 999px;
  padding: 6px 14px 6px 6px; font-weight: 700; font-size: 14px;
}
.me-chip .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: Fredoka; }
.date { color: var(--muted); font-weight: 700; font-size: 14px; margin-right: 12px; }

/* ---------- layout ---------- */
.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px minmax(0, 1fr); gap: 28px;
  max-width: 1320px; margin: 0 auto; padding: 16px 24px 40px; align-items: start;
}
@media (max-width: 1120px) {
  .stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
  .stage .center { order: -1; grid-column: 1 / -1; position: static; max-width: 420px; margin: 0 auto; width: 100%; }
}
@media (max-width: 720px) {
  .stage { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 40px; }
  .topbar { padding: 14px 16px 4px; }
  .date { display: none; }
}

/* ---------- side cards ---------- */
.side { --accent: var(--zac); --soft: var(--zac-soft); }
.side[data-side="jay"] { --accent: var(--jay); --soft: var(--jay-soft); }
.card {
  background: var(--foam); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 22px 18px; border-top: 8px solid var(--accent); position: relative;
}
.side-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-family: Fredoka; font-weight: 600; font-size: 22px;
  box-shadow: 0 0 0 4px var(--soft);
}
.side-head h2 { margin: 0; font-size: 24px; line-height: 1; }
.you-tag { font-size: 12px; font-weight: 800; color: var(--accent); background: var(--soft); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.side-head .sub { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.typing {
  margin-left: auto; font-size: 13px; font-weight: 800; color: var(--accent);
  opacity: 0; transition: opacity .25s; white-space: nowrap;
}
.typing.on { opacity: 1; }
.typing.on .pencil { display: inline-block; animation: scribble .35s ease-in-out infinite alternate; }
@keyframes scribble { from { transform: rotate(-12deg) translateX(-1px); } to { transform: rotate(10deg) translateX(2px); } }

.q { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 6px; font-weight: 700; font-size: 15px; line-height: 1.35; }
.qnum {
  flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--soft); color: var(--accent);
  display: grid; place-items: center; font-family: Fredoka; font-weight: 600; font-size: 14px; margin-top: -1px;
}
.q small { display: block; font-weight: 600; color: var(--muted); font-size: 13px; margin-top: 2px; }
textarea {
  width: 100%; resize: none; overflow: hidden; min-height: 76px;
  font: 600 15px/1.5 "Nunito", sans-serif; color: var(--espresso);
  background: var(--cream); border: 2px solid transparent; border-radius: 14px; padding: 12px 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
textarea::placeholder { color: #B9A796; }
textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--soft); }
textarea[readonly] { background: transparent; border: 2px dashed var(--latte); cursor: default; }
textarea[readonly]:focus { box-shadow: none; border-color: var(--latte); }
.saved { font-size: 12px; color: var(--muted); font-weight: 700; text-align: right; height: 16px; margin-top: 4px; opacity: 0; transition: opacity .3s; }
.saved.on { opacity: 1; }

/* receipt (Q3) */
.receipt-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .7s cubic-bezier(.2,.9,.3,1.2); }
.receipt-wrap.show { grid-template-rows: 1fr; }
.receipt-wrap > div { overflow: hidden; }
.receipt {
  margin: 18px 4px 12px; padding: 14px 16px 18px; background: #fff; position: relative;
  border: 2px solid var(--latte); border-bottom: none; border-radius: 6px 6px 0 0;
  transform: translateY(-30px); opacity: 0; transition: transform .7s cubic-bezier(.2,.9,.3,1.2) .1s, opacity .4s .1s;
}
.receipt-wrap.show .receipt { transform: none; opacity: 1; }
.receipt::after {
  content: ""; position: absolute; left: -2px; right: -2px; bottom: -10px; height: 10px;
  background:
    linear-gradient(135deg, #fff 50%, transparent 50%) 0 0 / 14px 10px repeat-x,
    linear-gradient(225deg, #fff 50%, transparent 50%) 0 0 / 14px 10px repeat-x;
  filter: drop-shadow(0 2px 0 var(--latte));
}
.receipt-label { text-align: center; font-family: Fredoka; font-size: 12px; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; }
.receipt .q { margin-top: 8px; }
.receipt textarea { background: var(--cream); }

/* history */
.history { margin-top: 26px; }
.history h3 { font-size: 18px; margin: 0 0 10px 6px; display: flex; align-items: center; gap: 8px; }
.history h3 .count { font-size: 12px; background: var(--soft); color: var(--accent); border-radius: 999px; padding: 2px 9px; font-family: Nunito; font-weight: 800; }
.hcard {
  background: var(--foam); border-radius: 16px; margin-bottom: 10px; box-shadow: 0 1px 0 rgba(59,38,24,.05);
  border: 2px solid transparent; transition: border-color .2s;
}
.hcard[open] { border-color: var(--soft); }
.hcard.fresh { animation: pop .6s cubic-bezier(.2,.9,.3,1.4); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.hcard summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.hcard summary::-webkit-details-marker { display: none; }
.hdate { flex: none; width: 48px; text-align: center; background: var(--soft); border-radius: 12px; padding: 5px 0; font-family: Fredoka; line-height: 1.05; color: var(--accent); }
.hdate b { display: block; font-size: 20px; font-weight: 600; }
.hdate span { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
.hmain { flex: 1; min-width: 0; }
.htitle { font-weight: 800; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hmeta { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { background: var(--latte); color: var(--coffee); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.chev { color: var(--muted); transition: transform .2s; }
.hcard[open] .chev { transform: rotate(90deg); }
.hbody { padding: 0 16px 14px 74px; font-size: 14px; }
.hbody dt { font-weight: 800; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin-top: 10px; }
.hbody dd { margin: 2px 0 0; line-height: 1.45; }
.empty { color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 6px; }

/* did you succeed? (receipt #3 + history) */
.succ { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.succ button {
  flex: 1 1 0; min-width: 92px; font: 800 14px Nunito; color: var(--espresso); cursor: pointer;
  background: var(--cream); border: 2px solid var(--latte); border-radius: 999px; padding: 8px 10px;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.succ button:hover:not(:disabled) { border-color: var(--accent); }
.succ button:active:not(:disabled) { transform: translateY(2px); }
.succ button.on { background: var(--soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.succ button:disabled { cursor: default; }
.succ button:disabled:not(.on) { background: transparent; border-style: dashed; color: var(--muted); opacity: .75; }
.note {
  width: 100%; font: 600 14px Nunito; color: var(--espresso); background: var(--cream);
  border: 2px solid transparent; border-radius: 12px; padding: 8px 12px; transition: border-color .2s, background .2s, box-shadow .2s;
}
.note::placeholder { color: #B9A796; }
.note:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--soft); }
.note[readonly] { background: transparent; border: 2px dashed var(--latte); }
.note[readonly]:focus { box-shadow: none; border-color: var(--latte); }
.sbadge { background: var(--soft); color: var(--accent); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 800; }
.snote { color: var(--muted); font-weight: 600; margin-top: 2px; }

/* edit a history entry */
.hactions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 12px; margin-top: -8px; }
.btn.sm { font-size: 13px; padding: 5px 12px; }
.btn.sm.primary { font-size: 13px; padding: 5px 14px; box-shadow: 0 3px 0 #1F130B; }
.btn.sm.primary:active { box-shadow: 0 1px 0 #1F130B; transform: translateY(2px); }
.hedit { padding: 0 16px 4px; }
.hedit label { display: block; font-weight: 800; color: var(--accent); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin: 10px 0 4px; }
.hedit textarea { min-height: 0; font-size: 14px; padding: 8px 12px; margin-top: 4px; text-transform: none; letter-spacing: 0; }
.hedit .hactions { padding: 10px 0 12px; margin: 0; }

/* ---------- center ---------- */
.center { text-align: center; position: sticky; top: 12px; }
.buddy-wrap { position: relative; height: 350px; }
#bud { width: 170px; height: 178px; position: absolute; left: 50%; top: 0; transform: translateX(-50%); z-index: 2; overflow: visible; }
#cup { width: 250px; position: absolute; left: 50%; top: 166px; transform: translateX(-46%); }
.clock { font-family: Fredoka; font-weight: 600; font-size: 64px; line-height: 1; letter-spacing: 1px; margin-top: -10px; font-variant-numeric: tabular-nums; }
.phase { font-weight: 800; color: var(--muted); font-size: 15px; margin-top: 6px; min-height: 22px; }
.phase.work { color: var(--coffee); }
.beans { display: flex; justify-content: center; gap: 8px; margin: 14px 0 6px; min-height: 28px; }
.beans svg { width: 20px; height: 26px; }
.beans .bean-body { fill: none; stroke: var(--latte-deep); stroke-width: 2; }
.beans .bean-line { stroke: var(--latte-deep); }
.beans .done .bean-body { fill: var(--coffee); stroke: var(--coffee); }
.beans .done .bean-line { stroke: #4A2A17; }
.beans .now .bean-body { stroke: var(--coffee); fill: var(--latte); }
.beans .now { animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.18); } }

.panel { background: var(--foam); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-top: 14px; }
.panel h3 { margin: 0 0 12px; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  border: 2px solid var(--latte); background: var(--cream); color: var(--espresso); border-radius: 999px;
  padding: 7px 13px; font: 700 13.5px Nunito; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--latte-deep); }
.chip.on { background: var(--espresso); border-color: var(--espresso); color: var(--foam); }
.custom { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.custom label { font-size: 12px; font-weight: 800; color: var(--muted); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.custom input {
  width: 70px; text-align: center; font: 600 20px Fredoka; color: var(--espresso);
  border: 2px solid var(--latte); border-radius: 12px; padding: 6px; background: #fff;
}
.custom input:focus { outline: none; border-color: var(--coffee); }
.summary { font-size: 14px; color: var(--muted); font-weight: 700; margin: 14px 0; }
.btn {
  border: none; cursor: pointer; font: 600 16px Fredoka; border-radius: 999px; padding: 10px 18px;
  background: var(--cream); color: var(--espresso); border: 2px solid var(--latte);
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:hover { background: var(--latte); }
.btn:active { transform: translateY(2px); }
.btn.primary {
  background: var(--espresso); color: var(--foam); border-color: var(--espresso);
  box-shadow: 0 5px 0 #1F130B; font-size: 20px; padding: 14px 30px;
}
.btn.primary:hover { background: #4E3322; }
.btn.primary:active { box-shadow: 0 1px 0 #1F130B; transform: translateY(4px); }
.controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--muted); margin: 12px 0 0; font-weight: 600; }
.done-title { font-size: 24px !important; }

/* ready check */
.ready-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.ready-btn {
  font: 800 14px Nunito; color: var(--acc); background: #fff; cursor: pointer;
  border: 2px dashed var(--acc); border-radius: 999px; padding: 7px 14px;
  transition: background .15s, color .15s, transform .1s;
}
.ready-btn:hover { background: var(--cream); }
.ready-btn:active { transform: translateY(2px); }
.ready-btn.on { background: var(--acc); color: #fff; border-style: solid; }
.ready-other { font-size: 13.5px; font-weight: 800; color: var(--muted); }
.ready-other.on { color: var(--acc); }
.btn.primary.dim { opacity: .6; }
.btn.primary.dim:hover { opacity: .8; }
.btn.primary.lit {
  background: var(--coffee); border-color: var(--coffee);
  box-shadow: 0 5px 0 #1F130B, 0 0 0 5px #F1DCC0, 0 0 26px 8px rgba(228,160,70,.55);
  animation: glow 1.6s ease-in-out infinite;
}
.btn.primary.lit:hover { background: #8C5634; }
@keyframes glow { 50% { box-shadow: 0 5px 0 #1F130B, 0 0 0 8px #F1DCC0, 0 0 40px 14px rgba(228,160,70,.75); } }

/* 3-2-1 countdown */
.clock.count { color: var(--coffee); }
.clock .cd { display: inline-block; transform: scale(1.35); animation: countpop .6s cubic-bezier(.2,.9,.3,1.4); }
@keyframes countpop { from { transform: scale(2.4); opacity: 0; } }

/* ---------- Bud ---------- */
#bud g { transform-box: fill-box; }
#bud-all { transform-origin: 50% 100%; }
#face { transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
#hp, #mug, #zzz, #eyes-closed, #eyes-happy, #mouth-o, #mouth-big { display: none; }
.mood-idle #bud-all { animation: float 3.4s ease-in-out infinite; }
.mood-idle #eyes-open { animation: blink 4.5s infinite; transform-origin: center; }
.mood-focus #hp, .mood-focus #eyes-closed { display: inline; }
.mood-focus #eyes-open { display: none; }
.mood-focus #bud-all { animation: nod 1.3s ease-in-out infinite; }
.mood-break #mug { display: inline; }
.mood-break #bud-all { animation: stretch 2.6s ease-in-out infinite; }
.mood-break #eyes-open { animation: blink 3s infinite; transform-origin: center; }
.mood-paused #zzz, .mood-paused #eyes-closed, .mood-paused #mouth-o { display: inline; }
.mood-paused #eyes-open, .mood-paused #mouth { display: none; }
.mood-paused #bud-all { animation: breathe 4s ease-in-out infinite; }
.mood-done #eyes-happy, .mood-done #mouth-big { display: inline; }
.mood-done #eyes-open, .mood-done #mouth { display: none; }
.mood-countdown #eyes-open, .mood-countdown #mouth-big { display: inline; }
.mood-countdown #mouth { display: none; }
.mood-countdown #bud-all { animation: hop .5s ease-in-out infinite alternate; }
.mood-countdown #arm-l { animation: wave .25s ease-in-out infinite alternate; transform-origin: 80% 80%; }
.mood-countdown #arm-r { animation: wave .25s ease-in-out infinite alternate-reverse; transform-origin: 20% 80%; }
.mood-done #bud-all { animation: wiggle .45s ease-in-out infinite alternate; }
.mood-done #arm-l { animation: wave .45s ease-in-out infinite alternate; transform-origin: 80% 80%; }
.mood-done #arm-r { animation: wave .45s ease-in-out infinite alternate-reverse; transform-origin: 20% 80%; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes nod { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(2deg) translateY(2px); } }
@keyframes stretch { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(.95, 1.07); } 60% { transform: scale(1.03, .97); } }
@keyframes breathe { 50% { transform: scale(1.02, .98); } }
@keyframes wiggle { from { transform: rotate(-6deg); } to { transform: rotate(6deg) translateY(-4px); } }
@keyframes hop { from { transform: scale(1.04, .96); } to { transform: translateY(-14px) scale(.98, 1.03); } }
@keyframes wave { from { transform: rotate(-25deg); } to { transform: rotate(20deg); } }
#zzz text { font-family: Fredoka; font-weight: 600; fill: var(--muted); animation: zz 2.4s ease-in infinite; }
#zzz text:nth-child(2) { animation-delay: .8s; }
#zzz text:nth-child(3) { animation-delay: 1.6s; }
@keyframes zz { from { opacity: 0; transform: translate(0, 10px); } 30% { opacity: 1; } to { opacity: 0; transform: translate(12px, -18px); } }
.steam { animation: steam 2s ease-in-out infinite; }
.steam.s2 { animation-delay: .7s; }
@keyframes steam { from { opacity: 0; transform: translateY(6px); } 50% { opacity: .8; } to { opacity: 0; transform: translateY(-10px); } }

/* Bud reacts to your writing (see bud.js): bold plan, relieved save, typing lean */
#headband, #brows, #mouth-smirk, #mouth-phew, #sparkles, #phew { display: none; }
/* bold: an ambitious Q1 while planning → headband, determined brows, smirk, puffed-up bob */
.mood-idle.bold #headband, .mood-idle.bold #brows, .mood-idle.bold #mouth-smirk, .mood-idle.bold #sparkles { display: inline; }
.mood-idle.bold #mouth { display: none; }
.mood-idle.bold #bud-all { animation: boldbob 2.4s ease-in-out infinite; }
.mood-idle.bold #arm-l { animation: flex 2.4s ease-in-out infinite; transform-origin: 80% 80%; }
.mood-idle.bold #arm-r { animation: flex 2.4s ease-in-out infinite reverse; transform-origin: 20% 80%; }
.hb-tails { animation: tails .9s ease-in-out infinite alternate; transform-origin: 0% 50%; }
.spark { transform-box: fill-box; transform-origin: center; animation: twinkle 1.8s ease-in-out infinite; }
.spark.s2 { animation-delay: .9s; }
@keyframes boldbob { 50% { transform: translateY(-5px) scale(1.04, 1.02); } }
@keyframes flex { 50% { transform: rotate(14deg) translateY(-3px); } }
@keyframes tails { from { transform: rotate(-6deg); } to { transform: rotate(8deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(.5) rotate(0); opacity: .3; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
/* relieved: session saved → eyes shut, a big exhale, a sweat drop slides away, "phew~" */
.mood-idle.relieved #eyes-closed, .mood-idle.relieved #mouth-phew, .mood-idle.relieved #phew { display: inline; }
.mood-idle.relieved #eyes-open, .mood-idle.relieved #mouth { display: none; }
.mood-idle.relieved #bud-all { animation: sigh 3s ease-in-out both; }
.mood-idle.relieved #mouth-phew { transform-box: fill-box; transform-origin: center; animation: exhale 3s ease-in-out both; }
.mood-idle.relieved .sweat { animation: sweat 2.4s ease-in .2s both; }
.mood-idle.relieved .phew-txt { animation: phewtxt 2.8s ease-out .5s both; }
.phew-txt { font-family: Fredoka; font-weight: 600; fill: var(--muted); }
@keyframes sigh { 0% { transform: none; } 22% { transform: translateY(-5px) scale(1.05, 1.05); } 55% { transform: translateY(3px) scale(1.05, .93); } 80%, 100% { transform: none; } }
@keyframes exhale { 0%, 20% { transform: scale(.6); } 35%, 60% { transform: scale(1.5, 1.3); } 100% { transform: scale(.8); } }
@keyframes sweat { from { opacity: 1; transform: none; } 70% { opacity: 1; } to { opacity: 0; transform: translate(4px, 26px); } }
@keyframes phewtxt { from { opacity: 0; transform: translate(10px, 4px); } 25% { opacity: 1; } to { opacity: 0; transform: translate(-8px, -22px); } }
/* typing: lean toward the side being typed on (zac left, jay right) plus a gentle wobble.
   Uses rotate/translate so it layers under the mood keyframes on #bud-all. */
#bud-lean { transform-origin: 50% 100%; transition: rotate .45s cubic-bezier(.3,1.4,.5,1), translate .45s cubic-bezier(.3,1.4,.5,1); }
#bud-lean.lean-l { rotate: -4deg; translate: -3px 0; animation: jiggle .32s ease-in-out infinite alternate; }
#bud-lean.lean-r { rotate: 4deg; translate: 3px 0; animation: jiggle .32s ease-in-out infinite alternate-reverse; }
@keyframes jiggle { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg) translateY(-1px); } }

.puff {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 3;
  animation: puff 1.6s ease-out forwards;
}
@keyframes puff {
  from { opacity: 1; transform: translate(0, 0) scale(.4); }
  to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3); }
}

/* ---------- toast / modal ---------- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translate(-50%, -120px);
  background: var(--espresso); color: var(--foam); padding: 12px 20px; border-radius: 999px;
  font-weight: 800; box-shadow: var(--shadow); transition: transform .45s cubic-bezier(.2,.9,.3,1.3); z-index: 50;
}
.toast.on { transform: translate(-50%, 0); }
.modal-bg { position: fixed; inset: 0; background: rgba(59,38,24,.35); display: none; place-items: center; z-index: 60; padding: 16px; }
.modal-bg.on { display: grid; }
.modal { background: var(--foam); border-radius: var(--radius); padding: 24px; max-width: 380px; width: 100%; text-align: center; box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2,.9,.3,1.4); }
.modal h3 { margin: 0 0 8px; font-size: 22px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-weight: 600; }
.modal .controls .btn.primary { font-size: 16px; padding: 10px 20px; box-shadow: 0 3px 0 #1F130B; }

/* ---------- break guard ---------- */
.guard {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 50% 40%, rgba(123,74,45,.55), rgba(59,38,24,.78));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: guardfade .45s ease-out;
}
.guard-card {
  background: var(--foam); border-radius: 30px; width: 100%; max-width: 420px; text-align: center;
  padding: 30px 28px 32px; border-top: 10px solid var(--latte);
  box-shadow: 0 3px 0 rgba(59,38,24,.12), 0 30px 60px -20px rgba(20,12,6,.6);
  animation: guardrise .6s cubic-bezier(.2,.9,.3,1.2);
}
.guard-bud { width: 132px; height: 139px; overflow: visible; animation: float 3.4s ease-in-out infinite; }
.guard-wave { transform-box: fill-box; transform-origin: 30% 90%; animation: wave .5s ease-in-out 4 alternate; }
.guard h2 { font-size: 40px; margin: 6px 0 4px; letter-spacing: -.5px; line-height: 1.05; }
.guard-sub { margin: 0; font: 600 20px Fredoka; color: var(--coffee); }
.guard-clock {
  display: inline-block; margin: 16px 0 24px; padding: 7px 16px; border-radius: 999px;
  background: var(--cream); border: 2px solid var(--latte); color: var(--muted); font-weight: 700; font-size: 14.5px;
}
.guard-clock b { font: 600 17px Fredoka; color: var(--espresso); font-variant-numeric: tabular-nums; margin-right: 2px; }
.btn.primary.guard-btn { font-size: 22px; padding: 15px 36px; animation: guardpulse 2.2s ease-in-out .6s infinite; }
.btn.primary.guard-btn:focus-visible { outline: 3px solid var(--latte-deep); outline-offset: 4px; }
@keyframes guardfade { from { opacity: 0; } }
@keyframes guardrise { from { opacity: 0; transform: translateY(36px) scale(.96); } }
@keyframes guardpulse {
  0% { box-shadow: 0 5px 0 #1F130B, 0 0 0 0 rgba(217,191,158,.9); scale: 1; }
  30% { scale: 1.035; }
  65%, 100% { box-shadow: 0 5px 0 #1F130B, 0 0 0 14px rgba(217,191,158,0); scale: 1; }
}
@media (max-width: 480px) { .guard h2 { font-size: 34px; } .guard-card { padding: 24px 20px 26px; } }
@media (max-height: 520px) {
  .guard-card { padding: 16px 20px 20px; }
  .guard-bud { width: 84px; height: 88px; }
  .guard h2 { font-size: 30px; }
  .guard-clock { margin: 10px 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- app shell ---------- */
[hidden] { display: none !important; }
.me-chip { cursor: default; }
.signout { background: none; border: none; color: var(--muted); font: 700 12px Nunito; cursor: pointer; padding: 0 0 0 6px; text-decoration: underline; }
.pill {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--espresso); color: var(--foam); font-weight: 800; font-size: 13px;
  border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow); z-index: 45;
}

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.gate-card { background: var(--foam); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 28px; max-width: 400px; width: 100%; }
.gate-card h1 { font-size: 34px; margin: 6px 0 4px; }
.gate-card h1 .b2 { color: var(--coffee); }
.gate-card p { color: var(--muted); font-weight: 600; margin: 0 0 22px; }
.gate-bud { width: 120px; height: 126px; animation: float 3.4s ease-in-out infinite; }
.gate-card .btn.primary { font-size: 17px; padding: 12px 22px; }
.gate-card .err { color: var(--zac); font-weight: 700; font-size: 13px; margin: 14px 0 0; }
