/* ════════════════════════════════════════════════════════════════════════
   Lumacord launcher styles
   Design system applied from design-taste-frontend (taste rules, not its
   React stack). Monochrome neutral base, emerald reserved for currency only.
   One radius scale: surfaces 16, controls 10, pills full.
   ════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Geist";
  src: url("assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Light (default). No pure black or white. */
  --bg: #F4F5F7;
  --card: #FCFCFD;
  --sidebar: #FAFAFB;
  --border: #E7E8EC;
  --ink: #14161A;
  --ink-soft: #3C4047;
  --muted: #6C707A;
  --hover: #EEF0F3;
  --primary: #16181C;
  --on-primary: #FBFBFC;
  --accent: #0E9F6E;
  --accent-deep: #0A7048;
  --accent-ink: #0A6B45;
  --accent-soft: rgba(14, 159, 110, 0.12);
  --accent-line: rgba(14, 159, 110, 0.32);
  --ok: #15834A;
  --warn: #C23A38;
  --preview-bg: #DCDEE3;

  --r-surface: 16px;
  --r-control: 10px;

  --sans: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0E0F11;
    --card: #17181B;
    --sidebar: #131417;
    --border: #26282E;
    --ink: #ECEDEF;
    --ink-soft: #B7B9BF;
    --muted: #8A8E97;
    --hover: #1E2024;
    --primary: #ECEDEF;
    --on-primary: #0E0F11;
    --accent: #2EC58D;
    --accent-deep: #0C7E57;
    --accent-ink: #45D49B;
    --accent-soft: rgba(46, 197, 141, 0.14);
    --accent-line: rgba(46, 197, 141, 0.32);
    --ok: #3FBE77;
    --warn: #E97070;
    --preview-bg: #08090A;
  }
}

/* Manual theme override (Settings -> Appearance) wins over the media query. */
:root[data-theme="dark"] {
  --bg: #0E0F11;
  --card: #17181B;
  --sidebar: #131417;
  --border: #26282E;
  --ink: #ECEDEF;
  --ink-soft: #B7B9BF;
  --muted: #8A8E97;
  --hover: #1E2024;
  --primary: #ECEDEF;
  --on-primary: #0E0F11;
  --accent: #2EC58D;
  --accent-deep: #0C7E57;
  --accent-ink: #45D49B;
  --accent-soft: rgba(46, 197, 141, 0.14);
  --accent-line: rgba(46, 197, 141, 0.32);
  --ok: #3FBE77;
  --warn: #E97070;
  --preview-bg: #08090A;
}

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

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}
.muted { color: var(--muted); }

/* ── Keyboard focus: a clean emerald ring, never the browser default ───── */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* ── Scrollbar ───────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
  border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }

.ic { width: 18px; height: 18px; flex: none; display: block; }

/* ── Viewport ────────────────────────────────────────────────────────── */
.viewport {
  position: relative; width: 100%; height: 100vh;
  overflow: hidden; background: var(--bg);
}

/* Browser preview: real window size, centered. */
html.preview body { display: grid; place-items: center; background: var(--preview-bg); padding: 24px; }
html.preview .viewport {
  width: 1040px; height: 660px; max-width: 100%; max-height: 100%;
  border-radius: var(--r-surface); border: 1px solid var(--border);
  box-shadow: 0 50px 100px -45px rgba(0, 0, 0, 0.5);
}

/* ════════════════════════════════════════════════════════════════════════
   SETUP
   ════════════════════════════════════════════════════════════════════════ */
.setup { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--card); }
body.ready .setup { display: none; }

.setup-head { padding: 26px 26px 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.setup-brand { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.stepper { display: flex; gap: 6px; width: 100%; max-width: 300px; }
.seg { flex: 1; height: 3px; border-radius: 999px; background: var(--border); transition: background 0.3s ease; }
.seg.done { background: var(--ink); }

.setup-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 24px; }
.step {
  position: absolute; width: 100%; max-width: 392px; display: flex; flex-direction: column;
  align-items: center; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.34s ease;
}
.step.active { opacity: 1; pointer-events: auto; }
/* Each step crossfades while its contents rise in sequence and the icon pops. */
.step.active > * { animation: contentUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }
.step.active > *:nth-child(1) { animation-delay: 0.04s; }
.step.active > *:nth-child(2) { animation-delay: 0.10s; }
.step.active > *:nth-child(3) { animation-delay: 0.16s; }
.step.active > *:nth-child(4) { animation-delay: 0.22s; }
.step.active > *:nth-child(5) { animation-delay: 0.28s; }
.step.active > .step-icon, .step.active > .step-done { animation-name: iconPop; }
@keyframes contentUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes iconPop { from { opacity: 0; transform: scale(0.82) translateY(8px); } to { opacity: 1; transform: none; } }

.step-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  margin-bottom: 22px; background: var(--hover); color: var(--ink); border: 1px solid var(--border);
}
.step-icon .ic { width: 24px; height: 24px; }

.step-title { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.step-desc { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 340px; }

.btn-lg { margin-top: 26px; padding: 12px 22px; font-size: 14px; }
.btn-icon { display: inline-flex; align-items: center; gap: 9px; }
.btn-icon .ic { width: 17px; height: 17px; }

.bar { width: 100%; height: 6px; margin-top: 26px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { width: 0; height: 100%; background: var(--ink); transition: width 0.14s linear; }

.fine { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* Animated install progress bar */
.install-bar .bar { margin-top: 0; }
.install-bar .bar-fill { position: relative; overflow: hidden; background: var(--accent); }
.install-bar .bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%); animation: shimmer 1.15s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* Username claim field */
.handle-field {
  margin-top: 24px; width: 100%; max-width: 300px; display: flex; align-items: center; gap: 4px;
  padding: 0 14px; height: 48px; background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r-control); transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.handle-field:focus-within { border-color: var(--ink); }
.handle-field[data-state="ok"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.handle-field[data-state="bad"] { border-color: var(--warn); }
.handle-at { color: var(--muted); font-size: 16px; font-weight: 500; }
.handle-input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font-family: var(--sans); font-size: 16px; font-weight: 500; color: var(--ink);
  letter-spacing: -0.01em; padding: 0;
}
.handle-input::placeholder { color: var(--muted); opacity: 0.55; }
.handle-spin { position: relative; width: 16px; height: 16px; flex: none; box-sizing: border-box; }
.handle-field[data-state="checking"] .handle-spin {
  border: 2px solid var(--border); border-top-color: var(--ink); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.handle-field[data-state="ok"] .handle-spin { background: var(--accent); border-radius: 50%; }
.handle-field[data-state="ok"] .handle-spin::after {
  content: ""; position: absolute; left: 5.5px; top: 2.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.handle-field[data-state="bad"] .handle-spin { background: var(--warn); border-radius: 50%; }
.handle-field[data-state="bad"] .handle-spin::before,
.handle-field[data-state="bad"] .handle-spin::after {
  content: ""; position: absolute; left: 3px; top: 7px; width: 10px; height: 2px; background: #fff; border-radius: 2px;
}
.handle-field[data-state="bad"] .handle-spin::before { transform: rotate(45deg); }
.handle-field[data-state="bad"] .handle-spin::after { transform: rotate(-45deg); }
.handle-msg { margin-top: 11px; font-size: 12.5px; color: var(--muted); min-height: 1.2em; transition: color 0.18s ease; }
.handle-field[data-state="ok"] ~ .handle-msg { color: var(--accent-ink); }
.handle-field[data-state="bad"] ~ .handle-msg { color: var(--warn); }

/* Personalized finish */
.step-done { position: relative; margin-bottom: 22px; }
.step-avatar {
  width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--ink); color: var(--card); font-weight: 600; font-size: 27px; letter-spacing: -0.02em;
}
.step-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.step-avatar.has-img { background: none; }
.step-check {
  position: absolute; right: -3px; bottom: -3px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; border: 3px solid var(--card);
  animation: checkPop 0.42s cubic-bezier(0.16, 1, 0.3, 1) 0.34s both;
}
.step-check .ic { width: 14px; height: 14px; }
@keyframes checkPop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: none; } }

/* Button lift */
.btn-lg:hover:not(:disabled) { transform: translateY(-1px); }

/* ════════════════════════════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════════════════════════════ */
.shell { position: absolute; inset: 0; display: none; }
body.ready .shell { display: flex; animation: shellIn 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes shellIn { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
body.ready.leaving .shell { animation: shellOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards; }
@keyframes shellOut { from { opacity: 1; } to { opacity: 0; transform: scale(0.99); } }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: 234px; flex: none; background: var(--sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 8px 8px 18px; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brand-mark { width: 20px; height: 20px; flex: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  -webkit-app-region: no-drag; display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border: none; background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  border-radius: var(--r-control); cursor: pointer; text-align: left; position: relative;
  transition: background 0.13s ease, color 0.13s ease, transform 0.14s ease;
}
.nav-item::before {
  content: ""; position: absolute; left: 1px; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--ink);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-item.active::before { transform: translateY(-50%) scaleY(1); }
.nav-item .ic { width: 17px; height: 17px; opacity: 0.85; }
.nav-item:hover { background: var(--hover); color: var(--ink); transform: translateX(2px); }
.nav-item.active { background: var(--hover); color: var(--ink); font-weight: 600; transform: none; }
.nav-item.active .ic { opacity: 1; }

.side-replay {
  -webkit-app-region: no-drag; margin-top: auto; margin-bottom: 8px;
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border: none; background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  border-radius: var(--r-control); cursor: pointer; text-align: left;
  transition: background 0.13s ease, color 0.13s ease;
}
.side-replay .ic { width: 16px; height: 16px; opacity: 0.85; }
.side-replay:hover { background: var(--hover); color: var(--ink); }
.side-foot { padding-top: 12px; border-top: 1px solid var(--border); }
.wallet {
  display: flex; align-items: center; gap: 9px; padding: 10px 11px; margin-bottom: 8px;
  border-radius: var(--r-control); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.wallet .ic { width: 16px; height: 16px; color: var(--accent); }
.wallet-bal { font-weight: 600; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.wallet-label { font-size: 12px; color: var(--muted); margin-left: auto; }

.account {
  -webkit-app-region: no-drag; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: none; background: transparent; border-radius: var(--r-control);
  cursor: default; text-align: left;
}
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--card); font-weight: 600; font-size: 13px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-img { background: none; }
.acc-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; min-width: 0; }
.acc-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.acc-name { font-size: 13px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-badge {
  display: none; align-items: center; flex: none; font-family: var(--sans); font-size: 9px; font-weight: 700;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; line-height: 1.4;
  background: var(--ink); color: var(--card);
}
.plan-badge.show { display: inline-flex; }
.plan-badge.free { background: var(--hover); color: var(--muted); }

.theme-swatch { display: flex; width: 100%; padding: 3px; background: var(--hover); border-radius: var(--r-control); gap: 3px; margin-bottom: 10px; position: relative; }
.theme-opt {
  -webkit-app-region: no-drag; flex: 1; height: 30px; display: grid; place-items: center;
  border: none; background: transparent; color: var(--muted); border-radius: calc(var(--r-control) - 3px); cursor: pointer;
  position: relative; z-index: 1;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.theme-opt .ic { width: 15px; height: 15px; }
.theme-opt:hover { color: var(--ink); }
.theme-opt.active { color: var(--ink); }

/* ── Main ────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 44px; flex: none; display: flex; align-items: center; -webkit-app-region: drag; }
.drag { flex: 1; height: 100%; }
.win-controls { -webkit-app-region: no-drag; display: flex; gap: 2px; padding-right: 8px; }
.win-btn {
  width: 34px; height: 28px; display: grid; place-items: center; border: none;
  background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer;
}
.win-btn .ic { width: 15px; height: 15px; }
.win-btn:hover { background: var(--hover); color: var(--ink); }
.win-close:hover { background: rgba(194, 58, 56, 0.14); color: var(--warn); }

.content { flex: 1; overflow-y: auto; padding: 0 40px 48px; }
.page { max-width: 700px; }
.view { display: none; }
.view.active { display: block; }
/* Sections reveal as they scroll into view (JS adds .in via IntersectionObserver). */
.reveal-on .page > * { opacity: 0; transform: translateY(16px); }
.reveal-on .page > *.in {
  opacity: 1; transform: none;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.title { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.lede { margin-top: 10px; color: var(--muted); font-size: 14.5px; max-width: 56ch; }

/* Sticky page header. Sits above the content (z-index) so nothing bleeds through
   it while scrolling, with a soft fade just under it so content slips away
   instead of cutting off hard. */
.page-head {
  position: sticky; top: 0; z-index: 10;
  padding: 26px 0 14px;
  background: var(--bg);
}
.page-head::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px;
  background: linear-gradient(to bottom, var(--bg), transparent); pointer-events: none;
}

/* ── Lumans earning + upgrade promo (Home) ───────────────────────────── */
.lumans-promo {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-top: 1px solid var(--border);
}
.lumans-promo-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lumans-promo-ic .ic { width: 20px; height: 20px; }
.lumans-promo-text { flex: 1; min-width: 0; }
.lumans-promo-title { font-size: 13.5px; font-weight: 600; }
.lumans-promo-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.promo-cta { flex: none; background: var(--primary); color: var(--on-primary); }
.promo-cta:hover { opacity: 0.9; }

/* ── Panel ───────────────────────────────────────────────────────────── */
.panel {
  margin-top: 22px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-surface); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.panel-sub { font-size: 12.5px; margin-top: 3px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  color: var(--ink); background: var(--hover);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pill-ver { font-family: var(--sans); font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); }

.panel-body { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }
.status { display: flex; align-items: center; gap: 10px; font-size: 13.5px; min-width: 0; }
.status-text { color: var(--ink); }

.lumans-body { gap: 16px; }
.luman-prog { flex: 1; position: relative; display: flex; align-items: center; }
.luman-prog .bar { margin-top: 0; overflow: visible; }
.bar-fill.gold {
  position: relative; overflow: hidden; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 10px 1px var(--accent-soft), 0 0 4px var(--accent);
}
.bar-fill.gold::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, 0.6) 50%, transparent 75%);
  transform: translateX(-130%);
}
.lumen-particle {
  position: absolute; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 7px var(--accent); pointer-events: none; z-index: 2;
}
@media (prefers-reduced-motion: no-preference) {
  .bar-fill.gold::after { animation: lumen-shimmer 1.5s ease-in-out infinite; }
  .lumen-particle { animation: lumen-fly var(--dur, 0.9s) ease-out forwards; }
}
@keyframes lumen-shimmer { 0% { transform: translateX(-130%); } 55%, 100% { transform: translateX(260%); } }
@keyframes lumen-fly {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--px)), calc(-50% + var(--py))) scale(0.2); opacity: 0; }
}
.luman-next { white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  -webkit-app-region: no-drag; font-family: var(--sans); font-size: 13px; font-weight: 600;
  border: none; border-radius: var(--r-control); padding: 10px 16px; cursor: pointer;
  white-space: nowrap; transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
.btn-gold { background: var(--accent-deep); color: #fff; }
.btn-gold:hover { opacity: 0.9; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: #C23A38; color: #fff; }
.btn-danger:hover { opacity: 0.9; }

/* ── Settings rows and controls ──────────────────────────────────────── */
.group-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 24px 2px 9px; }
.srow {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.srow:last-child { border-bottom: none; }
#update-suboptions {
  overflow: hidden; max-height: 220px; opacity: 1;
  transition: max-height 0.38s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}
#update-suboptions.collapsed { max-height: 0; opacity: 0; }
.panel:has(#update-suboptions.collapsed) > .srow:first-child { border-bottom: none; }
.srow-label { font-size: 14px; font-weight: 500; }
.srow-desc { font-size: 12.5px; margin-top: 2px; max-width: 46ch; }
.srow-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.toggle {
  flex: none; width: 40px; height: 24px; padding: 0; border: none; border-radius: 999px;
  background: var(--border); cursor: pointer; position: relative; transition: background 0.18s ease;
}
.toggle-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.18s ease;
}
.toggle.on { background: var(--ink); }
.toggle.on .toggle-knob { transform: translateX(16px); }

.segmented {
  flex: none; display: inline-flex; padding: 3px; background: var(--hover);
  border-radius: var(--r-control); gap: 2px; position: relative;
}
.seg-opt {
  border: none; background: transparent; cursor: pointer; font-family: var(--sans);
  font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 8px;
  position: relative; z-index: 1; transition: color 0.2s ease;
}
.seg-opt.active { color: var(--ink); }
/* Shared sliding pill that glides between options on segmented + swatch controls. */
.slide-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; z-index: 0;
  background: var(--card); border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
  pointer-events: none;
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1), width 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}
.slide-thumb.instant { transition: none; }
@media (prefers-reduced-motion: reduce) { .slide-thumb { transition: none; } }

.select {
  -webkit-app-region: no-drag; font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  color: var(--ink); background: var(--hover); border: 1px solid var(--border);
  border-radius: var(--r-control); padding: 7px 30px 7px 12px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236C707A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:hover { border-color: var(--muted); }
.select:focus, .select:focus-visible { outline: none; border-color: var(--ink); }

/* ════════════════════════════════════════════════════════════════════════
   TIERS / UPGRADE
   ════════════════════════════════════════════════════════════════════════ */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.tiers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.tier { border: 1px solid var(--border); border-radius: 14px; padding: 18px 16px; display: flex; flex-direction: column; position: relative; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.tier:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -24px rgba(0, 0, 0, 0.4); }
.tier-best { border-color: var(--accent-line); box-shadow: inset 0 0 0 1px var(--accent-line); }
.tier-ribbon {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--accent-deep);
  color: #fff; font-size: 10px; font-weight: 600; letter-spacing: 0.03em; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.tier-name { font-size: 14.5px; font-weight: 600; }
.tier-price { margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 52px; }
.tier-amt { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.tier-per { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tier-earn {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-control);
  background: var(--accent-soft); display: flex; flex-direction: column; gap: 2px;
}
.tier-earn-num { display: inline-flex; align-items: center; gap: 5px; font-size: 19px; font-weight: 600; color: var(--accent-ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.tier-earn-ic { width: 15px; height: 15px; flex: none; color: var(--accent); }
.tier-earn-label { font-size: 10.5px; font-weight: 500; color: var(--accent-ink); opacity: 0.72; }
.tier-perks { list-style: none; margin: 16px 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tier-perks li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; line-height: 1.3; }
.tier-perks .perk-ic { width: 15px; height: 15px; flex: none; }
.tier-perks li.has { color: var(--ink-soft); }
.tier-perks li.has .perk-ic { color: var(--accent); }
.tier-perks li.no { color: var(--muted); }
.tier-perks li.no .perk-ic { color: var(--muted); opacity: 0.6; }
.tier-btn { width: 100%; text-align: center; }
.tier-bonus {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  padding: 7px 11px; border-radius: var(--r-control);
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 600;
}
.tier-bonus[hidden] { display: none; }
.tier-bonus .ic { width: 14px; height: 14px; color: var(--accent); flex: none; }
.tier-bonus:not([hidden]) { animation: bonus-pop 0.34s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes bonus-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.tier.bonus-on .tier-earn { box-shadow: 0 0 0 1px var(--accent-line); }
.seg-plus { margin-left: 5px; font-size: 10px; font-weight: 700; color: var(--accent); }
.upgrade-head { display: block; }
.upgrade-head-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; position: relative; }
.upgrade-head .lede { white-space: nowrap; }
.pay-toggle { display: flex; align-items: center; gap: 10px; flex: none; }
.pay-toggle-label { font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
/* Monthly/Yearly is an overlay just below "Pay with" that pulls out from the
   right. Absolute, so it never shifts the title/subtext or anything else. */
.bill-row {
  position: absolute; top: calc(100% + 8px); right: 0;
  opacity: 0; transform: translateX(28px); pointer-events: none;
  transition: opacity 0.3s ease, transform 0.44s cubic-bezier(0.16, 1, 0.3, 1);
}
.bill-row.shown { opacity: 1; transform: translateX(0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  .bill-row { transition: opacity 0.2s ease; transform: none; }
}

/* ── First-login app tour ────────────────────────────────────────────────── */
.tour-block { position: fixed; inset: 0; z-index: 199; }
.tour-active .page > * { opacity: 1 !important; transform: none !important; transition: none !important; }
.tour-dim {
  position: fixed; inset: 0; z-index: 200; background: rgba(8, 9, 11, 0.62); opacity: 0;
  /* Force our own composited layer so the dim sits above GPU-composited controls
     (toggle knobs use transform, which otherwise paint over the overlay). */
  transform: translateZ(0); will-change: opacity, clip-path;
  transition: opacity 0.3s ease, clip-path 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}
.tour-dim.show { opacity: 1; }
.tour-bubble {
  position: fixed; z-index: 201; width: 290px; max-width: calc(100vw - 24px);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-control);
  padding: 15px 17px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translateY(6px) scale(0.98);
  transition: opacity 0.28s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    top 0.45s cubic-bezier(0.16, 1, 0.3, 1), left 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.tour-bubble.show { opacity: 1; transform: translateY(0) scale(1); }
.tour-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.tour-body { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.tour-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.tour-step { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.tour-prog { flex: 1; height: 3px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.tour-prog-fill { height: 100%; width: 0; border-radius: 999px; background: var(--ink); }
.tour-next {
  margin-left: auto; background: var(--primary); color: var(--on-primary); border: none;
  border-radius: 8px; padding: 7px 16px; font-family: var(--sans); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.tour-next:hover { opacity: 0.9; }
.tour-next:not([hidden]) { animation: tour-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes tour-pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.welcome-banner {
  display: flex; align-items: center; gap: 11px; margin-top: 18px; padding: 11px 15px;
  border-radius: var(--r-control); background: var(--accent-soft); border: 1px solid var(--accent-line);
  font-size: 12.5px; color: var(--accent-ink);
}
.welcome-banner .ic { width: 18px; height: 18px; color: var(--accent); flex: none; }
.welcome-banner strong { font-weight: 700; }
.tier-was { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.tier-current { background: var(--hover); color: var(--muted); }
.tier-soon { background: var(--hover); color: var(--muted); }
.tier-soon:disabled { opacity: 1; cursor: default; }

.upgrade-card {
  display: flex; align-items: center; gap: 16px; margin-top: 16px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-surface);
}
.upgrade-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.upgrade-icon .ic { width: 22px; height: 22px; }
.upgrade-body { flex: 1; min-width: 0; }
.upgrade-name { font-size: 14.5px; font-weight: 600; }
.upgrade-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; max-width: 52ch; }
.upgrade-status { font-size: 12px; font-weight: 600; color: var(--accent-ink); margin-top: 6px; }
.upgrade-status[hidden] { display: none; }
.upgrade-buybox { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.upgrade-cost { display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--accent-ink); }
.upgrade-cost .ic { width: 14px; height: 14px; color: var(--accent); }

/* ── Home: install gate ──────────────────────────────────────────────── */
.install-card {
  display: flex; align-items: center; gap: 18px; margin-top: 22px; padding: 22px 20px;
  border-radius: var(--r-surface); background: var(--card); border: 1px solid var(--accent-line);
  box-shadow: inset 0 0 0 1px var(--accent-line), 0 18px 40px -30px rgba(0, 0, 0, 0.5);
}
.install-icon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.install-icon .ic { width: 26px; height: 26px; }
.install-text { flex: 1; min-width: 0; }
.install-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; }
.install-subslot { position: relative; margin-top: 4px; }
.install-sub { font-size: 13px; color: var(--muted); max-width: 62ch; }
.install-bar { position: absolute; inset: 0; display: flex; align-items: center; max-width: 340px; }
.install-bar[hidden] { display: none; }
.install-action { flex: none; display: flex; align-items: center; gap: 10px; }
.install-card.done { padding: 14px 20px; border-color: var(--border); box-shadow: none; }
.install-card.done .install-icon { width: 40px; height: 40px; border-radius: 11px; }
.install-card.done .install-icon .ic { width: 21px; height: 21px; }
.install-card.done .install-title { font-size: 14px; }
.install-card.done .install-sub { display: none; }
.install-card.done .install-subslot { display: none; }

/* Everything below the install card dims until Luma is in Discord.
   !important is needed to beat the reveal animation's opacity on .page > * */
.home-rest { transition: opacity 0.4s ease; }
.home-rest.locked { opacity: 0.4 !important; pointer-events: none; user-select: none; }
.sidebar { transition: opacity 0.4s ease; }
.sidebar.locked { opacity: 0.4; pointer-events: none; user-select: none; }

/* Generic small modal (e.g. change username) */
.modal {
  position: absolute; inset: 0; z-index: 25; display: none; align-items: center; justify-content: center;
  background: rgba(8, 9, 10, 0.5); padding: 24px;
}
.modal.open { display: flex; animation: fade 0.2s ease; }
.modal-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-surface); padding: 24px; box-shadow: 0 50px 100px -35px rgba(0, 0, 0, 0.55);
}
.modal-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.modal-sub { font-size: 13px; margin-top: 5px; }
.modal-card .handle-field { max-width: none; margin-top: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.confirm-type { margin-top: 16px; }
.confirm-input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: var(--r-control);
  border: 1.5px solid var(--border); background: var(--card); color: var(--ink);
  font-family: var(--sans); font-size: 14px; outline: none;
}
.confirm-input:focus { border-color: var(--ink); }

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
