/* ── CLAW MACHINE — LAYOUT FIX ─────────────────────────────────────────── */

/* Tab занимает весь экран без прокрутки */
#tab-claw {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;  /* не скроллим всю страницу */
}

#clawMachineList {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Главный flex-контейнер: canvas → табы → контролы */
.claw-game-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ── Canvas wrap — заполняет всё свободное место ── */
.claw-canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 0;      /* критично для flex */
  overflow: hidden;
}

.claw-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* HUD поверх канваса */
.claw-hud-overlay {
  position: absolute;
  top: 8px; left: 10px; right: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.claw-health-hud {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px 8px;
}

.claw-hud-label { font-size: 10px; color: #64748b; }
.claw-hud-val   { font-size: 10px; color: #94a3b8; }

.claw-health-track {
  width: 60px; height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.claw-health-fill {
  height: 100%; border-radius: 3px;
  transition: width .5s, background .5s;
}

.claw-rush-badge {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 8px; padding: 3px 8px;
  font-size: 11px; font-weight: 700;
  animation: pulse 1.4s ease-in-out infinite;
}

.claw-spectators-badge {
  margin-left: auto;
  font-size: 11px; color: #64748b;
  background: rgba(0,0,0,0.4);
  border-radius: 8px; padding: 3px 8px;
}

.claw-turn-timer {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  border-radius: 8px; padding: 3px 10px;
  font-size: 12px; color: #f59e0b; font-weight: 600;
  pointer-events: none;
}

/* ── Список машин — горизонтальный скролл ── */
.claw-tabs-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;     /* не сжимается */
  border-top: 1px solid rgba(255,255,255,0.06);
}
.claw-tabs-row::-webkit-scrollbar { display: none; }

.claw-machine-tab {
  flex: 0 0 auto;   /* ← ИСПРАВЛЕНИЕ #3: не сжимается, всегда нативный размер */
  min-width: 96px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.claw-machine-tab.active {
  background: rgba(78,205,196,0.13);
  border-color: rgba(78,205,196,0.4);
}
.claw-machine-tab.is-broken { opacity: .55; }
.claw-tab-icon { display: block; font-size: 20px; }
.claw-tab-name { display: block; font-size: 11px; color: #94a3b8; margin-top: 2px;
  white-space: nowrap; }
.claw-tab-cost { display: block; font-size: 11px; color: #f6c90e; }

/* ── Controls bar — прибит к низу ── */
.claw-controls-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px 14px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(10,10,20,0.95);
}

.claw-price-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  background: rgba(246,201,14,0.08);
  border: 1px solid rgba(246,201,14,0.2);
  border-radius: 10px;
  padding: 6px 10px;
  flex-shrink: 0;
}
.claw-price-label { font-size: 9px; color: #64748b; text-transform: uppercase; }
.claw-price-val   { font-size: 15px; font-weight: 700; color: #f6c90e; }

.claw-play-btn {
  flex: 1;
  height: 50px;
  border-radius: 12px;
  font-size: 16px; font-weight: 800;
  letter-spacing: .5px;
  border: none; cursor: pointer;
  background: linear-gradient(135deg,
    var(--machine-color, #4ecdc4),
    color-mix(in srgb, var(--machine-color, #4ecdc4) 70%, #000));
  color: #0a0a12;
  box-shadow: 0 0 18px color-mix(in srgb, var(--machine-color, #4ecdc4) 50%, transparent);
  transition: all .18s ease;
}
.claw-play-btn:active { transform: scale(0.97); }

.claw-play-btn--stop {
  background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
  box-shadow: 0 0 22px rgba(239,68,68,.5) !important;
  animation: btnPulse .55s ease-in-out infinite;
}
.claw-play-btn--queue,
.claw-play-btn--wait {
  background: rgba(255,255,255,.07) !important;
  color: #475569 !important;
  box-shadow: none !important;
  cursor: not-allowed;
}
.claw-play-btn--active { animation: btnPulse .9s ease-in-out infinite; }

.claw-sabotage-btn {
  height: 50px;
  padding: 0 12px;
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 12px;
  background: rgba(239,68,68,.07);
  color: #ef4444;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
}
.claw-sabotage-btn:active { background: rgba(239,68,68,.2); }

/* Loading */
.claw-loading { display:flex; align-items:center; justify-content:center;
  gap:8px; padding:40px 16px; color:#64748b; font-size:14px; }
.claw-spin    { display:inline-block; animation: spin 1.2s linear infinite; }
.claw-error, .claw-empty { text-align:center; padding:32px 16px;
  color:#64748b; font-size:13px; }

/* Win popup */
.claw-result-popup {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(12px);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .28s ease;
}
.claw-result-popup.show { opacity: 1; pointer-events: all; }
.claw-result-card {
  background: rgba(18,18,30,.97);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px; padding: 32px 36px;
  text-align: center; min-width: 260px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.claw-result-emoji  { font-size: 60px; display: block; margin-bottom: 10px; }
.claw-result-title  { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.claw-result-sub    { font-size: 13px; color: #64748b; margin-bottom: 16px; }
.claw-result-reward { font-size: 26px; font-weight: 700; color: #f6c90e; margin-bottom: 20px; }
.claw-result-close  {
  width: 100%; padding: 14px;
  background: rgba(78,205,196,.18) !important;
  border: 1px solid rgba(78,205,196,.4) !important;
  color: #4ecdc4 !important;
  border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}

@keyframes confettiFall {
  0%   { transform: translateY(-10px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 0 18px rgba(239,68,68,.45); }
  50%     { box-shadow: 0 0 34px rgba(239,68,68,.85); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.65} }