:root {
  --tab-offset: 74px;
}

#dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0 12px 12px;
  box-sizing: border-box;
}

#appContent {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #0b1020;
  color: #e8ecf1;
}

header {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-left: 4px;
  padding-right: 4px;
  position: sticky;
  top: 0;
  z-index: 400;
  background: #0b1020;
  padding-top: 10px;
  padding-bottom: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-title {
  margin: 0;
}

.app-logo {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5ac8fa, #43d1c4);
  color: #0b1020;
  font-weight: 800;
  font-size: 14px;
  align-items: center;
  justify-content: center;
}

.header-search {
  flex: 1 1 320px;
  max-width: 420px;
  min-width: 220px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #0f1628;
  border: 1px solid #1f2a47;
  border-radius: 10px;
  padding: 6px 10px;
}

button {
  padding: 6px 10px;
  margin-right: 4px;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid #2b3755;
  background: #0f1628;
  color: #e8ecf1;
}

button.primary {
  background: linear-gradient(90deg, #43d1c4, #5ac8fa);
  color: #0b1020;
  border: none;
  font-weight: 600;
}

button.primary:hover {
  filter: brightness(1.05);
}

button.active {
  background: #5ac8fa;
  color: #0b1020;
  border: none;
}

.cta-btn {
  width: auto;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.card {
  background: #12182c;
  border: 1px solid #1f2a47;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  overflow: hidden;
}

.thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  background: #0b1020;
  border: 1px solid #1f2a47;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.card h3 [data-title] {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.meta {
  font-size: 12px;
  color: #9fb3d1;
}

canvas {
  background: #0b1020;
  border-radius: 8px;
  padding: 6px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
}

a {
  color: #7fc7ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.pill {
  background: #1a233b;
  border: 1px solid #2b3755;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill button {
  padding: 2px 6px;
  font-size: 11px;
}

.heat-meter {
  margin-top: 6px;
}

.heat-track {
  position: relative;
  height: 12px;
  background: linear-gradient(90deg, #1f6feb 0%, #43d1c4 40%, #f5c452 70%, #ff5f6d 100%);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
}

.heat-track::after {
  content: '';
  position: absolute;
  inset: -8px 55% -8px -8px;
  background: radial-gradient(circle at 0% 50%, rgba(99, 179, 255, 0.24), transparent 55%);
  pointer-events: none;
  filter: blur(4px);
}

.heat-needle {
  position: absolute;
  top: -3px;
  width: 12px;
  height: 20px;
  border-radius: 999px;
  background: #f5c452;
  left: 50%;
  transform: translateX(-50%);
  transition: left 0.25s ease, background 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 14px rgba(245, 196, 82, 0.45);
}

.heat-needle.is-cold {
  filter: blur(1px);
  box-shadow: 0 0 14px rgba(99, 179, 255, 0.45);
}

.heat-needle.is-hot {
  box-shadow: 0 0 16px rgba(255, 95, 109, 0.65);
}

.heat-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #7e8ba3;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.heat-labels span[data-heat-label] {
  color: #e8ecf1;
  font-weight: 600;
}

.bonus-wrap {
  margin-top: 8px;
}

.bonus-track {
  position: relative;
  height: 12px;
  background: #0f1f2c;
  border: 1px solid #1f2a47;
  border-radius: 999px;
  overflow: hidden;
}

.bonus-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: #5a6278;
  transition: width 0.2s ease, background 0.2s ease;
}

.landing {
  max-width: 520px;
  margin: 80px auto;
  text-align: center;
}

.logo {
  font-size: 28px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-card {
  background: #12182c;
  border: 1px solid #1f2a47;
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}

.login-card input {
  padding: 10px 12px;
  width: 100%;
  max-width: 280px;
}

.tab-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  justify-content: space-between;
  position: static;
  background: transparent;
  padding: 4px 0 2px;
}

.avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1f2a47;
  border: 1px solid #3c465f;
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  position: relative;
  z-index: 1401;
  overflow: hidden;
  transition: all 0.2s ease;
}

.avatar-btn:hover {
  border-color: #5ac8fa;
  background: #2b3755;
}

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

.tab-group {
  display: inline-flex;
  background: #0f1628;
  border: 1px solid #1f2a47;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  height: auto;
  width: auto;
}

.tab-group .tab-btn {
  border: none;
  background: transparent;
  color: #9fb3d1;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 0 0 auto;
}

.tab-group .tab-btn:hover {
  color: #fff;
}

.tab-group .tab-btn.active {
  background: #1f2a47;
  color: #5ac8fa;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sort-wrap {
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-width: 156px;
  height: 44px;
}

.sort-group {
  display: inline-flex;
  gap: 6px;
  align-items: stretch;
  height: 100%;
}

.sort-btn {
  width: 44px;
  height: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #2b3755;
  background: #0f1628;
  color: #e8ecf1;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.sort-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.sort-btn.active {
  background: linear-gradient(135deg, #3aa7d6, #48c7c4);
  color: #0b1020;
  border: none;
}

.sort-btn:hover {
  filter: brightness(1.05);
}

.avatar-menu {
  position: absolute;
  top: 48px;
  right: 0;
  background: #12182c;
  border: 1px solid #1f2a47;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  min-width: 140px;
  z-index: 1400;
}

.avatar-menu button {
  width: 100%;
  text-align: left;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #0f1f2c;
  border: 1px solid #1f2a47;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #43d1c4, #5ac8fa);
  transition: width 0.2s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.modal {
  background: #12182c;
  border: 1px solid #1f2a47;
  border-radius: 10px;
  padding: 16px;
  width: 360px;
  max-width: 90vw;
}

.modal h4 {
  margin: 0 0 8px;
}

.modal .meta {
  margin-bottom: 6px;
}

.content-scroll {
  padding-bottom: 70px;
  /* Space for fixed ad footer */
}

@media (max-width: 768px) {
  body {
    padding-top: 0;
  }

  header {
    align-items: stretch;
    padding-left: 8px;
    padding-right: 8px;
    flex-direction: column;
    gap: 8px;
  }

  .app-bar {
    gap: 8px;
    flex-wrap: nowrap;
    /* Prevent wrapping in top bar */
  }

  .app-title {
    display: none;
  }

  .app-logo {
    display: inline-flex;
  }

  .header-search {
    flex: 1;
    /* Take available space */
    min-width: 0;
    max-width: none;
    width: auto;
    order: 0;
    /* Keep natural order */
  }

  .desktop-only {
    display: none;
  }

  .title-wrap {
    flex: 1;
    justify-content: space-between;
  }

  .avatar-btn {
    width: 36px;
    height: 36px;
  }

  :root {
    --tab-offset: 130px;
  }

  .tab-row {
    flex-wrap: nowrap;
    /* Force single line */
    gap: 6px;
    overflow-x: auto;
    /* Allow scroll if absolutely needed, but try to fit */
  }

  .tab-group {
    flex: 1;
    width: auto;
    overflow: visible;
    /* Let buttons shrink/grow */
    white-space: nowrap;
    justify-content: stretch;
  }

  .tab-group .tab-btn {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    /* Reduce padding to fit */
    font-size: 12px;
  }

  .sort-wrap {
    width: auto;
    flex: 0 0 auto;
  }

  .sort-group {
    width: auto;
  }

  .sort-btn {
    width: 36px;
    /* Narrower sort buttons */
    padding: 6px;
  }
}


.active-alert {
  background: linear-gradient(135deg, #f5c452, #f7da92);
  color: #0b1020;
  border: none;
  box-shadow: 0 0 10px rgba(245, 196, 82, 0.4);
}

.active-alert:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 14px rgba(245, 196, 82, 0.6);
}

/* Cart Styles */
.cart-float {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  cursor: pointer;
  animation: bounce 0.5s ease;
}

.cart-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5ac8fa, #43d1c4);
  box-shadow: 0 4px 12px rgba(67, 209, 196, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1020;
  position: relative;
}

.cart-icon svg {
  width: 28px;
  height: 28px;
}

.cart-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff5f6d;
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 2px solid #0b1020;
  min-width: 18px;
  text-align: center;
}

.cart-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f1628;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #1f2a47;
}

.cart-item-remove {
  color: #ff5f6d;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 10px;
  padding-top: 10px;
  border-top: 1px solid #1f2a47;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Jackpot Tiles */
.jackpot-tiles {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px;
  margin-top: 6px;
  width: 100%;
}

.jackpot-pill {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: auto !important;
  font-size: 11px;
  background: #0f1628;
  border: 1px solid #1f2a47;
  padding: 5px 8px;
  border-radius: 6px;
  color: #9fb3d1;
  white-space: nowrap;
}

.jackpot-pill span {
  font-weight: 700;
  color: #fff;
  margin-left: 4px;
  font-size: 12px;
}