/* ===== Design tokens ===================================================== */
:root {
  --bg-0: #111317;
  --bg-1: #16181e;
  --bg-2: #1a1d24;
  --bg-3: #1f232b;
  --bg-4: #262a34;
  --bg-5: #2e3340;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.1);
  --text: #f4f6fa;
  --text-2: #c4cad5;
  --muted: #8b93a4;
  --muted-2: #636b7c;
  --green: #24c661;
  --green-1: #34d873;
  --green-2: #179b49;
  --yellow: #ffc61a;
  --yellow-2: #f0a400;
  --gold: #ffb627;
  --red: #ff4d5e;
  --red-2: #d9303f;
  --blue: #4c8dff;
  --purple: #9b6bff;
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 72px;
  --sidebar-w: 272px;
  --font: 'Rubik', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ===== Reset ============================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-2);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
::selection { background: rgba(255, 198, 26, 0.35); }
:focus-visible { outline: 2px solid rgba(255, 198, 26, 0.75); outline-offset: 2px; }
[hidden] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: #343946 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #343946; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Primitives ======================================================== */
.ic { width: 18px; height: 18px; flex: none; }
.ic-sm { width: 14px; height: 14px; }
.coin { width: 1.1em; height: 1.1em; flex: none; }
.amt { display: inline-flex; align-items: center; gap: 0.35em; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt.big { font-size: 20px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.green { color: var(--green-1); }
.red { color: var(--red); }
.gold { color: var(--yellow); }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.nowrap { white-space: nowrap; }
kbd {
  display: inline-block; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2);
  background: var(--bg-4); font: 600 11px var(--mono); color: var(--text-2);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Buttons =========================================================== */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 9px; border: 0;
  font-weight: 600; font-size: 14px; line-height: 1;
  color: #fff; background: var(--bg-4);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: filter 0.15s, transform 0.08s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }
.btn .ic { width: 17px; height: 17px; }
.btn-green {
  background: linear-gradient(180deg, #2fd56f 0%, #1ea955 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 6px 18px -6px rgba(36, 198, 97, 0.6);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.btn-yellow {
  color: #241900;
  background: linear-gradient(180deg, #ffd84a 0%, #f5b400 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 18px -6px rgba(255, 190, 0, 0.6);
}
.btn-red {
  background: linear-gradient(180deg, #ff6170 0%, #d9303f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 18px -6px rgba(255, 77, 94, 0.55);
}
.btn-blue {
  background: linear-gradient(180deg, #5d9bff 0%, #2f6fe0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 18px -6px rgba(76, 141, 255, 0.55);
}
.btn-dark { background: var(--bg-4); color: var(--text-2); border: 1px solid var(--line); }
.btn-dark:hover { background: var(--bg-5); color: #fff; filter: none; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: #fff; filter: none; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 11px; }
.btn-xl { height: 58px; padding: 0 30px; font-size: 18px; border-radius: 12px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn.active { background: var(--bg-5); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 198, 26, 0.45); }

/* ===== Form controls ===================================================== */
.input, .select {
  height: 40px; padding: 0 12px;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--text); outline: none; min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus, .select:focus { border-color: rgba(255, 198, 26, 0.55); box-shadow: 0 0 0 3px rgba(255, 198, 26, 0.12); }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a4' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .ic { position: absolute; left: 12px; color: var(--muted-2); pointer-events: none; }
.input-icon .input { padding-left: 38px; width: 100%; }
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; }

.switch {
  appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--bg-5);
  position: relative; cursor: pointer; flex: none; transition: background 0.2s; margin: 0;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.2s var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(18px); }

input[type='range'] { appearance: none; width: 160px; height: 6px; border-radius: 6px; background: var(--bg-5); outline: none; }
input[type='range']::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--yellow); cursor: pointer; box-shadow: 0 0 0 4px rgba(255, 198, 26, 0.15); }
input[type='range']::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--yellow); cursor: pointer; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.seg button:hover { color: #fff; }
.seg button.on { background: var(--bg-4); color: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.seg.seg-gold button.on { background: rgba(255, 198, 26, 0.14); color: var(--yellow); box-shadow: inset 0 0 0 1px rgba(255, 198, 26, 0.35); }

/* ===== Surfaces ========================================================== */
.panel { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.12); font-size: 11px; font-weight: 700;
}
.pill.green { background: rgba(36, 198, 97, 0.16); color: var(--green-1); }
.pill.red { background: rgba(255, 77, 94, 0.16); color: var(--red); }
.pill.gold { background: rgba(255, 198, 26, 0.16); color: var(--yellow); }
.section-head { display: flex; align-items: center; gap: 12px; margin: 36px 0 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; }
.section-head .sub { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 6px; }
.section-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title h1 { font-size: 28px; }
.page-title .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.back:hover { color: #fff; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty h3 { color: var(--text); font-size: 18px; }
.empty .ic { width: 42px; height: 42px; color: var(--muted-2); }

/* ===== Animations ======================================================== */
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
.shake { animation: shake 0.45s; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 198, 26, 0.0); } 50% { box-shadow: 0 0 24px 2px rgba(255, 198, 26, 0.35); } }

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