:root {
  --bg: #0e121b;
  --surface: #161d27;
  --surface-border: #2b3647;
  --primary: #448fff;
  --primary-strong: #5ca0ff;
  --text: #f5f7fb;
  --muted: #98a4b8;
  --disabled: #212e40;
  --tab-idle: #a8b2c4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", "Segoe UI", sans-serif;
}

body {
  display: flex;
  justify-content: center;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 590px);
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 29%, rgba(68, 143, 255, 0.3), transparent 22%),
    linear-gradient(180deg, #0d1119 0%, #0e121b 42%, #0d1119 100%);
  position: relative;
  overflow: hidden;
}

.snackbar {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(100% - 32px), 558px);
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(25, 34, 47, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.snackbar-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.snackbar-icon {
  position: relative;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #30d158;
}

.snackbar-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 5px;
  height: 9px;
  border-right: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(40deg);
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 24px 16px;
}

.brand {
  width: 270px;
  max-width: calc(100% - 110px);
  height: auto;
}

.level-badge {
  min-width: 84px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #324763;
  color: #fff;
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hero {
  position: relative;
  height: 370px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(14, 18, 27, 0) 0%, rgba(14, 18, 27, 0.06) 74%, rgba(14, 18, 27, 0.22) 100%),
    url("./imgs/learning_bg.png") center top / cover no-repeat;
}

.app-shell[data-screen="referrals"] .hero {
  background:
    linear-gradient(180deg, rgba(14, 18, 27, 0) 0%, rgba(14, 18, 27, 0.06) 74%, rgba(14, 18, 27, 0.22) 100%),
    url("./imgs/ref_bg.png") center top / cover no-repeat;
}

.app-shell[data-screen="signals"] .hero {
  background:
    linear-gradient(180deg, rgba(14, 18, 27, 0) 0%, rgba(14, 18, 27, 0.06) 74%, rgba(14, 18, 27, 0.22) 100%),
    url("./imgs/signal_bg.png") center top / cover no-repeat;
}

.content {
  position: relative;
  z-index: 2;
  margin-top: -100px;
  padding: 24px 24px 146px;
  border-radius: 28px 28px 0 0;
  background: rgba(13, 17, 25, 0.98);
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

.intro h1 {
  margin: 0;
  font-size: clamp(38px, 5.2vw, 54px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.intro p {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(20px, 3.8vw, 28px);
  line-height: 1.3;
}

.lesson-list {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.lesson-card {
  padding: 20px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.lesson-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lesson-head h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 33px);
  font-weight: 800;
}

.duration {
  margin: 20px 0 0;
  color: var(--text);
  font-size: clamp(18px, 3.5vw, 25px);
}

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

.lesson-card ul {
  margin: 18px 0 0;
  padding-left: 24px;
  color: var(--text);
  font-size: clamp(18px, 3.5vw, 24px);
  line-height: 1.45;
}

.lesson-button {
  width: 100%;
  margin-top: 18px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  font-size: clamp(18px, 3.6vw, 22px);
  font-weight: 800;
  transition: transform 160ms ease, opacity 160ms ease, background-color 160ms ease;
}

.lesson-button-primary {
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  color: #fff;
}

.lesson-button-primary:active {
  transform: translateY(1px);
}

.lesson-button-disabled {
  background: var(--disabled);
  color: rgba(255, 255, 255, 0.42);
}

.lock-icon {
  width: 28px;
  height: 28px;
  margin-right: 2px;
  object-fit: contain;
}

.referral-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  padding: 24px 20px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.referral-symbol {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}

.referral-copy {
  min-width: 0;
}

.referral-copy h2 {
  margin: 0;
  font-size: clamp(20px, 3.9vw, 27px);
  font-weight: 700;
}

.referral-link {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 3.6vw, 24px);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #fff;
}

.copy-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.activation-card,
.signal-card {
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.activation-card {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  padding: 16px;
}

.activation-step {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: clamp(22px, 4vw, 26px);
  font-weight: 700;
}

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

.step-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  background: #334763;
  color: #8da6c8;
}

.activation-step-active .step-badge {
  background: var(--primary);
  color: #fff;
}

.activation-step-done {
  color: var(--muted);
}

.activation-step-done .step-badge {
  background: #334763 url("./imgs/icons/activation_tick.svg") center / 24px 24px no-repeat;
  color: transparent;
}

.activation-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.activation-button {
  margin-top: 0;
}

.signals-section {
  margin-top: 24px;
}

.section-title {
  margin: 0 0 18px;
  font-size: clamp(24px, 4.4vw, 32px);
  line-height: 1.15;
  font-weight: 800;
}

.asset-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-bottom: 24px;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.asset-list::-webkit-scrollbar {
  display: none;
}

.asset-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  height: 48px;
  padding: 0 14px 0 12px;
  border-radius: 14px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
}

.asset-chip-active {
  background: var(--primary);
  border-color: transparent;
}

.asset-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.signal-card {
  padding: 16px;
}

.signal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.signal-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signal-card-title h3,
.signal-count {
  margin: 0;
  font-size: clamp(22px, 4vw, 27px);
  line-height: 1.15;
  font-weight: 700;
}

.signal-main-icon {
  display: block;
  width: 80px;
  height: 80px;
  margin: 38px auto 32px;
  object-fit: contain;
  opacity: 0.88;
}

.signal-main-icon-animated {
  animation: signal-spin 1.2s linear infinite;
}

.signal-card-body {
  display: none;
}

.signal-card[data-signal-state="idle"] .signal-card-body-idle,
.signal-card[data-signal-state="searching"] .signal-card-body-searching,
.signal-card[data-signal-state="locked"] .signal-card-body-locked {
  display: block;
}

.signal-card[data-signal-state="result"] .signal-card-body-result {
  display: grid;
}

.signal-card-body-result {
  display: none;
  gap: 28px;
  padding: 30px 0 32px;
}

.signal-result-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  font-size: clamp(24px, 6vw, 42px);
  line-height: 1.1;
  color: var(--text);
}

.signal-result-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.signal-button {
  margin-top: 0;
  background: #314563;
  color: #fff;
}

.signal-card[data-signal-state="searching"] .signal-button {
  color: rgba(255, 255, 255, 0.45);
}

.signal-card[data-signal-state="locked"] .signal-button {
  color: #fff;
}

@keyframes signal-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(calc(100% - 24px), 560px);
  padding: 16px 18px max(22px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 24px 24px 0 0;
}

.tab {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 6px 0 0;
  border: 0;
  background: transparent;
  color: var(--tab-idle);
  font-size: 14px;
  line-height: 1.2;
}

.tab.active {
  color: var(--primary);
}

.tab-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  opacity: 0.88;
  filter: grayscale(1) brightness(1.12);
}

.tab.active .tab-icon {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(54%) sepia(77%) saturate(3140%) hue-rotate(201deg) brightness(102%) contrast(101%);
}

@media (max-width: 480px) {
  .snackbar {
    font-size: 16px;
  }

  .topbar {
    padding-inline: 16px;
  }

  .content {
    padding-inline: 16px;
  }

  .tabbar {
    padding-inline: 10px;
  }

  .brand {
    width: 220px;
  }

  .level-badge {
    min-width: 74px;
    font-size: 17px;
    padding: 10px 12px;
  }

  .referral-card {
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    padding: 20px 16px;
  }

  .referral-symbol {
    width: 24px;
  }

  .activation-card {
    padding-inline: 16px;
  }

  .activation-step {
    gap: 18px;
    font-size: 18px;
  }

  .asset-chip {
    font-size: 15px;
  }
}
