/* ── CLAW MACHINE — LAYOUT FIX v2 ────────────────────────────── */

/* ── TAB ─────────────────────────────────────────────────────── */
/* ФИКС #1 — пустое место снизу: убрали height:100% */
#tab-claw1 {
  display: flex;
  flex-direction: column;
  height: auto;          /* ← было height:100% */
  overflow-y: auto;
}

#clawMachineList1 {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#tab-claw {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#clawMachineList {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-height: 0;
}
/* ФИКС #2 — контролы не на всю ширину: align-items:stretch */
.claw-game-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;  /* ← было center */
  gap: 0;
}

/* ФИКС #3 — рамка обрезана: высота 260→360px */
.claw-canvas-wrap {
  width: 300px;
  height: 360px;         /* ← было 260px */
  flex-shrink: 0;
  flex-grow: 0;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.claw-canvas {
  width: 300px !important;
  height: 360px !important; /* ← было 260px */
  display: block;
  touch-action: none;
  will-change: transform;
  transform: translateZ(0);
}

/* 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: 118px; 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; 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; }

/* ── ПАНЕЛЬ УПРАВЛЕНИЯ — ВНУТРИ canvas-wrap как overlay ─────────
   ФИКС #4 — кнопки стали частью отрисованной машины           */
.claw-controls-bar1 {
  position: absolute;    /* ← ключевое изменение */
  bottom: 26px;          /* над монетоприёмником */
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  z-index: 10;
}
/* Контейнер — двухстрочный flex */
.claw-controls-bar {
  position: absolute;
  bottom: 26px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0;
  z-index: 10;
}

/* Цена — первая строка, левый угол, без фона */
.claw-price-box {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
  background: none;
  border: none;
  padding: 0 2px;
  min-width: unset;
  align-self: flex-start;       /* прибит к левому краю */
}
.claw-price-label {
  font-size: 9px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.claw-price-val {
  font-size: 14px;
  font-weight: 700;
  color: #f6c90e;
}

/* Строка кнопок — ИГРАТЬ слева, пустота по центру, Шейк справа */
.claw-controls-bar > #clawPlayBtn,
.claw-controls-bar > #clawSabotageBtn {
  flex: 0 0 auto;               /* не растягиваются */
}

/* Враппер строки кнопок нам нужен — добавь в HTML! */
.claw-btn-row {
  display: flex;
  justify-content: space-between;  /* ← пустота по центру */
  align-items: center;
}

/* ИГРАТЬ */
.claw-play-btn {
  width: 110px;                 /* фиксированная ширина */
  height: 48px;
  border-radius: 12px;
  font-size: 15px; 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-sabotage-btn {
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 12px;
  background: rgba(239,68,68,.10);
  color: #ef4444;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-align: center; line-height: 1.3;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.claw-price-box1 {
  display: flex; flex-direction: column; align-items: center;
  min-width: 60px; background: rgba(246,201,14,0.10);
  border: 1px solid rgba(246,201,14,0.25); border-radius: 10px;
  padding: 5px 10px; flex-shrink: 0; backdrop-filter: blur(4px);
}
.claw-price-label1 { font-size: 9px; color: #64748b; text-transform: uppercase; }
.claw-price-val1   { font-size: 15px; font-weight: 700; color: #f6c90e; }

.claw-play-btn1 {
  flex: 1; height: 48px; border-radius: 12px;
  font-size: 15px; 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-btn1 {
  height: 48px; padding: 0 10px;
  border: 1px solid rgba(239,68,68,.3); border-radius: 12px;
  background: rgba(239,68,68,.10); color: #ef4444;
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all .2s; text-align: center; line-height: 1.3;
  flex-shrink: 0; backdrop-filter: blur(4px);
}
.claw-sabotage-btn:active { background: rgba(239,68,68,.2); }

/* ── Стрелки управления ───────────────────────────────────────── */
.claw-dir-controls {
  position: absolute;       /* ← было: relative/flex */
  bottom: 26px;             /* совпадает с .claw-controls-bar */
  left: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  padding: 0;
  z-index: 10;
}

.claw-dir-controls1 {
  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-arrows-group { display: flex; gap: 10px; }
.claw-arrow-btn {
  width: 58px; height: 52px; border-radius: 10px;
  background: rgba(255,255,255,0.09); border: 2px solid rgba(255,255,255,0.22);
  color: #fff; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: none; transition: background 100ms, transform 80ms;
}
.claw-arrow-btn:active { background: rgba(255,255,255,0.20); transform: scale(0.93); }
.claw-grab-circle {
  width: 68px; height: 68px; border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #ff6b6b, #dc2626);
  border: 3px solid rgba(255,180,180,0.45); cursor: pointer;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  box-shadow: 0 4px 20px rgba(220,38,38,0.55), 0 0 0 0 rgba(220,38,38,0.4);
  transition: transform 80ms, box-shadow 80ms;
  animation: grabPulse 2s ease-in-out infinite;
}
.claw-grab-circle:active { transform: scale(0.91); box-shadow: 0 2px 8px rgba(220,38,38,0.3); animation: none; }

/* ── 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;
}
.claw-result-nft-msg {
  font-size: 12px; color: #64748b; margin-bottom: 14px; padding: 8px 12px;
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2); border-radius: 8px;
}

/* ── 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; }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes grabPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(220,38,38,0.55), 0 0 0 0 rgba(220,38,38,0.3); }
  50%      { box-shadow: 0 4px 20px rgba(220,38,38,0.55), 0 0 0 10px rgba(220,38,38,0); }
}
@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} }