:root {
  --bg: #100814;
  --card: #221432;
  --card-2: #2a1840;
  --line: rgba(255, 255, 255, .08);
  --text: #f6f0ff;
  --muted: #b3a4c9;
  --accent: #c4a2ff;
  --accent-2: #8b6cff;
  --good: #3dd68c;
  --bad: #ff5d73;
  --tg-top: 0px;
  --tg-bottom: 0px;
  --tg-left: 0px;
  --tg-right: 0px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-top));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-bottom));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-left));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-right));
  --wash: #b06bff;
  --dim: 0;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: manipulation;
}

button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
}

button:focus-visible, .skin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--app-h, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

header, main, .dock, .tabs, .sheet-body, .sheet-bar {
  padding-left: max(12px, var(--safe-left));
  padding-right: max(12px, var(--safe-right));
}

header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding-top: calc(6px + var(--safe-top));
  padding-bottom: 6px;
}

.brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bal {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.bal.small { font-size: 18px; }

.chip {
  min-height: 48px;
  min-width: 48px;
  padding: 0 14px;
  border-radius: 999px;
  background: #3a2358;
  font-weight: 700;
}

main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: 4px;
  padding-bottom: 18px;
}

h1, h2, p { margin: 0; }

h1 { font-size: 20px; letter-spacing: -.03em; }

h2 { font-size: 17px; letter-spacing: -.02em; }

.muted { color: var(--muted); font-size: 13px; }

.stack { display: flex; flex-direction: column; gap: 10px; width: min(1180px, 100%); margin: 0 auto; }

.stack.fit { width: min(520px, 100%); }

.hero { padding: 28px 0; display: flex; flex-direction: column; gap: 10px; }

.kicker { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.good { color: var(--good); }

.bad { color: var(--bad); }

.primary, .ghost {
  min-height: 46px;
  width: 100%;
  border-radius: 12px;
  font-weight: 700;
  padding: 0 16px;
}

.primary {
  background: #8b6cff;
  color: white;
  transition: transform .15s ease, background .15s ease;
}

.primary:active, .ghost:active, .casebox:active { transform: translateY(2px); }

.ghost { background: var(--card-2); }

.primary:disabled, .ghost:disabled, .mult:disabled, .mod:disabled, .counts button:disabled { opacity: .45; }

.banner {
  width: 100%;
  min-height: 48px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: #3a2358;
  font-weight: 700;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.casebox {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  padding: 0;
  color: white;
  background: #1a1024;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.case-lid {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 34px;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, .06));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .22);
}

.case-latch {
  position: absolute;
  top: 36px;
  left: 50%;
  width: 28px;
  height: 12px;
  margin-left: -14px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, #f4e7c8, #a8844e);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25);
}

.casebox.has-art { background: #1a1024; }

.case-art {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: contain;
  background: radial-gradient(60% 80% at 50% 40%, rgba(196, 162, 255, .28), transparent 70%);
}

.case-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px 10px;
}

.case-name, .case-price { position: relative; display: block; }

.case-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-price { font-size: 14px; font-weight: 700; opacity: .92; }

.c-recruit { background: linear-gradient(180deg, #8b9bb0, #3c4c60); }
.c-signal { background: linear-gradient(180deg, #6d93ff, #1c3f9c); }
.c-violet { background: linear-gradient(180deg, #b07cff, #4c218f); }
.c-crimson { background: linear-gradient(180deg, #ff7382, #8e2033); }
.c-gold { background: linear-gradient(180deg, #f2c75a, #8a5a12); }

.odds { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--wash);
}

.panel {
  background: rgba(255, 255, 255, .03);
  border-radius: 16px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.case-top, .spread, .statline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.r-consumer { --wash: #b0c3d9; }
.r-milspec { --wash: #4b69ff; }
.r-restricted { --wash: #8847ff; }
.r-classified { --wash: #d32ce6; }
.r-covert { --wash: #eb4b4b; }
.r-extraordinary, .r-contraband { --wash: #e4ae39; }
.w-fn { --dim: 0; }
.w-mw { --dim: .12; }
.w-ft { --dim: .22; }
.w-ww { --dim: .34; }
.w-bs { --dim: .46; }

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

.skin {
  position: relative;
  overflow: hidden;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  padding: 10px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 112px;
}

.skin::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--wash), transparent 62%);
  opacity: calc(.55 - var(--dim));
  pointer-events: none;
}

.skin > * { position: relative; z-index: 1; }

.skin::after {
  content: "";
  display: block;
  height: 3px;
  margin-top: auto;
  border-radius: 99px;
  background: var(--wash);
  opacity: calc(1 - var(--dim));
  position: relative;
  z-index: 1;
}

.skin.on { box-shadow: inset 0 0 0 2px #fff; }

.ico { display: grid; place-items: center; height: 46px; color: rgba(255, 255, 255, .94); }

.ico svg, .ico img { width: 100%; height: 58px; object-fit: contain; }

.skin-name { font-size: 14px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }

.skin-wear, .skin-src { color: var(--muted); font-size: 12px; }

.skin-wear {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skin-price { font-variant-numeric: tabular-nums; font-weight: 700; }

.skin-side { text-align: right; }

.chance { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--wash); }

.skin.flat {
  min-height: 64px;
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 8px;
}

.skin.flat::after { display: none; }

.skin.flat .ico { height: 48px; }

.drop {
  background: var(--card);
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drop .skin { min-height: 0; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.pair .primary, .pair .ghost { min-height: 48px; }

.counts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.counts button {
  min-height: 48px;
  border-radius: 14px;
  background: var(--card-2);
  font-weight: 700;
}

.counts button.on { box-shadow: inset 0 0 0 2px var(--accent); }

.slot {
  min-height: 92px;
  width: 100%;
  border-radius: 16px;
  border: 1px dashed rgba(176, 107, 255, .5);
  color: var(--muted);
  padding: 16px;
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
}

.col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.mod {
  min-height: 44px;
  width: 100%;
  text-align: left;
  border-radius: 12px;
  background: var(--card-2);
  padding: 7px 10px;
  box-shadow: inset 0 0 0 1px transparent;
}

.mod.on { box-shadow: inset 0 0 0 2px var(--accent); }

.mod b { display: block; font-size: 15px; }

.mod small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.pills.three { grid-template-columns: 1fr 1fr 1fr; }

.pills.three button { font-size: 13px; padding: 0 4px; }

.pills button {
  min-height: 44px;
  border-radius: 12px;
  background: var(--card-2);
  font-weight: 700;
}

.pills button.on { background: #3a2358; color: white; }

.book {
  position: relative;
  min-width: 0;
  background: var(--card);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset 0 3px 0 var(--wash);
}

.book .ico { height: 72px; }

.book .ico svg, .book .ico img { height: 72px; }

.book .skin-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

.place, .wait { color: var(--muted); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }

.wait { color: var(--accent); }

.mults {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.mult {
  min-height: 72px;
  min-width: 128px;
  flex: 1 0 128px;
  text-align: left;
  border-radius: 14px;
  background: var(--card-2);
  padding: 10px;
  box-shadow: inset 0 0 0 1px transparent;
  transition: transform .15s ease, box-shadow .15s ease;
}

.mult.on { box-shadow: inset 0 0 0 2px var(--accent); }

.mult b { display: block; font-size: 18px; }

.mult small, .clamp {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wheel {
  position: relative;
  width: min(248px, 74vw);
  aspect-ratio: 1;
  margin: 4px auto 2px;
}

.wheel-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a1028;
  box-shadow: inset 0 0 0 8px #120818, 0 0 0 1px rgba(255, 255, 255, .08);
}

.wheel-fill {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: #241433;
}

.wheel-ticks {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from -0.4deg, rgba(255, 255, 255, .72) 0deg 0.7deg, transparent 0.7deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 68%, #000 69% 78%, transparent 79%);
  mask: radial-gradient(circle, transparent 68%, #000 69% 78%, transparent 79%);
  pointer-events: none;
  z-index: 1;
}

.wheel-rotor {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: 50% 50%;
}

.needle {
  position: absolute;
  left: 50%;
  top: 7%;
  width: 4px;
  height: 43%;
  margin-left: -2px;
  background: #fff;
  border-radius: 2px;
}

.needle::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 9px solid #fff;
}

.wheel-hub {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: #160c22;
  color: white;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18);
}

.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.stat {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}

.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }

.stat span { color: var(--muted); font-size: 12px; }

.boot {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 8, 20, .92);
}

.boot-card {
  width: min(320px, 100%);
  background: var(--card);
  border-radius: 22px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

.boot-card b { font-size: 34px; font-variant-numeric: tabular-nums; }

.boot-bar {
  height: 10px;
  border-radius: 99px;
  background: #1a0b28;
  overflow: hidden;
}

.boot-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 16px;
  padding: 10px 12px;
}

.id-row b { font-variant-numeric: tabular-nums; }

.id-row .ghost { min-height: 44px; margin-left: auto; width: auto; padding: 0 14px; }

.history { display: flex; flex-direction: column; gap: 12px; }

input {
  font-size: 16px;
  min-height: 48px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: var(--card-2);
  color: var(--text);
  padding: 0 14px;
}

.toast {
  flex: none;
  margin: 0 0 6px;
  text-align: center;
  color: var(--text);
  font-size: 14px;
}

.dock { flex: none; padding-top: 4px; padding-bottom: 8px; }

.tabs {
  flex: none;
  display: flex;
  gap: 4px;
  background: #1a0b28;
  border-top: 1px solid var(--line);
  padding-top: 6px;
  padding-bottom: calc(6px + var(--safe-bottom));
}

.tabs button {
  flex: 1;
  min-height: 48px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
}

.tabs button.on { background: #3a2358; color: white; }

.tab-ico { width: 24px; height: 24px; object-fit: contain; }

.tab-n {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  line-height: 16px;
}

.sheet {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: var(--safe-top);
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: 16px;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-body > *, .sheet-bar > * {
  width: min(1180px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.sheet-bar {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: var(--bg);
}

.reels { display: flex; flex-direction: column; gap: 18px; }

.reel {
  position: relative;
  overflow: hidden;
  height: 228px;
  border-radius: 18px;
  background: #1a0b28;
  box-shadow: inset 0 0 0 1px var(--line);
}

.reel-mark {
  position: absolute;
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 2px;
  margin-left: -1px;
  background: white;
  z-index: 2;
  pointer-events: none;
}

.reel::before, .reel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
}

.reel::before { left: 0; background: linear-gradient(90deg, #14081f, transparent); }

.reel::after { right: 0; background: linear-gradient(270deg, #14081f, transparent); }

.track {
  display: flex;
  gap: 16px;
  height: 100%;
  align-items: center;
  padding-left: 16px;
  will-change: transform;
}

.track .skin {
  width: 168px;
  flex: none;
  height: 204px;
  min-height: 204px;
}

.track .skin .ico { height: 72px; }

.track .skin .ico svg, .track .skin .ico img { height: 72px; }

.track .skin .skin-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

.track .skin .skin-wear { min-height: 2.4em; }

.track .skin::after { display: none; }

.user {
  width: 100%;
  min-height: 64px;
  text-align: left;
  border-radius: 14px;
  background: var(--card);
  padding: 10px 12px;
}

.hold {
  position: relative;
  min-width: 0;
  background: var(--card);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 3px 0 var(--wash);
}

.hold.on { box-shadow: inset 0 3px 0 var(--wash), inset 0 0 0 2px var(--accent); }

button.hold { width: 100%; text-align: left; }

.craft-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.craft-pills button {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card-2);
  font-weight: 700;
}

.craft-pills button.on { background: #3a2358; color: white; }

.hold .ico { height: 72px; }

.hold .ico svg, .hold .ico img { height: 72px; }

.hold .skin-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

.tile-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }

.tile-actions .primary, .tile-actions .ghost {
  min-height: 44px;
  font-size: 13px;
  padding: 0 8px;
}

.pick {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 18px;
  font-weight: 700;
}

.pick.on { background: var(--accent-2); color: white; }

.modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  background: rgba(8, 2, 14, .72);
}

.modal-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  animation: rise .22s ease;
}

.modal-card h2 { margin: 0; font-size: 17px; }

.modal-card p { margin: 0; }

@keyframes rise {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.tabs button { transition: background .15s ease, color .15s ease; }

@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 960px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

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