/* The pay site: unsubscribed.dev's look (its palette, system fonts and the receipt), for the one page where money comes in.
   Calm on purpose: one bold object, the receipt of the pack you pick; everything around it quiet. */
:root {
  --bg: #f3f3ef; --surface: #e8e8e2; --fg: #1d1f1c; --muted: #575a54; --line: #d3d4cc;
  --accent: #c2410c; --on-accent: #fff;
  /* The receipt is paper in both themes, as on unsubscribed.dev. */
  --paper: #fbfbf8; --ink: #1d1f1c; --dim: #575a54; --red: #b93e0c; --rule: #c9cac2; --dots: #b4b5ad;
  --display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Roboto Mono", monospace;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  color-scheme: light dark;
}
/* Dark follows the device, unless the embedded view's app passed its own theme (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1e2125; --fg: #ecebe6; --muted: #a8aaa5; --line: #2d3036;
    --accent: #ff6a3d; --on-accent: #15171a; --paper: #e9e8e2;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --surface: #1e2125; --fg: #ecebe6; --muted: #a8aaa5; --line: #2d3036;
  --accent: #ff6a3d; --on-accent: #15171a; --paper: #e9e8e2; color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1.0625rem/1.6 var(--text); }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
p { margin: 0 0 1rem; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }

/* Top bar: the mark home, the language switch and sign-out. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.mark { font: 800 1.45rem/1 var(--display); letter-spacing: -0.035em; color: var(--fg); text-decoration: none; white-space: nowrap; }
.mark span { color: var(--accent); display: inline-block; transform: rotate(9deg) translateX(.04em); }
.top-actions { display: flex; align-items: center; gap: .25rem; margin-right: -.6rem; }
.link-btn { background: none; border: 0; padding: 0 .6rem; min-height: 44px; color: var(--muted); font-size: .95rem; cursor: pointer;
  display: inline-flex; align-items: center; text-decoration: none; }
.link-btn:hover { color: var(--fg); }

/* Two columns from 60rem: what you do on the left, the receipt of your pack on the right. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side" "hist"; gap: 2.5rem; padding: 1.5rem 0 1rem; }
.main-col { grid-area: main; }
.side { grid-area: side; }
#history { grid-area: hist; }
#history:empty { display: none; }
@media (min-width: 60rem) {
  .layout { grid-template-columns: minmax(0, 1fr) 25rem; grid-template-areas: "main side" "hist side"; grid-template-rows: auto 1fr; gap: 0 3.5rem; padding-top: 2.5rem; }
  .side { position: sticky; top: 1.5rem; align-self: start; }
}

h1 { font-size: clamp(2.4rem, 9vw, 4rem); font-weight: 800; letter-spacing: -0.045em; line-height: 1; margin-bottom: 1rem; }
.lead { font-size: 1.15rem; line-height: 1.55; color: var(--muted); max-width: 36rem; margin-bottom: 1.5rem; }

/* The balance: the one number that's yours. */
.balance { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; padding: 1rem 0 1.1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.balance .label { color: var(--muted); }
.balance .amount { font: 800 clamp(2rem, 8vw, 2.75rem)/1.1 var(--display); letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.balance .who { flex-basis: 100%; font-size: .95rem; color: var(--muted); overflow-wrap: anywhere; }
.signed-out { padding: 1rem 0 0; border-top: 1px solid var(--line); }
.signed-out p { margin-bottom: .75rem; }

h2 { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; margin: 2.5rem 0 .5rem; }
#history h2 { margin-top: 0; }
@media (min-width: 60rem) { #history h2 { margin-top: 3rem; } }
.intro { color: var(--muted); max-width: 38rem; }

/* The packs: three choices, a radio group. On phones each is a row; from 36rem they sit side by side. */
.packs { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: .75rem; }
.packs legend { padding: 0; margin-bottom: .75rem; font-weight: 650; }
@media (min-width: 36rem) { .packs { grid-template-columns: repeat(3, minmax(0, 1fr)); } .packs legend { grid-column: 1 / -1; } }
.pack { position: relative; display: grid; gap: .15rem; padding: 1rem 1rem 1.1rem 2.9rem; border-radius: var(--r); background: var(--surface);
  border: 2px solid transparent; cursor: pointer; transition: border-color .15s ease-out; }
.pack input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pack::before { content: ""; position: absolute; left: 1rem; top: 1.35rem; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 2px solid var(--muted); background: var(--bg); }
.pack:has(input:checked) { border-color: var(--accent); }
.pack:has(input:checked)::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 45%, var(--bg) 50%); }
.pack:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.pack .price { font: 800 1.6rem/1.15 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pack .credit { font-weight: 650; }
.pack .meta { font-size: .95rem; color: var(--muted); }
/* The fee share as a bar: the bigger the pack, the less of it goes to fees. */
.feebar { height: 6px; border-radius: 3px; background: var(--line); margin-top: .4rem; overflow: hidden; }
.feebar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }

/* The receipt: paper on the table, the pack's maths printed line by line, and the button to pay. */
.receipt-wrap { filter: drop-shadow(0 18px 28px rgb(40 42 36 / .16)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .receipt-wrap { filter: drop-shadow(0 18px 30px rgb(0 0 0 / .45)); } }
.receipt { background: var(--paper); color: var(--ink); font: .95rem/1.5 var(--mono); padding: 1.6rem 1.3rem 2.4rem;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 18px 100%; }
.receipt a:not(.pay) { color: var(--red); }
.receipt :focus-visible { outline-color: var(--red); }
.r-head { font: 800 1.45rem/1 var(--display); letter-spacing: -0.03em; text-align: center; margin: 0 0 .35rem; }
.r-head span { color: var(--red); }
.r-sub { font: 400 .9rem/1.4 var(--mono); color: var(--dim); text-align: center; margin: 0 0 1rem; letter-spacing: 0; }
.receipt dl { margin: 0; padding: .8rem 0; border-top: 2px dashed var(--rule); }
.receipt dl div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5rem; padding: .25rem 0; }
.receipt dt { flex: 1 0 auto; display: flex; align-items: baseline; white-space: nowrap; }
.receipt dt::after { content: ""; flex: 1; min-width: .75rem; margin-left: .5rem; border-bottom: 2px dotted var(--dots); }
.receipt dd { margin: 0 0 0 auto; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 24rem) { .receipt dt { white-space: normal; flex-shrink: 1; } }
.receipt .sub dt { padding-left: 1.2ch; color: var(--dim); }
.receipt .sub dd { color: var(--dim); font-weight: 400; }
.receipt .total dd { font: 800 1.35rem/1.2 var(--display); letter-spacing: -0.02em; color: var(--red); }
.r-note { color: var(--dim); font-size: .85rem; margin: -.4rem 0 .9rem; }
.r-thanks { text-align: center; margin: 1.1rem 0 0; padding-top: 1rem; border-top: 2px dashed var(--rule); font-weight: 700; }
.r-status { font: 800 1.35rem/1.2 var(--display); letter-spacing: -0.02em; text-align: center; margin: .2rem 0 .6rem; }
.r-text { font: .95rem/1.55 var(--text); color: var(--ink); text-align: center; margin: 0 0 1rem; }

/* The one button that matters. Inside the receipt it is ink on paper's terms: accent, white text. */
.pay { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 3.5rem; padding: .75rem 1rem; border: 0; border-radius: var(--r);
  background: #c2410c; color: #fff; font: 650 1.15rem/1.3 var(--display); text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .15s ease-out, filter .15s ease-out; }
.pay:hover { filter: brightness(1.08); }
.pay:active { transform: translateY(1px); }
.pay:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.pay[disabled] { cursor: progress; filter: saturate(.6); }
.pay.quiet { background: none; color: var(--red); border: 2px solid currentColor; min-height: 3rem; }
.methods { font: .85rem/1.45 var(--text); color: var(--dim); text-align: center; margin: .7rem 0 0; }
.alert { font: .95rem/1.5 var(--text); color: var(--red); background: #f7e3da; border-radius: 8px; padding: .6rem .8rem; margin: .8rem 0 0; }

/* Google's button, centred; the dev-only test sign-in under it. */
.gsi { display: flex; justify-content: center; min-height: 44px; }
.test-signin { display: grid; gap: .4rem; margin-top: .9rem; font: .9rem/1.4 var(--text); }
.test-signin label { font-weight: 650; }
.test-signin .row { display: flex; gap: .5rem; }
.test-signin input { flex: 1; min-width: 0; min-height: 44px; padding: 0 .7rem; border-radius: 10px; border: 2px solid var(--rule); background: #fff; color: var(--ink); font: 1rem var(--mono); }
.test-signin input:focus-visible { outline: 3px solid var(--red); outline-offset: 1px; }
.test-signin button { min-height: 44px; padding: 0 1rem; border-radius: 10px; border: 0; background: var(--ink); color: var(--paper); font-weight: 650; cursor: pointer; }
.test-signin .hint { color: var(--dim); font-size: .85rem; }
.signed-out .gsi { justify-content: flex-start; }
.signed-out .test-signin { max-width: 26rem; margin-top: 0; }
.signed-out .test-signin .hint { color: var(--muted); }
.signed-out .test-signin button { background: var(--fg); color: var(--bg); }

/* History: spend per app, then each record; a top-up opens to its receipt. */
.spend-title { font: 650 1.05rem/1.3 var(--text); margin: 0 0 .4rem; }
.spend { margin: 0 0 1.5rem; padding: 0; list-style: none; font-family: var(--mono); font-size: .95rem; }
.spend li { display: flex; align-items: baseline; gap: .5rem; padding: .2rem 0; }
.spend li span:first-child { display: flex; flex: 1 0 auto; align-items: baseline; }
.spend li span:first-child::after { content: ""; flex: 1; min-width: .75rem; margin-left: .5rem; border-bottom: 2px dotted var(--line); }
.spend b { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.history { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.history > li { border-bottom: 1px solid var(--line); }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 1rem; align-items: baseline; padding: .8rem 0; }
.entry .what { font-weight: 600; }
.entry .when { grid-column: 1; font-size: .9rem; color: var(--muted); }
.entry .amount { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 700 1.05rem/1.2 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry .amount.plus { color: var(--fg); }
.entry .amount.minus { color: var(--muted); }
details > summary { list-style: none; cursor: pointer; border-radius: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary .what::after { content: ""; display: inline-block; width: .45em; height: .45em; margin-left: .5em; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-.2em) rotate(45deg); transition: transform .15s ease-out; }
details[open] > summary .what::after { transform: translateY(0) rotate(225deg); }
details .receipt { margin: 0 0 1rem; padding: .4rem 1rem 1.6rem; font-size: .88rem; }
details .receipt dl:first-child { border-top: 0; }

/* Moving the wallet: a quiet button for the code, a small form for entering one. */
.page-quiet { width: auto; padding: 0 1.25rem; color: var(--accent); }
.move-form { display: grid; gap: .4rem; margin: 1.25rem 0 0; max-width: 30rem; }
.move-form label { font-weight: 650; }
.move-form .row { display: flex; gap: .5rem; }
.move-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 .7rem; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--fg); font: 1rem var(--mono); }
.move-form input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.move-form button { min-height: 44px; padding: 0 1rem; border-radius: 10px; border: 0; background: var(--fg); color: var(--bg); font-weight: 650; cursor: pointer; }
#move-result { margin-top: 1rem; }
.move-code code { font: 700 1.05rem var(--mono); overflow-wrap: anywhere; user-select: all; }
.move-code .link-btn { color: var(--accent); }
#history s.amount { text-decoration-thickness: 2px; }

/* Footer: who sells, where to write, the retracto and refunds, how prices are set. */
.foot { border-top: 1px solid var(--line); margin-top: 3.5rem; padding: 1.5rem 0 3rem; font-size: .92rem; color: var(--muted); display: grid; gap: .25rem 2.5rem; }
@media (min-width: 48rem) { .foot { grid-template-columns: 1fr 1fr; } }
.foot p { margin: 0 0 .75rem; max-width: 40rem; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.foot .contact a { min-height: 0; }
.foot .who { color: var(--fg); font-weight: 600; }

/* One moment of motion: the receipt prints when it appears, and again when a payment confirms. */
@media (prefers-reduced-motion: no-preference) {
  .receipt.print { animation: print .9s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-10px); } to { clip-path: inset(0 0 0 0); transform: none; } }
  .waiting::after { content: ""; display: block; height: 2px; margin: 1rem auto 0; width: 40%; background: var(--red); animation: wait 1.4s ease-in-out infinite alternate; }
  @keyframes wait { from { transform: translateX(-60%); opacity: .3; } to { transform: translateX(60%); opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* The return page: the payment's receipt alone, centred. */
.ret { max-width: 28rem; margin: 2rem auto 0; }
.ret .r-action, .ret .pay { margin-top: 1.25rem; }

/* The records export, under the history: two quiet buttons. */
.export { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .25rem; margin: 1rem 0 2.5rem; color: var(--muted); font-size: .95rem; }
.export span { margin-right: .35rem; }
.export .link-btn { color: var(--accent); font-weight: 650; text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }

/* The embedded view inside the apps: one column, no footer; the top-up sentence is plain text, never a link. */
.embedded .top { min-height: 3.25rem; }
.layout.view { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "hist"; gap: 2rem; padding-top: .5rem; max-width: 44rem; }
.layout.view h1 { font-size: clamp(2rem, 9vw, 3rem); }
.layout.view #history h2 { margin-top: 0; }
.topup-note { margin: 1rem 0 0; color: var(--muted); }
.view-gone { padding: 1.5rem 0 3rem; }
