:root {
  --paper: #f6efe3;
  --ink: #1c1a17;
  --muted: #6f675c;
  --line: #ddd2bf;
  --teal: #0f8b8d;
  --orange: #ff6b35;
  --gold: #e8b83a;
  --card: #fffaf1;
  --round: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 max(16px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-right));
}
button { font: inherit; color: inherit; touch-action: manipulation; }
kbd {
  font: 600 11px var(--mono);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  background: var(--card);
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.ribbon {
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: 6px 16px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: var(--ink);
  color: var(--paper);
  font: 12px/1.4 var(--mono);
  text-align: center;
}
.ribbon strong { color: var(--gold); font-weight: 600; }

main { max-width: 980px; margin: 0 auto; }

/* ---------- hero ---------- */
.hero { padding: 28px 0 8px; text-align: center; }
.kicker {
  margin: 0;
  font: 600 13px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal);
}
h1 {
  margin: 6px 0 8px;
  font: 800 clamp(40px, 11vw, 84px)/0.95 var(--round);
  letter-spacing: -0.03em;
}
.lede { margin: 0 auto; max-width: 34em; color: var(--muted); }

.goal {
  margin: 22px auto 0;
  max-width: 560px;
  padding: 14px 16px 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--ink);
  text-align: left;
}
.g-label { font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.g-num { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 4px; }
.g-num b { font: 800 clamp(32px, 9vw, 48px)/1 var(--round); font-variant-numeric: tabular-nums; }
.g-num span { font: 13px var(--mono); color: var(--muted); }
.meter.big { height: 16px; margin: 10px 0 6px; }
.g-sub { font: 12px var(--mono); color: var(--muted); }
.goal.done .meter i { background: repeating-linear-gradient(-45deg, var(--teal) 0 6px, #2fb3b0 6px 12px); }

/* ---------- bar: menu + receipt ---------- */
.bar { display: grid; gap: 20px; padding: 28px 0 8px; }
.menu {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.menu .wide { grid-column: 1 / -1; }
.menu button {
  position: relative;
  width: 100%;
  min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 2px;
  padding: 10px 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.menu button:hover { background: #fff; }
.menu button:active, .menu button.pour { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.menu button:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.menu svg { width: 100%; max-width: 140px; height: 84px; }
.menu .wide svg { max-width: 240px; }
.menu button.pour svg { animation: wobble .45s ease; }
.nm { font: 800 18px/1.1 var(--round); }
.sv { font: 12px var(--mono); color: var(--muted); }
.menu kbd { position: absolute; top: 8px; right: 8px; }
@media (hover: none) { .menu kbd { display: none; } }
@keyframes wobble { 30% { transform: rotate(-6deg) scale(1.05); } 60% { transform: rotate(4deg); } }

.fine { margin: -6px 0 0; text-align: center; font: 12px var(--mono); color: var(--muted); }

/* bubbles */
.bubble {
  position: fixed; z-index: 9; pointer-events: none;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gold);
  animation: rise .9s ease-out forwards;
}
@keyframes rise { to { transform: translate(var(--dx), -140px) scale(.4); opacity: 0; } }

/* receipt */
.receipt {
  position: relative;
  padding: 18px 18px 22px;
  background: #fff;
  font: 13px/1.5 var(--mono);
  box-shadow: 0 1px 0 var(--line), 0 10px 24px rgba(28,26,23,.12);
  --zz: radial-gradient(circle at 6px 0, transparent 6px, #fff 6.5px);
}
.receipt::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: var(--zz) 0 0 / 12px 10px repeat-x;
}
.r-head { display: flex; justify-content: space-between; font-size: 15px; }
.r-sub { margin: 0 0 10px; color: var(--muted); border-bottom: 1px dashed var(--ink); padding-bottom: 10px; }
.r-lines { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; }
.r-lines li { display: flex; justify-content: space-between; gap: 10px; }
.r-lines li.new { animation: print .35s steps(4); }
.r-lines .empty { color: var(--muted); justify-content: center; }
@keyframes print { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.r-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--ink);
}
.r-total b { font: 800 26px var(--round); font-variant-numeric: tabular-nums; }
.meter { height: 10px; border: 1.5px solid var(--ink); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.meter i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--gold) 0 6px, #f3cd61 6px 12px); transition: width .5s ease; }
.r-goal { margin: 0; color: var(--muted); font-size: 12px; }
.r-actions { display: flex; gap: 8px; margin-top: 14px; }
.r-actions button {
  min-height: 44px; padding: 0 14px;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--card);
  font: 700 14px var(--round); cursor: pointer;
}
.r-actions .primary { flex: 1; background: var(--orange); color: #fff; border-color: var(--ink); }
.r-actions button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.r-foot { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 11px; }
.friend { display: block; width: fit-content; margin: 16px auto 0; padding: 8px 12px; background: #e6f4f3; border: 1.5px solid var(--teal); border-radius: 10px; font: 13px/1.4 var(--mono); max-width: 34em; }
.friend[hidden] { display: none; }

/* tip */
.tip {
  margin: 40px 0 0; padding: 20px; text-align: center;
  border: 2px dashed var(--line); border-radius: 16px;
}
.tip h2 { margin: 0 0 6px; font: 800 22px var(--round); }
.tip p { margin: 0 auto 14px; max-width: 34em; color: var(--muted); font-size: 14px; }
.tip-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--teal); color: #fff;
  font: 700 15px var(--round); text-decoration: none;
}

/* guide */
.guide { max-width: 680px; margin: 0 auto; padding: 40px 0 48px; }
.guide h2 { font: 800 24px/1.2 var(--round); margin: 32px 0 8px; }
.guide code { font: 13px var(--mono); background: var(--card); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; min-height: 28px; }
details p { margin: 8px 0 0; color: var(--muted); }
footer { margin-top: 32px; font-size: 12px; color: var(--muted); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 99px; background: var(--ink); color: var(--paper);
  font: 13px var(--mono); z-index: 10; max-width: calc(100vw - 32px); text-align: center;
}

/* ---------- wider screens ---------- */
@media (min-width: 760px) {
  .hero { padding-top: 48px; }
  .bar { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .bar .fine { grid-column: 1; grid-row: 2; }
  .receipt { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 16px; }
  .menu { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.r-actions #reset.armed { background: var(--ink); color: var(--paper); }

/* usdt tip */
.g-cta { display: inline-block; margin-top: 8px; font: 700 14px var(--round); color: var(--teal); text-decoration: none; border-bottom: 2px solid currentColor; }
.tip { scroll-margin-top: 12px; }
.usdt { margin: 16px auto 0; max-width: 480px; text-align: left; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.presets button {
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--card); cursor: pointer;
  font: 800 20px/1.1 var(--round);
}
.presets small { font: 11px var(--mono); color: var(--muted); }
.presets .pop small { color: var(--orange); font-weight: 700; }
.presets button.on { background: var(--orange); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.presets button.on small { color: #fff; }
.custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; font: 13px var(--mono); color: var(--muted); }
.custom input { width: 96px; min-height: 40px; padding: 0 8px; border: 1.5px solid var(--ink); border-radius: 8px; font: 700 16px var(--mono); background: #fff; }
.u-sum { margin: 8px 0 0 !important; text-align: left; font: 14px var(--mono); color: var(--ink) !important; }
.steps { margin: 14px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); text-align: left; }
.steps li { margin-bottom: 8px; }
.steps b { color: var(--ink); }
.usdt code { display: block; margin-top: 6px; padding: 10px; background: #fff; border: 1.5px solid var(--ink); border-radius: 8px; font: 13px var(--mono); word-break: break-all; user-select: all; color: var(--ink); }
.usdt button#u-copy { margin-top: 8px; min-height: 44px; padding: 0 16px; border: 2px solid var(--ink); border-radius: 10px; background: var(--teal); color: #fff; font: 700 14px var(--round); cursor: pointer; }
.mini { margin-left: 4px; padding: 2px 8px; min-height: 28px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--card); font: 12px var(--mono); cursor: pointer; }
.u-warn { margin: 8px auto 0 !important; font-size: 12px !important; text-align: left; }
