/* ===== Design tokens ===================================================== */
:root {
  --bg-0: #0b0c14;
  --bg-1: #10111c;
  --bg-2: #131422;
  --bg-3: #191a2c;
  --bg-4: #222439;
  --bg-5: #2c2f49;
  --line: rgba(160, 170, 255, 0.07);
  --line-2: rgba(160, 170, 255, 0.13);
  --text: #f5f6fc;
  --text-2: #c3c6dc;
  --muted: #8a8eaa;
  --muted-2: #5f6382;
  --green: #2bd96b;
  --green-1: #4cec88;
  --green-2: #16a34a;
  --yellow: #ffae1a;
  --yellow-2: #ff7a00;
  --gold: #ffb627;
  --orange: #ff7a00;
  --red: #ff4d5e;
  --red-2: #d9303f;
  --blue: #4c8dff;
  --purple: #8f6bff;
  --radius: 10px;
  --radius-sm: 6px;
  --cut: 10px;
  --topbar-h: 68px;
  --strip-h: 104px;
  --sidebar-w: 280px;
  --gamenav-w: 224px;
  --gamenav-rail: 72px;
  --font: 'Barlow', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --display: 'Barlow Condensed', 'Barlow', ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --accent-grad: linear-gradient(180deg, #ffc24a 0%, #ff8a00 100%);
  /* chamfered corners (top-left + bottom-right), the house shape for buttons and badges */
  --chamfer: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

/* ===== 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:
    radial-gradient(1400px 700px at 70% -200px, rgba(110, 80, 255, 0.10), transparent 70%),
    radial-gradient(900px 600px at 0% 0%, rgba(255, 122, 0, 0.05), transparent 70%),
    var(--bg-2);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/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-family: var(--display); font-weight: 700; letter-spacing: 0.01em; line-height: 1.05; }
h1, h2 { text-transform: uppercase; }
p { margin: 0; }
::selection { background: rgba(255, 138, 0, 0.4); }
:focus-visible { outline: 2px solid rgba(255, 160, 40, 0.8); outline-offset: 2px; }
[hidden] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: #2c2f49 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2c2f49; 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 {
  --cut: 7px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 0; border: 0; clip-path: var(--chamfer);
  font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #fff; background: var(--bg-4);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: filter 0.15s, transform 0.08s, background 0.15s, color 0.15s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.14); }
.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, #45ec84 0%, #17b455 100%);
  color: #04210f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.btn-yellow {
  color: #2a1300;
  background: var(--accent-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(120, 40, 0, 0.25);
}
.btn-red {
  background: linear-gradient(180deg, #ff6170 0%, #d9303f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.btn-blue {
  background: linear-gradient(180deg, #6aa2ff 0%, #3466e0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.btn-dark { background: var(--bg-4); color: var(--text-2); }
.btn-dark:hover { background: var(--bg-5); color: #fff; filter: none; }
.btn-ghost { background: transparent; color: var(--muted); clip-path: none; border-radius: 8px; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: #fff; filter: none; }
.btn-sm { --cut: 6px; height: 32px; padding: 0 13px; font-size: 13.5px; gap: 6px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-lg { --cut: 10px; height: 50px; padding: 0 26px; font-size: 18px; }
.btn-xl { --cut: 12px; height: 58px; padding: 0 32px; font-size: 21px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn.active { background: var(--bg-5); color: var(--yellow); }

/* ===== Form controls ===================================================== */
.input, .select {
  height: 40px; padding: 0 12px;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 8px;
  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, 150, 30, 0.6); box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.14); }
.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, 150, 20, 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 14px; border-radius: 7px; color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 14.5px; text-transform: uppercase; letter-spacing: 0.04em; 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: var(--accent-grad); color: #2a1300; box-shadow: none; }

/* ===== Surfaces ========================================================== */
.panel { background: linear-gradient(180deg, var(--bg-3), #161728); 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, 150, 20, 0.16); color: var(--yellow); }
.section-head { display: flex; align-items: center; gap: 14px; margin: 44px 0 18px; flex-wrap: wrap; }
.section-head h2 {
  position: relative; font-size: 28px; font-weight: 800; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 12px;
}
.section-head h2::before {
  content: ''; width: 6px; height: 26px; flex: none;
  background: var(--accent-grad); clip-path: polygon(0 4px, 100% 0, 100% calc(100% - 4px), 0 100%);
  box-shadow: 0 0 14px rgba(255, 138, 0, 0.6);
}
.section-head .sub { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; 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: 36px; font-weight: 800; }
.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, 138, 0, 0.0); } 50% { box-shadow: 0 0 26px 2px rgba(255, 138, 0, 0.35); } }

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