:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ececea;
  --text: #121212;
  --muted: #6b6b6b;
  --line: #d7d7d2;
  --red: #d82626;
  --red-dark: #9f1717;
  --black: #111111;
  --gold: #f2c94c;
  --blue: #2f6fed;
  --green: #198754;
  --shadow: 0 18px 50px rgba(17, 17, 17, .12);
}

:root.dark {
  color-scheme: dark;
  --bg: #0d0d0f;
  --surface: #18181b;
  --surface-2: #242428;
  --text: #f5f5f3;
  --muted: #aaaaa6;
  --line: #35353a;
  --red: #ff3b3b;
  --red-dark: #b81e1e;
  --black: #050505;
  --gold: #ffd45a;
  --blue: #5d8dff;
  --green: #39b46d;
  --shadow: 0 20px 60px rgba(0, 0, 0, .38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(216, 38, 38, .08), transparent 210px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.phone-app {
  width: min(100%, 480px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 96px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(216, 38, 38, .2), transparent 280px),
    var(--bg);
  overflow-y: auto;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .auth-screen {
  display: flex;
}

body.auth-locked .phone-app,
body.auth-locked .bottom-nav {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.auth-card {
  width: min(100%, 430px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card .eyebrow {
  color: var(--red);
}

.auth-card h1 {
  color: var(--text);
}

.auth-copy,
.auth-error {
  color: var(--muted);
  line-height: 1.45;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}

.auth-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
}

.auth-tabs button.is-active {
  border-color: var(--red);
  background: var(--black);
  color: #fff;
}

.auth-form,
.wallet-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.wallet-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input,
.auth-form select,
.wallet-form input,
.wallet-form select,
.withdraw-box input,
.withdraw-box select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px;
}

.phone-row {
  display: grid;
  grid-template-columns: minmax(112px, .48fr) minmax(0, 1fr);
  gap: 10px;
}

.auth-form .register-only {
  display: none;
}

.auth-form.is-register .register-only {
  display: grid;
}

.hero {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--black), #2a2a2d 58%, var(--red-dark));
  color: #fff;
  box-shadow: var(--shadow);
}

.hero__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #d7d7d2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 7px;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

.icon-btn {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 20px;
}

.balance-card {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
}

.balance-card span,
.balance-card small {
  color: rgba(255, 255, 255, .72);
}

.balance-card strong {
  font-size: 34px;
}

.screen {
  display: none;
  animation: rise .22s ease;
}

.screen.is-active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notice,
.quick-card,
.level-card,
.blago-card,
.claim-btn,
.stats-grid > div,
.ref-card,
.withdraw-box,
.bonus-list > div,
.profile-card,
.wallet-form,
.wallet-item,
.withdraw-item,
.menu-list,
.panel,
.feed-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(17, 17, 17, .06);
}

.notice {
  margin: 16px 0;
  padding: 14px;
}

.notice span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(216, 38, 38, .12);
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.notice p,
.section-head p,
.blago-card p,
.profile-card p,
.feed-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-card {
  min-height: 96px;
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.quick-card strong,
.quick-card span,
.level-card span,
.level-card small {
  display: block;
}

.quick-card strong {
  margin-bottom: 8px;
  font-size: 18px;
}

.quick-card span {
  color: var(--muted);
}

.quick-card--blago {
  grid-column: span 2;
  border-color: rgba(216, 38, 38, .35);
  background: linear-gradient(135deg, var(--red), var(--black));
  color: #fff;
}

.quick-card--blago span {
  color: rgba(255, 255, 255, .78);
}

.section-head {
  margin: 18px 0 12px;
}

.level-list,
.feed,
.bonus-list {
  display: grid;
  gap: 10px;
}

.level-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
}

.level-card strong {
  font-size: 18px;
}

.level-card span,
.level-card small {
  color: var(--muted);
}

.level-card.is-locked {
  background: color-mix(in srgb, var(--gold) 18%, var(--surface));
}

.level-card.is-active {
  border-color: var(--blue);
}

.level-card button,
.primary-btn,
.secondary-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

.level-card button,
.primary-btn {
  background: var(--red);
  color: #fff;
}

.level-card button:disabled {
  background: var(--gold);
  color: #28210b;
  cursor: not-allowed;
}

.blago-card {
  margin-top: 18px;
  padding: 18px;
  text-align: center;
}

.blago-card .eyebrow {
  color: var(--muted);
}

.timer {
  margin: 18px 0 10px;
  font-variant-numeric: tabular-nums;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.blago-card .primary-btn {
  width: 100%;
  margin-top: 16px;
}

.claim-btn {
  display: flex;
  width: 100%;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  background: #f28c28;
  color: #1a1208;
}

.claim-btn span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  font-size: 28px;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stats-grid > div {
  padding: 14px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stats-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.secondary-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.withdraw-box {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
}

.withdraw-box label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feed-item {
  padding: 12px;
}

.feed-item strong {
  display: block;
  margin-bottom: 5px;
}

.ref-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.ref-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px;
}

.bonus-list {
  margin-top: 12px;
}

.bonus-list > div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
}

.bonus-list strong {
  min-width: 58px;
  color: var(--red);
  font-size: 22px;
}

.bonus-list span {
  color: var(--muted);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
}

.avatar {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--black));
  color: #fff;
  font-weight: 900;
}

.profile-card h2 {
  margin-bottom: 4px;
}

.wallet-form {
  margin-top: 12px;
  padding: 14px;
}

.wallet-form h2 {
  margin-bottom: 0;
}

.wallet-list,
.withdraw-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.withdraw-list {
  margin-bottom: 12px;
}

.wallet-item,
.withdraw-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  overflow-wrap: anywhere;
}

.wallet-item strong,
.withdraw-item strong {
  color: var(--text);
}

.wallet-item span,
.withdraw-item span {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  width: max-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 22%, var(--surface-2));
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.menu-list {
  display: grid;
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
}

.menu-list button {
  min-height: 48px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.panel {
  margin-top: 12px;
  padding: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.panel strong {
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  min-height: 48px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bottom-nav button.is-active {
  background: var(--black);
  color: #fff;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 86px;
  left: 16px;
  z-index: 20;
  display: none;
  width: min(calc(100% - 32px), 448px);
  margin: 0 auto;
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--black);
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  display: block;
}

.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .62);
}

.payment-modal[hidden] {
  display: none;
}

.payment-card {
  position: relative;
  width: min(100%, 430px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.payment-card .eyebrow {
  color: var(--red);
}

.payment-card p {
  color: var(--muted);
  line-height: 1.45;
}

.payment-close {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.payment-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.payment-options button {
  min-height: 52px;
  border-radius: 8px;
  background: var(--black);
  color: #fff;
  font-weight: 900;
}

.payment-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.payment-result a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

@media (min-width: 481px) {
  body {
    display: grid;
    place-items: start center;
  }

  .phone-app {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
}
