:root {
  --bg: #0e0f11;
  --panel: #15161a;
  --card: #1a1b1f;
  --line: #26282e;
  --line-hi: #34363d;
  --text: #ececef;
  --muted: #9b9da6;
  --accent: #8b95ff;
  --good: #3ddc97;
  --warn: #f0b232;
  --bad: #ed4245;
  --avatar: #2b2d33;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
code { font-family: "IBM Plex Mono", ui-monospace, monospace; }
[hidden] { display: none !important; }

/* signed in: account line + pay-with-balance option */
.acct-line { margin: 0; font-size: 13.5px; color: var(--muted); }
.acct-line b { color: var(--text); }
.field a, .acct-line a { color: var(--accent); }
.bal-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.bal-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bal-opt input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.bal-opt span { display: grid; gap: 2px; }
.bal-opt small { font-size: 12.5px; }
#doneAccount { margin-top: 18px; }

/* issue / failure screen */
.warn-mark {
  width: 56px; height: 56px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
  font-size: 30px; font-weight: 800; line-height: 1;
}
.invoice { margin: 18px 0 6px; text-align: left; }
.invoice .muted { display: block; margin-bottom: 6px; font-size: 13px; }
#issue .copy-row { justify-content: center; }
.cta-slot:empty { display: none; }
.cta-slot { margin: 18px 0 6px; text-align: left; }
#issueReach .rc-title { font-size: 16px; }
#issueReach .rc-grid { grid-template-columns: minmax(0, 1fr); }

.wrap { max-width: 560px; margin: 0 auto; padding: 22px 16px 48px; }
.brand { display: inline-block; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--text);
  text-decoration: none; margin-bottom: 18px; }
.brand span { color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.panel.center { text-align: center; padding: 40px 24px; }
h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -0.015em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.kind { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

/* item */
.item { display: flex; gap: 16px; align-items: center; }
.thumb { width: 96px; height: 96px; flex: none; border-radius: 14px; overflow: hidden; position: relative;
  display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #25272e, #141518 72%);
  border: 1px solid var(--line); }
.item-text p { margin: 2px 0 0; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 6px;
  padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.total s { color: var(--muted); margin-right: 6px; }
.total b { font-size: 22px; }

/* previews (same look as the shop) */
.deco { position: relative; width: 74%; aspect-ratio: 1; }
.deco .avatar { position: absolute; inset: 11%; border-radius: 50%; background: var(--avatar); }
.deco img { position: absolute; inset: 0; width: 100%; height: 100%; }
.plate { width: 92%; height: 30px; border-radius: 6px; background: #202227 center / cover no-repeat; }
.effect, .bundle-img { width: 100%; height: 100%; object-fit: cover; }
.bundle { position: absolute; inset: 0; background: center / cover no-repeat; }
.bundle img { width: 100%; height: 100%; object-fit: contain; }

/* form */
form { margin-top: 18px; display: grid; gap: 18px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > span, legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.field small { font-size: 12.5px; }
input[type=email] { height: 44px; padding: 0 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; outline: none; transition: border-color .15s; }
input[type=email]:focus { border-color: var(--accent); }
.coins { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.coin { display: flex; flex-direction: column; gap: 1px; text-align: left; padding: 10px 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s; }
.coin:hover { border-color: var(--line-hi); }
.coin[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.coin b { font-size: 14px; }
.coin span { font-size: 12px; color: var(--muted); }
.error { margin: 0; color: var(--bad); font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px;
  border: 0; border-radius: 10px; background: var(--accent); color: #0e0f11; font-weight: 650; cursor: pointer;
  text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line-hi); font-weight: 550; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.closed { margin: 0; text-align: center; }

/* pay */
.pay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.6s ease-in-out infinite; }
.state.ok i { background: var(--good); }
@keyframes pulse { 50% { opacity: .35; } }

.pay-grid { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
.qr-box { display: grid; gap: 8px; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: 12px; padding: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px; }
.qr-switch button { border: 0; background: none; padding: 5px 4px; font-size: 11.5px; color: var(--muted); border-radius: 6px; cursor: pointer; }
.qr-switch button[aria-pressed="true"] { background: var(--line-hi); color: var(--text); }

.pay-fields { display: grid; gap: 14px; min-width: 0; }
.copy { display: grid; gap: 4px; font-size: 13px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; min-width: 0; font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
.copy-row code.addr { font-size: 12.5px; }
.warn { margin: 0; font-size: 13px; color: var(--warn); }
.note { margin: 0; font-size: 13.5px; padding: 10px 12px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--line); }

/* processing / done */
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-hi); border-top-color: var(--accent);
  animation: spin .9s linear infinite; margin: 0 auto 12px; }
.spin.big { width: 54px; height: 54px; border-width: 4px; margin-bottom: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading { text-align: center; padding: 48px 24px; }
.eta { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 18px 0 4px; font-variant-numeric: tabular-nums; }
.tick { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: 28px; color: #0e0f11; background: var(--good); }
.gift { margin-top: 22px; display: grid; gap: 12px; }
.gift code { font: 15px ui-monospace, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; overflow-wrap: anywhere; user-select: all; }
.gift-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.foot code { font: 12px ui-monospace, monospace; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 12.5px; }

@media (max-width: 560px) {
  .panel { padding: 18px; }
  .pay-grid { grid-template-columns: 1fr; }
  .qr-box { justify-items: center; }
  .pay-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .spin, .state i { animation-duration: 3s; }
}

/* profile frame preview (Discord has no public frame image): a profile card in a glowing frame */
.frame-pv { position: relative; width: 62%; aspect-ratio: 3 / 4; display: grid; place-items: center; }
.frame-pv .fcard { position: absolute; inset: 8%; border-radius: 14px; background: linear-gradient(180deg, #2b2d36, #1c1d22);
  border: 3px solid transparent; background-clip: padding-box; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 70%, transparent),
  0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); display: grid; align-content: start; justify-items: start; gap: 6px; padding: 18% 12% 0; }
.frame-pv .fav { width: 34%; aspect-ratio: 1; border-radius: 50%; background: #3a3c44; border: 3px solid #1c1d22; }
.frame-pv .fcard b { display: block; height: 7px; width: 80%; border-radius: 4px; background: #3a3c44; }
.frame-pv .fcard b.short { width: 55%; }
.frame-pv .ftag { position: absolute; bottom: 2%; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg, #0e0f11)); border-radius: 6px; padding: 2px 7px; }

/* cart: item lines (details / processing / done / issue) */
.cart-lines { display: grid; gap: 8px; margin: 4px 0 10px; text-align: left; }
.cart-lines .kind { margin: 0 0 2px; }
.cart-line { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.thumb.sm { width: 48px; height: 48px; border-radius: 10px; }
.thumb.sm .plate { height: 16px; }
.thumb.sm .plate .user { display: none; }
.cl-text { display: grid; min-width: 0; }
.cl-text b, .cl-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-text span { font-size: 12.5px; }
.cl-price { font-variant-numeric: tabular-nums; }
.cl-acts { display: flex; gap: 6px; }
.cart-line.st-delivered { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.cart-line.st-issue { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
#prLines, #doneLines, #issueLines { margin-top: 18px; }
