:root {
  --bg: #0b0d40;
  --surface: #0f193d;
  --card: #162246;
  --card-hi: #1a2a5e;
  --border: #22305f;
  --border-hi: #2f4380;
  --text: #f9fafb;
  --muted: #b6bfe0;
  --muted-2: #8f9ac4;
  --accent: #3b82f6;
  --accent-ink: #fff;
  --accent-2: #61c0da;
  --coin: #f5c451;
  --danger: #ff9aa8;
  --danger-bg: #3a1f24;
  --warn-bg: #2a3a6b;
  --font-display: "Sora", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* ========================================================
   CUSTOM SCROLLBAR DESIGN SYSTEM
   Aligns seamlessly with dark neon-navy & electric blue palette
   ======================================================== */
/* Modern standard (Firefox 64+, Chrome 121+) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

/* WebKit & Blink browsers (Chrome, Edge, Safari, Mobile Webviews) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 999px;
  border: 2px solid var(--bg); /* Floating pill effect with inset margin */
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent); /* Electric blue glow on hover */
}

::-webkit-scrollbar-thumb:active {
  background: var(--accent-2); /* Cyan highlight when active/dragging */
}

::-webkit-scrollbar-corner {
  background: transparent;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
}

input {
  font: inherit;
}

a {
  color: var(--accent);
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

/* App Container - Clamped to 100% width with no overflow */
.app {
  width: 100%;
  max-width: 1440px;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: clip;
}

/* Ambient glow constrained so it never causes horizontal scroll */
.glow {
  opacity: 0.45;
  filter: blur(70px);
  pointer-events: none;
  background: #1f2f7a;
  border-radius: 999px;
  width: min(340px, 80vw);
  height: min(340px, 80vw);
  position: absolute;
  top: -120px;
  right: 0;
  z-index: 0;
}

/* Header & Navigation */
.head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 8px;
  position: relative;
  width: 100%;
  z-index: 2;
}

.head__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.head__row .search {
  flex: 1 1 100% !important;
  width: 100%;
}

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

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  background: transparent;
  filter: drop-shadow(0 2px 8px rgba(97, 192, 218, 0.3));
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand__mark:hover {
  transform: scale(1.08);
}

.brand__title {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desknav {
  display: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.desknav button {
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.desknav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.desknav button.on {
  color: var(--accent-2);
  font-weight: 700;
}

/* Search input */
.search {
  background: var(--card);
  border: 1px solid var(--border-hi);
  height: 44px;
  color: var(--muted-2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-width: 0;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.search:focus-within {
  border-color: var(--accent);
}

.search input {
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.search input::placeholder {
  color: var(--muted-2);
}

/* Toolbar & Category Chips */
.toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  min-width: 0;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  white-space: nowrap;
  background: var(--card);
  border: 1px solid var(--border-hi);
  color: var(--muted);
  border-radius: 10px;
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

.select {
  background: var(--card);
  border: 1px solid var(--border-hi);
  height: 40px;
  color: var(--muted);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  align-self: flex-end;
  outline: 0;
  cursor: pointer;
  max-width: 100%;
}

/* Main Content Area */
.main {
  flex: 1;
  padding: 8px clamp(12px, 3vw, 48px) 96px;
  position: relative;
  width: 100%;
  min-width: 0;
}

/* Responsive Grid System */
.list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

/* Tablet: 2 Columns */
@media (min-width: 600px) and (max-width: 959px) {
  .list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Desktop: 3 Columns */
@media (min-width: 960px) {
  .list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

.list--2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

@media (min-width: 640px) {
  .list--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Featured Offer Card */
.featured {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--border-hi);
  text-align: left;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding: clamp(14px, 3vw, 20px);
  content-visibility: auto;
  contain-intrinsic-size: 0 160px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.featured:hover {
  border-color: var(--accent);
}

.featured:active {
  transform: scale(0.995);
}

.featured__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.featured__who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.featured__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.featured__reward {
  font-family: var(--font-display);
  color: var(--accent-2);
  letter-spacing: -0.02em;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
}

/* Standard Offer Row Card */
.row {
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  content-visibility: auto;
  contain-intrinsic-size: 0 72px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.row:hover {
  border-color: var(--border-hi);
  background: var(--card);
}

.row:active {
  transform: scale(0.99);
}

.row__text {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.row__name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.row__sub {
  color: var(--muted-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__reward {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}

/* UI Elements */
.pill {
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  white-space: nowrap;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.ptag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag {
  background: var(--border-hi);
  color: #cdd6f4;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.oimg {
  object-fit: cover;
  border: 1px solid var(--border);
  background: #1b2340;
  aspect-ratio: 1 / 1;
  flex: none;
}

.oimg--empty {
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section {
  color: var(--muted-2);
  letter-spacing: 0.08em;
  padding: 6px 0 0;
  font-size: 11px;
  font-weight: 700;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: clamp(40px, 8vh, 80px) 20px;
  color: var(--muted);
}

.state b {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
}

.retry-btn {
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.retry-btn:hover {
  opacity: 0.92;
}

.retry-btn:active {
  transform: scale(0.97);
}

.spinner {
  border: 3px solid var(--border-hi);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  animation: 1s linear infinite spin;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--surface), var(--card), var(--surface));
  background-size: 200% 100%;
  border-radius: 16px;
  height: 72px;
  animation: 1.4s infinite shimmer;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* Bottom Navigation Bar (Mobile / Webview) */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15, 25, 61, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav button {
  color: var(--muted-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 64px;
  min-height: 44px;
  font-size: 11px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.nav button.on {
  color: var(--accent-2);
  font-weight: 700;
}

/* Modal Overlay & Bottom Sheet */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 6, 16, 0.76);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden;
  padding: 0;
}

.sheet {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  max-height: 94vh;
  position: relative;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet__glow {
  opacity: 0.4;
  filter: blur(70px);
  pointer-events: none;
  background: #1f3f8a;
  border-radius: 999px;
  width: 320px;
  height: 320px;
  position: absolute;
  top: -140px;
  left: -60px;
}

.sheet__head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 12px;
  position: relative;
}

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

.iconbtn {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.iconbtn:hover {
  background: var(--card-hi);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.hero h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  word-break: break-word;
}

.hero p {
  color: var(--muted);
  max-width: 360px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.stats {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.stats small {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 600;
  display: block;
}

.stats b {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  display: block;
}

.sheet__body {
  padding: 0 18px 12px;
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

.sheet__body::-webkit-scrollbar {
  width: 5px;
}

.sheet__body::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

.sheet__body::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 999px;
}

.sheet__body::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.steps {
  display: flex;
  flex-direction: column;
}

.step {
  display: flex;
  gap: 14px;
}

.step__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
}

.step__n {
  background: var(--card);
  border: 2px solid var(--border-hi);
  width: 28px;
  height: 28px;
  color: var(--muted);
  font-family: var(--font-display);
  border-radius: 999px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.step__n.first {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.step__line {
  background: var(--border-hi);
  flex: 1;
  width: 2px;
}

.step__main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0 18px;
  min-width: 0;
}

.step__name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.step__reward {
  font-family: var(--font-display);
  color: var(--accent-2);
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}

.more {
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 8px 42px;
  font-size: 13px;
  font-weight: 700;
}

.sheet__foot {
  padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.cta {
  background: var(--accent);
  height: 52px;
  color: var(--accent-ink);
  font-family: var(--font-display);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.cta:active {
  transform: scale(0.99);
}

.cta.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.qr {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-top: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.qr canvas {
  width: 170px !important;
  height: 170px !important;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #0f193d;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.qr div {
  color: var(--text);
}

.qr div:last-child {
  color: var(--muted-2) !important;
}

.note {
  text-align: center;
  color: var(--muted-2);
  font-size: 11px;
}

/* Activity & Terms Cards */
.tcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  min-width: 0;
}

.tcard__h {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.tcard__i {
  width: 32px;
  height: 32px;
  color: var(--accent);
  background: #1b2340;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tcard p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.summary {
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  min-width: 0;
}

.summary__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary small {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 600;
  display: block;
}

.summary b {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  font-size: 26px;
  font-weight: 800;
  display: block;
}

.status {
  letter-spacing: 0.06em;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  display: inline-block;
}

.status--ok {
  color: #8ee6b0;
  background: #12301f;
}

.status--pending {
  background: var(--warn-bg);
  color: var(--accent-2);
}

.status--bad {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ========================================================
   DESKTOP & LARGER SCREENS BREAKPOINT (>= 860px)
   ======================================================== */
@media (min-width: 860px) {
  .head {
    padding: 0;
    gap: 0;
  }

  .head__row {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 72px;
    padding: 0 clamp(20px, 4vw, 48px);
    flex-wrap: nowrap;
    gap: clamp(16px, 3vw, 32px);
  }

  .head__row .search {
    flex: 0 1 320px !important;
    max-width: 320px;
    min-width: 180px;
    width: auto;
  }

  .desknav {
    display: flex;
    gap: clamp(12px, 2vw, 24px);
    align-items: center;
  }

  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 4px;
    margin-bottom: 14px;
  }

  .toolbar .chips {
    flex: 1 1 auto;
  }

  .toolbar .select {
    align-self: auto;
    flex: 0 0 auto;
  }

  .main {
    padding-bottom: 48px;
  }

  .nav {
    display: none;
  }

  .overlay {
    align-items: center;
    padding: 20px;
  }

  .sheet {
    border-radius: 22px;
    border-bottom: 1px solid var(--border);
    max-height: 88vh;
    animation: zoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes zoomIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
  }
}
