/* ALPINKA FIFTY/FIFTY — F0.1.9 GAME POLISH */
:root {
  --bg: #050914;
  --bg2: #071633;
  --panel: rgba(9, 19, 43, .72);
  --panel-strong: rgba(6, 13, 30, .92);
  --line: rgba(255,255,255,.14);
  --line-strong: rgba(71, 160, 255, .42);
  --text: #f5fbff;
  --muted: rgba(245,251,255,.68);
  --blue: #148cff;
  --cyan: #66d9ff;
  --violet: #8a5cff;
  --pink: #ff3bbd;
  --danger: #ff4368;
  --good: #39e59a;
  --shadow: rgba(0,0,0,.42);
  --radius: 28px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

:root[data-theme="light"] {
  --bg: #eef7ff;
  --bg2: #d9ecff;
  --panel: rgba(255,255,255,.76);
  --panel-strong: rgba(255,255,255,.94);
  --line: rgba(5,26,63,.12);
  --line-strong: rgba(9,101,205,.32);
  --text: #071633;
  --muted: rgba(7,22,51,.62);
  --shadow: rgba(20, 84, 140, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; font-family: var(--font); color: var(--text); }
body {
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(20,140,255,.36), transparent 26%),
    radial-gradient(circle at 92% 18%, rgba(138,92,255,.22), transparent 28%),
    radial-gradient(circle at 48% 105%, rgba(102,217,255,.20), transparent 34%),
    linear-gradient(135deg, var(--bg), var(--bg2) 62%, #02050e);
  overscroll-behavior: none;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 12% 14%, rgba(20,140,255,.22), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(0,0,0,.08), transparent 28%),
    linear-gradient(135deg, #f7fcff 0%, #e3f2ff 52%, #ffffff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255,255,255,.06), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 92px);
  opacity: .8;
}

button, input { font: inherit; }
button { cursor: pointer; border: 0; color: inherit; }
img { user-select: none; -webkit-user-drag: none; }
.hidden { display: none !important; }

.app-shell {
  position: relative;
  width: min(100%, 1120px);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 18px 86px;
}

.screen {
  display: none;
  min-height: calc(100vh - 72px);
  min-height: calc(100dvh - 72px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  text-align: center;
  animation: screenIn .38s cubic-bezier(.2,.8,.2,1) both;
}

.screen-active { display: flex; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px) scale(.985); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* FIRST LAUNCH POWER INTRO */
.power-on {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: #01030a;
  color: white;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.power-on.playing {
  visibility: visible;
  animation: powerIntro 2.15s ease both;
}

.power-noise {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(255,255,255,.035) 4px 5px),
    radial-gradient(circle, rgba(40,150,255,.18), transparent 32%);
  animation: flickerNoise .24s steps(2) 0s 6 alternate;
}

.power-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 22px var(--cyan), 0 0 70px var(--blue);
  animation: dotOpen 1.35s cubic-bezier(.16,1,.3,1) both;
}

.power-label {
  position: absolute;
  bottom: 20%;
  letter-spacing: .24em;
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,.72);
  animation: labelBlink .8s steps(2) 3;
}

@keyframes powerIntro {
  0% { opacity: 0; }
  5%, 55% { opacity: 1; }
  68% { opacity: .86; }
  72% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}
@keyframes flickerNoise {
  0% { opacity: .2; transform: translateY(0); }
  50% { opacity: .75; transform: translateY(-1px); }
  100% { opacity: .1; transform: translateY(1px); }
}
@keyframes dotOpen {
  0% { transform: scale(.1); opacity: 0; }
  32% { transform: scale(1); opacity: 1; }
  63% { transform: scale(18, .8); opacity: .55; border-radius: 40%; }
  100% { transform: scale(160); opacity: .08; }
}
@keyframes labelBlink { 50% { opacity: .14; } }

/* HOME */
.hero {
  display: grid;
  place-items: center;
  gap: 8px;
  max-width: 760px;
}

.home-screen.first-run-ready .drift-logo {
  animation: logoBubble .9s cubic-bezier(.18,1.55,.28,1) .72s both;
}
.home-screen.first-run-ready .hero-kicker,
.home-screen.first-run-ready .hero-text {
  animation: softRise .56s ease 1.08s both;
}
.home-screen.first-run-ready .game-menu-button {
  animation: buttonPop .62s cubic-bezier(.2,1.65,.35,1) both;
}
.home-screen.first-run-ready .game-menu-button:nth-child(1) { animation-delay: 1.18s; }
.home-screen.first-run-ready .game-menu-button:nth-child(2) { animation-delay: 1.28s; }
.home-screen.first-run-ready .game-menu-button:nth-child(3) { animation-delay: 1.38s; }

@keyframes logoBubble {
  from { opacity: 0; transform: scale(.16); filter: blur(14px); }
  58% { opacity: 1; transform: scale(1.065); filter: blur(0); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes softRise {
  from { opacity: 0; transform: translateY(12px); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes buttonPop {
  from { opacity: 0; transform: translateY(18px) scale(.88); filter: blur(8px); }
  70% { opacity: 1; transform: translateY(-4px) scale(1.025); filter: blur(0); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.drift-logo {
  width: min(86vw, 410px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  transform-style: preserve-3d;
}

.logo-word {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) skewX(-8deg);
  font-weight: 1000;
  font-size: clamp(54px, 15vw, 92px);
  letter-spacing: -.065em;
  line-height: .82;
  font-family: Impact, Haettenschweiler, "Arial Black", var(--font);
  text-shadow:
    -3px -3px 0 #06122d,
    3px -3px 0 #06122d,
    -3px 3px 0 #06122d,
    3px 3px 0 #06122d,
    0 8px 0 rgba(0,0,0,.18),
    0 16px 34px rgba(0,0,0,.28);
  z-index: 1;
}
.logo-word-top {
  top: 18%;
  color: #ffffff;
}
.logo-word-bottom {
  bottom: 17%;
  color: #1592ff;
}

.logo-car {
  position: absolute;
  width: 82%;
  height: 42%;
  left: 9%;
  top: 32%;
  z-index: 3;
  filter: drop-shadow(0 18px 20px rgba(0,0,0,.35));
  transform: rotate(-4deg);
}
.car-body {
  position: absolute;
  left: 11%;
  top: 22%;
  width: 76%;
  height: 50%;
  border-radius: 45% 48% 38% 34% / 50% 58% 36% 38%;
  background: linear-gradient(155deg, #35b6ff 0%, #147ee9 50%, #0350ab 100%);
  border: 4px solid #06122d;
  box-shadow: inset -18px -16px 0 rgba(0,0,0,.16), inset 10px 8px 0 rgba(255,255,255,.22);
}
.car-roof {
  position: absolute;
  left: 28%;
  top: -32%;
  width: 44%;
  height: 52%;
  border-radius: 50% 48% 20% 16%;
  background: #06122d;
  transform: skewX(-14deg);
}
.car-window {
  position: absolute;
  left: 39%;
  top: -22%;
  width: 28%;
  height: 35%;
  border-radius: 50% 40% 12% 12%;
  background: linear-gradient(160deg, #dff6ff, #10234a 56%);
  transform: skewX(-14deg);
}
.car-tail {
  position: absolute;
  left: 8%;
  top: 31%;
  width: 22%;
  height: 12%;
  border-radius: 999px;
  background: #ff4262;
  box-shadow: 0 0 12px rgba(255,66,98,.55);
}
.car-line {
  position: absolute;
  left: 22%;
  right: 15%;
  top: 54%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
}
.wheel {
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  bottom: -22%;
  background: #06122d;
  border: 6px solid #eaf6ff;
  box-shadow: inset 0 0 0 7px #06122d;
}
.wheel::after {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: #4fc3ff;
}
.wheel-back { left: 18%; }
.wheel-front { right: 18%; transform: rotate(-18deg) skewY(-8deg); }

.car-smoke {
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  filter: blur(.4px);
}
.smoke-a { width: 40%; height: 28%; left: 0; bottom: 4%; opacity: .88; }
.smoke-b { width: 26%; height: 18%; left: 4%; bottom: 26%; opacity: .66; }

.hero-kicker {
  margin: -8px 0 0;
  font-size: 11px;
  letter-spacing: .28em;
  font-weight: 900;
  color: var(--muted);
}
h1, h2, h3, p { margin: 0; }
h1, h2 {
  font-weight: 1000;
  letter-spacing: -.045em;
}
h1 { font-size: clamp(38px, 9vw, 72px); }
h2 { font-size: clamp(30px, 8vw, 56px); }
.section-text, .hero-text {
  max-width: 680px;
  line-height: 1.55;
  color: var(--muted);
  font-size: 15px;
}

.stagger-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(10px) scale(.8);
  filter: blur(5px);
  animation: charPop .38s cubic-bezier(.2,1.6,.28,1) forwards;
  animation-delay: calc(var(--i) * 28ms + var(--base-delay, 0ms));
}
@keyframes charPop {
  70% { opacity: 1; transform: translateY(-3px) scale(1.05); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.home-actions {
  display: grid;
  gap: 12px;
  width: min(92vw, 330px);
}

.game-menu-button {
  min-height: 54px;
  border-radius: 18px;
  padding: 0 22px;
  font-weight: 1000;
  letter-spacing: .03em;
  text-transform: uppercase;
  background:
    linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.04)),
    linear-gradient(135deg, rgba(20,140,255,.28), rgba(8,18,42,.82));
  border: 1px solid var(--line-strong);
  box-shadow: 0 16px 44px var(--shadow), inset 0 0 0 1px rgba(255,255,255,.08);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  position: relative;
  overflow: hidden;
}
.game-menu-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0 35%, rgba(255,255,255,.22), transparent 65% 100%);
  transform: translateX(-120%);
  transition: transform .6s ease;
}
.game-menu-button:hover::before { transform: translateX(120%); }
.game-menu-button:active { transform: scale(.965); }
.game-menu-button.primary {
  background: linear-gradient(135deg, #0b7cff, #18cbff 58%, #083372);
  color: white;
}
.game-menu-button.ghost {
  opacity: .88;
}

/* General cards/buttons */
.back-link {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 20;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.screen-head { display: grid; gap: 8px; place-items: center; }

.settings-shell, .analytics-card {
  width: min(94vw, 760px);
  border-radius: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 26px 80px var(--shadow);
  backdrop-filter: blur(22px);
  padding: 18px;
}

.settings-stats-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini-stat-title {
  grid-column: 1 / -1;
  text-align: left;
  color: var(--cyan);
  font-weight: 1000;
  letter-spacing: .12em;
  font-size: 12px;
}
.mini-stat {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-radius: 17px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.setting-tile {
  display: grid;
  gap: 12px;
  text-align: left;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255,255,255,.075);
  border: 1px solid var(--line);
}
.setting-tile > span { font-weight: 900; color: var(--muted); font-size: 13px; }
.segmented {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(0,0,0,.22);
}
.segmented button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}
.segmented button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}
.toggle-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  min-height: 42px;
  border-radius: 999px;
  padding: 5px;
  background: rgba(0,0,0,.24);
}
.toggle-pill span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 0 18px rgba(20,140,255,.44);
}
.toggle-pill.off span { background: linear-gradient(135deg, #404a5d, #101827); box-shadow: none; }
.toggle-pill b { font-size: 13px; }
.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.galaxy-btn, .soft-action, .leaderboard-button {
  border-radius: 18px;
  padding: 13px 18px;
  font-weight: 1000;
  background: linear-gradient(135deg, #071633, #0d5bd2 60%, #32d6ff);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 16px 34px rgba(0,0,0,.25);
}
.soft-action {
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(20,140,255,.18));
}
.leaderboard-button {
  width: 100%;
  margin-top: 14px;
  background: conic-gradient(from 0deg, #0b7cff, #7c4dff, #ff3bbd, #0b7cff);
}

.analytics-card { display: grid; gap: 14px; text-align: left; }
.analytics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.analytics-head small { color: var(--cyan); font-weight: 1000; letter-spacing: .18em; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: rgba(57,229,154,.12);
  color: var(--good);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}
.live-pill span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 12px var(--good);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat-tile, .value-cards > div {
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.stat-tile p, .value-cards p { color: var(--muted); font-size: 12px; font-weight: 800; }
.stat-tile b { font-size: 25px; }
.value-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.leaderboard-grid {
  width: min(94vw, 760px);
  display: grid;
  gap: 12px;
}
.leaderboard-card {
  text-align: left;
  padding: 16px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.leaderboard-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

/* MODE */
.mode-stage {
  position: relative;
  width: min(94vw, 720px);
  height: 360px;
  overflow: hidden;
  border-radius: 38px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px var(--shadow);
  touch-action: pan-y;
}

.mode-bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
  overflow: hidden;
}
.mode-stage[data-mode="offline"] .mode-bg-offline,
.mode-stage[data-mode="online"] .mode-bg-online { opacity: 1; }
.mode-bg-offline {
  background:
    radial-gradient(circle at 20% 18%, rgba(20,140,255,.22), transparent 28%),
    linear-gradient(135deg, rgba(255,255,255,.055), rgba(0,0,0,.18));
}
.mode-bg-offline span {
  position: absolute;
  color: rgba(255,255,255,.14);
  font-size: 30px;
}
.mode-bg-offline span:nth-child(1){left:12%;top:12%}
.mode-bg-offline span:nth-child(2){left:74%;top:16%}
.mode-bg-offline span:nth-child(3){left:16%;top:72%}
.mode-bg-offline span:nth-child(4){left:62%;top:68%}
.mode-bg-offline span:nth-child(5){left:44%;top:34%}
.mode-bg-online {
  background:
    radial-gradient(circle at 78% 20%, rgba(102,217,255,.18), transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,.04), rgba(0,0,0,.20));
}
.outline-car {
  position: absolute;
  left: 10%;
  top: 39%;
  width: 55%;
  height: 18%;
  border: 3px solid rgba(255,255,255,.20);
  border-radius: 50% 48% 36% 32%;
  transform: skewX(-12deg);
}
.phone-shape {
  position: absolute;
  right: 16%;
  top: 18%;
  width: 74px;
  height: 142px;
  border-radius: 22px;
  border: 3px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.055);
}
.mode-bg-online span { position: absolute; color: rgba(255,255,255,.14); font-size: 28px; }
.mode-bg-online span:nth-of-type(1){left:70%;top:70%}
.mode-bg-online span:nth-of-type(2){left:22%;top:20%}
.mode-bg-online span:nth-of-type(3){left:50%;top:62%}

.mode-track {
  position: relative;
  height: 100%;
  display: flex;
  width: 200%;
  transition: transform .5s cubic-bezier(.2,.85,.2,1);
  will-change: transform;
}
.mode-stage[data-mode="offline"] .mode-track { transform: translateX(0); }
.mode-stage[data-mode="online"] .mode-track { transform: translateX(-50%); }
.mode-card {
  width: 50%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 34px;
}
.mode-card small {
  color: var(--cyan);
  letter-spacing: .22em;
  font-weight: 1000;
}
.mode-card h3 {
  font-size: clamp(30px, 7vw, 58px);
  letter-spacing: -.05em;
  font-weight: 1000;
}
.mode-card p {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.5;
}
.continue-button {
  min-width: 240px;
  min-height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, #04142f, #0b75ff);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 50px var(--shadow);
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* OFFLINE */
.offline-layout {
  width: min(98vw, 1060px);
  display: grid;
  grid-template-columns: 1.2fr .85fr;
  gap: 14px;
  align-items: stretch;
}
.prize-zone, .stake-zone {
  border-radius: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px var(--shadow);
  backdrop-filter: blur(20px);
  padding: 14px;
}
.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.zone-head b { font-weight: 1000; }
.zone-head span {
  color: var(--cyan);
  font-weight: 900;
  font-size: 13px;
}
.prize-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}
.prize-card {
  position: relative;
  min-height: 198px;
  border-radius: 22px;
  padding: 9px;
  display: grid;
  align-content: end;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.035));
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 16px 34px rgba(0,0,0,.22);
  transform-style: preserve-3d;
}
.prize-card.selected {
  border-color: rgba(102,217,255,.88);
  box-shadow: 0 0 0 2px rgba(102,217,255,.18), 0 24px 48px rgba(20,140,255,.22);
}
.prize-card.used {
  filter: grayscale(.7) brightness(.62);
}
.prize-card img {
  position: absolute;
  inset: 9px 9px 52px;
  width: calc(100% - 18px);
  height: calc(100% - 61px);
  object-fit: contain;
  transform: translateZ(24px);
}
.prize-chance {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 3px;
  justify-items: center;
  border-radius: 15px;
  padding: 8px 5px;
  background: rgba(0,0,0,.36);
  backdrop-filter: blur(12px);
  font-weight: 1000;
}
.prize-chance b { font-size: 19px; color: var(--cyan); }
.prize-chance small { color: var(--muted); font-size: 10px; }
.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.45);
  font-weight: 1000;
  color: white;
  text-align: center;
  padding: 12px;
}
.stake-zone { display: grid; gap: 12px; align-content: start; }
.stake-summary {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}
.stake-summary > div {
  text-align: left;
  border-radius: 18px;
  padding: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.stake-summary small { color: var(--muted); font-size: 11px; font-weight: 800; }
.stake-summary b { display: block; margin-top: 3px; font-weight: 1000; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  color: #071633;
  padding: 0 12px;
}
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #071633;
}
.search-results {
  max-height: 224px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 3px;
}
.search-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border-radius: 16px;
  padding: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}
.search-item img {
  width: 48px; height: 34px; object-fit: contain;
  border-radius: 8px; background: rgba(0,0,0,.18);
}
.search-item b { display: block; font-size: 13px; }
.search-item small { color: var(--muted); }
.add-badge {
  border-radius: 999px;
  background: rgba(20,140,255,.18);
  color: var(--cyan);
  padding: 7px 10px;
  font-weight: 900;
}
.selected-panel {
  border-radius: 18px;
  padding: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line);
}
.selected-list { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; min-height: 38px; }
.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 210px;
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(20,140,255,.16);
  border: 1px solid rgba(102,217,255,.25);
  font-size: 12px;
}
.selected-chip span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.selected-chip button {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,67,104,.82);
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(14px);
  padding: 18px;
}
.modal-card {
  width: min(94vw, 480px);
  border-radius: 34px;
  padding: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
  position: relative;
  text-align: center;
  animation: modalIn .28s cubic-bezier(.2,1.4,.3,1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(22px) scale(.94); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
.modal-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.11);
  font-size: 22px;
}
.modal-card-image {
  width: 100%;
  height: 220px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(20,140,255,.22), transparent 42%),
    rgba(255,255,255,.06);
  overflow: hidden;
  transform-style: preserve-3d;
}
.modal-card-image img { width: 96%; height: 96%; object-fit: contain; }
.modal-card h3 { margin-top: 14px; font-size: 25px; }
.modal-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0;
}
.modal-meta span {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,.09);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.modal-copy { color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.play-roulette-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0b7cff, #60e4ff);
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* RESULT */
.result-arena {
  width: min(94vw, 720px);
  border-radius: 38px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 28px 90px var(--shadow);
  display: grid;
  gap: 16px;
}
.result-top small { color: var(--cyan); font-weight: 1000; letter-spacing: .22em; }
.result-top h2 { margin-top: 4px; }
.roulette-visual {
  display: grid;
  place-items: center;
}
.roulette-ring {
  width: min(56vw, 280px);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(from 0deg, rgba(255,255,255,.08) 0 360deg);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 36px rgba(0,0,0,.32), 0 20px 50px rgba(0,0,0,.25);
  overflow: hidden;
}
.win-slice {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, var(--blue) 0deg, var(--pink) var(--win-deg, 0deg), transparent var(--win-deg, 0deg) 360deg);
  opacity: .9;
}
.roulette-pointer {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 0;
  height: 44%;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--roll-deg, 0deg));
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.roulette-pointer::after {
  content: "";
  position: absolute;
  left: -8px;
  top: -1px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 22px solid white;
  filter: drop-shadow(0 0 12px var(--cyan));
}
.roulette-core {
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.roulette-core b { font-size: 25px; color: var(--cyan); }
.roulette-core span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .18em; }
.result-cards {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.result-mini-card {
  width: 126px;
  min-height: 116px;
  display: grid;
  align-content: end;
  justify-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  padding: 8px;
}
.result-mini-card img { width: 100%; height: 72px; object-fit: contain; }
.result-mini-card small { color: var(--muted); font-size: 10px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ONLINE */
.online-actions {
  width: min(94vw, 920px);
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  gap: 12px;
}
.online-choice, .minigame-card {
  min-height: 180px;
  border-radius: 30px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 22px 60px var(--shadow);
  transition: transform .22s ease, border-color .22s ease;
}
.online-choice:hover, .minigame-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.online-choice small { color: var(--cyan); font-weight: 1000; letter-spacing: .16em; }
.online-choice b { font-size: 24px; }
.online-choice span { color: var(--muted); }
.room-panel {
  width: min(94vw, 620px);
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.room-panel input {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.1);
  color: var(--text);
  padding: 0 12px;
}
.online-minigames {
  width: min(94vw, 620px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.minigame-card {
  min-height: 130px;
  background:
    radial-gradient(circle at 20% 10%, rgba(20,140,255,.20), transparent 42%),
    var(--panel);
}
.minigame-card b { font-size: 22px; }
.minigame-card span { color: var(--muted); }
.quiz-cubes {
  width: min(94vw, 680px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.quiz-card {
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px;
}
.quiz-card img { width: 100%; height: 180px; object-fit: contain; }

/* CHAT */
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 650;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 18px 44px rgba(20,140,255,.38);
  display: grid;
  place-items: center;
}
.chat-fab span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: white;
  display: inline-block;
  margin: 2px;
}
.chat-panel {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 660;
  width: min(92vw, 360px);
  height: 460px;
  border-radius: 28px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 28px 90px rgba(0,0,0,.46);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  font-weight: 1000;
}
.chat-head small { display: block; color: var(--good); font-size: 11px; }
.chat-head button { margin-left: auto; background: transparent; font-size: 24px; }
.chat-messages {
  padding: 14px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 9px;
}
.msg {
  width: fit-content;
  max-width: 84%;
  padding: 9px 11px;
  border-radius: 16px 16px 16px 4px;
  background: rgba(255,255,255,.09);
  text-align: left;
  font-size: 13px;
}
.msg.me {
  justify-self: end;
  border-radius: 16px 16px 4px 16px;
  background: rgba(20,140,255,.28);
}
.msg small { display: block; opacity: .7; margin-top: 3px; text-align: right; }
.quick-chat {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px;
}
.quick-chat button {
  flex: 1;
  border-radius: 999px;
  padding: 7px;
  background: rgba(255,255,255,.08);
  font-size: 12px;
}
.chat-input {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.chat-input input {
  border: 0;
  outline: 0;
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255,255,255,.10);
  color: var(--text);
}
.chat-input button {
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
}

/* LOADING */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(14px);
}
.loader-card {
  width: min(86vw, 420px);
  min-height: 150px;
  border-radius: 32px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.loader-word {
  font-weight: 1000;
  font-size: clamp(36px, 12vw, 68px);
  letter-spacing: -.06em;
  animation: loaderPulse .9s ease infinite alternate;
}
.loader-line {
  width: 170px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: lineSlide 1.2s ease infinite;
}
@keyframes loaderPulse { from { opacity: .55; transform: scale(.98); } to { opacity: 1; transform: scale(1.03); } }
@keyframes lineSlide { 50% { transform: scaleX(.55); opacity: .45; } }

/* HINTS */
.hint-bubble {
  position: fixed;
  z-index: 1000;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  width: min(92vw, 440px);
  border-radius: 20px;
  padding: 12px 14px;
  background: rgba(5, 16, 38, .92);
  border: 1px solid rgba(102,217,255,.25);
  color: white;
  box-shadow: 0 20px 60px rgba(0,0,0,.36);
  animation: hintIn .35s cubic-bezier(.2,1.4,.3,1) both;
}
@keyframes hintIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(.94); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* RESPONSIVE */
@media (max-width: 860px) {
  .offline-layout { grid-template-columns: 1fr; }
  .prize-grid { grid-template-columns: repeat(3, 1fr); }
  .online-actions { grid-template-columns: 1fr; }
  .online-choice { min-height: 120px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .app-shell { padding: 18px 12px 74px; }
  .screen { min-height: calc(100dvh - 54px); gap: 14px; }
  .drift-logo { width: min(90vw, 320px); }
  .logo-word { font-size: clamp(48px, 16vw, 72px); }
  .section-text, .hero-text { font-size: 13px; }
  .settings-grid, .settings-stats-mini, .value-cards { grid-template-columns: 1fr; }
  .settings-shell, .analytics-card { padding: 14px; border-radius: 28px; }
  .mode-stage { height: 310px; border-radius: 30px; }
  .mode-card { padding: 22px; }
  .prize-grid { grid-template-columns: repeat(2, 1fr); }
  .prize-card { min-height: 174px; }
  .stake-summary { grid-template-columns: 1fr; }
  .search-results { max-height: 190px; }
  .room-panel { grid-template-columns: 1fr; }
  .online-minigames, .quiz-cubes { grid-template-columns: 1fr; }
  .chat-panel { right: 10px; left: 10px; bottom: 82px; width: auto; height: 430px; }
  .back-link { top: 12px; left: 12px; padding: 8px 11px; }
}


/* RESTORE FIX — non-destructive polish over the original F0.1.3 */
.modal-close {
  background: rgba(8, 16, 36, .92) !important;
  border: 1px solid rgba(255,255,255,.34) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 3px rgba(102,217,255,.08);
  z-index: 20;
}
.modal-close:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(0,0,0,.42), 0 0 0 4px rgba(102,217,255,.18); }
.modal-card-image img[src=""], .prize-card img[src=""], .search-item img[src=""], .result-mini-card img[src=""] { display: none; }
.modal-card-image { position: relative; }
.modal-card-image::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 22px;
  background: url('/static/placeholder_card.svg') center / contain no-repeat;
  opacity: .28;
  pointer-events: none;
}
.modal-card-image img { position: relative; z-index: 1; }

.loader-card-roulette { min-height: 245px; gap: 12px; }
.loader-roulette {
  width: 126px;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: conic-gradient(from -90deg, rgba(102,217,255,.95) 0deg, rgba(216,73,230,.95) 150deg, rgba(255,255,255,.08) 150deg 360deg);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 0 28px rgba(0,0,0,.35), 0 18px 44px rgba(20,140,255,.20);
  overflow: hidden;
}
.loader-roulette::after {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: rgba(8,18,39,.94);
  border: 1px solid rgba(255,255,255,.11);
}
.loader-roulette-pointer {
  position: absolute;
  left: 50%;
  top: 5px;
  width: 0;
  height: 54px;
  transform-origin: 50% 58px;
  animation: loadingPointer 1.05s cubic-bezier(.2,.9,.2,1) infinite;
  z-index: 4;
}
.loader-roulette-pointer::after {
  content: "";
  position: absolute;
  left: -9px;
  top: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 24px solid #fff;
  filter: drop-shadow(0 0 14px var(--cyan));
}
.loader-roulette-core {
  position: relative;
  z-index: 5;
  font-weight: 1000;
  color: var(--cyan);
  letter-spacing: -.05em;
}
@keyframes loadingPointer {
  0% { transform: translateX(-50%) rotate(0deg); }
  45% { transform: translateX(-50%) rotate(560deg); }
  100% { transform: translateX(-50%) rotate(1080deg); }
}

.extra-modal-card { text-align: left; }
.extra-modal-card h3 { margin: 4px 44px 8px 0; font-size: 28px; }
.extra-list { display: grid; gap: 10px; margin: 14px 0; }
.extra-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  border-radius: 20px;
  padding: 13px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  color: var(--text);
}
.extra-toggle b { display: block; font-weight: 1000; }
.extra-toggle small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.extra-toggle i {
  flex: 0 0 48px;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.12);
  position: relative;
}
.extra-toggle i::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  left: 4px;
  top: 3px;
  background: #fff;
  transition: transform .18s ease;
}
.extra-toggle.active i { background: linear-gradient(135deg, var(--blue), var(--cyan)); }
.extra-toggle.active i::after { transform: translateX(19px); }
body.compact-ui .prize-card { min-height: 172px; }
body.compact-ui .prize-zone, body.compact-ui .stake-zone, body.compact-ui .settings-shell { padding: 10px; }
body.compact-ui .search-results { max-height: 180px; }
body.hide-percents .prize-chance small, body.hide-percents #currentChanceValue, body.hide-percents #modalPrizeChance { opacity: .35; filter: blur(3px); }
body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

@media (max-width: 640px) {
  .loader-card-roulette { min-height: 215px; }
  .loader-roulette { width: 108px; }
  .extra-modal-card h3 { font-size: 24px; }
}


/* F0.1.3 LOGO POLISH — keeps old UI, adds image logo support and mobile polish */
.custom-drift-logo {
  display: none;
  width: min(82vw, 380px);
  max-height: 320px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 18px 28px rgba(0,0,0,.30)) drop-shadow(0 0 20px rgba(102,217,255,.16));
  transform-origin: center;
}
body.custom-logo-ready .custom-drift-logo { display: block; }
body.custom-logo-ready .drift-logo > :not(.custom-drift-logo) { display: none !important; }
body.custom-logo-ready .drift-logo {
  min-height: auto;
  width: min(88vw, 430px);
  margin-bottom: 8px;
}

/* Make close buttons unmistakable on desktop and phone */
.modal-close {
  width: 46px !important;
  height: 46px !important;
  right: 12px !important;
  top: 12px !important;
  font-size: 31px !important;
  line-height: 42px !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(5, 14, 34, .96) !important;
  border: 1px solid rgba(255,255,255,.42) !important;
  color: #fff !important;
  box-shadow: 0 10px 28px rgba(0,0,0,.46), 0 0 0 4px rgba(102,217,255,.10) !important;
}
.modal-close:active { transform: scale(.94) !important; }

/* Broken image protection: never show ugly alt text or collapsed slots */
.prize-card img,
.search-item img,
.result-mini-card img,
.quiz-card img,
.modal-card-image img {
  color: transparent;
  text-indent: -9999px;
}
.prize-card img {
  background: radial-gradient(circle at 50% 25%, rgba(102,217,255,.16), transparent 48%), rgba(255,255,255,.035);
  border-radius: 16px;
}
.search-item img {
  background: url('/static/placeholder_card.svg') center / contain no-repeat, rgba(255,255,255,.045);
}
.result-mini-card img,
.quiz-card img {
  background: url('/static/placeholder_card.svg') center / contain no-repeat, rgba(255,255,255,.045);
  border-radius: 12px;
}

/* Offline flow readability: player immediately understands the loop */
.offline-flow-hint {
  border-radius: 16px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(20,140,255,.12), rgba(102,217,255,.08));
  border: 1px solid rgba(102,217,255,.18);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}
.stake-summary {
  position: relative;
}
.stake-summary::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(102,217,255,.08);
}

/* Better loader: feels like the old alive ALPINKA loading, not a plain SPIN card */
.loading-overlay {
  background: rgba(2, 8, 18, .72) !important;
}
.loader-card-roulette {
  width: min(92vw, 410px);
  border-radius: 34px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(102,217,255,.18), transparent 42%),
    radial-gradient(circle at 80% 80%, rgba(216,73,230,.12), transparent 35%),
    rgba(6, 16, 37, .92) !important;
}
.loader-word {
  text-transform: uppercase;
  letter-spacing: .02em !important;
  text-align: center;
}
.loader-roulette-pointer {
  animation-duration: .82s !important;
}

/* Settings: old layout, but less web-panel and more game UI */
.settings-shell {
  position: relative;
  overflow: hidden;
}
.settings-shell::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 14% 14%, rgba(102,217,255,.12), transparent 32%),
              radial-gradient(circle at 86% 22%, rgba(216,73,230,.08), transparent 28%);
  pointer-events: none;
}
.settings-shell > * { position: relative; z-index: 1; }
.setting-tile,
.mini-stat,
.analytics-card,
.leaderboard-card {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.035);
}

/* Phone-first cleanup */
@media (max-width: 620px) {
  body.custom-logo-ready .drift-logo { width: min(94vw, 330px); }
  .custom-drift-logo { width: min(92vw, 330px); max-height: 260px; }
  .home-actions { width: 100%; }
  .home-actions .game-menu-button { width: min(100%, 330px); }
  .offline-layout { gap: 12px; }
  .stake-zone {
    order: -1;
  }
  .stake-summary {
    position: sticky;
    top: 8px;
    z-index: 40;
    padding: 8px;
    border-radius: 22px;
    background: rgba(5,16,38,.88);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(102,217,255,.16);
  }
  html[data-theme="light"] .stake-summary {
    background: rgba(243,248,255,.88);
  }
  .prize-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
  }
  .prize-card {
    min-height: 162px !important;
    border-radius: 20px;
  }
  .prize-chance b { font-size: 17px; }
  .search-results { max-height: 240px; }
  .modal {
    padding: 10px;
    align-items: end;
  }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    overflow: auto;
    border-radius: 28px 28px 22px 22px;
  }
  .modal-card-image { height: 190px; }
  .online-actions,
  .online-minigames {
    width: 100%;
  }
}

/* Extra small phones */
@media (max-width: 390px) {
  .prize-card { min-height: 148px !important; }
  .prize-card img { inset: 7px 7px 50px; width: calc(100% - 14px); height: calc(100% - 57px); }
  .prize-chance { padding: 7px 4px; }
  .prize-chance b { font-size: 15px; }
}


.roulette-visual.result-spin-animate .roulette-pointer {
  animation: resultPointerSettle 1.15s cubic-bezier(.12,.82,.18,1.02) both;
}
@keyframes resultPointerSettle {
  from { transform: rotate(0deg); }
  70% { transform: rotate(calc(var(--roll-deg, 0deg) + 720deg)); }
  to { transform: rotate(var(--roll-deg, 0deg)); }
}


/* ===================== F0.1.4 POLISH ===================== */

/* main menu: logo only, no visible image element */
.hero {
  gap: 8px;
}
.hero-kicker,
.hero .stagger-title,
.hero-text {
  display: none !important;
}
.custom-drift-logo {
  display: none;
  width: min(92vw, 560px);
  height: min(48vw, 360px);
  max-height: 390px;
  background-image: var(--logo-url);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 24px 44px rgba(0,0,0,.32)) drop-shadow(0 0 22px rgba(102,217,255,.16));
}
body.custom-logo-ready .custom-drift-logo { display: block; }
body.custom-logo-ready .drift-logo > :not(.custom-drift-logo) { display: none !important; }
body.custom-logo-ready .drift-logo {
  width: min(94vw, 610px);
  min-height: 370px;
  display: grid;
  place-items: center;
  margin: 16px auto 4px;
}
.home-actions {
  margin-top: 8px;
}
.home-actions .game-menu-button {
  text-shadow: none;
}

/* If user's file still has a checkerboard, it is inside the PNG. Use transparent PNG to remove it. */
:root[data-theme="light"] .game-menu-button:not(.primary):not(.ghost),
:root[data-theme="light"] .soft-action,
:root[data-theme="light"] .continue-button {
  color: #061630;
  text-shadow: none;
}
:root[data-theme="light"] .game-menu-button.primary,
:root[data-theme="light"] .galaxy-btn,
:root[data-theme="light"] .play-roulette-btn {
  color: #fff;
  text-shadow: none;
}

/* settings: compact game dashboard instead of clunky rows */
.settings-shell {
  overflow: hidden;
}
.settings-stats-mini.stats-f014 {
  display: grid;
  grid-template-columns: 1fr 1fr .8fr;
  gap: 10px;
}
.stat-glow-card {
  min-height: 74px;
  border-radius: 22px;
  padding: 12px 14px;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(102,217,255,.10), rgba(255,255,255,.045)),
    rgba(255,255,255,.045);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.stat-glow-card small {
  display: block;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .13em;
  margin-bottom: 5px;
}
.stat-glow-card b {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 28px;
  line-height: .95;
}
.stat-glow-card b em {
  font-style: normal;
  color: var(--muted);
  font-size: 17px;
}
.stat-glow-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.stat-glow-card.rate {
  background:
    radial-gradient(circle at 20% 15%, rgba(57,229,154,.18), transparent 42%),
    rgba(255,255,255,.045);
}
:root[data-theme="light"] .settings-shell,
:root[data-theme="light"] .analytics-card,
:root[data-theme="light"] .leaderboard-card,
:root[data-theme="light"] .setting-tile,
:root[data-theme="light"] .stat-glow-card {
  color: #071633;
  background: rgba(255,255,255,.70);
  border-color: rgba(5,26,63,.13);
}
:root[data-theme="light"] .settings-shell {
  box-shadow: 0 24px 70px rgba(20,84,140,.16);
}
:root[data-theme="light"] .segmented,
:root[data-theme="light"] .toggle-pill {
  background: rgba(5,26,63,.08);
}
:root[data-theme="light"] .segmented button,
:root[data-theme="light"] .toggle-pill b,
:root[data-theme="light"] .stat-glow-card b {
  color: #071633;
}
:root[data-theme="light"] .segmented button.active {
  color: #fff;
}
:root[data-theme="light"] .toggle-pill:not(.off) b,
:root[data-theme="light"] .soft-action:not(.stars) {
  color: #071633;
}
:root[data-theme="light"] .galaxy-btn {
  background: linear-gradient(135deg, #005ed0, #18bdf5);
  box-shadow: 0 18px 48px rgba(0,94,208,.22);
}
:root[data-theme="light"] .settings-actions .soft-action {
  background: rgba(255,255,255,.78);
  box-shadow: 0 14px 36px rgba(20,84,140,.14);
}

/* Full stats: no weird edge glow sticking out */
.analytics-card {
  overflow: hidden;
}
.analytics-card::before,
.settings-shell::before {
  max-width: 100%;
  overflow: hidden;
}

/* mode screen: no OFFLINE/ONLINE labels, more wallpaper-like */
.mode-card small { display: none !important; }
.mode-stage[data-mode="offline"] {
  box-shadow: 0 32px 90px rgba(20,140,255,.16), inset 0 0 0 1px rgba(102,217,255,.12);
}
.mode-stage[data-mode="online"] {
  box-shadow: 0 32px 90px rgba(106,143,255,.18), inset 0 0 0 1px rgba(102,217,255,.10);
}
.mode-bg-offline span,
.mode-bg-online span { display: none !important; }
.mode-bg-offline {
  background:
    radial-gradient(circle at 18% 22%, rgba(20,140,255,.26), transparent 34%),
    radial-gradient(circle at 82% 70%, rgba(102,217,255,.08), transparent 32%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.16)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='16' y='22' width='30' height='24' rx='6'/%3E%3Cpath d='M24 22v-6m14 6v-6M25 34h1m13 0h1'/%3E%3Cpath d='M80 26h24v18H91l-7 7v-7h-4z'/%3E%3Crect x='20' y='78' width='34' height='22' rx='4'/%3E%3Cpath d='M25 84h24M25 91h18'/%3E%3Ccircle cx='90' cy='88' r='13'/%3E%3Cpath d='M84 88h12M90 82v12'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, rgba(255,255,255,.055), rgba(0,0,0,.18));
  background-size: auto, auto, 120px 120px, auto;
}
.mode-bg-online {
  background:
    radial-gradient(circle at 78% 20%, rgba(102,217,255,.18), transparent 32%),
    radial-gradient(circle at 30% 72%, rgba(106,143,255,.18), transparent 32%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.13)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='94' y='18' width='24' height='44' rx='8'/%3E%3Cpath d='M28 46c15-13 48-15 72-6l10 10H22zM34 50h70'/%3E%3Ccircle cx='45' cy='55' r='5'/%3E%3Ccircle cx='88' cy='55' r='5'/%3E%3Cpath d='M24 96h36v22H24zM30 104h24M78 98h34v18H88l-10 8v-8'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, rgba(255,255,255,.04), rgba(0,0,0,.20));
  background-size: auto, auto, 140px 140px, auto;
}
.mode-card {
  transition: transform .32s ease, opacity .32s ease, filter .32s ease;
}
.mode-card h3 {
  text-shadow: 0 12px 28px rgba(0,0,0,.28);
}
.continue-button {
  background: linear-gradient(135deg, rgba(0,110,245,.95), rgba(102,217,255,.92));
  box-shadow: 0 18px 45px rgba(20,140,255,.28), inset 0 0 0 1px rgba(255,255,255,.16);
}

/* offline roulette */
.stake-summary {
  grid-template-columns: 1fr auto;
}
.stake-summary .stake-count-pill {
  min-width: 96px;
  text-align: center;
}
.stake-summary .stake-count-pill b {
  color: var(--cyan);
  font-size: 22px;
}
.prize-action-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-radius: 18px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(20,140,255,.16), rgba(102,217,255,.08));
  border: 1px solid rgba(102,217,255,.22);
}
.prize-action-panel small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.prize-action-panel b {
  display: block;
  margin-top: 3px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prize-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.soft-action.mini {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
}
.soft-action.stars {
  background: linear-gradient(135deg, rgba(255,184,60,.20), rgba(102,217,255,.10));
  border-color: rgba(255,184,60,.28);
}
.prize-card {
  transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease, filter .24s ease;
}
.prize-card:hover {
  transform: translateY(-2px);
  border-color: rgba(102,217,255,.52);
}
.prize-card img {
  inset: 8px 8px 42px !important;
  width: calc(100% - 16px) !important;
  height: calc(100% - 50px) !important;
  object-fit: contain !important;
}
.prize-title {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 8px;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 10px;
  color: rgba(245,251,255,.86);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.08));
  pointer-events: none;
}
.prize-chance {
  position: absolute !important;
  left: 12px;
  right: 12px;
  bottom: 8px;
  min-height: 34px;
  padding: 5px 8px !important;
  background: rgba(4, 12, 30, .68) !important;
  border: 1px solid rgba(102,217,255,.16);
}
.prize-chance b {
  font-size: 20px !important;
  letter-spacing: -.03em;
  text-shadow: 0 0 18px rgba(102,217,255,.35);
}
.prize-chance small:empty { display: none; }
.prize-chance:not(.cooldown) small { display: none !important; }
.lock-overlay {
  backdrop-filter: blur(5px);
}

/* search cards: less website, more game */
.search-box {
  min-height: 52px;
  border-radius: 19px;
  background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(229,244,255,.92));
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.search-results {
  scrollbar-width: thin;
  scrollbar-color: rgba(102,217,255,.55) rgba(255,255,255,.05);
  padding-right: 6px;
}
.search-results::-webkit-scrollbar { width: 9px; }
.search-results::-webkit-scrollbar-track {
  background: rgba(255,255,255,.05);
  border-radius: 999px;
}
.search-results::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--blue), var(--cyan));
  border-radius: 999px;
  border: 2px solid rgba(5,16,38,.85);
}
.search-item {
  min-height: 58px;
  border-radius: 18px;
  padding: 9px 10px;
  background:
    radial-gradient(circle at 0 50%, rgba(102,217,255,.10), transparent 35%),
    rgba(255,255,255,.075);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.search-item:hover {
  transform: translateX(2px);
  border-color: rgba(102,217,255,.34);
  background:
    radial-gradient(circle at 0 50%, rgba(102,217,255,.16), transparent 38%),
    rgba(255,255,255,.10);
}
.search-item b {
  font-size: 13.5px;
  letter-spacing: -.02em;
}
.search-item small {
  font-size: 11px;
}
.add-badge {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(102,217,255,.14);
}
.selected-panel {
  min-height: 56px;
  background: rgba(255,255,255,.055);
}
.selected-list {
  justify-content: flex-start;
  gap: 9px;
}
.selected-empty {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 10px;
}
.selected-chip.stake-token {
  border-radius: 18px;
  padding: 7px 9px 7px 7px;
  background: linear-gradient(135deg, rgba(20,140,255,.20), rgba(255,255,255,.055));
  max-width: 280px;
  min-height: 50px;
  box-shadow: 0 8px 20px rgba(0,0,0,.16);
}
.selected-chip.stake-token.new {
  animation: tokenPop .32s cubic-bezier(.18,.92,.18,1.2);
}
@keyframes tokenPop {
  from { transform: scale(.88) translateY(4px); opacity: .3; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.selected-chip.stake-token img {
  width: 46px;
  height: 34px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(0,0,0,.20);
}
.selected-chip.stake-token span {
  display: grid;
  gap: 2px;
}
.selected-chip.stake-token b {
  display: block;
  font-size: 12px;
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selected-chip.stake-token small {
  color: var(--cyan);
  font-size: 10px;
}

/* online menu: atmospheric cards, no side labels, no chat on menu */
.online-choice {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 18%, rgba(102,217,255,.12), transparent 34%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='115' height='115' viewBox='0 0 115 115'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.12)' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M20 35h32v20H34l-9 8v-8h-5z'/%3E%3Crect x='72' y='18' width='22' height='38' rx='7'/%3E%3Cpath d='M20 82c12-10 38-10 58-4l9 8H14z'/%3E%3Ccircle cx='32' cy='88' r='4'/%3E%3Ccircle cx='70' cy='88' r='4'/%3E%3C/g%3E%3C/svg%3E"),
    var(--panel);
  background-size: auto, 115px 115px, auto;
}
.online-choice::after {
  content: "";
  position: absolute;
  inset: auto 14px 14px 14px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(102,217,255,.65), transparent);
  opacity: .6;
}
.online-choice small { display: none !important; }
.online-minigames { display: none !important; }
.chat-fab, .chat-panel { display: none !important; }

/* stronger loader */
.loading-overlay {
  background: rgba(1, 7, 18, .76) !important;
}
.loader-card-roulette {
  transform: translateY(-2vh);
}

/* mobile */
@media (max-width: 720px) {
  body.custom-logo-ready .drift-logo {
    min-height: 260px;
    width: min(96vw, 390px);
  }
  .custom-drift-logo {
    width: min(96vw, 390px);
    height: min(60vw, 280px);
  }
  .settings-stats-mini.stats-f014 {
    grid-template-columns: 1fr;
  }
  .stat-glow-card {
    min-height: 60px;
  }
  .stat-glow-card b {
    font-size: 24px;
  }
  .offline-layout {
    grid-template-columns: 1fr !important;
  }
  .stake-zone {
    order: -1;
  }
  .stake-summary {
    grid-template-columns: 1fr auto;
  }
  .prize-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .prize-card {
    min-height: 174px !important;
  }
  .prize-title {
    font-size: 9.5px;
  }
  .prize-action-panel {
    grid-template-columns: 1fr;
  }
  .prize-action-buttons {
    justify-content: stretch;
  }
  .prize-action-buttons .soft-action {
    flex: 1;
  }
  .search-results {
    max-height: 270px;
  }
  .online-actions {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 390px) {
  .prize-card {
    min-height: 158px !important;
  }
  .prize-chance b { font-size: 17px !important; }
  .search-results { max-height: 235px; }
}

/* ==============================
   F0.1.5 HOME SCREEN REFINEMENT
   ============================== */
:root {
  --home-btn-width: min(100%, 348px);
  --home-btn-height: clamp(58px, 7.2vh, 72px);
  --home-btn-radius: 18px;
}

.app-shell {
  padding-top: max(16px, calc(env(safe-area-inset-top) + 12px));
  padding-right: max(18px, calc(env(safe-area-inset-right) + 18px));
  padding-bottom: max(26px, calc(env(safe-area-inset-bottom) + 22px));
  padding-left: max(18px, calc(env(safe-area-inset-left) + 18px));
}

.home-screen {
  min-height: calc(100dvh - 52px);
  justify-content: center;
  gap: clamp(22px, 3.2vh, 34px);
}

.home-screen .hero {
  width: min(100%, 520px);
  margin-inline: auto;
  gap: clamp(18px, 2.8vh, 30px);
  align-items: center;
}

.hero-graphic {
  width: 100%;
  display: flex;
  justify-content: center;
}

.drift-logo {
  width: min(100%, 432px);
  justify-content: center;
  align-items: center;
  margin-inline: auto;
  padding-inline: 10px;
}

.custom-drift-logo {
  width: min(100%, 396px);
  aspect-ratio: 1.08 / 1;
  margin-inline: auto;
  filter: drop-shadow(0 0 24px rgba(34, 150, 255, 0.22));
}

.logo-word {
  letter-spacing: -0.06em;
  text-align: center;
}

.logo-word-top,
.logo-word-bottom {
  left: 50%;
  transform: translateX(-50%) skewX(-9deg);
}

.logo-word-top {
  top: 14%;
}

.logo-word-bottom {
  bottom: 12%;
}

.logo-car {
  width: 74%;
  height: 40%;
  left: 50%;
  top: 31%;
  transform: translateX(-50%);
}

.logo-smoke {
  left: 11%;
  bottom: 24%;
  transform: scale(0.9);
  opacity: 0.96;
}

.logo-shadow {
  width: 56%;
  left: 50%;
  transform: translateX(-50%);
}

.home-actions {
  width: 100%;
  max-width: 360px;
  margin-inline: auto;
  gap: 14px;
}

.home-actions .game-menu-button {
  width: var(--home-btn-width);
  min-height: var(--home-btn-height);
  padding: 0 18px;
  border-radius: var(--home-btn-radius);
  border: 1px solid rgba(124, 190, 255, 0.38);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(37, 84, 148, 0.94), rgba(18, 37, 71, 0.98)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
  box-shadow:
    0 16px 32px rgba(0, 14, 38, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}

.home-actions .game-menu-button::before {
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255,255,255,0.24), rgba(255,255,255,0.05) 36%, rgba(255,255,255,0) 65%);
  opacity: 0.7;
  transform: translateX(-118%);
}

.home-actions .game-menu-button::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--home-btn-radius) - 1px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.home-actions .game-menu-button.primary {
  background:
    linear-gradient(90deg, rgba(31, 135, 255, 0.98), rgba(57, 217, 255, 0.98)),
    linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0));
  border-color: rgba(152, 230, 255, 0.48);
  box-shadow:
    0 20px 36px rgba(0, 88, 194, 0.28),
    0 0 0 1px rgba(105, 206, 255, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.18);
}

.home-actions .game-menu-button.ghost {
  background:
    linear-gradient(180deg, rgba(42, 79, 130, 0.88), rgba(20, 35, 63, 0.96)),
    linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0));
}

.home-actions .game-menu-button:hover,
.home-actions .game-menu-button:focus-visible {
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    0 20px 38px rgba(0, 16, 42, 0.4),
    0 0 0 1px rgba(105, 206, 255, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.28);
}

.home-actions .game-menu-button:hover::before,
.home-actions .game-menu-button:focus-visible::before {
  transform: translateX(118%);
}

.home-actions .game-menu-button:active {
  transform: translateY(0) scale(0.992);
}

.home-actions .menu-label {
  font-size: clamp(15px, 1.7vw, 18px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(0,0,0,.28);
}

@media (max-width: 768px) {
  .home-screen {
    min-height: calc(100dvh - 24px);
  }

  .home-screen .hero {
    width: min(100%, 440px);
  }

  .drift-logo {
    width: min(100%, 360px);
    padding-inline: 0;
  }

  .custom-drift-logo {
    width: min(100%, 340px);
  }

  .logo-word {
    font-size: clamp(50px, 16vw, 78px);
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding-right: max(12px, calc(env(safe-area-inset-right) + 12px));
    padding-left: max(12px, calc(env(safe-area-inset-left) + 12px));
    padding-bottom: max(18px, calc(env(safe-area-inset-bottom) + 18px));
  }

  .home-screen {
    gap: 20px;
  }

  .home-screen .hero {
    gap: 20px;
  }

  .drift-logo {
    width: min(100%, 330px);
  }

  .custom-drift-logo {
    width: min(100%, 312px);
  }

  .logo-word {
    font-size: clamp(44px, 15vw, 66px);
    text-shadow:
      -2px -2px 0 #06122d,
      2px -2px 0 #06122d,
      -2px 2px 0 #06122d,
      2px 2px 0 #06122d,
      0 8px 0 rgba(0,0,0,.16),
      0 14px 28px rgba(0,0,0,.26);
  }

  .logo-word-top {
    top: 15%;
  }

  .logo-word-bottom {
    bottom: 13%;
  }

  .logo-car {
    width: 78%;
    top: 31.5%;
  }

  .logo-smoke {
    left: 8%;
    bottom: 23.5%;
    transform: scale(0.82);
  }

  .home-actions {
    max-width: 100%;
    gap: 12px;
  }

  .home-actions .game-menu-button {
    width: 100%;
    min-height: 56px;
    border-radius: 16px;
  }

  .home-actions .menu-label {
    font-size: 14px;
    letter-spacing: 0.07em;
  }
}

@media (max-width: 360px) {
  .custom-drift-logo {
    width: min(100%, 286px);
  }

  .logo-word {
    font-size: clamp(40px, 14.5vw, 58px);
  }

  .home-actions .game-menu-button {
    min-height: 54px;
    padding-inline: 14px;
  }
}


/* =====================================================
   F0.1.6 FIXED: applied on top of working F0.1.5
   ===================================================== */
body.text-switching main, body.theme-switching main { opacity: .35; filter: blur(8px) saturate(.8); transform: translateY(4px); transition: opacity .16s ease, filter .16s ease, transform .16s ease; }
body.text-switched main, body.theme-switched main { animation: uiReenter .36s cubic-bezier(.16,.9,.18,1.1); }
@keyframes uiReenter { from { opacity: .25; filter: blur(8px); transform: translateY(10px) scale(.992); } to { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); } }

.segmented { gap: 6px; }
.segmented button { transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.segmented button:hover { transform: translateY(-1px); }
.setting-tile { overflow: hidden; }
.toggle-pill { width: min(100%, 190px); justify-self: end; }
.toggle-pill::after { content: ""; position: absolute; inset: -30%; background: radial-gradient(circle at 30% 50%, rgba(86,210,255,.22), transparent 32%); opacity: .55; pointer-events: none; }

/* Kennyotsu-style loader */
.loading-overlay { background: radial-gradient(circle at 50% 45%, rgba(42,160,255,.18), transparent 32%), rgba(2,8,22,.72) !important; backdrop-filter: blur(9px); }
.alpinka-loader-card { --bg-color: rgba(7,13,31,.96); background: linear-gradient(135deg, rgba(20,44,82,.95), rgba(7,13,31,.98)); padding: 1rem 1.55rem; border-radius: 1.25rem; border: 1px solid rgba(102,217,255,.24); box-shadow: 0 28px 90px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.035), 0 0 38px rgba(74,200,255,.16); opacity: 0; transform: scale(.92) translateY(8px); animation: loaderIn .24s cubic-bezier(.16,.92,.18,1.18) forwards; }
.alpinka-loader { color: rgba(220,235,255,.68); font-weight: 900; font-size: clamp(21px, 2.2vw, 30px); line-height: 40px; height: 40px; padding: 10px 8px; display: flex; align-items: center; border-radius: 12px; letter-spacing: -.02em; }
.alpinka-loader p { margin: 0; }
.loader-words { overflow: hidden; position: relative; height: 40px; margin-left: 9px; min-width: 178px; }
.loader-words::after { content:""; position:absolute; inset:0; background:linear-gradient(var(--bg-color) 5%, transparent 30%, transparent 70%, var(--bg-color) 95%); z-index:2; pointer-events:none; }
.loader-word-spin { display:block; height:40px; color:#5fe0ff; text-shadow:0 0 18px rgba(95,224,255,.35); animation: alpinkaWordSpin 3.7s infinite; will-change:transform; }
@keyframes alpinkaWordSpin { 10%{transform:translateY(-102%)}25%{transform:translateY(-100%)}35%{transform:translateY(-202%)}50%{transform:translateY(-200%)}60%{transform:translateY(-302%)}75%{transform:translateY(-300%)}85%{transform:translateY(-402%)}100%{transform:translateY(-400%)} }
@keyframes loaderIn { to { opacity:1; transform:scale(1) translateY(0); filter:blur(0); } }
.loader-card, .loader-word, .loader-line, .loader-roulette { display: none !important; }

/* Offline cards / chance */
.prize-card img { object-fit: contain !important; background: #f6f8fc; border-radius: 10px; }
.prize-card.selected { border-color: rgba(95,224,255,.82); box-shadow: 0 0 0 1px rgba(95,224,255,.2), 0 22px 40px rgba(0,125,255,.20); }
.prize-title { font-size: 10px; line-height: 1.05; opacity: .78; max-height: 22px; overflow: hidden; }
.prize-chance b { transition: transform .25s ease, color .25s ease; }
.prize-chance b.counter-flip, #stakeCounterMirror.counter-flip { animation: counterFlip .3s cubic-bezier(.18,.92,.18,1.16); }
@keyframes counterFlip { 0% { transform: translateY(12px) rotateX(80deg); opacity:.25; filter:blur(3px); } 100% { transform: translateY(0) rotateX(0); opacity:1; filter:blur(0); } }
.stake-zone .zone-head > span { display: none; }
.stake-target-summary small { color: rgba(210,230,255,.55); }
.prize-action-panel { grid-template-columns: 1fr auto; align-items: center; }
.prize-action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.prize-action-buttons .swap-option.hidden { display:none !important; }
.prize-action-panel.swap-open .swap-option { display:inline-flex !important; }
.spin-fifty-button { width: 100%; min-height: 54px; margin-top: 12px; border: 0; border-radius: 18px; background: linear-gradient(135deg, #1f87ff, #45d9ff); color: white; font-weight: 1000; letter-spacing: .02em; box-shadow: 0 16px 38px rgba(15,135,255,.28), inset 0 0 0 1px rgba(255,255,255,.18); transition: transform .18s ease, box-shadow .18s ease; }
.spin-fifty-button:hover { transform: translateY(-2px); box-shadow: 0 22px 48px rgba(15,135,255,.34), inset 0 0 0 1px rgba(255,255,255,.24); }
.spin-fifty-button:active { transform: translateY(1px) scale(.99); }

/* Cosmic search */
.search-box { display: none !important; }
.cosmic-search { width:100%; min-height:64px; position:relative; display:flex; align-items:center; justify-content:center; isolation:isolate; margin: 12px 0; }
.nebula,.starfield,.stardust,.cosmic-ring { position:absolute; inset:0; border-radius:18px; overflow:hidden; pointer-events:none; z-index:-1; }
.nebula { filter:blur(26px); opacity:.36; inset:-20px; }
.nebula::before,.starfield::before,.stardust::before,.cosmic-ring::before { content:""; position:absolute; width:760px; height:760px; top:50%; left:50%; transform:translate(-50%,-50%) rotate(70deg); transition:transform 2.2s ease; }
.nebula::before { background-image:conic-gradient(#000,#246dff 5%,#000 38%,#000 50%,#62e1ff 60%,#000 87%); }
.starfield::before { background-image:conic-gradient(transparent,#1c7cff,transparent 10%,transparent 50%,#2aebff,transparent 60%); opacity:.45; }
.stardust::before { background-image:conic-gradient(transparent 0%,#4d9dff,transparent 8%,transparent 50%,#6ee8ff,transparent 58%); filter:brightness(1.35); }
.cosmic-ring::before { background-image:conic-gradient(#05071b,#4d9dff 5%,#05071b 14%,#05071b 50%,#6ee8ff 60%,#05071b 64%); }
.cosmic-search:hover .starfield::before,.cosmic-search:hover .nebula::before,.cosmic-search:hover .stardust::before,.cosmic-search:hover .cosmic-ring::before { transform:translate(-50%,-50%) rotate(-110deg); }
.cosmic-search:focus-within .starfield::before,.cosmic-search:focus-within .nebula::before,.cosmic-search:focus-within .stardust::before,.cosmic-search:focus-within .cosmic-ring::before { transform:translate(-50%,-50%) rotate(430deg); transition-duration:4s; }
.cosmic-main { width:100%; position:relative; }
.cosmic-input { width:100%; height:58px; border:1px solid rgba(102,217,255,.18); border-radius:18px; background:#05071b; color:#cfe4ff; padding:0 20px 0 58px; font-size:16px; font-weight:800; outline:none; box-shadow:inset 0 0 0 1px rgba(255,255,255,.035),0 10px 28px rgba(0,0,0,.18); }
.cosmic-input::placeholder { color:#6e8cff; opacity:.9; }
.input-mask { position:absolute; pointer-events:none; width:120px; height:24px; top:17px; left:58px; background:linear-gradient(90deg,transparent,#05071b); }
.cosmic-glow { position:absolute; pointer-events:none; width:34px; height:20px; top:13px; left:10px; background:#4d9dff; filter:blur(20px); opacity:.78; transition:opacity .7s ease; }
.cosmic-search:hover .cosmic-glow { opacity:.2; }
.cosmic-search-icon { position:absolute; left:20px; top:16px; transform:scaleX(-1); opacity:.95; color:#8be8ff; font-size:22px; z-index:2; }
.cosmic-input:focus { border-color:rgba(102,217,255,.50); }

.search-item { grid-template-columns: 48px minmax(0,1fr) auto auto 38px; gap: 8px; }
.search-card-main { min-width: 0; }
.copy-status { min-width:38px; color:rgba(207,228,255,.74); font-size:11px; font-weight:1000; text-align:center; padding:5px 7px; border-radius:999px; background:rgba(255,255,255,.055); }
.chance-add { min-width:58px; color:#5fe0ff; font-size:11px; font-weight:1000; text-align:right; }
.add-badge.minus { background: rgba(238,78,113,.20); color: rgba(255,210,220,.95); opacity:.76; }
.selected-list.has-cards { min-height: 128px; display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content:start; }
.selected-chip.stake-token { max-width: none; }
.selected-more { min-height:50px; border:1px solid rgba(102,217,255,.22); border-radius:18px; color:#5fe0ff; font-weight:1000; background:rgba(20,140,255,.12); }
.stake-deck-card { max-width: 680px; }
.stake-deck-full { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; max-height:min(65vh,560px); overflow:auto; }
.stake-full-card { display:grid; grid-template-columns:110px 1fr 34px; gap:12px; align-items:center; padding:10px; border-radius:18px; border:1px solid rgba(102,217,255,.16); background:rgba(255,255,255,.055); }
.stake-full-card img { width:110px; height:78px; object-fit:contain; border-radius:12px; background:rgba(255,255,255,.08); }
.stake-full-card b { display:block; color:var(--text); font-size:14px; margin-bottom:4px; }
.stake-full-card span,.stake-full-card small { display:block; color:var(--muted); font-weight:800; }
.stake-full-card small { color:#5fe0ff; }
.stake-full-card button { border:0; width:30px; height:30px; border-radius:999px; color:#fff; background:rgba(238,78,113,.86); }

/* Online screen */
.online-screen::before { content:""; position:absolute; inset:0; background-image: radial-gradient(circle at 20% 30%, rgba(64,180,255,.13), transparent 28%), radial-gradient(circle at 80% 15%, rgba(113,101,255,.14), transparent 32%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='110' viewBox='0 0 170 110'%3E%3Cg fill='none' stroke='rgba(128,190,255,0.13)' stroke-width='2'%3E%3Cpath d='M18 30h30v20H30l-12 9V50H18zM98 18h32v40H98zM55 70c20-15 58-15 84 0M64 73h62M32 82h32v16H32zM82 82h32v16H82zM142 80h16v16h-16z'/%3E%3C/g%3E%3C/svg%3E"); background-size:auto, auto, 170px 110px; pointer-events:none; opacity:.9; }
.online-actions { gap:16px; position:relative; z-index:1; }
.online-choice { min-height:150px; background: radial-gradient(circle at 20% 20%, rgba(102,217,255,.12), transparent 34%), linear-gradient(135deg, rgba(13,36,73,.72), rgba(7,13,33,.94)); transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; }
.online-choice:hover { transform:translateY(-4px); border-color:rgba(102,217,255,.42); box-shadow:0 20px 44px rgba(0,90,220,.18); }
.room-panel { border:1px solid rgba(102,217,255,.18); border-radius:22px; background:rgba(255,255,255,.055); box-shadow:0 18px 52px rgba(0,0,0,.20); }
.room-panel input { border:2px solid transparent; height:48px; padding:0 14px; outline:none; overflow:hidden; background-color:rgba(243,243,243,.12); color:var(--text); border-radius:14px; transition:all .35s ease; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.room-panel input:hover,.room-panel input:focus { border-color:#4A9DEC; box-shadow:0 0 0 7px rgba(74,157,236,.18); background-color:rgba(255,255,255,.10); }

:root[data-theme="light"] .cosmic-input { color:#061633; background:rgba(255,255,255,.84); }
:root[data-theme="light"] .input-mask { background:linear-gradient(90deg,transparent,rgba(255,255,255,.9)); }
:root[data-theme="light"] .room-panel input { color:#061633; background-color:rgba(255,255,255,.72); }
:root[data-theme="light"] .prize-card img { background:#fff; }

@media (max-width: 760px) {
  .alpinka-loader { font-size:20px; }
  .loader-words { min-width:136px; }
  .search-item { grid-template-columns:44px 1fr 38px; }
  .chance-add { display:none; }
  .copy-status { grid-column:2; justify-self:start; }
  .add-badge { grid-column:3; grid-row:1 / span 2; }
  .selected-list.has-cards { grid-template-columns:1fr; }
  .stake-deck-full { grid-template-columns:1fr; }
  .spin-fifty-button { min-height: 52px; }
  .online-choice { min-height:118px; }
}


/* =====================================================
   F0.1.7 MENU ANIMATION: code-based logo reveal + clean home controls
   Scope: home screen only. Offline/online mechanics are not changed here.
   ===================================================== */

.home-screen {
  position: relative;
  overflow: hidden;
}

.home-screen::before {
  content: "";
  position: absolute;
  inset: -22%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(99, 220, 255, .14), transparent 26%),
    radial-gradient(circle at 20% 62%, rgba(24, 118, 255, .12), transparent 32%),
    radial-gradient(circle at 82% 40%, rgba(114, 64, 255, .10), transparent 30%);
  opacity: .72;
  transform: translate3d(0,0,0);
  animation: homeAuroraDrift 12s ease-in-out infinite alternate;
}

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

@keyframes homeAuroraDrift {
  from { transform: translate3d(-1.4%, -1.2%, 0) scale(1); filter: saturate(.95); }
  to { transform: translate3d(1.6%, 1%, 0) scale(1.03); filter: saturate(1.12); }
}

.home-corner-actions {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 14px));
  right: max(14px, calc(env(safe-area-inset-right) + 14px));
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
}

.corner-icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 210, 255, .30);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(23, 50, 88, .84), rgba(7, 15, 34, .88)),
    radial-gradient(circle at 35% 20%, rgba(95, 224, 255, .18), transparent 40%);
  box-shadow:
    0 18px 38px rgba(0, 10, 32, .28),
    inset 0 1px 0 rgba(255,255,255,.16),
    inset 0 -1px 0 rgba(0,0,0,.25);
  color: #d9f4ff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform: translate3d(0,0,0);
  transition: transform .22s cubic-bezier(.18,.9,.2,1.18), box-shadow .22s ease, border-color .22s ease, background .22s ease;
}

.corner-icon-btn svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
  filter: drop-shadow(0 0 12px rgba(95,224,255,.25));
  transition: transform .28s cubic-bezier(.18,.9,.2,1.18), color .22s ease;
}

.corner-icon-btn:hover,
.corner-icon-btn:focus-visible {
  transform: translateY(-2px) scale(1.035);
  border-color: rgba(119, 226, 255, .58);
  box-shadow:
    0 22px 44px rgba(0, 16, 42, .36),
    0 0 0 1px rgba(95, 224, 255, .10),
    0 0 32px rgba(38, 162, 255, .16),
    inset 0 1px 0 rgba(255,255,255,.20);
}

.settings-icon-btn:hover svg,
.settings-icon-btn:focus-visible svg {
  transform: rotate(38deg) scale(1.06);
  color: #65deff;
}

.exit-icon-btn:hover,
.exit-icon-btn:focus-visible {
  border-color: rgba(255, 112, 143, .38);
}

.exit-icon-btn:hover svg,
.exit-icon-btn:focus-visible svg {
  transform: translateX(2px) scale(1.06);
  color: #ffd7df;
}

.corner-icon-btn:active {
  transform: translateY(0) scale(.94);
}

/* Logo slices: works when the user adds /static/assets/fifty_fifty_logo.png */
.custom-drift-logo {
  position: relative;
  background-image: none !important;
  isolation: isolate;
  overflow: visible;
  transform: translate3d(0,0,0);
  will-change: transform, filter, opacity;
}

.logo-slice {
  position: absolute;
  inset: 0;
  background-image: var(--logo-url);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  transform: translate3d(0,0,0);
  will-change: transform, opacity, filter;
  pointer-events: none;
}

.logo-slice-top {
  clip-path: inset(0 0 54% 0);
}

.logo-slice-car {
  clip-path: inset(22% 0 25% 0);
}

.logo-slice-bottom {
  clip-path: inset(50% 0 0 0);
}

.home-screen.home-reveal .drift-logo {
  animation: logoWholeSettle 1.05s cubic-bezier(.14,.9,.18,1.04) both;
}

.home-screen.home-reveal .custom-drift-logo {
  animation: customLogoGlowSettle 1.08s cubic-bezier(.16,.9,.18,1.06) both;
}

.home-screen.home-reveal .logo-slice-top {
  animation: logoTopReveal .62s cubic-bezier(.14,.86,.18,1.12) .08s both;
}

.home-screen.home-reveal .logo-slice-car {
  animation: logoCarReveal .72s cubic-bezier(.12,.88,.18,1.06) .20s both;
}

.home-screen.home-reveal .logo-slice-bottom {
  animation: logoBottomReveal .62s cubic-bezier(.14,.86,.18,1.12) .36s both;
}

@keyframes logoTopReveal {
  0% { opacity: 0; transform: translate3d(0,-18px,0) scale(.965); filter: blur(14px) saturate(.85); }
  58% { opacity: 1; transform: translate3d(0,3px,0) scale(1.018); filter: blur(1px) saturate(1.12); }
  100% { opacity: 1; transform: translate3d(0,0,0) scale(1); filter: blur(0) saturate(1); }
}

@keyframes logoCarReveal {
  0% { opacity: 0; transform: translate3d(42px,8px,0) scale(.955) rotate(-1.2deg); filter: blur(16px) saturate(.76); }
  50% { opacity: 1; transform: translate3d(-6px,0,0) scale(1.018) rotate(.25deg); filter: blur(1.5px) saturate(1.16); }
  100% { opacity: 1; transform: translate3d(0,0,0) scale(1) rotate(0deg); filter: blur(0) saturate(1); }
}

@keyframes logoBottomReveal {
  0% { opacity: 0; transform: translate3d(0,20px,0) scale(.965); filter: blur(14px) saturate(.85); }
  58% { opacity: 1; transform: translate3d(0,-3px,0) scale(1.018); filter: blur(1px) saturate(1.12); }
  100% { opacity: 1; transform: translate3d(0,0,0) scale(1); filter: blur(0) saturate(1); }
}

@keyframes customLogoGlowSettle {
  0% { opacity: .01; filter: drop-shadow(0 0 0 rgba(99,220,255,0)) blur(10px); transform: translate3d(0,10px,0) scale(.92); }
  42% { opacity: 1; filter: drop-shadow(0 28px 52px rgba(0,0,0,.30)) drop-shadow(0 0 30px rgba(99,220,255,.24)) blur(0); transform: translate3d(0,-2px,0) scale(1.025); }
  100% { opacity: 1; filter: drop-shadow(0 24px 44px rgba(0,0,0,.32)) drop-shadow(0 0 22px rgba(102,217,255,.16)); transform: translate3d(0,0,0) scale(1); }
}

@keyframes logoWholeSettle {
  0% { opacity: .08; transform: translate3d(0,12px,0) scale(.94); }
  55% { opacity: 1; transform: translate3d(0,-2px,0) scale(1.018); }
  100% { opacity: 1; transform: translate3d(0,0,0) scale(1); }
}

/* Fallback generated logo: animated in the same order when no PNG logo exists */
.home-screen.home-reveal:not(.custom-logo-ready) .logo-word-top,
body:not(.custom-logo-ready) .home-screen.home-reveal .logo-word-top {
  animation: logoTopReveal .62s cubic-bezier(.14,.86,.18,1.12) .08s both;
}

.home-screen.home-reveal:not(.custom-logo-ready) .logo-car,
body:not(.custom-logo-ready) .home-screen.home-reveal .logo-car {
  animation: logoCarReveal .72s cubic-bezier(.12,.88,.18,1.06) .20s both;
}

.home-screen.home-reveal:not(.custom-logo-ready) .logo-word-bottom,
body:not(.custom-logo-ready) .home-screen.home-reveal .logo-word-bottom {
  animation: logoBottomReveal .62s cubic-bezier(.14,.86,.18,1.12) .36s both;
}

/* Cleaner home layout: logo + one strong start button + icon controls */
.home-screen .hero {
  margin-top: clamp(10px, 3.6vh, 42px);
}

body.custom-logo-ready .drift-logo {
  min-height: clamp(245px, 38vw, 390px);
  margin-bottom: clamp(2px, 1vh, 10px);
}

body.custom-logo-ready .custom-drift-logo {
  width: min(94vw, 610px);
  height: min(52vw, 390px);
  max-height: 390px;
}

.home-actions {
  max-width: 430px;
  margin-top: clamp(0px, 1.2vh, 14px);
  perspective: 1000px;
}

.home-actions .game-menu-button.phantom-start {
  position: relative;
  width: min(100%, 390px);
  min-height: clamp(66px, 8.8vh, 82px);
  padding: 0 26px;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent !important;
  box-shadow: none !important;
  transform-style: preserve-3d;
  isolation: isolate;
  text-shadow: none;
  color: #f7fbff;
}

.home-actions .game-menu-button.phantom-start::before,
.home-actions .game-menu-button.phantom-start::after {
  display: none !important;
}

.phantom-stack,
.phantom-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-style: preserve-3d;
}

.phantom-stack {
  z-index: 0;
  transition: transform .24s cubic-bezier(.12,.9,.2,1.16);
}

.phantom-layer {
  border-radius: 21px;
  transition:
    transform .28s cubic-bezier(.16,.95,.2,1.22),
    filter .28s ease,
    opacity .28s ease;
}

.phantom-layer.layer-a {
  inset: 8px -8px -8px 8px;
  background: linear-gradient(135deg, rgba(2,8,24,.98), rgba(10,30,70,.96));
  clip-path: polygon(0 0, 96% 0, 100% 18%, 100% 100%, 6% 100%, 0 82%);
  opacity: .96;
}

.phantom-layer.layer-b {
  inset: 3px -3px -3px 3px;
  background: linear-gradient(135deg, rgba(0,119,255,.85), rgba(94,226,255,.82));
  clip-path: polygon(7% 0, 100% 0, 100% 82%, 90% 100%, 0 100%, 0 18%);
  opacity: .84;
  filter: saturate(1.08);
}

.phantom-layer.layer-c {
  inset: 0;
  background:
    linear-gradient(135deg, rgba(20,45,88,.96), rgba(8,18,42,.98)),
    radial-gradient(circle at 28% 15%, rgba(255,255,255,.18), transparent 36%);
  border: 1px solid rgba(146,228,255,.46);
  clip-path: polygon(0 0, 94% 0, 100% 16%, 100% 100%, 5% 100%, 0 84%);
  box-shadow:
    0 20px 44px rgba(0,14,42,.34),
    inset 0 1px 0 rgba(255,255,255,.22),
    inset 0 -1px 0 rgba(0,0,0,.28),
    0 0 0 1px rgba(58,173,255,.12);
}

.phantom-label {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-height: inherit;
  font-weight: 1000;
  font-size: clamp(17px, 2.6vw, 24px);
  letter-spacing: .065em;
  text-transform: uppercase;
  color: #f8fcff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25), 0 0 18px rgba(95,224,255,.22);
}

.phantom-hit {
  position: absolute;
  z-index: 5;
  width: 33.333%;
  height: 33.333%;
  pointer-events: auto;
}

.phantom-hit.p1 { top: 0; left: 0; }
.phantom-hit.p2 { top: 0; left: 33.333%; }
.phantom-hit.p3 { top: 0; right: 0; }
.phantom-hit.p4 { top: 33.333%; left: 0; }
.phantom-hit.p5 { top: 33.333%; left: 33.333%; }
.phantom-hit.p6 { top: 33.333%; right: 0; }
.phantom-hit.p7 { bottom: 0; left: 0; }
.phantom-hit.p8 { bottom: 0; left: 33.333%; }
.phantom-hit.p9 { bottom: 0; right: 0; }

.phantom-start:hover .phantom-stack,
.phantom-start:focus-visible .phantom-stack {
  transform: translate3d(0,-2px,0) scale(1.018);
}

.phantom-start:hover .layer-a,
.phantom-start:focus-visible .layer-a {
  transform: translate3d(-7px, -4px, 0) rotate(-1.1deg);
}

.phantom-start:hover .layer-b,
.phantom-start:focus-visible .layer-b {
  transform: translate3d(8px, 4px, 0) rotate(.9deg);
}

.phantom-start:hover .layer-c,
.phantom-start:focus-visible .layer-c {
  filter: brightness(1.08) saturate(1.1);
  box-shadow:
    0 24px 52px rgba(0,22,58,.38),
    0 0 34px rgba(63,197,255,.16),
    inset 0 1px 0 rgba(255,255,255,.26),
    inset 0 -1px 0 rgba(0,0,0,.26);
}

.phantom-start:hover .stagger-char,
.phantom-start:focus-visible .stagger-char {
  animation: letterButtonPulse .46s cubic-bezier(.2,.85,.2,1.22) both;
  animation-delay: calc(var(--i) * 26ms);
}

@keyframes letterButtonPulse {
  0% { transform: translateY(0) scale(1); filter: blur(0); }
  45% { transform: translateY(-4px) scale(1.08); filter: blur(.2px); }
  100% { transform: translateY(0) scale(1); filter: blur(0); }
}

.phantom-start:active .phantom-stack {
  transform: translate3d(0, 2px, 0) scale(.972) !important;
}

.phantom-start:active .layer-a,
.phantom-start:active .layer-b {
  transform: translate3d(0,0,0) rotate(0deg) !important;
}

/* Home entrance for the button and corner controls */
.home-screen.home-reveal .phantom-start {
  animation: startButtonReveal .58s cubic-bezier(.14,.86,.18,1.15) .72s both;
}

.home-screen.home-reveal .home-corner-actions {
  animation: cornerControlsReveal .42s cubic-bezier(.14,.86,.18,1.12) .58s both;
}

@keyframes startButtonReveal {
  0% { opacity: 0; transform: translate3d(0,18px,0) scale(.94); filter: blur(8px); }
  70% { opacity: 1; transform: translate3d(0,-3px,0) scale(1.018); filter: blur(0); }
  100% { opacity: 1; transform: translate3d(0,0,0) scale(1); filter: blur(0); }
}

@keyframes cornerControlsReveal {
  0% { opacity: 0; transform: translate3d(12px,-8px,0) scale(.9); filter: blur(8px); }
  100% { opacity: 1; transform: translate3d(0,0,0) scale(1); filter: blur(0); }
}

/* Parallax zones, softened so it does not look nervous */
.phantom-start:has(.p1:hover) .phantom-stack { transform: rotateX(7deg) rotateY(-7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p2:hover) .phantom-stack { transform: rotateX(7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p3:hover) .phantom-stack { transform: rotateX(7deg) rotateY(7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p4:hover) .phantom-stack { transform: rotateY(-7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p5:hover) .phantom-stack { transform: translateY(-2px) scale(1.02); }
.phantom-start:has(.p6:hover) .phantom-stack { transform: rotateY(7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p7:hover) .phantom-stack { transform: rotateX(-7deg) rotateY(-7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p8:hover) .phantom-stack { transform: rotateX(-7deg) translateY(-2px) scale(1.012); }
.phantom-start:has(.p9:hover) .phantom-stack { transform: rotateX(-7deg) rotateY(7deg) translateY(-2px) scale(1.012); }

@media (max-width: 620px) {
  .home-corner-actions {
    top: max(10px, calc(env(safe-area-inset-top) + 10px));
    right: max(10px, calc(env(safe-area-inset-right) + 10px));
    gap: 8px;
  }

  .corner-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 15px;
  }

  .corner-icon-btn svg {
    width: 20px;
    height: 20px;
  }

  body.custom-logo-ready .drift-logo {
    min-height: clamp(210px, 64vw, 310px);
    margin-top: 8px;
  }

  body.custom-logo-ready .custom-drift-logo {
    width: min(96vw, 360px);
    height: min(64vw, 270px);
  }

  .home-screen {
    justify-content: center;
    gap: 14px;
  }

  .home-actions {
    max-width: min(94vw, 360px);
  }

  .home-actions .game-menu-button.phantom-start {
    width: 100%;
    min-height: 66px;
  }

  .phantom-label {
    font-size: 16px;
    letter-spacing: .055em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-screen::before,
  .home-screen.home-reveal .drift-logo,
  .home-screen.home-reveal .custom-drift-logo,
  .home-screen.home-reveal .logo-slice-top,
  .home-screen.home-reveal .logo-slice-car,
  .home-screen.home-reveal .logo-slice-bottom,
  .home-screen.home-reveal .phantom-start,
  .home-screen.home-reveal .home-corner-actions {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* =====================================================
   F0.1.8 SETTINGS GAME POLISH — one bug, one clean patch
   Scope: settings/stat cards/toggles/buttons/touch feedback only.
   Does not touch offline logic, online logic, search, prize math or bot API.
   ===================================================== */
#screen-settings .settings-shell {
  background:
    radial-gradient(circle at 18% 16%, rgba(88, 210, 255, .115), transparent 34%),
    radial-gradient(circle at 82% 78%, rgba(74, 117, 255, .075), transparent 36%),
    linear-gradient(152deg, rgba(11, 27, 58, .94), rgba(7, 16, 38, .965) 62%, rgba(5, 12, 28, .98));
  border: 1px solid rgba(111, 205, 255, .22);
  box-shadow: 0 28px 70px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.095), inset 0 -1px 0 rgba(15,120,255,.10);
  backdrop-filter: blur(14px) saturate(1.08);
  isolation: isolate;
}
#screen-settings .settings-shell::before { display: none !important; }
#screen-settings .settings-stats-mini.stats-f014 { gap: 12px; }
#screen-settings .stat-glow-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 86px;
  border-radius: 24px;
  padding: 15px 16px;
  background: linear-gradient(160deg, rgba(28,48,82,.96), rgba(18,32,60,.97) 54%, rgba(13,25,48,.98)) !important;
  border: 1px solid rgba(142,220,255,.20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(0,0,0,.22), 0 14px 32px rgba(0,0,0,.18), 0 0 0 1px rgba(52,170,255,.055);
  transform: translate3d(0,0,0);
  will-change: transform, box-shadow, border-color;
  transition: transform .18s cubic-bezier(.16,.95,.26,1.18), box-shadow .22s ease, border-color .22s ease, filter .22s ease;
}
#screen-settings .stat-glow-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, rgba(255,255,255,.095), transparent 34%, transparent 68%, rgba(82,178,255,.045)), radial-gradient(circle at 15% 10%, rgba(96,223,255,.16), transparent 38%);
  opacity: .76;
  pointer-events: none;
}
#screen-settings .stat-glow-card::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 9px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(102,217,255,.55), transparent);
  opacity: .18;
  pointer-events: none;
}
#screen-settings .stat-glow-card:active { transform: translate3d(0,2px,0) scale(.986); filter: brightness(1.06); }
@media (hover:hover) {
  #screen-settings .stat-glow-card:hover {
    transform: translate3d(0,-2px,0) scale(1.006);
    border-color: rgba(102,217,255,.36);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 -1px 0 rgba(0,0,0,.22), 0 18px 42px rgba(0,0,0,.22), 0 0 24px rgba(67,191,255,.10);
  }
}
#screen-settings .stat-glow-card small { color: #6ee5ff; text-shadow: 0 0 14px rgba(110,229,255,.18); }
#screen-settings .stat-glow-card b { color: #f7fbff; text-shadow: 0 2px 0 rgba(0,0,0,.15), 0 0 18px rgba(87,205,255,.08); }
#screen-settings .stat-glow-card p { color: rgba(239,248,255,.66); }
#screen-settings .setting-tile {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 26px;
  padding: 16px;
  background: radial-gradient(circle at 12% 0%, rgba(102,217,255,.10), transparent 38%), linear-gradient(155deg, rgba(30,48,82,.94), rgba(17,31,58,.96));
  border: 1px solid rgba(142,220,255,.17);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), inset 0 -1px 0 rgba(0,0,0,.20), 0 12px 28px rgba(0,0,0,.12);
}
#screen-settings .setting-tile > span { color: rgba(240,248,255,.70); letter-spacing: .015em; }
#screen-settings .segmented {
  position: relative;
  gap: 7px;
  padding: 6px;
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(3,10,25,.72), rgba(10,20,42,.78));
  border: 1px solid rgba(255,255,255,.055);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.055), inset 0 -10px 22px rgba(0,0,0,.12);
}
#screen-settings .segmented button {
  min-height: 44px;
  border-radius: 15px;
  color: rgba(237,246,255,.62);
  text-shadow: none;
  transition: transform .16s cubic-bezier(.16,.95,.26,1.12), color .18s ease, background .18s ease, box-shadow .18s ease, filter .18s ease;
}
#screen-settings .segmented button.active {
  color: #fff;
  background: radial-gradient(circle at 25% 8%, rgba(255,255,255,.28), transparent 28%), linear-gradient(135deg, #1397ff 0%, #54ddff 100%);
  box-shadow: 0 10px 24px rgba(0,138,255,.24), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(0,0,0,.16);
}
#screen-settings .segmented button:active { transform: scale(.966) translateY(1px); }
@media (hover:hover) {
  #screen-settings .segmented button:not(.active):hover { color: rgba(255,255,255,.86); background: rgba(255,255,255,.055); }
  #screen-settings .segmented button.active:hover { filter: brightness(1.06) saturate(1.08); transform: translateY(-1px); }
}
#screen-settings .toggle-pill {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 50px;
  padding: 6px 12px 6px 6px;
  justify-self: stretch;
  justify-content: flex-start;
  gap: 12px;
  background: linear-gradient(180deg, rgba(3,10,25,.76), rgba(9,18,40,.82));
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -12px 24px rgba(0,0,0,.14);
  transition: transform .16s cubic-bezier(.16,.95,.26,1.15), box-shadow .22s ease, border-color .22s ease, filter .22s ease;
}
#screen-settings .toggle-pill::after { display: none !important; }
#screen-settings .toggle-pill span {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.36), transparent 30%), linear-gradient(135deg, #148cff, #66d9ff);
  box-shadow: 0 0 20px rgba(20,140,255,.35), 0 8px 18px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.30);
  transform: translate3d(0,0,0);
  transition: transform .24s cubic-bezier(.2,1.35,.26,1), background .18s ease, box-shadow .18s ease;
}
#screen-settings .toggle-pill span::before { content: "🔊"; font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 0 rgba(0,0,0,.18)); }
#screen-settings #hintsToggle span::before { content: "?"; font-size: 20px; font-weight: 1000; color: #041228; }
#screen-settings .toggle-pill.off span { background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.18), transparent 30%), linear-gradient(135deg, #3b465b, #111827); box-shadow: 0 8px 18px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.13); }
#screen-settings #soundToggle.off span::before { content: "🔇"; }
#screen-settings #hintsToggle.off span::before { content: "!"; color: rgba(255,255,255,.72); }
#screen-settings .toggle-pill b { font-size: 15px; color: rgba(247,252,255,.90); }
#screen-settings .toggle-pill:active { transform: scale(.975) translateY(1px); }
@media (hover:hover) {
  #screen-settings .toggle-pill:hover { border-color: rgba(102,217,255,.24); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 24px rgba(86,210,255,.10); }
  #screen-settings .toggle-pill:hover span { transform: translate3d(2px,0,0) scale(1.045); }
}
#screen-settings .settings-actions { gap: 12px; margin-top: 16px; }
#screen-settings .galaxy-btn, #screen-settings .soft-action {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  min-height: 52px;
  padding: 14px 22px;
  transform: translate3d(0,0,0);
  transition: transform .16s cubic-bezier(.16,.95,.26,1.18), filter .18s ease, box-shadow .18s ease;
}
#screen-settings .galaxy-btn { background: radial-gradient(circle at 25% 0%, rgba(255,255,255,.24), transparent 32%), linear-gradient(135deg, #0d7df1, #54ddff 68%, #075cad); box-shadow: 0 16px 38px rgba(0,116,255,.22), inset 0 1px 0 rgba(255,255,255,.26), inset 0 -1px 0 rgba(0,0,0,.18); }
#screen-settings .soft-action { background: linear-gradient(135deg, rgba(43,65,104,.92), rgba(23,42,78,.95)); border-color: rgba(142,220,255,.18); box-shadow: 0 14px 32px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.10); }
#screen-settings .galaxy-btn:active, #screen-settings .soft-action:active { transform: scale(.972) translateY(2px); }
@media (hover:hover) { #screen-settings .galaxy-btn:hover, #screen-settings .soft-action:hover { transform: translateY(-2px) scale(1.01); filter: brightness(1.06) saturate(1.08); } }
#screen-settings .back-link, #screen-full-stats .back-link, #screen-leaderboard .back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(14,28,56,.86), rgba(6,14,32,.92));
  border: 1px solid rgba(142,220,255,.18);
  box-shadow: 0 12px 28px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.10);
  transition: transform .16s cubic-bezier(.16,.95,.26,1.12), box-shadow .18s ease, border-color .18s ease;
}
#screen-settings .back-link:active, #screen-full-stats .back-link:active, #screen-leaderboard .back-link:active { transform: scale(.965) translateY(1px); }
@media (hover:hover) { #screen-settings .back-link:hover, #screen-full-stats .back-link:hover, #screen-leaderboard .back-link:hover { transform: translateY(-1px); border-color: rgba(102,217,255,.34); box-shadow: 0 14px 32px rgba(0,0,0,.20), 0 0 20px rgba(86,210,255,.10); } }
:root[data-theme="light"] #screen-settings .settings-shell { background: radial-gradient(circle at 17% 13%, rgba(19,151,255,.12), transparent 36%), radial-gradient(circle at 86% 78%, rgba(102,217,255,.11), transparent 34%), linear-gradient(152deg, rgba(255,255,255,.92), rgba(239,248,255,.94) 62%, rgba(229,244,255,.96)); border-color: rgba(12,95,180,.14); }
:root[data-theme="light"] #screen-settings .stat-glow-card, :root[data-theme="light"] #screen-settings .setting-tile { color: #071633; background: radial-gradient(circle at 15% 5%, rgba(32,172,255,.13), transparent 38%), linear-gradient(155deg, rgba(255,255,255,.94), rgba(235,246,255,.94)) !important; border-color: rgba(12,95,180,.15); box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 12px 30px rgba(20,84,140,.10); }
:root[data-theme="light"] #screen-settings .stat-glow-card b, :root[data-theme="light"] #screen-settings .segmented button, :root[data-theme="light"] #screen-settings .toggle-pill b { color: #071633; }
:root[data-theme="light"] #screen-settings .stat-glow-card p, :root[data-theme="light"] #screen-settings .setting-tile > span { color: rgba(7,22,51,.62); }
:root[data-theme="light"] #screen-settings .segmented, :root[data-theme="light"] #screen-settings .toggle-pill { background: rgba(7,22,51,.075); border-color: rgba(12,95,180,.09); }
:root[data-theme="light"] #screen-settings .soft-action, :root[data-theme="light"] #screen-settings .back-link { color: #071633; background: linear-gradient(145deg, rgba(255,255,255,.92), rgba(229,243,255,.95)); border-color: rgba(12,95,180,.14); }
@media (max-width: 720px) {
  #screen-settings { justify-content: flex-start; padding-top: max(24px, env(safe-area-inset-top)); }
  #screen-settings .settings-shell { width: min(94vw, 560px); padding: 16px; border-radius: 30px; }
  #screen-settings .settings-stats-mini.stats-f014 { grid-template-columns: 1fr; gap: 11px; }
  #screen-settings .stat-glow-card { min-height: 98px; padding: 16px; border-radius: 25px; }
  #screen-settings .stat-glow-card b { font-size: 30px; }
  #screen-settings .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  #screen-settings .setting-tile { min-height: 126px; border-radius: 26px; }
  #screen-settings .segmented button { min-height: 48px; font-size: clamp(15px, 4.2vw, 18px); }
  #screen-settings .toggle-pill { min-height: 54px; }
  #screen-settings .toggle-pill span { width: 42px; height: 42px; }
  #screen-settings .settings-actions { display: grid; grid-template-columns: 1fr; }
  #screen-settings .galaxy-btn, #screen-settings .soft-action { width: min(100%, 360px); justify-self: center; }
}


/* ===============================
   F0.1.9 GAME POLISH PATCH
   =============================== */
:root {
  --game-font: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}
body, button, input {
  font-family: var(--game-font);
}
.app-shell { transition: filter .52s ease, transform .52s ease; }
.app-shell.screen-switching { filter: saturate(1.08); }
.app-shell.screen-switching::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(95,224,255,.08), rgba(0,0,0,.18) 60%, transparent 74%);
  animation: screenBloom .72s ease both;
  z-index: 25;
}
.screen { animation: screenInGame .72s cubic-bezier(.18,.9,.24,1) both; }
.screen.screen-prep { opacity: 0; transform: translateY(18px) scale(.985); }
@keyframes screenInGame {
  from { opacity: 0; transform: translateY(22px) scale(.98); filter: blur(10px); }
  55% { opacity: 1; }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes screenBloom {
  from { opacity: 0; }
  35% { opacity: 1; }
  to { opacity: 0; }
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(14,27,60,.92), rgba(6,13,31,.84));
  border: 1px solid rgba(102,217,255,.18);
  box-shadow: 0 10px 28px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.08);
}
.back-link:hover { transform: translateY(-1px); border-color: rgba(102,217,255,.42); box-shadow: 0 14px 30px rgba(0,0,0,.28), 0 0 0 1px rgba(95,224,255,.14); }
.back-link:active { transform: scale(.965); }
.back-link-arrow { font-size: 24px; line-height: 1; }
.back-link-text { display: none; }

.analytics-card {
  text-align: left;
  background:
    radial-gradient(circle at 20% 15%, rgba(95,224,255,.12), transparent 26%),
    radial-gradient(circle at 80% 0%, rgba(138,92,255,.14), transparent 28%),
    linear-gradient(160deg, rgba(5,15,40,.94), rgba(10,27,62,.90));
  border: 1px solid rgba(95,224,255,.16);
  box-shadow: 0 24px 70px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.05);
}
.analytics-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.analytics-head small,
.board-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #74dfff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.analytics-head h3 {
  margin: 6px 0 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: .95;
  letter-spacing: -.04em;
}
.stats-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.stat-tile, .value-cards > div {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.05));
  border: 1px solid rgba(180,222,255,.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 12px 34px rgba(0,0,0,.16);
}
.stat-tile::before, .value-cards > div::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(95,224,255,.08), transparent 40%, transparent 65%, rgba(138,92,255,.08));
  pointer-events: none;
}
.stat-tile p, .value-cards p {
  margin: 0 0 8px;
  color: rgba(233,245,255,.72);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 800;
}
.stat-tile b {
  font-size: clamp(38px, 7vw, 52px);
  letter-spacing: -.05em;
}
.value-cards {
  margin-top: 14px;
  grid-template-columns: 1fr;
  gap: 14px;
}
.value-cards b {
  display: block;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.02;
  letter-spacing: -.035em;
}
.leaderboard-button {
  width: 100%;
  margin-top: 16px;
  min-height: 58px;
  border-radius: 20px;
  font-weight: 1000;
  font-size: 18px;
  letter-spacing: -.01em;
  background: linear-gradient(135deg, #278cff, #4ad9ff 58%, #6b56ff 100%);
  color: white;
  box-shadow: 0 18px 40px rgba(35,145,255,.28), inset 0 1px 0 rgba(255,255,255,.22);
  transition: transform .18s ease, box-shadow .18s ease;
}
.leaderboard-button:hover { transform: translateY(-2px); box-shadow: 0 24px 46px rgba(35,145,255,.34), inset 0 1px 0 rgba(255,255,255,.28); }
.leaderboard-button:active { transform: scale(.985); }

.leaderboard-grid {
  width: min(94vw, 860px);
  display: grid;
  gap: 16px;
}
.fancy-board {
  overflow: hidden;
  border-radius: 26px;
  background:
    radial-gradient(circle at 0 0, rgba(95,224,255,.12), transparent 24%),
    linear-gradient(160deg, rgba(6,15,40,.96), rgba(8,20,49,.90));
  border: 1px solid rgba(95,224,255,.14);
  box-shadow: 0 18px 44px rgba(0,0,0,.28);
}
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}
.board-head h3 { margin: 4px 0 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.04em; }
.board-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(95,224,255,.12);
  border: 1px solid rgba(95,224,255,.16);
  color: #8ae9ff;
  font-size: 12px;
  font-weight: 900;
}
.board-table-head, .leaderboard-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.board-table-head {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  color: rgba(233,245,255,.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.board-table-body { display: grid; gap: 10px; margin-top: 10px; }
.leaderboard-row {
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
  border-radius: 18px;
  padding: 12px 14px;
}
.leaderboard-row.podium { border-color: rgba(95,224,255,.24); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 26px rgba(8,124,255,.12); }
.lb-rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(34,144,255,.26), rgba(95,224,255,.18));
  color: #f5fbff;
  font-weight: 1000;
}
.lb-name {
  min-width: 0;
  font-weight: 900;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-value {
  font-size: 16px;
  color: #8de7ff;
  letter-spacing: -.03em;
}

.cosmic-search {
  margin: 14px 0 16px;
}
.cosmic-main {
  background: linear-gradient(180deg, rgba(7,15,36,.98), rgba(5,10,24,.96));
  border-radius: 22px;
  border: 1px solid rgba(95,224,255,.14);
  box-shadow: 0 18px 42px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.04);
}
.cosmic-input {
  height: 62px;
  padding: 0 20px 0 60px;
  border-radius: 22px;
  font-size: 15px;
  letter-spacing: .01em;
}
.cosmic-input::placeholder { color: rgba(140,188,255,.76); }
.input-mask { display: none; }
.cosmic-glow { left: 14px; top: 18px; }
.cosmic-search-icon { left: 22px; top: 18px; }

.search-results {
  display: grid;
  gap: 12px;
}
.search-item {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(95,224,255,.12);
  background:
    radial-gradient(circle at 0 50%, rgba(95,224,255,.08), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.045));
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  text-align: left;
  overflow: hidden;
  transition: transform .16s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.search-item:hover {
  transform: translateY(-2px);
  border-color: rgba(95,224,255,.28);
  box-shadow: 0 18px 34px rgba(0,0,0,.22), 0 0 0 1px rgba(95,224,255,.10);
}
.search-item:active { transform: scale(.992); }
.search-item.is-added {
  border-color: rgba(95,224,255,.22);
  background: linear-gradient(180deg, rgba(14,107,208,.18), rgba(255,255,255,.06));
}
.search-thumb {
  width: 62px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.06);
}
.search-item img {
  width: 56px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
}
.search-card-main { display: grid; gap: 4px; min-width: 0; }
.search-card-main b {
  display: block;
  font-size: 18px;
  letter-spacing: -.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-card-main small {
  color: rgba(233,245,255,.68);
  font-size: 13px;
  line-height: 1.2;
}
.search-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.copy-status,
.chance-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
}
.copy-status {
  background: rgba(255,255,255,.07);
  color: rgba(233,245,255,.78);
}
.chance-add {
  background: rgba(95,224,255,.12);
  color: #89e8ff;
}
.add-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: end;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(28,145,255,.28), rgba(95,224,255,.16));
  border: 1px solid rgba(95,224,255,.18);
  color: white;
  font-style: normal;
  font-size: 28px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 8px 24px rgba(0,0,0,.18);
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.add-badge:hover { transform: translateY(-1px); }
.add-badge:active { transform: scale(.94); }
.add-badge.minus {
  background: linear-gradient(180deg, rgba(255,97,138,.28), rgba(255,112,160,.16));
  border-color: rgba(255,112,160,.18);
  color: #ffe6ee;
}
.search-item.flash-add { animation: cardFlashAdd .34s cubic-bezier(.18,.92,.18,1.08); }
.search-item.flash-remove { animation: cardFlashRemove .34s cubic-bezier(.18,.92,.18,1.08); }
@keyframes cardFlashAdd {
  0% { transform: scale(.98); box-shadow: 0 0 0 rgba(95,224,255,0); }
  48% { transform: scale(1.014); box-shadow: 0 0 0 1px rgba(95,224,255,.20), 0 0 26px rgba(95,224,255,.24); }
  100% { transform: scale(1); }
}
@keyframes cardFlashRemove {
  0% { transform: scale(1); }
  40% { transform: scale(.988); box-shadow: 0 0 0 1px rgba(255,112,160,.20), 0 0 22px rgba(255,112,160,.18); }
  100% { transform: scale(1); }
}

.selected-panel {
  min-height: 72px;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
  border: 1px solid rgba(95,224,255,.12);
}
.selected-list { display: grid; gap: 10px; }
.selected-list.has-cards { grid-template-columns: 1fr; }
.selected-chip.stake-token {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) auto 34px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 8px 8px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20,140,255,.16), rgba(255,255,255,.05));
  border: 1px solid rgba(95,224,255,.12);
}
.selected-chip.stake-token img {
  width: 52px;
  height: 38px;
}
.selected-chip.stake-token span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.selected-chip.stake-token b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-chip.stake-token small { color: rgba(233,245,255,.66); font-size: 11px; }
.selected-chip.stake-token strong {
  color: #8de8ff;
  font-size: 12px;
  font-weight: 1000;
}
.selected-chip.stake-token button {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(255,102,146,.18);
  color: #ffe8ee;
  font-size: 20px;
}
.selected-empty { padding: 12px 10px; font-size: 13px; }
.selected-more {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
}

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .value-cards { grid-template-columns: 1fr; }
  .leaderboard-grid { width: min(94vw, 760px); }
  .search-item {
    grid-template-columns: 54px minmax(0, 1fr) 46px;
    padding: 10px;
    gap: 10px;
  }
  .search-thumb { width: 54px; height: 42px; }
  .search-item img { width: 48px; height: 34px; }
  .search-card-main b { font-size: 16px; }
  .search-card-main small { font-size: 12px; }
  .search-card-tags { gap: 6px; }
  .copy-status, .chance-add { padding: 4px 8px; font-size: 10px; }
  .selected-chip.stake-token {
    grid-template-columns: 48px minmax(0,1fr) auto 32px;
  }
}
