:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  color: #f5f2ff;
  background: #151420;
  font-synthesis: none;
  --muted: #c4bfd6;
  --purple: #a889f7;
  --border: #3b354f;
  --panel: #1a1926;
  --surface: #242233;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  padding-top: clamp(20px, 4vh, 36px);
  background: radial-gradient(ellipse at 50% 0%, #241d37 0%, #191725 45%, #12111a 90%);
}
main { width: min(100% - 32px, 610px); margin: 0 auto; }
.sale {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: clamp(16px, 4vw, 26px);
  box-shadow: 0 24px 85px #0e0c17a0;
}
.intro { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; }
.coin { display: block; flex: none; width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
h1 { font-size: clamp(1.55rem, 5vw, 2rem); letter-spacing: -.045em; line-height: 1.13; margin: 0; }
p { margin: 0; line-height: 1.5; }
.stats { margin: 0 0 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats div { border: 1px solid var(--border); border-radius: 15px; background: var(--surface); padding: 10px; }
dt { color: var(--muted); font-size: .875rem; }
dd { margin: 4px 0 0; font-size: clamp(1.1rem, 4vw, 1.35rem); font-weight: 750; line-height: 1.2; }
dd small { color: #d6c6fc; font-size: .61em; white-space: nowrap; }
.section-label, .wallet-detail, .total {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.wallet-detail p { color: var(--muted); font-size: .875rem; }
.wallet { border-block: 1px solid var(--border); padding: 11px 0 12px; }
.section-label h2, form label { margin: 0; font-weight: 700; font-size: 1rem; }
a, .text-button { color: #c5afff; }
a:hover, .text-button:hover:not(:disabled) { color: #f0e8ff; }
.section-label a { font-size: .875rem; }
.wallet-detail { min-height: 22px; margin: 1px 0 5px; }
#wallet-address { color: var(--muted); font: .82rem ui-monospace, monospace; }
.wallet-actions, .stepper { display: grid; gap: 8px; }
.wallet-actions { margin-top: 7px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
button, input {
  min-height: 44px;
  border-radius: 11px;
  font: inherit;
  color: inherit;
  border: 1px solid #4c4364;
  background: #22202f;
}
button { padding: 8px 10px; cursor: pointer; font-weight: 650; }
button:not(:disabled):hover { border-color: var(--purple); background-color: #332a49; }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid #ccbbff; outline-offset: 3px; }
.text-button { border: 0; min-height: 30px; padding: 0 2px; background: transparent !important; font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; }
form { margin-top: 11px; }
.stepper { grid-template-columns: 47px minmax(0, 1fr) 47px; margin: 6px 0; }
#quantity-slider { display: block; width: 100%; min-height: 32px; margin: 0; padding: 0; accent-color: var(--purple); cursor: pointer; }
#quantity-slider:disabled { opacity: .5; cursor: default; }
.stepper button { font-size: 1.2rem; }
input { width: 100%; text-align: center; background: #14131f; font-size: 1.25rem; }
input[aria-invalid="true"] { border-color: #e8a3bd; }
.help { font-size: .875rem; margin-top: 5px; color: var(--muted); }
.total { margin: 12px 0 8px; }
#cost { color: #f1eaff; font-size: 1.35rem; font-weight: 800; white-space: nowrap; }
.primary { width: 100%; min-height: 48px; background: #754bd2; border-color: #8e66e5; color: #fff; }
.primary:not(:disabled):hover { background: #855be3; }
.primary:disabled { background: #382d55; border-color: #524071; color: #e6dbff; opacity: 1; }
.result { margin-top: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.result[data-kind="error"] { border-color: #895970; }
.result a, .result button { margin-top: 5px; display: inline-block; }
@media (min-width: 620px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats div { display: flex; flex-direction: column; justify-content: space-between; }
}
@media (max-width: 420px) {
  .wallet-actions button { padding-inline: 5px; font-size: .875rem; }
  .stats div { padding-inline: 10px; }
}

.about { margin: 20px 0 32px; padding: clamp(18px, 4vw, 26px); border: 1px solid var(--border); border-radius: 22px; background: var(--panel); }
.about h2 { margin: 0 0 9px; font-size: 1.45rem; }
.about h3 { margin: 20px 0 5px; font-size: 1rem; }
.about p, .about li { color: var(--muted); line-height: 1.6; }
.about ul { padding-left: 1.25rem; margin: 8px 0 0; }
.about li + li, .about p + p { margin-top: 8px; }
.about strong { color: #f5f2ff; }

.account-panel { width: fit-content; max-width: calc(100% - 32px); margin: 0 16px 12px auto; }
.account-panel.connected { position: relative; width: 276px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.account-panel.connected #connect { position: absolute; top: 6px; right: 12px; min-height: 32px; padding: 2px 4px; border: 0; background: transparent; color: #c5afff; font-size: .875rem; font-weight: 550; }
.account-panel summary { width: fit-content; max-width: calc(100% - 78px); cursor: pointer; color: var(--purple); font-size: .875rem; }
.account-panel #wallet-address { color: var(--muted); font-family: ui-monospace, monospace; }
#full-address { display: block; margin-top: 12px; overflow-wrap: anywhere; font-size: .8rem; user-select: all; }
.balances { display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); gap: 12px; }
.balances dt { color: var(--muted); font-size: .8rem; }
.balances dd { margin: 2px 0 0; font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wallet-actions { display: flex; }
.wallet-actions button { flex: 1; }
.result[data-kind="success"] { position: fixed; z-index: 10; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: min(340px, 100% - 32px); margin: 0; box-shadow: 0 8px 30px #101019aa; }
@media (min-width: 1240px) {
  .account-panel, .account-panel.connected { position: absolute; top: 16px; right: 18px; margin: 0; max-width: min(320px, calc(50% - 332px)); }
}
