:root {
  --bg: #14122B;
  --panel: #1E1B3D;
  --line: #34306A;
  --text: #EEEAFF;
  --muted: #9C95D0;
  --violet: #8B5CF6;
  --violet-hover: #7C4DEF;
  --gold: #F5C84B;
  --win: #5EF0A0;
  --loss: #FF5A6E;
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F3F0FF;
    --panel: #FFFFFF;
    --line: #D9D2FF;
    --text: #1B1740;
    --muted: #6A62A6;
  }
}

:root[data-theme="light"] {
  --bg: #F3F0FF;
  --panel: #FFFFFF;
  --line: #D9D2FF;
  --text: #1B1740;
  --muted: #6A62A6;
}

* { box-sizing: border-box; margin: 0; }

html { color-scheme: light dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

/* ---------- Header ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px clamp(16px, 4vw, 48px);
  max-width: 1280px;
  margin: 0 auto;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  font-family: var(--display);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -0.02em;
}

.logo span { color: var(--gold); }

nav { display: flex; gap: 10px; align-items: center; }

.btn {
  font: 700 14px var(--body);
  border-radius: 999px;
  padding: 10px 18px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease, opacity .15s ease;
}

.btn:hover { border-color: var(--violet); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--violet);
  border-color: var(--violet);
  color: #fff;
}

.btn.primary:hover { background: var(--violet-hover); border-color: var(--violet-hover); }

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.small { padding: 7px 12px; font-size: 12px; }

.btn:focus-visible,
input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 8px;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.hero p {
  color: var(--muted);
  font-size: 18px;
  margin-top: 14px;
  max-width: 52ch;
}

/* ---------- Main layout ---------- */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 60px;
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
}

/* ---------- Form ---------- */
form {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  display: grid;
  gap: 14px;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

input {
  font: 500 16px var(--body);
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  width: 100%;
}

input::placeholder { color: var(--muted); opacity: .7; }

input[aria-invalid="true"] { border-color: var(--loss); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field-error {
  font-size: 12px;
  color: var(--loss);
  min-height: 14px;
}

.themes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.sw {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid var(--line);
  cursor: pointer;
  position: relative;
  padding: 0;
}

.sw[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }

.sw .lock {
  position: absolute;
  inset: auto 4px 4px auto;
  font-size: 13px;
}

.sw-midnight { background: radial-gradient(120% 90% at 85% 10%, #3B2A8C 0%, #1A1640 55%, #110E2B 100%); }
.sw-paper { background: #FAF8FF; }
.sw-gold { background: linear-gradient(135deg, #3A2A05, #F5C84B 55%, #7A5A10); }
.sw-holo { background: linear-gradient(135deg, #7CF2FF, #C79BFF, #FF9BD5, #FFE37C); }

.hint { font-size: 13px; color: var(--muted); }
.hint.success { color: var(--win); }
.hint.error { color: var(--loss); }

.unlock { display: flex; gap: 8px; }
.unlock input { flex: 1; }

/* ---------- Card stage ---------- */
.stage { display: grid; gap: 14px; }

.card-wrap { container-type: inline-size; width: 100%; }

.card {
  aspect-ratio: 1200 / 675;
  width: 100%;
  border-radius: 2.2cqw;
  overflow: hidden;
  position: relative;
  padding: 4.5cqw 5cqw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--body);
}

.card .top { display: flex; justify-content: space-between; align-items: center; }
.ticker { font-family: var(--display); font-weight: 700; font-size: 4cqw; }
.handle { font-size: 2.2cqw; opacity: .75; }
.mult { font-family: var(--display); font-weight: 900; font-size: 17cqw; line-height: .9; letter-spacing: -0.04em; }
.sub { display: flex; gap: 3cqw; font-size: 2.8cqw; font-weight: 700; align-items: baseline; flex-wrap: wrap; }
.bot { display: flex; justify-content: space-between; align-items: flex-end; font-size: 1.9cqw; }
.self { opacity: .55; }
.brand { font-family: var(--display); font-weight: 700; text-align: right; }

.t-midnight { background: radial-gradient(120% 90% at 85% 10%, #3B2A8C 0%, #1A1640 55%, #110E2B 100%); color: #F0ECFF; }
.t-paper { background: #FAF8FF; color: #1B1740; }
.t-gold {
  background: radial-gradient(110% 90% at 80% 0%, #6B4E0C 0%, #2A1E04 60%, #170F00 100%);
  color: #FFF4D6;
  box-shadow: inset 0 0 0 .5cqw #F5C84B;
}
.t-gold .mult {
  background: linear-gradient(180deg, #FFF0B8, #F5C84B 55%, #B8871E);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.t-holo { background: linear-gradient(125deg, #1B1446, #2B1760 40%, #10284A); color: #fff; }
.t-holo .mult {
  background: linear-gradient(90deg, #7CF2FF, #C79BFF, #FF9BD5, #FFE37C);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.win { color: var(--win); }
.loss { color: var(--loss); }
.t-paper .win { color: #0E9F57; }
.t-paper .loss { color: #D6263E; }
.down .mult {
  color: var(--loss);
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  font-size: 9cqw;
  white-space: nowrap;
}

.card.empty .mult { opacity: .35; }
.empty-msg {
  display: none;
  text-align: center;
  margin-top: 1.5cqw;
  font-size: 2.4cqw;
  font-weight: 700;
  color: var(--muted);
  opacity: .8;
}
.card.empty .empty-msg { display: block; }
.t-paper .empty-msg { color: #6A62A6; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.note { font-size: 13px; color: var(--muted); }

/* ---------- Footer ---------- */
footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1.5px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
