/* Рулетка — отдельным файлом, как и её код (web/gated/wheel.js): сервер отдаёт его, только пока рулетка
   включена в панели (владелец, 06.10.2026: «в фронте она не должна отдаваться»).
   Переменные (--panel, --gold, …) — из app.css, он подключён раньше. */

/* ---------- плитка рулетки на главной ---------- */

.wtile:active { transform: scale(.975); }
/* вход в рулетку — единственное, что на главной светится */
/* плитка красная и светится, пока есть крутки; кончились — тускнеет, число серое */
.wtile { position: relative; width: 100%; text-align: left; border-radius: 24px; background: linear-gradient(160deg, #2a1012, var(--panel) 60%); padding: 18px 18px 16px;
  display: flex; align-items: center; gap: 14px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(229, 50, 43, .6), 0 0 36px rgba(229, 50, 43, .38);
  transition: box-shadow .4s, transform .12s ease-out; }
.wtile.out { background: linear-gradient(160deg, #1c1214, var(--panel) 60%); box-shadow: inset 0 0 0 1px rgba(229, 50, 43, .25), 0 0 18px rgba(229, 50, 43, .12); }
.wtile.out .left b { color: var(--dim); }
.wtile .txt { flex: 1; min-width: 0; }
.wtile .txt b { display: block; font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.2; margin-top: 6px; }
.wtile .txt small { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.wtile .left { flex: none; text-align: center; padding: 10px 14px; border-radius: 16px; background: var(--bg); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.wtile .left small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.wtile .left b { display: block; font-family: var(--display); font-weight: 800; font-size: 30px; color: var(--red); line-height: 1.1; font-variant-numeric: tabular-nums; }

/* ---------- три плитки в ряд: у рулетки и у реферальной программы (ref.css) ---------- */

.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpis.three .tile { border-radius: 16px; padding: 12px 10px; text-align: center; }
.kpis.three b { font-weight: 700; font-size: 17px; line-height: 1.4; }
.kpis.three small { font-size: 11px; line-height: 1.3; margin-top: 3px; }

/* ---------- рулетка ---------- */

.reel { position: relative; border-radius: 24px; background: var(--panel); padding: 18px 0 16px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(244, 192, 74, .4), 0 0 36px rgba(244, 192, 74, .18); transition: box-shadow .3s; }
.reel.spinning { box-shadow: inset 0 0 0 1px rgba(244, 192, 74, .4), 0 0 60px rgba(244, 192, 74, .4); }
.reel::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(244, 192, 74, .2), transparent 60%); pointer-events: none; }
.reel .track { position: relative; height: 150px; overflow: hidden; }
/* лента начинается от середины: сдвиг до карточки не зависит от ширины телефона */
.reel .strip { position: absolute; left: 50%; top: 0; display: flex; gap: 8px; will-change: transform; }
.reel .track::before, .reel .track::after { content: ''; position: absolute; top: 0; bottom: 0; width: 48px; z-index: 1; pointer-events: none; }
.reel .track::before { left: 0; background: linear-gradient(90deg, var(--panel-solid), transparent); }
.reel .track::after { right: 0; background: linear-gradient(-90deg, var(--panel-solid), transparent); }
.reel .mark { position: absolute; left: 50%; top: -2px; width: 3px; height: 154px; margin-left: -1.5px; background: var(--gold); border-radius: 2px;
  box-shadow: 0 0 12px rgba(244, 192, 74, .9); pointer-events: none; z-index: 2; }
.reel .mark::before { content: ''; position: absolute; left: -6.5px; top: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid var(--gold); }
/* карточка приза: лут — тёмная, настоящий приз — красная и светится */
.wcard { flex: none; width: 96px; height: 150px; border-radius: 16px; background: var(--panel-2); padding: 10px 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
/* картинка приза: крупно и без подложки — вырезка лежит прямо на карточке */
.wpic { flex: none; width: 72px; height: 72px; position: relative; color: var(--dim);
  display: flex; align-items: center; justify-content: center; }
.wpic img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; opacity: 0; transition: opacity .2s; }
.wpic img.ok { opacity: 1; }
.wcard b { font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .02em; line-height: 1; font-variant-numeric: tabular-nums; }
.wcard small { font-size: 11px; color: var(--muted); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wcard.real { background: linear-gradient(160deg, var(--red), var(--red-deep)); box-shadow: 0 0 18px rgba(229, 50, 43, .35); }
.wcard.real .wpic { color: rgba(255, 255, 255, .9); }
.wcard.real b { font-size: 10px; color: rgba(255, 255, 255, .85); }
.wcard.real small { color: rgba(255, 255, 255, .85); }
.wcard.win { animation: glow 1.4s ease-in-out infinite; }
.btn.spin { height: 60px; font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .02em; box-shadow: 0 8px 32px rgba(229, 50, 43, .45);
  white-space: normal; line-height: 1.15; }
.btn.spin:disabled { opacity: 1; background: var(--panel-2); color: var(--dim); box-shadow: none; }
.btn.spin.long { font-size: 13px; }
.wres { border-radius: 20px; background: var(--panel); padding: 14px 18px; display: flex; align-items: center; gap: 14px; animation: win .4s cubic-bezier(.2, .9, .3, 1.2) both; }
.wres .wpic { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; background: var(--panel-2); color: #fff; }
.wres .wpic img { width: 86%; height: 86%; border-radius: 0; }
.wres .txt { min-width: 0; }
.wres .lbl { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.wres .val { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.1; margin-top: 3px; }
.wres .val span { font-family: var(--body); font-weight: 500; font-size: 14px; color: var(--text-2); }
/* настоящий приз — событие: красная карточка со свечением */
.wres.real { flex-direction: column; align-items: stretch; gap: 12px; border-radius: 24px; background: linear-gradient(160deg, var(--red), var(--red-deep)); padding: 20px 18px 18px; color: #fff;
  box-shadow: 0 0 48px rgba(229, 50, 43, .55); animation-duration: .5s; }
.wres.real .head { display: flex; align-items: center; gap: 14px; }
.wres.real .wpic { width: 60px; height: 60px; border-radius: 16px; background: rgba(0, 0, 0, .25); }
.wres.real .lbl { color: var(--gold); font-weight: 700; letter-spacing: .12em; }
.wres.real .val { font-size: 26px; margin-top: 4px; overflow-wrap: anywhere; }
.wres.real p { font-size: 14px; line-height: 1.45; opacity: .95; }
.wres.real .btn { height: 52px; font-size: 15px; }
/* топ периода: отсчёт, пьедестал, остальные места */
.topcard { border-radius: 24px; background: var(--panel); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.topcard .left { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.topcard .left b { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.topcard .nobody { padding: 28px 12px; text-align: center; border-radius: 16px; background: var(--bg); }
.topcard .nobody small { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
/* пьедестал: первое место в середине и выше остальных */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.pod { --m: var(--gold); min-width: 0; min-height: 124px; border-radius: 16px; background: var(--panel-2); padding: 12px 8px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pod.p1 { order: 2; min-height: 150px; }
.pod.p2 { order: 1; min-height: 134px; --m: var(--silver); }
.pod.p3 { order: 3; --m: var(--bronze); }
.pod.p1:not(.free) { box-shadow: inset 0 0 0 1px rgba(244, 192, 74, .4); }
.pod.me { background: rgba(244, 192, 74, .12); box-shadow: inset 0 0 0 1px rgba(244, 192, 74, .6); }
.pod.free { background: var(--bg); }
.medal { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--m, var(--gold)); color: var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.medal.m2 { --m: var(--silver); }
.medal.m3 { --m: var(--bronze); }
.pod .name { display: block; width: 100%; font-weight: 700; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .val { font-family: var(--display); font-weight: 700; font-size: 14px; }
.pod.free .name, .pod.free .val { color: var(--dim); }
/* приз за место: картинка над названием — в одну строку с картинкой название не помещалось
   («Керамбит» обрезался уже на 375 px); название — до двух строк */
.pod .prize { margin-top: auto; max-width: 100%; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 12px;
  background: rgba(244, 192, 74, .14); font-size: 10px; line-height: 1.2; color: var(--gold-2); font-weight: 600; }
.pod .prize img { flex: none; width: 26px; height: 26px; object-fit: contain; }
.pod .prize span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* приз задан только картинкой — показываем её крупно, без подписи */
.pod .prize.pic { padding: 0; background: none; }
.pod .prize.pic img { width: 44px; height: 44px; }
.rest { display: flex; flex-direction: column; }
.rest div { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); font-size: 14px; border-radius: 10px; }
.rest .place { flex: none; width: 28px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rest .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rest .sum { flex: none; font-weight: 700; font-size: 13px; }
.rest .me { background: rgba(244, 192, 74, .08); }
.rest .me .name { font-weight: 700; color: var(--gold-2); }
.topcard .foot { font-size: 12px; color: var(--dim); line-height: 1.45; }
.listcard { border-radius: 24px; background: var(--panel); padding: 16px; display: flex; flex-direction: column; }
.listcard .eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .08em; margin-bottom: 6px; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lrow .medal { width: 24px; height: 24px; font-size: 11px; }
.lrow .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wheel-code { white-space: normal; overflow-wrap: anywhere; }
.lrow .wheel-code { display: block; }
.lrow .when { flex: none; font-size: 12px; color: var(--dim); }
.lrow .sum { flex: none; min-width: 48px; text-align: right; font-weight: 700; font-size: 13px; }
.lrow .sum.dim { min-width: 0; font-size: 12px; color: var(--muted); }
.lrow .prize { flex: none; max-width: 40%; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gold-2); font-weight: 600; }
.lrow .prize img { flex: none; width: 22px; height: 22px; object-fit: contain; }
.lrow .prize span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .take { flex: none; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; }
.listcard .none { padding: 10px 0 2px; font-size: 13px; color: var(--muted); }
.wgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wgrid .wcard { width: auto; height: auto; padding: 10px 6px 10px; gap: 6px; justify-content: flex-start; }
.wgrid .wcard .wpic { width: 100%; max-width: 84px; height: auto; aspect-ratio: 1; }

@keyframes glow { 0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(244, 192, 74, .55); } 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 44px rgba(244, 192, 74, .9); } }
@keyframes win { 0% { transform: scale(.9); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* «уменьшить движение»: без свечения и пульсации, выигрыш отмечен ровной золотой рамкой */
@media (prefers-reduced-motion: reduce) {
  .wres { animation: none; }
  .wtile { transition: none; }
  .wtile:active { transform: none; }
  .wcard.win { animation: none; box-shadow: 0 0 0 2px var(--gold); }
  .reel, .reel.spinning { box-shadow: inset 0 0 0 1px rgba(244, 192, 74, .4); }
  .wtile, .wtile.out { box-shadow: inset 0 0 0 1px rgba(229, 50, 43, .45); }
  .btn.spin, .wres.real, .wcard.real { box-shadow: none; }
}

.home-wheel { display: grid; gap: 10px; width: 100%; min-width: 0; text-align: left; }
.home-wheel-heading { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.home-wheel-heading > span { color: #66df88; font-weight: 700; }
.home-wheel-reel { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center;
  min-height: 112px; padding: 12px; overflow: hidden; isolation: isolate; border-radius: 24px;
  background: var(--panel); box-shadow: inset 0 0 0 1px #e5322b66, 0 0 18px #e5322b24; }
.home-wheel-window { grid-area: 1 / 1; width: 100%; min-width: 0; overflow: hidden; border-radius: 16px; }
.home-wheel-track { display: flex; width: max-content; filter: blur(1.7px);
  animation: home-wheel-scroll 14s linear infinite paused; }
.home-wheel-track.running { animation-play-state: running; }
.home-wheel-group { display: flex; gap: 8px; padding-right: 8px; }
.home-wheel-group .wpic { width: 76px; height: 88px; padding: 8px; border-radius: 12px;
  color: #f7d48a; background: linear-gradient(155deg, #603d44, #35232f);
  box-shadow: inset 0 -3px #e85b58, inset 0 0 0 1px #ed858659; }
.home-wheel-group .wpic:nth-child(3n + 1) { background: linear-gradient(155deg, #805a26, #4c351f);
  box-shadow: inset 0 -3px #dea348, inset 0 0 0 1px #edbc6559; }
.home-wheel-action { grid-area: 1 / 1; z-index: 1; padding: 10px 20px; border-radius: 999px;
  background: var(--red); color: white; font-weight: 700; }
@keyframes home-wheel-scroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .home-wheel-track { animation: none; } }

.wcard { justify-content: flex-start; }
.recent-wins { min-width: 0; padding: 4px 0; }
.recent-wins h2 { margin: 0 4px 8px; font-size: 14px; font-weight: 700; }
.wins-rail { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.win-entry { display: flex; flex: 0 0 min(224px, 90%); align-items: flex-start; gap: 12px;
  border-radius: 16px; background: var(--panel); padding: 12px; scroll-snap-align: start; }
.win-entry .wpic { width: 44px; height: 52px; }
.win-entry .wpic img { border-radius: 4px; }
.win-info { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.win-info b { font-size: 13px; line-height: 1.35; }
.win-info span { font-size: 12px; color: var(--muted); }
.win-info time, .wins-empty { font-size: 11px; color: var(--muted); }
.wins-empty { padding: 0 4px; }
.home-wheel-marker { position: absolute; inset: 8px auto 8px calc(50% - 1px);
  width: 2px; border-radius: 2px; background: var(--gold); pointer-events: none; }
.home-wheel-marker::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--gold); }
