:root {
  --radius: 14px;
}
/* Colour themes, chosen by data-theme on <html> (public pages default to light; see js/theme.js).
   Without the attribute (the admin panel) the dark set applies. */
:root, :root[data-theme="dark"] {
  --bg: #0b0b0d;
  --surface: #151518;
  --surface-2: #1d1d21;
  --input-bg: #0b0b0d;
  --line: #2a2a30;
  --text: #ffffff;
  --muted: #a1a1aa;
  --red: #eb0029;
  --red-soft: rgba(235, 0, 41, 0.14);
  --on-red: #ffffff;
  --err: #ff6b81;
  --ok: #1f9d55;
  --ok-soft: rgba(31, 157, 85, 0.12);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, 0.14);
  --amber-text: #ffc061;
  --disabled-bg: #121215;
  --disabled-line: #222227;
  --disabled-text: #85858f;
  --qr-bg: #ffffff;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f7f7f9;
  --input-bg: #ffffff;
  --line: #d9d9e0;
  --text: #111114;
  --muted: #55555f;
  --red: #e00027;
  --red-soft: rgba(224, 0, 39, 0.07);
  --on-red: #ffffff;
  --err: #c4001f;
  --ok: #157a40;
  --ok-soft: rgba(21, 122, 64, 0.09);
  --amber: #c27803;
  --amber-soft: rgba(245, 165, 36, 0.12);
  --amber-text: #8a5300;
  --disabled-bg: #ececf0;
  --disabled-line: #e0e0e6;
  --disabled-text: #6a6a74;
  --qr-bg: #ffffff;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--text); }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }

header.top { border-bottom: 1px solid var(--line); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; text-decoration: none; }
.logo img { display: block; height: 36px; width: auto; }
/* One logo per theme, switched by the same data-theme as the toggle (set in <head> by theme.js, so no flash). */
:root[data-theme="light"] .logo .for-dark, :root:not([data-theme="light"]) .logo .for-light { display: none; }
nav a { color: var(--muted); text-decoration: none; font-size: 14px; margin-inline-start: 16px; }
nav a:hover { color: var(--text); }

main { flex: 1; padding: 28px 0 48px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.step { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }

label.field { display: block; }
input[type="text"] {
  width: 100%; background: var(--input-bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 14px; font: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px;
}
input[type="text"]:focus { outline: none; border-color: var(--red); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hint.err { color: var(--err); }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 6px; }
.card > p:last-child { margin-bottom: 0; }
fieldset.field { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
fieldset.field legend { padding: 0; }
.footnote { font-size: 12px; margin-top: -4px; }

.choices { display: grid; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choices.three .choice label { padding: 11px 10px; text-align: center; }
.choices.three .big { font-size: 16px; }
.choices.three .small { font-size: 12px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: block; height: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); cursor: pointer;
}
.choice input:checked + label { border-color: var(--red); background: var(--red-soft); }
.choice input:focus-visible + label { outline: 2px solid var(--red); outline-offset: 2px; }
.choice input:disabled + label { background: var(--disabled-bg); border-color: var(--disabled-line); color: var(--disabled-text); cursor: not-allowed; }
.choice input:disabled + label .small { color: var(--disabled-text); }
.choice .big { font-weight: 700; font-size: 18px; display: block; }
.choice .small { color: var(--muted); font-size: 13px; }
.choice .small.soon { font-weight: 600; }
.choice .big.with-logo { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 6px; }
.logo-img { width: 24px; height: 24px; object-fit: contain; flex: none; }
.choice input:disabled + label .logo-img { filter: grayscale(1); opacity: 0.55; }
.choice .opt-price { display: block; margin-top: 10px; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.choice .opt-coin { display: block; font-variant-numeric: tabular-nums; }


.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.price { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.price small { font-size: 16px; color: var(--muted); font-weight: 600; }
.pay-figure { display: flex; flex-direction: column; align-items: flex-end; text-align: end; }
.pay-figure .sub { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.breakdown { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.bd-row { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; padding: 2px 0; }
.usd { color: var(--muted); font-size: 15px; font-weight: 600; white-space: nowrap; }
.amount-line { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.coin-mark { position: relative; flex: none; width: 30px; height: 30px; align-self: center; }
.coin-mark .coin-img { width: 30px; height: 30px; object-fit: contain; display: block; }
.coin-mark .net-badge { position: absolute; inset-inline-end: -5px; bottom: -4px; width: 16px; height: 16px; object-fit: contain; border-radius: 3px; background: var(--bg); box-shadow: 0 0 0 2px var(--bg); }
.amount-line code { flex: 0 1 auto; word-break: normal; overflow-wrap: anywhere; }

.btn {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 15px; font: inherit; font-weight: 700; font-size: 17px;
  background: var(--red); color: var(--on-red); cursor: pointer; text-align: center; text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.small { display: inline-block; width: auto; padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.notice { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.notice.warn { border-color: var(--red); background: var(--red-soft); }
.notice.ok { border-color: var(--ok); background: var(--ok-soft); }
.notice.caution { border-color: var(--amber); background: var(--amber-soft); }
.notice.caution .notice-title { display: block; color: var(--amber-text); margin-bottom: 4px; }
.notice.caution p { margin: 6px 0 0; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: end; word-break: break-all; }
/* Left-to-right values (addresses, amounts) on right-to-left pages still sit at the far end of the row. */
[dir="rtl"] .kv dd[dir="ltr"] { text-align: left; }
/* Amounts inside a value (bdi, see common.js T.ltr) stay on one line; long addresses can still break. */
.kv dd bdi { white-space: nowrap; }

.addr-box { display: flex; gap: 8px; align-items: center; background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.addr-box code { flex: 1; word-break: break-all; font-size: 14px; }
.qr { background: var(--qr-bg); border-radius: 12px; padding: 10px; width: 200px; max-width: 100%; margin: 14px auto; display: block; }

.timer { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 1px; }
.timer.red { color: var(--red); }
.center { text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.status-pill.red { background: var(--red); border-color: var(--red); color: var(--on-red); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--red); width: 0; transition: width 0.5s; }

footer { border-top: 1px solid var(--line); padding: 20px 0; font-size: 13px; color: var(--muted); }
footer a { color: var(--muted); }
footer .foot-links { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 18px; }
footer .foot-links a { color: var(--text); text-decoration: none; font-weight: 600; }
footer .foot-links a:hover { color: var(--red); }
footer .foot-links a[aria-current="page"] { color: var(--red); }

/* Refund / Fees pages */
.result-kv { margin-top: 4px; }
.result-kv dd.big { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fee-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fee-table th, .fee-table td { padding: 10px 4px; border-bottom: 1px solid var(--line); text-align: start; }
.fee-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.fee-table td.num, .fee-table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.fee-table tr:last-child td { border-bottom: 0; }
.fee-table .opt { display: flex; align-items: center; gap: 8px; }
.notice ul { margin: 8px 0 0; padding-inline-start: 20px; }
footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--red); }
.theme-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; flex: none; }
/* The button offers the other theme: a moon + "Dark" in light mode, a sun + "Light" in dark mode. */
:root[data-theme="light"] .theme-toggle .to-light, :root:not([data-theme="light"]) .theme-toggle .to-dark { display: none; }
[hidden] { display: none !important; }

@media (min-width: 640px) {
  h1 { font-size: 32px; }
}
.mb { margin-bottom: 14px; }
.mt { margin-top: 16px; }
@media (max-width: 479px) {
  .theme-toggle { margin-inline-start: 0; }
}
