:root {
  --primary: #762F8D;
  --primary-hover: #5e2471;
  --primary-light: rgba(118, 47, 141, 0.12);
  --primary-glow: rgba(118, 47, 141, 0.28);

  --secondary: #F2F2F2;
  --bg-main: #F2F2F2;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F2F2F2;
  --bg-board: #E4DFEA;
  --cell-empty: #F2F2F2;

  --tertiary: #F7A236;
  --tertiary-hover: #df8b21;
  --tertiary-light: rgba(247, 162, 54, 0.16);
  --tertiary-glow: rgba(247, 162, 54, 0.35);

  --text-main: #1F1627;
  --text-muted: #64596E;
  --border-subtle: rgba(118, 47, 141, 0.15);

  --accent: var(--primary);
  --accent-hover: var(--primary-hover);
  --accent-glow: var(--primary-glow);
  --gold: #d97706;
  --gold-bright: #c97309;
  --gold-glow: var(--tertiary-glow);

  --success: #0d9488;
  --warning: #F7A236;
  --danger: #dc2626;
  --shadow-lg: 0 14px 34px -10px rgba(118, 47, 141, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.bg-glow {
  position: fixed;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  top: -130px;
  left: -100px;
  background: var(--primary);
}

.bg-glow-2 {
  bottom: -130px;
  right: -100px;
  background: var(--tertiary);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Topbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  background: #ffffff;
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.brand-title {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* IDR Wallet Pill (Tertiary #F7A236) */
.coin-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--tertiary-light);
  border: 1px solid var(--tertiary);
  color: #9a5200;
  padding: 7px 13px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.coin-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--tertiary-glow);
}

.coin-delta {
  position: absolute;
  top: -12px;
  right: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  opacity: 0;
  pointer-events: none;
}

.coin-delta.pop {
  animation: floatUp 0.85s ease-out forwards;
}

.shop-cta-btn {
  padding: 7px 13px;
  border-radius: 11px;
  border: 1px solid var(--primary);
  background: linear-gradient(135deg, var(--primary), #9b42b8);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.shop-cta-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

/* Mode Tabs (4 Modes: 2048, Recall, Koleksi, Blackjack) */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 15px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.mode-tab.active {
  background: linear-gradient(135deg, var(--primary-light), var(--tertiary-light));
  border-color: var(--primary);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.tab-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--primary);
}

.mode-tab.active .tab-badge {
  background: var(--primary);
  color: #fff;
}

.tab-text {
  display: flex;
  flex-direction: column;
}

.tab-text strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.tab-text small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Views */
.game-view {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.game-view.active {
  display: flex;
}

/* HUD Bar */
.hud-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
}

.score-cards {
  display: flex;
  gap: 8px;
}

.score-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px 12px;
  min-width: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.score-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 800;
}

.accent-text {
  color: var(--primary);
}

.gold-text {
  color: #b86200;
}

.score-delta {
  position: absolute;
  top: -10px;
  right: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary);
  opacity: 0;
  pointer-events: none;
}

.score-delta.pop {
  animation: floatUp 0.75s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(6px); }
  100% { opacity: 0; transform: translateY(-16px); }
}

.tactical-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.size-selector,
.powerup-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.cashout-chip {
  background: var(--tertiary-light);
  border-color: var(--tertiary);
  color: #9a5200;
}

.cashout-chip:hover {
  background: var(--tertiary);
  color: #fff;
}

.tool-btn {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.tool-btn:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.tool-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.skill-btn {
  background: var(--primary-light);
  border-color: rgba(118, 47, 141, 0.35);
  color: var(--primary);
}

.skill-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.gold-btn {
  background: var(--tertiary);
  color: #1F1627;
  border: 1px solid var(--tertiary-hover);
  box-shadow: 0 4px 12px var(--tertiary-glow);
}

.gold-btn:hover:not(:disabled) {
  background: var(--tertiary-hover);
  color: #fff;
}

.danger-btn {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.3);
}

.badge-count {
  background: rgba(118, 47, 141, 0.15);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

.primary-btn .badge-count,
.skill-btn:hover .badge-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Info banners & instructions */
.info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--tertiary-light);
  border: 1px solid var(--tertiary);
  color: var(--text-main);
  font-size: 0.85rem;
}

.ai-banner {
  background: var(--primary-light);
  border-color: var(--primary);
}

.hidden {
  display: none !important;
}

.mini-btn {
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  background: var(--tertiary);
  color: #1F1627;
  font-weight: 700;
  cursor: pointer;
}

.instructions-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 10px 14px;
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.instructions-card strong {
  color: var(--primary);
}

/* Board Container */
.board-container {
  position: relative;
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
}

/* 2048 Board */
.board-2048 {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-board);
  border: 2px solid var(--border-subtle);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  touch-action: none;
  outline: none;
}

.board-2048.grid-4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.board-2048.grid-5 {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 8px;
  padding: 10px;
}

.tile-cell {
  background: var(--cell-empty);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1.65rem;
  position: relative;
  transition: transform 0.14s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.board-2048.grid-5 .tile-cell {
  font-size: 1.3rem;
  border-radius: 10px;
}

.tile-cell.pop-in {
  animation: tileSpawn 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.tile-cell.merged {
  animation: tileMerge 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tile-cell.swap-selectable {
  cursor: pointer;
  outline: 2px dashed var(--tertiary);
}

.tile-cell.swap-selected {
  outline: 3px solid var(--primary);
  transform: scale(0.92);
}

@keyframes tileSpawn {
  0% { transform: scale(0.3); opacity: 0.2; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes tileMerge {
  0% { transform: scale(1); }
  50% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

/* 2048 Tile Colors Harmonized with #762F8D (Primary), #F2F2F2 (Secondary), #F7A236 (Tertiary) */
.tile-2    { background: #FFFFFF; color: #3B2847; border: 1px solid rgba(118, 47, 141, 0.16); }
.tile-4    { background: #F5E8FA; color: #5C2270; border: 1px solid rgba(118, 47, 141, 0.25); }
.tile-8    { background: #FBD39D; color: #5A3200; }
.tile-16   { background: #F9BA66; color: #3D2000; }
.tile-32   { background: #F7A236; color: #FFFFFF; box-shadow: 0 4px 10px rgba(247, 162, 54, 0.35); }
.tile-64   { background: #E08212; color: #FFFFFF; box-shadow: 0 4px 12px rgba(224, 130, 18, 0.4); }
.tile-128  { background: #9B4BB5; color: #FFFFFF; font-size: 1.45rem; }
.tile-256  { background: #883AA1; color: #FFFFFF; font-size: 1.45rem; box-shadow: 0 0 14px rgba(118, 47, 141, 0.35); }
.tile-512  { background: #762F8D; color: #FFFFFF; font-size: 1.45rem; box-shadow: 0 0 18px rgba(118, 47, 141, 0.5); }
.tile-1024 { background: linear-gradient(135deg, #762F8D, #C45161); color: #FFFFFF; font-size: 1.2rem; box-shadow: 0 0 20px rgba(118, 47, 141, 0.55); }
.tile-2048 { background: linear-gradient(135deg, #762F8D, #F7A236); color: #FFFFFF; font-size: 1.2rem; box-shadow: 0 0 24px rgba(247, 162, 54, 0.65); }
.tile-super { background: linear-gradient(135deg, #4A195B, #F7A236); color: #FFFFFF; font-size: 1.05rem; box-shadow: 0 0 26px rgba(118, 47, 141, 0.7); }

/* Board Overlays */
.board-overlay {
  position: absolute;
  inset: 0;
  background: rgba(31, 22, 39, 0.72);
  backdrop-filter: blur(6px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.overlay-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.game-footer-tips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==================== MODE 2: NUMBER RECALL BOARD ==================== */
.recall-board {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-board);
  border: 2px solid var(--border-subtle);
  border-radius: 20px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 8px;
  box-shadow: var(--shadow-lg);
}

.recall-cell {
  background: var(--cell-empty);
  border: 2px solid transparent;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.recall-cell.active-num {
  background: var(--bg-surface);
  border-color: var(--primary);
  color: var(--primary);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(118, 47, 141, 0.12);
}

.recall-cell.active-num:hover {
  transform: scale(1.03);
}

.recall-cell.masked {
  background: var(--primary);
  color: transparent;
  cursor: pointer;
  box-shadow: 0 0 14px var(--primary-glow);
}

.recall-cell.xray-peek {
  background: var(--tertiary);
  border-color: var(--primary);
  color: #1F1627;
  box-shadow: 0 0 18px var(--tertiary-glow);
}

.recall-cell.correct {
  background: rgba(13, 148, 136, 0.16);
  border-color: var(--success);
  color: var(--success);
  pointer-events: none;
}

.recall-cell.wrong {
  background: rgba(220, 38, 38, 0.25);
  border-color: var(--danger);
  color: var(--danger);
  animation: shake 0.35s ease;
}

.timer-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--primary);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ==================== MODALS (SKILL SHOP, LEADERBOARD, AUTH & DATABASE) ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 22, 39, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

.modal-wide {
  max-width: 680px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  font-size: 1.15rem;
  color: var(--primary);
}

.modal-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.shop-wallet-badge {
  margin-left: auto;
  background: var(--tertiary-light);
  border: 1px solid var(--tertiary);
  color: #9a5200;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 0.92rem;
}

.converter-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--tertiary-light), var(--primary-light));
  border: 1px solid var(--tertiary);
}

.converter-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.converter-info strong {
  font-size: 0.9rem;
}

.converter-info span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.shop-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shop-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.shop-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.shop-card:hover {
  border-color: var(--primary);
}

.shop-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.shop-card-title {
  font-size: 0.88rem;
  font-weight: 800;
}

.shop-card-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
  white-space: nowrap;
}

.shop-card-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.38;
}

.shop-buy-btn {
  width: 100%;
  justify-content: center;
  padding: 8px 12px;
}

/* Database & Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

/* History Table */
.history-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-header h3 {
  font-size: 0.88rem;
}

.db-actions {
  display: flex;
  gap: 6px;
}

.import-label {
  cursor: pointer;
}

.history-table-wrap {
  max-height: 190px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-elevated);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.history-table th,
.history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.history-table th {
  background: var(--bg-surface);
  color: var(--primary);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.lb-row-me {
  background: var(--tertiary-light);
}

/* Auth & Supabase Modal Form */
.auth-top-btn.logged-in {
  background: rgba(13, 148, 136, 0.14);
  border-color: var(--success);
  color: var(--success);
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--bg-elevated);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  padding: 9px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 0.88rem;
  margin-top: 4px;
}

.auth-alert {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
  border: 1px solid var(--border-subtle);
}

.auth-alert.loading {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.auth-alert.success {
  background: rgba(13, 148, 136, 0.14);
  border-color: var(--success);
  color: var(--success);
}

.auth-alert.error {
  background: rgba(220, 38, 38, 0.12);
  border-color: var(--danger);
  color: var(--danger);
}

.auth-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.form-input:focus {
  border-color: var(--primary);
  background: #ffffff;
}

.inline-input-row {
  display: flex;
  gap: 8px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast-item {
  background: var(--bg-surface);
  border: 2px solid var(--primary);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== HALAMAN KOLEKSI & BLIND BOX 2D ==================== */
.color-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  border: 1px solid rgba(31, 22, 39, 0.25);
}

.gacha-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), #9b42b8 60%, var(--tertiary));
  color: #fff;
  box-shadow: 0 14px 34px -10px var(--primary-glow);
  overflow: hidden;
}

.gacha-hero h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.gacha-hero .modal-subtitle {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 12px;
}

.gacha-hero-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.gacha-open-btn {
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 13px;
}

.gacha-rates {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.gacha-rates ul {
  list-style: none;
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 4px 16px;
}

.gacha-rates li {
  display: flex;
  align-items: center;
}

.rate-val {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
}

/* Kotak Blind Box 2D (CSS) */
.blindbox-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 190px;
}

.blindbox {
  position: relative;
  width: 140px;
  height: 140px;
  animation: boxFloat 2.6s ease-in-out infinite;
}

.blindbox-body {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 105px;
  border-radius: 14px;
  background: linear-gradient(160deg, #5e2471, #3d1450);
  border: 3px solid #fff;
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.blindbox-body::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 100%;
  background: var(--tertiary);
}

.blindbox-body span {
  position: relative;
  z-index: 1;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blindbox-lid {
  position: absolute;
  top: 18px;
  left: -8px;
  width: calc(100% + 16px);
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(160deg, #883aa1, #5e2471);
  border: 3px solid #fff;
  z-index: 2;
}

.blindbox-lid::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 100%;
  background: var(--tertiary);
}

.blindbox-lid::after {
  content: '🎀';
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
}

.blindbox.shaking {
  animation: boxShake 0.12s linear infinite;
}

.blindbox.shaking .blindbox-lid {
  animation: lidPop 1.4s ease-in forwards;
}

@keyframes boxFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes boxShake {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-5px, 1px) rotate(-6deg); }
  50% { transform: translate(4px, -2px) rotate(5deg); }
  75% { transform: translate(-3px, 2px) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

@keyframes lidPop {
  0%, 75% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(-40px) rotate(-18deg); opacity: 0.6; }
}

/* Ringkasan Koleksi & Favorit */
.collection-summary {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px;
}

.favorite-slot {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  min-height: 120px;
}

.fav-art {
  width: 84px;
  height: 104px;
  flex-shrink: 0;
}

.fav-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fav-info small {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--tertiary-hover);
}

.fav-info strong {
  font-size: 1.15rem;
  color: var(--primary);
}

.fav-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.fav-empty {
  width: 100%;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.collection-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
}

.progress-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 99px;
  background: var(--bg-board);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--tertiary));
  transition: width 0.4s ease;
}

/* Kartu Album Koleksi */
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.collection-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.collection-card:not(.locked):hover {
  transform: translateY(-4px);
  border-color: var(--char-color);
}

.collection-card.favorite {
  border-color: var(--tertiary);
  box-shadow: 0 10px 26px var(--tertiary-glow);
}

.collection-card .rarity-pill {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
}

.owned-count {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  background: var(--primary);
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
}

.char-art {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 13px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #ffffff, #efe8f5 70%);
  border: 1px solid var(--border-subtle);
}

.char-art::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: var(--char-color);
}

.char-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.char-art-fallback {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--char-color);
}

.char-art.silhouette img {
  filter: brightness(0) opacity(0.22);
}

.collection-card.locked .char-art::before {
  content: '?';
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--primary);
}

.collection-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.collection-card-info strong {
  font-size: 1rem;
  color: var(--text-main);
}

.collection-card-info small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

.collection-card-info p {
  margin-top: 4px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.rarity-pill {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 99px;
  color: #fff;
  letter-spacing: 0.02em;
}

.rarity-unyu { background: linear-gradient(135deg, #1E3A8A, #831843, #F59E0B); color: #fff; font-weight: 800; box-shadow: 0 0 12px rgba(99, 102, 241, 0.45); }
.rarity-mythic { background: linear-gradient(135deg, #FFDF00, #F59E0B, #DC2626); color: #1F1627; font-weight: 800; box-shadow: 0 0 14px rgba(245, 158, 11, 0.6); }
.rarity-legendary { background: linear-gradient(135deg, #F7A236, #d97706); }
.rarity-epic { background: linear-gradient(135deg, #762F8D, #9b42b8); }
.rarity-rare { background: linear-gradient(135deg, #0ea5e9, #2563eb); }

/* Gacha Action Buttons */
.gacha-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.gacha-6x-btn {
  background: linear-gradient(135deg, #7C3AED, #4F46E5) !important;
  color: #fff !important;
  border-color: rgba(124, 58, 237, 0.4) !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
  font-weight: 700;
}

.gacha-6x-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.5);
}

.badge-discount {
  font-size: 0.72rem;
  background: #EF4444;
  color: #fff;
  padding: 1px 7px;
  border-radius: 99px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-left: 4px;
}

/* Modal Reveal Gacha */
.reveal-card {
  position: relative;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  text-align: center;
  transition: max-width 0.3s ease;
  padding: 32px 18px 18px;
  scrollbar-width: thin;
}

.reveal-card::-webkit-scrollbar {
  width: 6px;
}
.reveal-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.reveal-close-x {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 20;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-color, #fff);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reveal-close-x:hover {
  background: #EF4444;
  border-color: #EF4444;
  color: #fff;
  transform: scale(1.1);
}

.reveal-card .overlay-actions {
  position: sticky;
  bottom: -4px;
  background: var(--bg-card, #1A1325);
  padding: 10px 0 2px;
  margin-top: 10px;
  z-index: 10;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.reveal-card.multi-reveal {
  max-width: 660px;
  width: 95vw;
}

.multi-reveal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin: 10px 0 16px;
}

@media (max-width: 580px) {
  .multi-reveal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.multi-reveal-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
  animation: revealPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.multi-reveal-item:hover {
  transform: translateY(-3px);
  border-color: var(--char-color, var(--primary));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.multi-reveal-item .char-art {
  width: 100px;
  height: 133px;
  border-radius: 8px;
  margin: 2px 0;
}

.multi-reveal-item .multi-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-color, #fff);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.multi-reveal-item .reveal-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
}

.reveal-body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reveal-rays {
  position: absolute;
  top: 40px;
  left: 50%;
  width: 520px;
  height: 520px;
  margin-left: -260px;
  background: repeating-conic-gradient(var(--char-color) 0deg 10deg, transparent 10deg 24deg);
  opacity: 0.16;
  border-radius: 50%;
  animation: raysSpin 12s linear infinite;
  pointer-events: none;
}

@keyframes raysSpin {
  to { transform: rotate(360deg); }
}

.reveal-tag {
  position: relative;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--primary-light);
  color: var(--primary);
}

.reveal-tag.is-new {
  background: var(--tertiary);
  color: #1F1627;
}

.reveal-art {
  width: 210px;
  animation: revealPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 14px 30px var(--primary-glow);
}

@keyframes revealPop {
  0% { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.reveal-name {
  position: relative;
  font-size: 1.4rem;
  color: var(--primary);
}

.reveal-title {
  position: relative;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==================== DEDICATED PROFILE PAGE (/profile/{username}) ==================== */
.profile-shell {
  width: 100%;
  overflow-x: hidden;
}

.profile-back-btn {
  text-decoration: none;
  padding: 9px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.profile-hero-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.prof-avatar-box {
  width: 130px;
  height: 160px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, #ffffff, #ede7f3);
  border: 3px solid var(--primary);
  overflow: hidden;
  box-shadow: 0 10px 24px var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.prof-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prof-avatar-fallback {
  font-size: 3.5rem;
}

.profile-meta-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prof-username-text {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-status-tag {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.auth-status-tag.cloud-active {
  background: rgba(13, 148, 136, 0.14);
  color: var(--success);
  border: 1px solid var(--success);
}

.auth-status-tag.guest {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.prof-sub-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.profile-url-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 12px;
  margin: 4px 0;
  width: 100%;
}

.url-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.url-copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.url-text {
  flex: 1;
  min-width: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--primary);
  user-select: all;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.copy-url-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.own-profile-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.prof-rename-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.prof-rename-row .form-input {
  flex: 1;
  min-width: 0;
}

.prof-rename-row .tool-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.prof-account-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.stats-grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

.prof-section-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prof-collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

.prof-history-section {
  margin-top: 4px;
}

.prof-history-wrap {
  max-height: 280px;
}

@media (max-width: 860px) {
  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .profile-shell {
    padding: 12px 12px 28px;
    gap: 12px;
  }
  .profile-topbar {
    padding: 10px 12px;
    border-radius: 14px;
  }
  .profile-topbar .brand {
    gap: 10px;
    min-width: 0;
    flex: 1;
  }
  .profile-topbar .brand-logo-img {
    width: 42px;
    height: 42px;
  }
  .profile-topbar .brand-title {
    font-size: 1.05rem;
  }
  .profile-topbar .brand-subtitle {
    font-size: 0.68rem;
  }
  .profile-topbar .topbar-actions {
    width: 100%;
  }
  .profile-back-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 9px 12px;
    font-size: 0.82rem;
  }
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stats-grid-6 .stat-box {
    padding: 10px 8px;
  }
  .stats-grid-6 .stat-num {
    font-size: 0.96rem;
    word-break: break-word;
  }
  .stats-grid-6 .stat-title {
    font-size: 0.7rem;
  }
  .profile-hero-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 16px 14px;
    border-radius: 18px;
  }
  .prof-avatar-box {
    width: 108px;
    height: 132px;
    border-radius: 14px;
  }
  .profile-meta-info {
    width: 100%;
    align-items: center;
  }
  .profile-title-row {
    justify-content: center;
    gap: 8px;
  }
  .prof-username-text {
    font-size: 1.32rem;
  }
  .profile-url-pill {
    text-align: left;
    padding: 8px 10px;
  }
  .url-copy-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .url-text {
    font-size: 0.72rem;
  }
  .prof-rename-row {
    flex-direction: column;
    align-items: stretch;
  }
  .prof-rename-row .form-input,
  .prof-rename-row .tool-btn {
    width: 100%;
    min-height: 40px;
  }
  .prof-account-btns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .prof-account-btns .tool-btn {
    width: 100%;
    min-height: 40px;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  .prof-collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .prof-collection-grid .collection-card {
    padding: 9px;
    border-radius: 14px;
    gap: 7px;
  }
  .prof-collection-grid .collection-card .rarity-pill {
    top: 13px;
    left: 13px;
    font-size: 0.62rem;
    padding: 2px 6px;
  }
  .prof-collection-grid .owned-count {
    top: 13px;
    right: 13px;
    font-size: 0.66rem;
    padding: 2px 6px;
  }
  .prof-collection-grid .collection-card-info strong {
    font-size: 0.84rem;
  }
  .prof-collection-grid .collection-card-info small {
    font-size: 0.68rem;
  }
}

@media (max-width: 380px) {
  .prof-account-btns {
    grid-template-columns: 1fr;
  }
  .url-copy-row {
    flex-direction: column;
    align-items: stretch;
  }
  .copy-url-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .gacha-hero,
  .collection-summary {
    grid-template-columns: 1fr;
  }
  .gacha-hero-info {
    align-items: stretch;
  }
  .collection-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================== BLACKJACK CASINO TABLE & MULTIPLAYER (1-4P) ==================== */
.chip-pill {
  background: rgba(247, 162, 54, 0.16);
  border: 1px solid var(--tertiary);
  color: #8c4700;
}

.bj-hud-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bj-hud-left,
.bj-hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bj-wallet-card {
  min-width: 140px;
  padding: 6px 14px;
}

.score-sub-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.table-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-subtle);
}

.min-bet-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.bj-table-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.bj-status-banner {
  background: linear-gradient(135deg, rgba(118, 47, 141, 0.12), rgba(247, 162, 54, 0.16));
  border-color: var(--primary);
  color: var(--text-main);
  font-weight: 700;
  text-align: center;
  justify-content: center;
}

/* Meja Kasino Green Felt Oval */
.casino-table-wrap {
  position: relative;
  width: 100%;
  border-radius: 28px;
  padding: 14px;
  background: linear-gradient(145deg, #2d1838, #180d20);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), inset 0 2px 6px rgba(255, 255, 255, 0.12);
  border: 4px solid #4a2d11;
}

.casino-table {
  position: relative;
  width: 100%;
  min-height: 480px;
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 25%, #0f5132 0%, #0a3622 70%, #062316 100%);
  border: 2px dashed rgba(247, 162, 54, 0.45);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  overflow: hidden;
}

/* Dealer Station */
.dealer-station {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.dealer-avatar-badge {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--tertiary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 99px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.cards-row {
  display: flex;
  gap: 8px;
  min-height: 88px;
  align-items: center;
  justify-content: center;
}

.dealer-score-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: #f7a236;
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 10px;
  border-radius: 99px;
}

.table-felt-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: rgba(247, 162, 54, 0.45);
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  margin: -6px 0;
}

/* 4 Kursi Pemain Meja Blackjack */
.seats-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  z-index: 2;
}

.bj-seat {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.bj-seat.seat-human {
  border-color: var(--tertiary);
  background: rgba(24, 16, 32, 0.85);
}

.bj-seat.seat-current-turn {
  border-color: #ffd700;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.65);
  transform: translateY(-4px);
}

.bj-seat.seat-empty {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.22);
  justify-content: center;
  opacity: 0.75;
}

.empty-seat-circle {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.4);
  margin: 6px 0;
}

.seat-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  gap: 4px;
}

.seat-badge {
  font-family: 'JetBrains Mono', monospace;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.66rem;
}

.seat-chip-count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: #ffd700;
  font-size: 0.7rem;
}

.seat-remove-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 2px;
}

.seat-remove-btn:hover {
  color: var(--danger);
}

.seat-avatar {
  font-size: 1.4rem;
  margin: -2px 0;
}

.seat-player-name {
  font-size: 0.76rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.seat-bet-spot {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seat-bet-chip {
  background: linear-gradient(135deg, #f7a236, #b45309);
  color: #1f1627;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.bet-empty {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.35);
}

.seat-cards {
  display: flex;
  gap: 4px;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.seat-score-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
}

.seat-status-pill {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.1);
  width: 100%;
  text-align: center;
}

.seat-status-pill.status-won {
  background: rgba(16, 185, 129, 0.28);
  border: 1px solid #10b981;
  color: #10b981;
}

.seat-status-pill.status-lost {
  background: rgba(239, 68, 68, 0.28);
  border: 1px solid #ef4444;
  color: #ef4444;
}

.seat-status-pill.status-push {
  background: rgba(245, 158, 11, 0.28);
  border: 1px solid #f59e0b;
  color: #f59e0b;
}

.seat-status-pill.status-blackjack {
  background: linear-gradient(135deg, #ffd700, #f59e0b);
  color: #1f1627;
  font-weight: 900;
}

.seat-status-pill.status-busted {
  background: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.seat-status-pill.status-active-turn {
  background: #f7a236;
  color: #1f1627;
  font-weight: 900;
  animation: pulseSeat 1s infinite alternate;
}

@keyframes pulseSeat {
  from { opacity: 0.85; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1.02); }
}

/* Kartu Blackjack Fisik */
.bj-card {
  width: 52px;
  height: 74px;
  background: #ffffff;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  user-select: none;
  animation: cardDeal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bj-card.card-red {
  color: #dc2626;
}

.bj-card.card-black {
  color: #0f172a;
}

.bj-card-back {
  background: repeating-linear-gradient(45deg, #762f8d, #762f8d 6px, #5c2270 6px, #5c2270 12px);
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.6rem;
}

.card-corner {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-corner small {
  font-size: 0.65rem;
}

.card-bottom {
  transform: rotate(180deg);
}

.card-suit-center {
  font-size: 1.3rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.9;
}

@keyframes cardDeal {
  from { transform: translateY(-30px) scale(0.6); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Action Control Bars di Bawah Meja */
.bj-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
}

.bet-chip-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bet-prompt-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.bj-bet-chip-btn {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.bj-bet-chip-btn:hover {
  border-color: var(--tertiary);
  transform: translateY(-2px);
}

.bj-bet-chip-btn.active {
  background: var(--tertiary);
  color: #1f1627;
  border-color: var(--tertiary-hover);
  box-shadow: 0 4px 12px var(--tertiary-glow);
}

.bj-big-deal-btn {
  padding: 10px 24px;
  font-size: 0.92rem;
  border-radius: 12px;
}

.bj-play-btn {
  padding: 11px 22px;
  font-size: 0.92rem;
  border-radius: 12px;
}

.stand-btn {
  background: #475569;
  color: #ffffff;
  border-color: #334155;
}

.stand-btn:hover {
  background: #334155;
}

/* Preset Buttons Modal Tukar Chip */
.chip-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.buy-chip-preset {
  justify-content: center;
  padding: 10px 8px;
  font-size: 0.8rem;
}

/* Responsive Meja */
@media (max-width: 760px) {
  .mode-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .seats-container {
    grid-template-columns: repeat(2, 1fr);
  }
  .bj-card {
    width: 44px;
    height: 64px;
  }
}

@media (max-width: 640px) {
  .mode-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .shop-grid,
  .stats-grid-4 {
    grid-template-columns: 1fr;
  }
  .hud-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .score-cards {
    justify-content: space-between;
  }
  .score-card {
    flex: 1;
  }
  .tactical-controls {
    align-items: stretch;
  }
  .size-selector, .powerup-bar {
    justify-content: center;
  }
  .tile-cell {
    font-size: 1.35rem;
  }
  .modal-content {
    padding: 16px;
    border-radius: 16px;
    gap: 12px;
  }
  .inline-input-row {
    flex-direction: column;
    align-items: stretch;
  }
  .auth-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .auth-actions .tool-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }
  .history-table th,
  .history-table td {
    padding: 7px 8px;
    font-size: 0.72rem;
    white-space: nowrap;
  }
}
