/* JoyReceipt — warm thermal-paper receipts on a deep dusk sky. */
:root {
  --dusk: #14121f; --dusk-2: #1d1a2d; --dusk-3: #272339; --line: #3a3452;
  --text: #f7efe4; --muted: #cbbfd2; --faint: #9a8fa8;
  --amber: #f3b37a; --rose: #e98a9f; --glow-a: rgba(243, 179, 122, .55); --glow-b: rgba(233, 138, 159, .35);
  --paper: #fbf6ec; --ink: #2a2530; --ink-soft: #6e6574;
  --focus: #ffe08a; --danger: #ffb3b3; --ok: #a8e6c4;
  --radius: 18px; --gap: clamp(16px, 3vw, 28px);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--dusk); color: var(--text); font: 17px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 520px at 50% -12%, var(--glow-a), transparent 62%), radial-gradient(700px 480px at 92% 8%, var(--glow-b), transparent 60%), linear-gradient(180deg, #1a1628 0%, var(--dusk) 55%); }
a { color: var(--amber); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
main:focus, main:focus-visible { outline: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); color: var(--ink); padding: 8px 12px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 6vw, 40px); font-weight: 700; }
h2 { font-size: 22px; font-weight: 650; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: 14px; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 13px; color: var(--amber); font-weight: 600; margin-bottom: .6em; }

/* ---------- layout ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto; padding: 14px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff2d9, var(--amber) 45%, var(--rose) 100%); box-shadow: 0 0 18px var(--glow-a); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tabs a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: 15px; font-weight: 550; }
.tabs a[aria-current="page"] { color: var(--dusk); background: var(--amber); }
.app, .page { max-width: 760px; margin: 0 auto; padding: 8px 16px 96px; }
.stack > * + * { margin-top: var(--gap); }
.card { background: color-mix(in srgb, var(--dusk-2) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 4vw, 28px); margin-bottom: var(--gap); }
.card.wide { max-width: 1100px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--paper); color: var(--ink); padding: 0; border-radius: 12px; font-weight: 550; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 20; }
.toast:not(:empty) { padding: 12px 18px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; font: 600 16px/1.2 var(--font); text-decoration: none; cursor: pointer; transition: transform .2s var(--ease), background .2s var(--ease); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--amber), var(--rose)); color: #1b1220; box-shadow: 0 6px 24px rgba(233, 138, 159, .28); }
.btn.secondary { background: var(--dusk-3); color: var(--text); border-color: var(--line); }
.btn.quiet { background: transparent; color: var(--text); border-color: var(--line); }
.btn.link { background: none; border: 0; color: var(--amber); padding: 6px 4px; min-height: 0; text-decoration: underline; }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=time], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--dusk); color: var(--text); font: 17px/1.4 var(--font); }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 16px; }
.hint { font-size: 14px; color: var(--faint); margin-top: 4px; }
.counter { float: right; font-weight: 400; color: var(--faint); font-size: 13px; }
.notice { border-radius: 12px; padding: 12px 16px; background: var(--dusk-3); border: 1px solid var(--line); margin-bottom: 16px; }
.notice.warn { border-color: color-mix(in srgb, var(--amber) 60%, transparent); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--dusk-3); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pill.plus { background: linear-gradient(135deg, var(--amber), var(--rose)); color: #1b1220; border: 0; font-weight: 700; }

/* ---------- glow orb ---------- */
.orb-wrap { display: grid; place-items: center; padding: 18px 0 8px; }
.orb { --level: .5; width: clamp(150px, 42vw, 220px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff6e8 0%, #ffd2a1 22%, var(--amber) 48%, var(--rose) 100%);
  opacity: calc(.6 + var(--level) * .4);
  box-shadow: 0 0 calc(24px + var(--level) * 80px) calc(4px + var(--level) * 26px) var(--glow-a), 0 0 calc(60px + var(--level) * 120px) calc(var(--level) * 30px) var(--glow-b);
  animation: idle 7s var(--ease) infinite; }
@keyframes idle { 50% { transform: scale(1.04); } }
.orb.breathing { animation: none; transition: transform 4s var(--ease); }
.orb.breathing.in { transform: scale(1.35); transition-duration: 4s; }
.orb.breathing.out { transform: scale(.85); transition-duration: 6s; }
.breath-label { font-size: 22px; font-weight: 600; text-align: center; min-height: 1.6em; margin-top: 24px; }

/* ---------- glimmer form ---------- */
.glimmer { position: relative; }
.glimmer .num { position: absolute; left: 14px; top: 13px; font: 600 15px var(--mono); color: var(--amber); }
.glimmer input { padding-left: 42px; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.styles label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 500; cursor: pointer; margin: 0; min-height: 48px; }
.styles input { accent-color: var(--amber); width: 18px; height: 18px; }
.styles label:has(input:checked) { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); }
.styles .lock { margin-left: auto; font-size: 12px; color: var(--faint); }

/* ---------- the receipt ---------- */
.receipt-wrap { display: grid; place-items: center; padding: 10px 0 28px; }
.receipt { --paper-bg: var(--paper); --r-ink: var(--ink); --r-soft: var(--ink-soft);
  position: relative; width: min(100%, 360px); background: var(--paper-bg); color: var(--r-ink);
  font: 500 14px/1.55 var(--mono); text-align: left; padding: 26px 22px 30px; border-radius: 4px 4px 0 0;
  box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 0 80px rgba(243,179,122,.18);
  animation: print 1.1s var(--ease) both; transform-origin: top center; }
.receipt::after { /* torn zig-zag bottom edge */
  content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 12px;
  background: linear-gradient(-45deg, transparent 8px, var(--paper-bg) 0) 0 0 / 16px 12px repeat-x, linear-gradient(45deg, transparent 8px, var(--paper-bg) 0) 0 0 / 16px 12px repeat-x; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-14px); } to { clip-path: inset(0 0 -20px 0); transform: none; } }
.r-head { text-align: center; }
.r-brand { font-weight: 800; letter-spacing: .32em; font-size: 17px; margin: 0; }
.r-for { margin: 6px 0 0; font-weight: 700; letter-spacing: .08em; }
.r-stamp { margin: 4px 0 0; color: var(--r-soft); font-size: 13px; }
.r-rule { border: 0; border-top: 2px dashed color-mix(in srgb, var(--r-ink) 45%, transparent); margin: 14px 0; }
.r-items { list-style: none; margin: 0; padding: 0; }
.r-item { display: flex; align-items: baseline; gap: 6px; margin: 4px 0; }
.r-qty { color: var(--r-soft); flex: none; }
.r-label { flex: 0 1 auto; overflow-wrap: anywhere; }
.r-dots { flex: 1 1 12px; border-bottom: 2px dotted color-mix(in srgb, var(--r-ink) 35%, transparent); transform: translateY(-4px); min-width: 12px; }
.r-price { flex: none; font-weight: 700; }
.r-line { display: flex; justify-content: space-between; gap: 10px; margin: 2px 0; }
.r-total { font-weight: 800; font-size: 16px; margin-top: 6px; }
.r-from { text-align: center; font-style: italic; margin: 0 0 10px; }
.r-barcode { display: grid; place-items: center; color: var(--r-ink); margin: 6px 0; }
.r-barcode svg { max-width: 100%; height: 34px; }
.r-foot { text-align: center; color: var(--r-soft); font-size: 12px; margin: 4px 0 0; letter-spacing: .04em; }

/* styles (Plus) */
.receipt.style-diner { --paper-bg: #fff3d6; --r-ink: #7a1f1f; --r-soft: #a5523a; font-family: "Courier New", Courier, var(--mono); }
.receipt.style-diner .r-brand { color: #b3261e; }
.receipt.style-boarding { --paper-bg: #eef4fb; --r-ink: #12355b; --r-soft: #4b6788; border-left: 10px solid #2c6fb7; text-transform: uppercase; }
.receipt.style-ticket { --paper-bg: #fde8c8; --r-ink: #3b1d0e; --r-soft: #7b4a2e; border: 2px dashed #b5653a; border-radius: 10px; }
.receipt.style-letter { --paper-bg: #fff0f3; --r-ink: #6b1f3a; --r-soft: #9c4d6a; font-family: Georgia, "Iowan Old Style", serif; font-style: italic; }
.receipt.style-crayon { --paper-bg: #fffdf5; --r-ink: #2f4fa8; --r-soft: #d9534f; font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", cursive, var(--mono); }
.receipt.style-crayon .r-rule { border-top-style: solid; border-top-color: #f0ad4e; border-top-width: 4px; border-radius: 4px; }
.receipt.style-holiday { --paper-bg: #f6fbf4; --r-ink: #1f5132; --r-soft: #b33a3a; }
.receipt.style-holiday .r-rule { border-top: 4px dotted #b33a3a; }
.receipt.style-minimal { --paper-bg: #ffffff; --r-ink: #111; --r-soft: #777; font-family: var(--font); letter-spacing: .01em; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.receipt.style-minimal .r-rule { border-top: 1px solid #ddd; }

/* ---------- lists ---------- */
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .grow { flex: 1; min-width: 0; }
.mini-list a.item { color: var(--text); text-decoration: none; display: block; }
.mini-list .sub { color: var(--faint); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month { margin-top: 18px; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .12em; }

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--dusk-3); display: flex; flex-direction: column; gap: 10px; }
.plan.best { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.plan .price { font-size: 28px; font-weight: 750; }
.ticks { list-style: none; padding: 0; margin: 0 0 12px; }
.ticks li { padding-left: 26px; position: relative; margin: 6px 0; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--amber); font-weight: 800; }

/* ---------- wrapped ---------- */
.wrapped-stat { font-size: clamp(40px, 12vw, 64px); font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--amber), var(--rose)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar { height: 10px; border-radius: 999px; background: var(--dusk-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--rose)); }

/* ---------- crisis ---------- */
.crisis { border-color: color-mix(in srgb, var(--rose) 60%, transparent); }
.crisis a.btn { width: 100%; justify-content: flex-start; margin-bottom: 8px; }

/* ---------- recipient page ---------- */
.recipient { text-align: center; padding-top: 24px; }
.recipient .eyebrow { font-size: 15px; max-width: 30ch; margin: 0 auto 18px; line-height: 1.4; }
.recipient-actions { display: grid; gap: 10px; max-width: 360px; margin: 12px auto 22px; }
.recipient-safety { max-width: 420px; margin: 0 auto 18px; text-align: left; background: var(--dusk-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.recipient-safety summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.recipient-safety select { width: auto; flex: 1 1 160px; }

/* ---------- operator ---------- */
.op-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }

@media (max-width: 480px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .tabs { justify-content: flex-start; }
  .tabs a { padding: 8px 10px; font-size: 14px; }
  .receipt { font-size: 13px; padding: 22px 16px 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .orb, .receipt { animation: none !important; }
  .orb.breathing.in, .orb.breathing.out { transform: none; }
  * { transition-duration: .01ms !important; }
}
.reduce-motion .orb, .reduce-motion .receipt { animation: none !important; }
