@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Kanit:wght@300;400;500;600&display=swap');

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Kanit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; }
.nav-right { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem; }

.wallet-pill {
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.mode-switch {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 999px;
}
.mode-switch button {
  border: none;
  background: transparent;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.mode-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.btn {
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1.5rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.search-group { display: flex; flex-wrap: wrap; gap: 0.6rem; flex: 1; }
.input, .select {
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  outline: none;
}
.input { min-width: 220px; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.game-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -10px rgba(15, 23, 42, 0.15);
}

.thumb-wrap { position: relative; aspect-ratio: 1 / 1; background: #e2e8f0; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge-featured {
  position: absolute; top: 8px; left: 8px;
  background: #0f172a; color: #fff;
  font-size: 0.7rem; padding: 2px 8px; border-radius: 999px;
}

.card-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.game-title { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-provider { font-size: 0.78rem; color: var(--muted); }

.rtp-row { margin-top: 2px; }
.rtp-label { display: flex; justify-content: space-between; font-size: 0.74rem; font-weight: 600; margin-bottom: 3px; }
.rtp-bar { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.rtp-fill { height: 100%; border-radius: 999px; transition: width 0.3s ease; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 1rem;
}
.modal-backdrop.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  padding: 1.5rem;
  box-shadow: 0 20px 30px -10px rgba(0,0,0,0.2);
}

.form-group { margin-bottom: 0.9rem; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; font-weight: 500; }
.form-group input, .form-group select { width: 100%; }

/* Fullscreen Game Player Modal */
.player-modal {
  position: fixed; inset: 0; background: #090d16; z-index: 100;
  display: flex; flex-direction: column;
}
.player-modal.hidden { display: none; }
.player-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.65rem 1.25rem; background: #111827; color: #f8fafc;
}
.iframe-box { position: relative; flex: 1; }
#gameFrame { width: 100%; height: 100%; border: none; display: block; }
.iframe-loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #cbd5e1; background: #090d16;
}
.iframe-loader.hidden { display: none; }

/* Admin Table & Bento Cards */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.bento-card .label { font-size: 0.82rem; color: var(--muted); }
.bento-card .value { font-size: 1.6rem; font-weight: 700; margin-top: 0.25rem; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 600; }
