:root {
  color-scheme: dark;
  --bg: #070812;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --pink: #ec4899;
  --violet: #8b5cf6;
  --indigo: #6366f1;
  --blue: #0a84ff;
  --amber: #f59e0b;
  --green: #22c55e;
  --danger: #ef4444;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(236, 72, 153, 0.28), transparent 32%),
    radial-gradient(circle at 85% 0%, rgba(99, 102, 241, 0.3), transparent 30%),
    radial-gradient(circle at 55% 100%, rgba(10, 132, 255, 0.18), transparent 36%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

body:not(.signed-in) .authed-only,
body.signed-in .logged-out-only,
[hidden] {
  display: none !important;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.app-shell {
  width: min(1220px, calc(100% - 28px));
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 78px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.desktop-tabs {
  justify-self: center;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.desktop-tabs a,
.mobile-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 10px 15px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}

.desktop-tabs a.active,
.mobile-tabs button.active {
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--indigo));
  box-shadow: 0 12px 28px rgba(236, 72, 153, 0.24);
}

.corp-link {
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.ghost-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 950;
  cursor: pointer;
}

.ghost-button,
.secondary-button {
  background: rgba(255, 255, 255, 0.08);
}

.primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--pink), var(--indigo));
  box-shadow: 0 18px 42px rgba(236, 72, 153, 0.32);
}

.app-main {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 26px 26px 0 0;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.entry-screen {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 28%, rgba(236, 72, 153, 0.26), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(99, 102, 241, 0.08));
}

.entry-screen img {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  box-shadow: 0 18px 46px rgba(236, 72, 153, 0.26);
}

.entry-screen h1 {
  margin: 0;
  font-size: clamp(3.4rem, 10vw, 7rem);
}

.entry-screen p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.screen {
  height: 100%;
  display: none;
  padding: 22px;
  overflow: auto;
}

.screen.active {
  display: block;
}

.watch-layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.ad-player {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  background:
    linear-gradient(145deg, rgba(236, 72, 153, 0.22), rgba(99, 102, 241, 0.12)),
    rgba(255, 255, 255, 0.06);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.22);
}

.player-top,
.ad-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ad-frame {
  min-height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 22px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(236, 72, 153, 0.24), transparent 28%),
    rgba(0, 0, 0, 0.2);
}

.ad-frame-label {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.ad-frame strong {
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 0.9;
}

.ad-frame p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.wallet-stack {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 150px 150px;
  gap: 18px;
}

.dashboard-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.8fr);
  grid-template-rows: 1fr 148px 148px;
  grid-template-areas:
    "hero balance"
    "hero today"
    "mode streak";
  gap: 18px;
}

.hero-card,
.balance-card,
.mini-stat,
.mission-card,
.ledger-panel,
.rules,
.cashout-card,
.jackpot-card,
.auth-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055));
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.22);
}

.hero-card {
  grid-area: hero;
  min-height: 100%;
  padding: 26px;
  display: grid;
  align-content: space-between;
  background:
    linear-gradient(145deg, rgba(236, 72, 153, 0.22), rgba(99, 102, 241, 0.12)),
    rgba(255, 255, 255, 0.06);
}

.hero-topline,
.quick-actions,
.offer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill,
.rank-pill,
.rule-chip {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8rem;
  font-weight: 900;
  gap: 4px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 760px;
  margin: 34px 0 16px;
  font-size: clamp(3rem, 5.8vw, 5.2rem);
  line-height: 0.88;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
}

.hero-card p,
.rules p,
.jackpot-card p,
.form-note,
.mission-card p,
label {
  color: var(--muted);
  line-height: 1.55;
}

.hero-card p {
  max-width: 640px;
  font-size: 1.08rem;
}

.balance-card {
  grid-area: balance;
  position: relative;
  min-height: 100%;
  padding: 24px;
  display: grid;
  align-content: end;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(245, 158, 11, 0.34), transparent 28%),
    linear-gradient(160deg, rgba(99, 102, 241, 0.34), rgba(236, 72, 153, 0.14)),
    rgba(255, 255, 255, 0.08);
}

.coin-orbit {
  position: absolute;
  top: 42px;
  left: 50%;
  width: 142px;
  height: 142px;
  transform: translateX(-50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #ffe08a, var(--amber) 58%, #a85d00);
  box-shadow: 0 0 42px rgba(245, 158, 11, 0.52);
}

.coin-core {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 8px solid rgba(255, 255, 255, 0.42);
  color: #4a2600;
  font-size: 4rem;
  font-weight: 1000;
}

.label,
.mini-stat span,
.jackpot-card span {
  color: var(--muted);
  font-weight: 900;
}

.balance-card strong {
  margin: 5px 0 14px;
  font-size: clamp(3.8rem, 7vw, 6.2rem);
  line-height: 0.85;
}

.meter {
  height: 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 25%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--pink), var(--indigo));
}

.mini-stat {
  min-height: 138px;
  padding: 20px;
}

.today-stat { grid-area: today; }
.streak-stat { grid-area: streak; }
.mode-stat { grid-area: mode; }

.mini-stat strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 2.8rem;
}

.mini-stat.hot { background: linear-gradient(145deg, rgba(236, 72, 153, 0.28), rgba(255, 255, 255, 0.06)); }
.mini-stat.violet { background: linear-gradient(145deg, rgba(139, 92, 246, 0.3), rgba(255, 255, 255, 0.06)); }
.mini-stat.amber { background: linear-gradient(145deg, rgba(245, 158, 11, 0.25), rgba(255, 255, 255, 0.06)); }

.screen-head {
  margin-bottom: 18px;
}

.screen-head h2 {
  margin-top: 12px;
}

.mission-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mission-card {
  min-height: 380px;
  padding: 20px;
  display: grid;
  align-content: space-between;
  position: relative;
  overflow: hidden;
}

.mission-card::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(236, 72, 153, 0.18);
}

.offer-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--indigo));
  font-weight: 1000;
  font-size: 1.1rem;
}

.mission-card h3 {
  margin: 18px 0 8px;
  font-size: 1.6rem;
}

.reward {
  color: #ffd166;
  font-weight: 1000;
}

.wallet-grid,
.cashout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.ledger-panel,
.rules,
.cashout-card,
.jackpot-card {
  padding: 20px;
}

.ledger {
  display: grid;
  gap: 10px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.ledger-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.rules {
  display: grid;
  align-content: start;
  gap: 10px;
}

.cashout-card form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.09);
  color: white;
}

select option {
  color: #111827;
}

.jackpot-card {
  min-height: 330px;
  display: grid;
  align-content: end;
  background:
    radial-gradient(circle at 50% 28%, rgba(245, 158, 11, 0.4), transparent 28%),
    linear-gradient(145deg, rgba(236, 72, 153, 0.24), rgba(99, 102, 241, 0.18));
}

.jackpot-card strong {
  display: block;
  font-size: 7rem;
  line-height: 0.86;
}

.mobile-tabs {
  display: none;
}

dialog {
  width: min(430px, calc(100% - 24px));
  border: 0;
  border-radius: 22px;
  padding: 0;
  background: transparent;
  color: white;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 26px;
}

.auth-card img {
  width: 120px;
  height: 42px;
  object-fit: contain;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
}

@media (max-width: 980px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    padding: 0 10px;
    grid-template-rows: auto 1fr auto;
  }

  .topbar {
    height: 72px;
    grid-template-columns: 1fr auto;
  }

  .desktop-tabs,
  .corp-link {
    display: none;
  }

  .app-main {
    border-radius: 24px;
  }

  .screen {
    padding: 14px;
  }

  .dashboard-grid,
  .wallet-grid,
  .cashout-grid {
    display: flex;
    flex-direction: column;
  }

  .hero-card,
  .balance-card,
  .mission-card,
  .jackpot-card {
    min-height: auto;
  }

  h1 {
    margin-top: 26px;
    font-size: clamp(2.7rem, 14vw, 4.7rem);
  }

  .balance-card {
    min-height: 330px;
  }

  .coin-orbit {
    width: 130px;
    height: 130px;
  }

  .coin-core {
    width: 82px;
    height: 82px;
    font-size: 3rem;
  }

  .mission-map {
    grid-template-columns: 1fr;
  }

  .mobile-tabs {
    height: 74px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    align-items: center;
    padding: 8px 0 12px;
  }
}
