:root {
  /* ===== Monochrome system (true-black OLED base) ===== */
  --bg: #000000;
  --bg-1: #060607;
  --surface: #0e0e11;
  --surface-2: #15151a;
  --surface-3: #1d1d23;
  --surface-4: #26262e;
  --line: rgba(255,255,255,0.10);
  --line-strong: rgba(255,255,255,0.18);
  --line-soft: rgba(255,255,255,0.06);

  --text: #f7f7f8;
  --text-2: #a9a9b2;
  --text-3: #6d6d77;

  --white: #ffffff;
  --ink: #000000;
  --danger: #e06a6a;

  /* Rarity — grayscale ramp */
  --r-common: #6a6a72;
  --r-uncommon: #8d8d96;
  --r-rare: #b0b0b8;
  --r-epic: #d6d6dc;
  --r-legendary: #ffffff;

  /* Radii */
  --r-xs: 10px;
  --r-sm: 13px;
  --r-md: 17px;
  --r-lg: 22px;
  --r-xl: 28px;

  /* Elevation */
  --hi: inset 0 1px 0 rgba(255,255,255,0.08);
  --sh-1: 0 1px 2px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  --sh-2: 0 10px 30px -12px rgba(0,0,0,0.85), inset 0 1px 0 rgba(255,255,255,0.06);
  --sh-3: 0 24px 60px -18px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.08);
  --glow: 0 0 0 1px rgba(255,255,255,0.06), 0 18px 50px -20px rgba(255,255,255,0.18);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --maxw: 480px;
  font-synthesis: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { background: #000; }
body {
  background:
    radial-gradient(120% 80% at 50% -10%, #141417 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; line-height: 1.2; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4 { letter-spacing: -0.03em; }
::selection { background: rgba(255,255,255,0.22); }
:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 2px; }
.tnum { font-variant-numeric: tabular-nums; }

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ----------------------------- Topbar ----------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85), rgba(0,0,0,0.35));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__brand { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.topbar__logo { font-weight: 800; letter-spacing: -0.04em; font-size: 19px; }
.topbar__sub { font-size: 10px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; }

.balance-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line); box-shadow: var(--sh-1);
  padding: 8px 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px; color: var(--text);
  transition: transform .12s var(--ease), box-shadow .2s var(--ease);
}
.balance-pill:active { transform: scale(0.96); }
.balance-pill .coin { width: 16px; height: 16px; fill: none; stroke: var(--white); stroke-width: 1.8; }

/* ----------------------------- View ----------------------------- */
.view {
  flex: 1;
  padding: 18px 16px 132px;
  display: flex; flex-direction: column; gap: 18px;
  animation: viewIn .34s var(--ease);
}
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 19px; font-weight: 800; letter-spacing: -0.035em; margin: 2px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.center { text-align: center; }

/* ----------------------------- Cards ----------------------------- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-1));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--sh-1);
}
.card--raised { box-shadow: var(--sh-2); border-color: var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }

/* Hero / feature banner */
.hero {
  position: relative; border-radius: var(--r-xl); overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(130% 120% at 12% -10%, rgba(255,255,255,0.16), transparent 50%),
    radial-gradient(120% 120% at 100% 120%, rgba(255,255,255,0.06), transparent 55%),
    linear-gradient(160deg, #1b1b20 0%, #0a0a0c 70%);
  padding: 22px;
  box-shadow: var(--sh-3);
}
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
}
.hero__kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); }
.hero__kicker svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.hero__title { font-size: 25px; font-weight: 800; letter-spacing: -0.04em; margin: 14px 0 5px; line-height: 1.12; }
.hero__meta { color: var(--text-2); font-size: 13px; }
.hero__row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; }
.hero__timer { display: flex; gap: 7px; }
.tbox { background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; text-align: center; min-width: 48px; box-shadow: var(--hi); }
.tbox b { display: block; font-size: 19px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tbox span { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }

/* Stat tiles */
.stat {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-1));
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: 16px; display: flex; flex-direction: column; justify-content: center; min-height: 92px;
  box-shadow: var(--sh-1);
}
.stat__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); display: flex; align-items: center; gap: 7px; font-weight: 700; }
.stat__label svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; margin-top: 8px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat__value small { font-size: 13px; color: var(--text-2); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 17px; border-radius: var(--r-sm); font-weight: 700; font-size: 14px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line); color: var(--text);
  box-shadow: var(--sh-1);
  transition: transform .12s var(--ease), filter .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), opacity .2s var(--ease);
  width: 100%; white-space: nowrap; letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.975); filter: brightness(1.08); }
.btn--primary { background: linear-gradient(180deg, #ffffff, #d9d9de); border-color: rgba(255,255,255,0.6); color: var(--ink); box-shadow: 0 8px 22px -10px rgba(255,255,255,0.5), var(--hi); }
.btn--primary:active { background: linear-gradient(180deg, #f0f0f2, #cfcfd4); }
.btn--ghost { background: rgba(255,255,255,0.02); box-shadow: none; }
.btn--ghost:active { background: rgba(255,255,255,0.06); }
.btn--gold { background: linear-gradient(135deg, #e7e7eb, #ffffff 45%, #c4c4ca); color: #000; border-color: transparent; box-shadow: 0 8px 22px -10px rgba(255,255,255,0.45); }
.btn--sm { padding: 9px 13px; font-size: 13px; width: auto; border-radius: 999px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn .coin { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* Pills / badges */
.badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; line-height: 1.4; border: 1px solid var(--line); }
.badge--new { background: var(--white); color: #000; border-color: var(--white); }
.badge--kick { background: rgba(255,255,255,0.06); color: var(--text-2); }
.badge--done { background: rgba(255,255,255,0.16); color: #fff; }
.badge--soft { background: var(--surface-3); color: var(--text-2); }
.badge--gold { background: rgba(255,255,255,0.12); color: #fff; }

.chip-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px; gap: 3px; box-shadow: var(--sh-1); }
.chip-tab { padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-2); transition: color .2s var(--ease), background .2s var(--ease); }
.chip-tab.is-active { background: var(--white); color: #000; box-shadow: 0 4px 12px -6px rgba(255,255,255,0.5); }

/* List items */
.item {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, var(--surface), var(--bg-1));
  border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px; min-height: 66px;
  box-shadow: var(--sh-1);
  transition: transform .12s var(--ease), border-color .2s var(--ease);
}
.item:active { transform: scale(0.99); border-color: var(--line); }
.item__icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px; background: linear-gradient(180deg, var(--surface-4), var(--surface-2)); display: grid; place-items: center; border: 1px solid var(--line-soft); box-shadow: var(--hi); }
.item__icon svg { width: 20px; height: 20px; stroke: var(--text); fill: none; stroke-width: 1.8; }
.item__body { flex: 1; min-width: 0; }
.item__title { font-weight: 700; font-size: 14.5px; letter-spacing: -0.02em; }
.item__desc { color: var(--text-3); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item__reward { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item__reward .coin { width: 14px; height: 14px; stroke: var(--white); fill: none; stroke-width: 1.9; }
.item__right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }

/* Progress */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.6); }
.progress__fill { height: 100%; background: linear-gradient(90deg, #cfcfd4, #ffffff); border-radius: 999px; transition: width .5s var(--ease); }
.progress__fill--gold { background: linear-gradient(90deg, #b6b6bd, #ffffff); }

/* Shop grid */
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.product { position: relative; background: linear-gradient(180deg, var(--surface), var(--bg-1)); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sh-1); transition: transform .14s var(--ease), border-color .2s var(--ease); }
.product:active { transform: translateY(1px) scale(0.995); border-color: var(--line); }
.product__media { aspect-ratio: 16/10; background: radial-gradient(100% 120% at 50% 0%, rgba(255,255,255,0.10), transparent 60%), linear-gradient(160deg, #1c1c21, #0c0c0e); display: grid; place-items: center; position: relative; border-bottom: 1px solid var(--line-soft); }
.product__media svg { width: 36px; height: 36px; stroke: var(--text); fill: none; stroke-width: 1.4; opacity: 0.92; }
.product__badge { position: absolute; top: 9px; left: 9px; }
.product__stock { position: absolute; top: 9px; right: 9px; }
.product__body { padding: 13px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.product__title { font-weight: 700; font-size: 13.5px; letter-spacing: -0.02em; }
.product__price { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.product__price .coin { width: 15px; height: 15px; stroke: var(--white); fill: none; stroke-width: 1.9; }
.product .btn { margin-top: auto; }

/* Avatar */
.avatar { width: 66px; height: 66px; border-radius: 50%; background: linear-gradient(180deg, var(--surface-4), var(--surface-2)); display: grid; place-items: center; font-weight: 800; font-size: 25px; color: var(--text); overflow: hidden; border: 1px solid var(--line); flex: 0 0 auto; box-shadow: var(--sh-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 42px; height: 42px; font-size: 16px; }

/* Case / roulette */
.case-card { background: linear-gradient(180deg, var(--surface), var(--bg-1)); border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-2); }
.case-card__head { aspect-ratio: 16/9; background: radial-gradient(100% 130% at 50% 0%, rgba(255,255,255,0.16), transparent 55%), linear-gradient(160deg, #1e1e24, #0b0b0d); display: grid; place-items: center; position: relative; }
.case-card__head::after { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 60% at 50% 40%, rgba(255,255,255,0.10), transparent 70%); }
.case-card__head svg { width: 48px; height: 48px; stroke: var(--white); fill: none; stroke-width: 1.4; position: relative; filter: drop-shadow(0 6px 18px rgba(255,255,255,0.25)); }
.case-card__body { padding: 15px; display: flex; flex-direction: column; gap: 12px; }
.odds { display: flex; flex-direction: column; gap: 7px; }
.odds__row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; box-shadow: 0 0 8px currentColor; }

.reel-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; position: relative; background: var(--bg-1); box-shadow: inset 0 2px 12px rgba(0,0,0,0.7); }
.reel-wrap::before { content: ""; position: absolute; z-index: 2; inset: 0; pointer-events: none; background: linear-gradient(90deg, var(--bg-1), transparent 14%, transparent 86%, var(--bg-1)); }
.reel-wrap::after { content: ""; position: absolute; z-index: 3; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; transform: translateX(-1px); box-shadow: 0 0 14px 2px rgba(255,255,255,0.7); }
.reel { display: flex; transition: transform 4.6s cubic-bezier(0.1,0.62,0.12,1); }
.reel__cell { flex: 0 0 96px; height: 96px; margin: 10px 5px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--surface)); display: grid; place-items: center; text-align: center; font-size: 12px; font-weight: 700; padding: 8px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 124px; transform: translateX(-50%) translateY(20px); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 440px; opacity: 0; transition: opacity .24s var(--ease), transform .24s var(--ease); }
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast__item { background: rgba(28,28,33,0.92); backdrop-filter: blur(12px); border: 1px solid var(--line); color: var(--text); padding: 12px 17px; border-radius: 14px; font-size: 13.5px; font-weight: 600; box-shadow: var(--sh-3); max-width: 100%; }
.toast__item--ok { border-color: rgba(255,255,255,0.5); }
.toast__item--err { border-color: rgba(224,106,106,0.7); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(0,0,0,0.66); backdrop-filter: blur(10px); padding: 20px; animation: fadeIn .2s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal__card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--r-lg); width: 100%; max-width: 420px; padding: 24px; animation: pop .26s var(--ease); box-shadow: var(--sh-3); }
@keyframes pop { from { transform: scale(0.92) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

/* Inputs */
.input { width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; color: var(--text); font-size: 14px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: rgba(255,255,255,0.7); box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
.input-row { display: flex; gap: 10px; align-items: stretch; }
.input-row .btn--sm { white-space: nowrap; border-radius: 13px; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
label.field { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-2); font-weight: 600; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-md); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 66px; }

/* Empty */
.empty { text-align: center; color: var(--text-3); padding: 48px 16px; }
.empty svg { width: 42px; height: 42px; stroke: var(--text-3); fill: none; stroke-width: 1.4; margin-bottom: 12px; opacity: 0.8; }

/* ----------------------------- Floating tabbar ----------------------------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: min(var(--maxw), calc(100% - 24px)); z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14,14,17,0.78);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 8px;
  box-shadow: var(--sh-3);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 0; color: var(--text-3); font-size: 10px; font-weight: 700; border-radius: 16px; letter-spacing: 0.01em; transition: color .2s var(--ease), background .2s var(--ease); }
.tab__ic { width: 22px; height: 22px; display: grid; place-items: center; }
.tab__ic svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tab.is-active { color: #fff; background: rgba(255,255,255,0.09); box-shadow: var(--hi); }

/* Misc */
.divider { height: 1px; background: var(--line-soft); border: 0; margin: 4px 0; }
.kpi-row { display: flex; gap: 10px; flex-wrap: wrap; }
.copy-field { display: flex; align-items: center; gap: 8px; background: var(--bg-1); border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; }
.copy-field code { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.copy-field .btn { flex: 0 0 auto; }
.steps { display: flex; gap: 6px; align-items: center; }
.step-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface-2); }
.step-dot.is-done { background: #fff; border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.4); }
.hint { display: flex; gap: 11px; align-items: flex-start; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 14px; padding: 13px; font-size: 13px; color: var(--text-2); }
.hint svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: var(--text); stroke-width: 1.8; margin-top: 1px; }

/* Respect [hidden] on overlays */
.modal[hidden] { display: none !important; }
.toast[hidden] { display: none !important; }
