/* ============================================================
   Вкладка «Казик» — барабан / кейс CS2 / трежерка Dota 2
   ============================================================ */

.view--casino { background: var(--bg); }

.casino__mobtabs { display: none; }

.casino {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr) minmax(224px, 1fr);  /* 1 : 2 : 1 */
  gap: 10px; padding: 10px;
}

.panel {
  background: var(--bg-chrome); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.panel__head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.panel__foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.panel__empty { padding: 18px 14px; text-align: center; color: var(--ink-2); }
.panel__empty p { margin: 0 0 4px; }

/* ===================== Левая панель: пул ===================== */
.poollist { flex: 1 1 auto; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 7px; }

.pool-item {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 4px solid var(--rar, var(--line-strong));
  border-radius: 8px; padding: 6px 8px; position: relative;
  transition: background .12s, transform .12s;
}
.pool-item:hover { background: var(--hover); }
.pool-item.is-out { opacity: .35; filter: grayscale(1); }
.pool-item.is-active { box-shadow: 0 0 0 2px var(--rar, var(--accent)) inset; }
.pool-item__img { width: 34px; height: 51px; border-radius: 4px; object-fit: cover; background: var(--chip-soft); }
.pool-item__body { min-width: 0; }
.pool-item__title { font-size: 12.5px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pool-item__sub { font-size: 11px; color: var(--ink-3); display: flex; gap: 6px; margin-top: 2px; }
.pool-item__odds { font-size: 11px; color: var(--ink-2); }

.votes { display: flex; align-items: center; gap: 2px; }
.votes button {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--chip-soft); color: var(--ink-2); cursor: pointer; display: grid; place-items: center;
  font-size: 11px; padding: 0;
}
.votes button:hover { background: var(--hover); color: var(--ink); border-color: var(--line-strong); }
.votes button:disabled { opacity: .3; cursor: not-allowed; }
.votes__n { min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.pool-item__del {
  position: absolute; right: 4px; top: 4px; width: 18px; height: 18px; border-radius: 4px;
  border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 11px; opacity: 0; display: grid; place-items: center;
}
.pool-item:hover .pool-item__del { opacity: 1; }
.pool-item__del:hover { color: #ff6b6b; background: var(--hover); }

/* ===================== Центр: сцена ===================== */
.panel--stage {
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    var(--bg-chrome);
}
.stage {
  flex: 1 1 auto; min-height: 0; position: relative;
  display: grid; place-items: center; padding: 10px 12px; overflow: hidden;
}
.stage__status {
  position: absolute; top: 8px; left: 12px; right: 12px; z-index: 6;
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3);
  pointer-events: none;
}
.stage__round { color: var(--ink-2); }
.stage__bar {
  flex: 0 0 auto; border-top: 1px solid var(--line); padding: 10px 12px;
  display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
}

.rou { width: 100%; height: 100%; display: grid; place-items: center; }

/* --------------------- Барабан --------------------- */
/* самый крупный квадрат, который влезает в сцену */
.wheel__wrap {
  position: relative; width: min(100%, 760px); max-height: 100%;
  aspect-ratio: 1; display: grid; place-items: center;
}
.wheel__wrap canvas { width: 100%; height: 100%; display: block; border-radius: 50%; }
.wheel__pointer {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%); z-index: 5;
  width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent;
  border-top: 26px solid var(--accent);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6));
}
.wheel__hub {
  position: absolute; width: 21%; aspect-ratio: 1; border-radius: 50%;
  background: var(--bg-chrome); border: 2px solid var(--line-strong);
  display: grid; place-items: center; pointer-events: none; z-index: 4;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .55);
}
.wheel__hub img { width: 68%; opacity: .95; }
html[data-theme='light'] .wheel__hub img { filter: invert(1); }

/* --------------------- Кейс CS2 --------------------- */
.case {
  position: relative; width: 100%; max-width: 1100px; height: min(46vh, 300px); min-height: 170px;
  border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 40%),
    #0e0f11;
}
.case__grid {
  position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px;
}
.case__viewport { position: absolute; inset: 0; overflow: hidden; }
.case__belt { display: flex; height: 100%; align-items: center; will-change: transform; }
.case__marker {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; z-index: 8;
  background: linear-gradient(180deg, #ffd700, #fff 50%, #ffd700);
  box-shadow: 0 0 12px 2px rgba(255, 215, 0, .8); transform: translateX(-50%);
}
.case__marker::before, .case__marker::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  border-left: 8px solid transparent; border-right: 8px solid transparent;
}
.case__marker::before { top: 0; border-top: 11px solid #ffd700; }
.case__marker::after { bottom: 0; border-bottom: 11px solid #ffd700; }
.case__fade { position: absolute; top: 0; bottom: 0; width: 14%; pointer-events: none; z-index: 7; }
.case__fade--l { left: 0; background: linear-gradient(90deg, #0e0f11 10%, transparent); }
.case__fade--r { right: 0; background: linear-gradient(270deg, #0e0f11 10%, transparent); }

.case__item { flex: 0 0 var(--item-w, 150px); width: var(--item-w, 150px); height: 100%; padding: 10px 5px; }
.case__card {
  height: 100%; border-radius: 4px; overflow: hidden; position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rar) 32%, #14151a), #0f1013 78%);
  border-bottom: 4px solid var(--rar);
  box-shadow: inset 0 0 26px color-mix(in srgb, var(--rar) 26%, transparent);
  display: flex; flex-direction: column;
}
.case__card img { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: cover; }
.case__card .case__name {
  flex: 0 0 auto; font-size: 10.5px; padding: 3px 5px; background: rgba(0, 0, 0, .55); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.case__card.is-gold::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 215, 0, .35) 50%, transparent 65%);
  animation: goldShine 2.2s linear infinite;
}
@keyframes goldShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* --------------------- Трежерка Dota 2 --------------------- */
.treasure { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.treasure__chest { position: relative; width: 100%; height: 26px; display: grid; place-items: center; }
.treasure__beam {
  width: min(70%, 520px); height: 3px; border-radius: 3px; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--rar, var(--accent)), transparent);
  box-shadow: 0 0 22px 5px color-mix(in srgb, var(--rar, var(--accent)) 60%, transparent);
  transition: opacity .3s;
}
.treasure__beam.is-on { opacity: 1; animation: beamPulse 1.1s ease-in-out infinite; }
@keyframes beamPulse { 50% { transform: scaleY(2.4); } }

.treasure__row {
  display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; align-items: center;
  width: 100%; max-width: 1000px; padding: 4px;
}
.t-item {
  position: relative; width: var(--t-w, 108px); aspect-ratio: 2/3; border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rar) 30%, #15161b), #0f1013);
  border: 1px solid color-mix(in srgb, var(--rar) 55%, transparent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), inset 0 0 22px color-mix(in srgb, var(--rar) 22%, transparent);
  transition: transform .22s cubic-bezier(.2, .9, .3, 1.4), opacity .3s, filter .3s, box-shadow .2s;
  flex: 0 0 auto;
}
.t-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-item__name {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 2px 4px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85)); color: #fff; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-item.is-scan { transform: translateY(-9px) scale(1.06); box-shadow: 0 0 22px 3px color-mix(in srgb, var(--rar) 75%, transparent); z-index: 3; }
.t-item.is-out { animation: tPoof .42s ease-in forwards; }
@keyframes tPoof {
  40% { transform: scale(1.1); filter: brightness(2.2); }
  100% { transform: scale(.25) rotate(14deg); opacity: 0; filter: blur(4px); }
}
.t-item.is-win {
  transform: scale(1.45); z-index: 6;
  box-shadow: 0 0 40px 10px color-mix(in srgb, var(--rar) 78%, transparent);
  animation: tWin .6s ease-out;
}
@keyframes tWin { 0% { transform: scale(1); } 60% { transform: scale(1.65); } 100% { transform: scale(1.45); } }
.t-item.is-gold::before {
  content: ''; position: absolute; inset: -40%; z-index: 2;
  background: conic-gradient(from 0deg, transparent, rgba(255, 215, 0, .55), transparent 45%);
  animation: goldSpin 3s linear infinite;
}
@keyframes goldSpin { to { transform: rotate(360deg); } }

/* --------------------- Результат --------------------- */
.reveal {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(60% 60% at 50% 45%, color-mix(in srgb, var(--rar, var(--accent)) 26%, transparent), rgba(0, 0, 0, .86) 70%);
  backdrop-filter: blur(6px); animation: revealIn .35s ease-out;
}
@keyframes revealIn { from { opacity: 0; } }
.reveal__card {
  position: relative; display: flex; gap: 16px; align-items: center;
  max-width: min(94%, 660px); padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rar) 22%, #16171c), #0f1013);
  border: 1px solid color-mix(in srgb, var(--rar) 70%, transparent);
  box-shadow: 0 0 60px color-mix(in srgb, var(--rar) 45%, transparent);
  animation: revealPop .45s cubic-bezier(.2, .9, .3, 1.35);
}
@keyframes revealPop { from { transform: scale(.7) translateY(20px); opacity: 0; } }
.reveal__glow {
  position: absolute; inset: -2px; border-radius: 14px; pointer-events: none;
  background: linear-gradient(120deg, transparent 40%, color-mix(in srgb, var(--rar) 45%, transparent) 50%, transparent 60%);
  animation: goldShine 2.6s linear infinite;
}
.reveal__poster {
  width: min(34vw, 210px); aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; flex: 0 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.reveal__meta { min-width: 0; }
.reveal__rarity { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--rar); margin-bottom: 6px; }
.reveal__title { font-size: clamp(18px, 3.4vw, 30px); font-weight: 600; line-height: 1.15; color: #fff; }
.reveal__sub { margin-top: 8px; color: #c6c6c6; font-size: 13px; line-height: 1.5; }

/* --------------------- Кнопка ролла --------------------- */
.spinbtn {
  flex: 1 1 260px; max-width: 420px; min-height: 52px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff 6%), color-mix(in srgb, var(--accent) 70%, #000));
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .09s, filter .15s;
}
.spinbtn:hover { filter: brightness(1.12); }
.spinbtn:active { transform: translateY(2px); }
.spinbtn:disabled { filter: grayscale(.85); opacity: .55; cursor: not-allowed; }
.spinbtn__label { font-size: 17px; font-weight: 700; letter-spacing: .08em; }
.spinbtn__sub { font-size: 11px; opacity: .85; letter-spacing: .04em; }

/* ===================== Правая панель: настройки ===================== */
.panel--settings { overflow: auto; padding: 0 0 10px; }
.setgroup { padding: 12px; border-bottom: 1px solid var(--line); }
.setgroup:last-child { border-bottom: 0; }
.setgroup__title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3);
  margin-bottom: 9px;
}

.radio { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.radio:hover { background: var(--hover); }
.radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio__dot {
  width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--ok); flex: 0 0 auto; position: relative;
}
.radio input:checked + .radio__dot::after {
  content: ''; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--ok);
}
.radio__label { font-weight: 600; letter-spacing: .05em; font-size: 13px; color: var(--ok); }
.radio input:checked ~ .radio__label { color: var(--ink); }

.seg { display: flex; background: var(--chip-soft); border-radius: 8px; padding: 3px; gap: 3px; }
.seg__btn {
  flex: 1; border: 0; background: none; color: var(--ink-2); border-radius: 6px; padding: 7px 6px;
  cursor: pointer; font-size: 12.5px;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--accent); color: #fff; font-weight: 500; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.row output { font-variant-numeric: tabular-nums; color: var(--ink-2); }

input[type='range'] {
  width: 100%; -webkit-appearance: none; appearance: none; background: transparent; margin: 6px 0 12px; height: 18px;
}
input[type='range']::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--chip); }
input[type='range']::-moz-range-track { height: 4px; border-radius: 3px; background: var(--chip); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--accent);
  margin-top: -5.5px; border: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[type='range']::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--accent); }

.check { display: flex; align-items: flex-start; gap: 9px; padding: 7px 2px; cursor: pointer; font-size: 13px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--line-strong); flex: 0 0 auto;
  margin-top: 1px; position: relative; transition: background .12s, border-color .12s;
}
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box::after {
  content: ''; position: absolute; left: 4px; top: 0.5px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(43deg);
}
.check input:focus-visible + .check__box { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.legend i { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend b { color: var(--ink); font-weight: 500; }

/* --------------------- История --------------------- */
.hist { border-bottom: 1px solid var(--line); }
.hist > summary {
  list-style: none; cursor: pointer; padding: 11px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3);
}
.hist > summary::-webkit-details-marker { display: none; }
.hist > summary::after { content: '▾'; margin-left: auto; transition: transform .15s; }
.hist[open] > summary::after { transform: rotate(180deg); }
.hist__list { max-height: 210px; overflow: auto; padding: 0 8px 4px; display: flex; flex-direction: column; gap: 5px; }
.hist-item {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center;
  padding: 4px 6px; border-radius: 6px; background: var(--chip-soft);
  border-left: 3px solid var(--rar, var(--line-strong));
}
.hist-item img { width: 26px; height: 39px; object-fit: cover; border-radius: 3px; }
.hist-item__t { font-size: 11.5px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hist-item__d { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.hist #histClear { margin: 4px 10px 10px; }

/* ===================== Мобилка ===================== */
@media (max-width: 1000px) {
  .casino { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .casino__mobtabs {
    display: flex; gap: 4px; padding: 8px 8px 0;
  }
  .mobtab {
    flex: 1; border: 1px solid var(--line); background: var(--bg-chrome); color: var(--ink-2);
    border-radius: 8px; padding: 8px 4px; font-size: 13px; cursor: pointer;
  }
  .mobtab.is-active { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .casino .panel { display: none; }
  .casino .panel.is-active { display: flex; }
  .panel--settings.is-active { display: block; }
  .wheel__wrap { width: min(100%, 52vh); }
  .case { height: min(34vh, 220px); }
  .reveal__card { flex-direction: column; text-align: center; }
  .reveal__poster { width: min(46vw, 170px); }
  .spinbtn { flex: 1 1 100%; }
}
