:root {
  --bg: #0d0f12;
  --surface: #16191e;
  --device: #202429;
  --device-edge: #2c3138;
  --screen: #f5f3ea;
  --ink: #1a1c1f;
  --muted: #6b7078;
  --accent: #12a074;
  --accent-warm: #e0a53b;
  --danger: #c0453a;
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1b1f26 0%, var(--bg) 60%);
  color: var(--screen);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.stage { width: 100%; max-width: 420px; }

/* Terminal device. */
.terminal {
  background: linear-gradient(180deg, var(--device) 0%, #191c21 100%);
  border: 1px solid var(--device-edge);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 30px 60px -20px rgba(0,0,0,0.7);
}

.terminal-notch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 4px 8px 12px;
}

.terminal-notch .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: blip 2.4s ease-in-out infinite;
}

@keyframes blip { 0%, 90%, 100% { opacity: 1; } 95% { opacity: 0.25; } }

/* The bright screen. */
.screen {
  background: var(--screen);
  color: var(--ink);
  border-radius: 14px;
  padding: 22px 20px 24px;
  text-align: center;
}

.prompt {
  margin: 6px 0 2px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.reaction {
  margin: 0 0 18px;
  min-height: 20px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.tiers { display: grid; gap: 10px; }

.tier {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid #d9d5c7;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.tier:hover { border-color: var(--accent); transform: translateY(-1px); }
.tier.selected { border-color: var(--accent); background: #eaf7f1; }

.tier .amt { font-size: 20px; font-weight: 800; }
.tier .tier-label { font-size: 13px; color: var(--muted); text-align: right; }

.continue {
  margin-top: 14px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease;
}
.continue:hover { filter: brightness(1.05); }
.continue:active { transform: translateY(1px); }

.no-tip {
  background: none;
  border: none;
  padding: 4px 2px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.no-tip:hover { color: var(--danger); }

.terminal-foot {
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 12px 8px 4px;
}

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

/* Jar mascot. */
.jar { width: 120px; margin: 0 auto 6px; }
.jar svg { width: 100%; height: auto; overflow: visible; }

.jar .lid, .jar .lid-band { fill: #b9722f; }
.jar .glass {
  fill: rgba(18, 160, 116, 0.10);
  stroke: #2f7d63;
  stroke-width: 2.5;
}

.jar .face path { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.jar .face circle { fill: var(--ink); }
.jar .sweat path, .jar .tear path { fill: #4aa3d1; stroke: none; }
.jar .spark path { fill: var(--accent-warm); stroke: none; }

/* Show only the face parts for the active mood. */
.jar .m-idle, .jar .m-meh, .jar .m-pleased, .jar .m-ecstatic, .jar .m-hurt,
.jar .m-overwhelmed { display: none; }
.jar[data-mood="idle"] .m-idle,
.jar[data-mood="meh"] .m-meh,
.jar[data-mood="pleased"] .m-pleased,
.jar[data-mood="ecstatic"] .m-ecstatic,
.jar[data-mood="hurt"] .m-hurt,
.jar[data-mood="overwhelmed"] .m-overwhelmed { display: inline; }

/* The open mouth is drawn as a filled shape rather than a stroke, so the
   default face rule that strokes paths has to be overridden. */
.jar .face .agape { fill: var(--ink); stroke: none; }

.jar[data-mood="idle"] .m-idle { animation: blink 3.6s steps(1) infinite; }
@keyframes blink { 0%, 92%, 100% { opacity: 1; } 96% { opacity: 0.15; } }

.jar[data-mood="ecstatic"] { animation: bounce 0.5s ease; }
@keyframes bounce { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

.jar[data-mood="hurt"] { animation: shrink 0.4s ease; }

/* The lid slumps when the jar is refused. A tilted lid does more to sell hurt
   than any change to the face, because it reads as posture rather than
   expression. */
.jar .lid, .jar .lid-band {
  transition: transform 0.35s ease;
  transform-origin: 60px 26px;
}

.jar[data-mood="hurt"] .lid,
.jar[data-mood="hurt"] .lid-band {
  transform: rotate(-9deg);
}

/* Past a certain number the lid comes off. It is the only mood the presets
   cannot reach, so it belongs to whoever went looking for it. */
.jar[data-mood="overwhelmed"] .lid,
.jar[data-mood="overwhelmed"] .lid-band {
  transform: translateY(-16px) rotate(13deg);
}

.jar[data-mood="overwhelmed"] { animation: bounce 0.5s ease; }

/* The custom amount, kept quiet on purpose. A tip screen that makes naming
   your own number easy is not the tip screen this is about. */
.minor-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
}

.other-amount {
  background: none;
  border: 0;
  padding: 4px 2px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.other-amount:hover { color: var(--ink); }

.custom { margin: 4px 0 12px; text-align: left; }

.custom-label {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.custom-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid #d9d5c7;
  border-radius: 12px;
  padding: 12px 14px;
}

.custom-field:focus-within { border-color: var(--accent); }

.custom-currency { font-size: 20px; font-weight: 700; color: var(--muted); }

.custom-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
}
@keyframes shrink { 0% { transform: scale(1); } 50% { transform: scale(0.94); } 100% { transform: scale(1); } }

.jar .coins circle { fill: var(--accent-warm); stroke: #b9722f; stroke-width: 1.5; }
.coin-drop { animation: drop 0.45s cubic-bezier(0.3, 1.4, 0.6, 1) both; }
@keyframes drop {
  0% { transform: translateY(-40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* No Tip gauntlet. */
/* Keyboard focus has to be visible on both surfaces: the pale screen and the
   dark modal. focus-visible keeps the ring off mouse clicks, where it would
   read as a stuck selection. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.overlay :focus-visible {
  outline-color: var(--screen);
}

/* The hidden attribute is what the interface toggles, and a display rule on
   an element beats the user agent's [hidden] style. Without this the guilt
   modal greets every visitor before they have refused anything, which spoils
   the one joke the page is built around. */
[hidden] {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 10, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--device-edge);
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.8);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal h2 { margin: 0 0 8px; font-size: 20px; }

/* The terms sit in the footer where a terminal files the things nobody reads,
   which is the only place the sincerity belongs. */
.terms-link {
  background: none;
  border: 0;
  padding: 0 6px;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: inherit;
  letter-spacing: inherit;
  color: inherit;
  opacity: 0.75;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.terms-link:hover { opacity: 1; }

.terms { max-width: 460px; }
.why { max-width: 380px; }

.terms-body { margin: 0 0 18px; }

.terms-body p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: #b7bcc4;
}

.terms-body p:last-child { margin-bottom: 0; color: var(--screen); }

/* The Why panel is deliberately terse: short, deadpan lines, not an essay. The
   UI is the satire, so the explanation only has to land and get out. */
.why-terse { margin: 6px 0 20px; }

.why-terse p {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--screen);
}

/* The TLDR on tipping culture: calmer register than the beats, set off by a
   rule so it reads as an aside, not another punch line. */
.why-terse p.why-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--device-edge);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  color: #b7bcc4;
}

.why-terse p.fine {
  margin-top: 16px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

/* The Why link sits under the fine print: a touch more discoverable than the
   footer Terms, since it is the sincere heart of the joke, but still quiet. */
.why-link {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: 0;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.why-link:hover { color: var(--screen); }
.modal-body { margin: 0 0 18px; font-size: 14px; color: #b7bcc4; line-height: 1.5; }

.admit {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: #d3d7dd;
  margin-bottom: 18px;
  cursor: pointer;
}
.admit input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--danger); }

.modal-actions { display: flex; gap: 10px; }

.modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: none;
}
.ghost { background: var(--accent); color: #fff; }
.ghost:hover { filter: brightness(1.06); }
.damning { background: #2a2e34; color: #9aa0a8; border: 1px solid #3a3f47; }
.damning:enabled:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.damning:disabled { opacity: 0.5; cursor: not-allowed; }

/* Toast. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--device-edge);
  color: var(--screen);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 340px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Paid screen: the receipt for a transaction where nothing happened. */
.terminal-notch .dot.ok {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.receipt {
  margin: 6px 0 14px;
  padding: 14px 2px;
  border-top: 1px dashed #c9c4b4;
  border-bottom: 1px dashed #c9c4b4;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  text-align: left;
}

.r-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.r-line span { color: var(--muted); }
.r-line b { font-weight: 700; color: var(--ink); }
.r-total { margin-top: 6px; padding-top: 8px; border-top: 1px solid #e4e0d2; }

.paid-note { margin: 0 0 16px; }

/* The Continue style is a button on the tip screen and a link on the paid
   screen, so the anchor has to be coaxed into the same block shape. */
a.continue { display: block; text-align: center; text-decoration: none; }

/* A quiet wordmark so a screenshot of any panel carries the address home. It is
   how the joke travels: as an image that signs itself. */
.wordmark {
  margin: 16px 0 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: center;
}

/* The receipt signs itself the way a printed one prints the store's website. */
.r-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #c9c4b4;
  text-align: center;
  letter-spacing: 0.12em;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
