:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-elevated: #1a1a1a;
  --text: #f5f5f5;
  --text-muted: #9e9e9e;
  --accent: #e53935;
  --accent-dark: #b71c1c;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --glass: rgba(20, 20, 20, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Exo 2", -apple-system, system-ui, Roboto, sans-serif;
  overflow-x: hidden;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 80px;
  position: relative;
}

/* Header style */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo {
  text-decoration: none;
  color: var(--text);
  font-family: 'Nosifer', cursive, sans-serif;
  font-size: 16px;
  letter-spacing: 1px;
}

.logo-accent {
  color: var(--accent);
}

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

.stars-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
}

.lang-emoji {
  font-size: 18px;
}

.avatar-wrap {
  position: relative;
  cursor: pointer;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  user-select: none;
}

.avatar-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

/* Category Toggle */
.category-toggle {
  display: flex;
  position: relative;
  background: var(--bg-elevated);
  border-radius: 30px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  height: 48px;
  align-items: center;
}

.category-toggle-slider {
  position: absolute;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--accent);
  border-radius: 26px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.category-toggle.to-sports .category-toggle-slider {
  transform: translateX(100%);
}

.category-toggle-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  outline: none;
  transition: color 0.2s;
}

.category-toggle-btn.is-active {
  color: #fff;
}

/* Category Panels */
.category-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Promo Carousel */
.promo-roulette {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

.promo-roulette-wrap {
  width: 100%;
}

.promo-roulette-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.promo-roulette-track::-webkit-scrollbar {
  display: none;
}

.promo-block {
  flex: 0 0 100%;
  scroll-snap-align: start;
  height: 160px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  display: block;
  text-decoration: none;
}

.promo-block-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
}

/* Blocks layout */
.block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.block-title {
  font-size: 18px;
  font-weight: 800;
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card Style (Casbot style premium) */
.game-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px;
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
  position: relative;
}

.game-card-v2:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.game-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.game-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.game-card-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-card-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.game-card-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.game-card-badge--fs {
  background: rgba(253, 224, 71, 0.2);
  color: #fde047;
}

.game-card-badge--pct {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.game-card-badge--promo {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.game-card-title {
  font-size: 15px;
  font-weight: 700;
}

.game-card-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
  text-decoration: none;
}

.game-card-action-btn svg {
  width: 18px;
  height: 18px;
}

.game-card-action-btn:hover {
  opacity: 0.9;
}

.game-card-bottom {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border-radius: 8px;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.game-card-promo-left {
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 10px;
  letter-spacing: 0.5px;
}

.game-card-promo-center {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  padding-left: 12px;
}

.game-card-copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  height: 100%;
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border);
}

.game-card-copy-btn:hover {
  color: #fff;
}

/* Footer style */
.footer {
  margin-top: 40px;
  padding: 24px 0 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-logo {
  font-family: 'Nosifer', cursive, sans-serif;
  font-size: 14px;
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.footer-sep {
  height: 1px;
  background: var(--border);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-18 {
  color: var(--accent);
  font-weight: 800;
  font-size: 16px;
}

.footer-disclaimer {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Popups & Modals */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.popup-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  padding: 24px 16px;
  z-index: 2;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-panel--small {
  margin: auto 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.popup-panel--large {
  max-height: 95vh;
}

.popup-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.popup-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.popup-close-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.admin-only-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.admin-only-btn.btn-danger {
  background: rgba(229, 57, 53, 0.2);
  color: #ef5350;
}

.admin-only-btn.btn-edit {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.popup-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.game-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.badges {
  display: flex;
  gap: 6px;
}

.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge.yellow {
  background: rgba(253, 224, 71, 0.2);
  color: #fde047;
}

.badge.green {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.badge.promo {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.game-title {
  font-size: 20px;
  font-weight: 800;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-value {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #e0e0e0;
}

.promo-row {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  height: 48px;
}

.promo-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 12px;
}

.promo-title {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 4px;
}

.promo-code {
  font-size: 14px;
  font-weight: 700;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  height: 100%;
  padding: 0 16px;
  cursor: pointer;
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.copy-btn:hover {
  color: #fff;
}

.play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #000;
  text-decoration: none;
  height: 52px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.play-btn:hover {
  opacity: 0.95;
}

/* Admin panel inside miniapp footer */
.footer-admin {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  z-index: 99;
}

.footer-admin-btn {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  height: 38px;
}

.footer-admin-btn:hover {
  background: rgba(255,255,255,0.05);
}

.footer-admin-btn.btn-logout {
  flex: 0 0 70px;
  border-color: rgba(229, 57, 53, 0.3);
  color: #ef5350;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
}

.req {
  color: var(--accent);
}

.action-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s;
}

.action-btn:hover {
  opacity: 0.9;
}

.action-btn.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.upload-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.error-msg {
  color: #ef5350;
  font-size: 12px;
  font-weight: 700;
}

/* Banner editor layout */
.banners-editor-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.banners-list-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.banner-editor-item {
  display: flex;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  position: relative;
}

.banner-editor-preview {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.banner-editor-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-del-banner {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #ef5350;
  font-size: 14px;
  cursor: pointer;
}

.tabs-header {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}

.tab-btn.active {
  color: #fff;
  border-bottom: 2px solid var(--accent);
}
