body {
  background: #0d1223;
  overflow-x: hidden;
}

/* Prevent iOS auto-zoom */
input, textarea, select { font-size: 16px; }
a, button, [onclick] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ── TABS ── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #111827;
  border-bottom: 1px solid #1e2d4a;
  position: sticky; top: 0; z-index: 50;
}

.tab {
  padding: 16px;
  min-height: 52px;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border-bottom: 3px solid transparent;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tab.active {
  color: #fff;
  background: #162032;
  border-bottom-color: #22c55e;
}
.tab:active { opacity: 0.7; }

/* ── SEARCH ROW ── */
.search-row {
  display: flex;
  gap: 10px;
  padding: 14px 14px 10px;
  align-items: center;
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-box.full { flex: 1; }

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: #0d1223;
  border: 1.5px solid #22c55e;
  border-radius: 30px;
  padding: 13px 16px 13px 42px;
  color: #fff;
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}
.search-box input::placeholder { color: #4b5563; }
.search-box input:focus { border-color: #4ade80; }

.btn-add-games {
  background: linear-gradient(135deg, #c9a227, #f0c040);
  color: #1a0800;
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-height: 48px;
  min-width: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.btn-add-games:active { opacity: 0.8; transform: scale(0.97); }

/* ── GAME CARD ── */
.slider-area {
  padding: 6px 14px 0;
  min-height: 380px;
}

.game-card-detail {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  color: #111;
}

.game-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 12px;
}

.game-card-img {
  width: 80px; height: 80px;
  border-radius: 14px;
  object-fit: cover;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.game-card-meta { flex: 1; min-width: 0; }

.game-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dcfce7;
  color: #16a34a;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.game-card-name {
  font-size: 20px;
  font-weight: 800;
  color: #111;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-balance {
  font-size: 20px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}

.refresh-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-refresh:active { background: #333; transform: scale(0.97); }

.btn-star {
  background: none;
  border: 1.5px solid #d1d5db;
  color: #9ca3af;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  flex-shrink: 0;
  transition: all 0.18s cubic-bezier(.34,1.56,.64,1);
  -webkit-tap-highlight-color: transparent;
}
.btn-star:active { transform: scale(0.82); }

/* Favourited state */
.btn-star.is-fav {
  color: #f0c040;
  background: rgba(240,192,64,0.12);
  border-color: rgba(240,192,64,0.4);
  box-shadow: 0 0 12px rgba(240,192,64,0.35);
}

/* Star pop animation on toggle */
@keyframes starPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45) rotate(-10deg); }
  70%  { transform: scale(0.9) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.btn-star.pop { animation: starPop 0.4s cubic-bezier(.34,1.56,.64,1); }

.current-bal {
  font-size: 11px;
  color: #9ca3af;
  padding: 0 18px 12px;
  letter-spacing: 0.5px;
}

/* CREDENTIALS */
.creds-section {
  background: #f3f4f6;
  margin: 0 14px 12px;
  border-radius: 12px;
  overflow: hidden;
}

.cred-row-game {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid #e5e7eb;
  min-height: 52px;
}
.cred-row-game:last-of-type { border-bottom: none; }

.cred-icon { font-size: 16px; flex-shrink: 0; }

.cred-label-g {
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  width: 72px;
  flex-shrink: 0;
}

.cred-value-g {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: #111;
  font-family: monospace;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cred-copy, .cred-eye {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0;
  font-size: 16px;
  cursor: pointer;
  color: #6b7280;
  min-width: 44px; min-height: 44px; /* fixed tap target */
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}
.cred-copy:active, .cred-eye:active { background: #e5e7eb; }

.btn-reset-pass {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 0 14px 12px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-reset-pass:active { background: #333; transform: scale(0.98); }

/* ACTION BUTTONS */
.action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 14px 10px;
}

.btn-add-credits {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  touch-action: manipulation;
}
.btn-add-credits:active { opacity: 0.85; transform: scale(0.97); }

.btn-withdraw-credits {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  touch-action: manipulation;
}
.btn-withdraw-credits:active { opacity: 0.85; transform: scale(0.97); }

.btn-play-now-big {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 28px);
  margin: 0 14px 16px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 17px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 20px rgba(34,197,94,0.3);
  min-height: 56px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-play-now-big:active { transform: scale(0.98); box-shadow: 0 2px 10px rgba(34,197,94,0.2); }

/* PAGINATION */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 0 4px;
}

.pg-btn {
  width: 44px; height: 44px; /* was 36px — fixed */
  background: rgba(255,255,255,0.08);
  border: 1px solid #1e2d4a;
  color: #fff;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pg-btn:active { background: rgba(255,255,255,0.18); transform: scale(0.9); }

.pg-info {
  background: transparent;
  min-width: 60px;
  min-height: 20px;
  text-align: center;
  display: flex; align-items: center; justify-content: center;
}

.pg-hint {
  text-align: center;
  font-size: 12px;
  color: #4b5563;
  padding: 4px 0 16px;
}

/* AVAILABLE GAMES GRID */
.available-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 cols default (was 4) */
  gap: 10px;
  padding: 8px 12px 100px;
}

.avail-card {
  background: #111827;
  border: 1px solid #1e2d4a;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  text-align: center;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.avail-card:active { transform: scale(0.95); border-color: #22c55e; }
.avail-card.is-added { opacity: 0.85; }
.avail-card.highlighted { border-color: #f0c040; box-shadow: 0 0 0 2px rgba(240,192,64,0.4); }

.avail-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.avail-img {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.avail-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.25);
}

.avail-name {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  padding: 7px 4px 3px;
  line-height: 1.3;
}

.avail-already {
  font-size: 9px;
  font-weight: 700;
  color: #22c55e;
  padding-bottom: 7px;
  letter-spacing: 0.5px;
}

/* Create account popup overlay on card */
.avail-popup {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  gap: 7px;
  border-radius: 14px;
  z-index: 5;
}
.avail-popup.hidden { display: none; }

.btn-create-acct {
  background: #0f766e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  width: 85%;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  touch-action: manipulation;
}
.btn-create-acct:active { background: #0d9488; }

.btn-cancel-acct {
  background: #374151;
  color: #d1d5db;
  border: none;
  border-radius: 8px;
  padding: 10px 0;
  width: 85%;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  touch-action: manipulation;
}
.btn-cancel-acct:active { background: #4b5563; }

.hidden { display: none !important; }
.bnav-item.active { color: #f0c040 !important; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .available-grid { gap: 8px; padding: 6px 10px 100px; }
  .avail-name { font-size: 10px; padding: 5px 3px 2px; }
  .avail-badge { font-size: 8px; padding: 2px 5px; }
  .search-row { padding: 10px 10px 8px; gap: 8px; }
  .btn-add-games { padding: 0 12px; font-size: 13px; }
  .game-card-name { font-size: 18px; }
  .action-btns { gap: 8px; padding: 0 12px 10px; }
}

@media (max-width: 360px) {
  .available-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .game-card-top { padding: 14px 14px 10px; gap: 10px; }
  .game-card-img { width: 68px; height: 68px; }
}
