:root {
  --bg: #080b0e;
  --surface: #10151a;
  --surface-2: #151b21;
  --surface-3: #1a222a;
  --line: rgba(172, 196, 212, 0.16);
  --line-strong: rgba(172, 196, 212, 0.3);
  --text: #f3f6f8;
  --muted: #8e9ba6;
  --muted-strong: #b9c3ca;
  --cyan: #36cfda;
  --cyan-soft: rgba(54, 207, 218, 0.12);
  --gold: #e0b966;
  --gold-soft: rgba(224, 185, 102, 0.12);
  --red: #df2631;
  --red-2: #ed3540;
  --red-3: #b91f28;
  --danger: #ff737b;
  --ok: #44d4a0;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 0.9, 0.25, 1.08);
}

.iconSprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.uiIcon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  width: min(100%, 600px);
  padding: 18px 16px 116px;
}

.screen {
  animation: none;
}

.screen.active > * {
  animation: motionRise 0.36s var(--ease-out) both;
}

.screen.active > *:nth-child(2) {
  animation-delay: 35ms;
}

.screen.active > *:nth-child(3) {
  animation-delay: 70ms;
}

.screen.active > *:nth-child(4) {
  animation-delay: 105ms;
}

.screen.active > *:nth-child(n + 5) {
  animation-delay: 125ms;
}

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

.brandCard,
.brandCard.compact,
.brandCard.mainHeader {
  width: 100%;
  min-height: 0;
  gap: 8px;
  margin: 0 0 20px;
  padding: 8px 52px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brandCard.mainHeader {
  padding-top: 4px;
  padding-bottom: 8px;
}

.brandLogo,
.brandCard.compact .brandLogo {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #050708;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
}

.brandCard.compact .brandLogo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.brandCard h1 {
  margin-top: 3px;
  color: var(--text);
  font-size: 24px;
  font-weight: 760;
  line-height: 1.14;
}

.brandCard.compact h1 {
  font-size: 21px;
}

.brandCard p {
  max-width: 390px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.backButton {
  left: 0;
  top: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted-strong);
  transition: color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.backButton::before {
  content: none;
}

.backButton:active {
  color: var(--text);
  border-color: var(--line-strong);
  transform: scale(0.96);
}

.subscriptionCard,
.setupCard,
.infoCard,
.emptyAccountCard,
.installAppCard {
  margin: 0 0 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.emptyAccountCard {
  display: flex;
  align-items: center;
  gap: 14px;
  border-color: rgba(54, 207, 218, 0.24);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.emptyAccountIcon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(54, 207, 218, 0.3);
  border-radius: 8px;
  background: var(--cyan-soft);
  color: var(--cyan);
}

.emptyAccountCard span {
  display: block;
  margin-bottom: 3px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.emptyAccountCard h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
}

.emptyAccountCard p {
  max-width: min(330px, 62vw);
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subTop p,
.mutedText {
  color: var(--muted);
}

.activeBadge {
  border: 1px solid rgba(68, 212, 160, 0.25);
  background: rgba(68, 212, 160, 0.1);
  color: var(--ok);
}

.daysLine strong {
  color: var(--text);
  font-size: 34px;
}

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

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

.primaryButton,
.outlineButton,
.darkButton {
  min-height: 48px;
  gap: 9px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 720;
  transition:
    transform 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.primaryButton {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 22px rgba(223, 38, 49, 0.2);
}

.outlineButton {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
}

.darkButton {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted-strong);
}

.primaryButton:active,
.outlineButton:active,
.darkButton:active,
.webLoginButton:active,
.trialButton:active,
.logoutButton:active,
.starsLinkButton:active,
.channelButton:active {
  transform: translateY(1px) scale(0.985);
}

.primaryButton:disabled,
.outlineButton:disabled,
.darkButton:disabled {
  cursor: wait;
  opacity: 0.58;
  box-shadow: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.primaryActions,
.utilityActions {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.wideAction,
.channelButton,
.trialButton,
.logoutButton,
.webLoginButton,
.starsLinkButton {
  width: 100%;
  margin: 0;
}

.primaryActions .wideAction {
  min-height: 54px;
  font-size: 16px;
}

.channelButton,
.trialButton,
.logoutButton,
.webLoginButton,
.starsLinkButton {
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
  transition:
    transform 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease;
}

.trialButton {
  border-color: rgba(224, 185, 102, 0.28);
  background: var(--surface);
}

.webLoginButton {
  border-color: rgba(54, 207, 218, 0.24);
}

.actionLead {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 680;
}

.actionLead > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trialButton .actionLead,
.trialButton .actionLead > span,
.webLoginButton .actionLead,
.webLoginButton .actionLead > span,
.logoutButton .actionLead,
.logoutButton .actionLead > span,
.starsLinkButton .actionLead,
.starsLinkButton .actionLead > span,
.channelButton .actionLead,
.channelButton .actionLead > span {
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 680;
}

.trialButton .uiIcon {
  color: var(--gold);
}

.webLoginButton .uiIcon,
.logoutButton .uiIcon {
  color: var(--cyan);
}

.channelButton .uiIcon {
  color: var(--gold);
}

.trialButton b,
.webLoginButton b,
.logoutButton b,
.starsLinkButton b,
.channelButton b {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.trialButton b {
  color: var(--gold);
}

.webLoginButton b {
  color: var(--cyan);
}

.legalLinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 18px 0 0;
  padding: 18px 4px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.legalLinks a {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.plansGrid {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.planCard {
  min-height: 128px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
  transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.planCard:last-child {
  border-bottom: 1px solid var(--line);
}

.planInfo span {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0;
}

.planInfo h2 {
  color: var(--text);
  font-size: 18px;
}

.planInfo p,
.planPrices em {
  color: var(--muted);
}

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

.planBottom .primaryButton {
  min-width: 104px;
  min-height: 42px;
  border-radius: 8px;
}

.progressBars span {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  transition: background-color 0.24s ease, transform 0.24s var(--ease-out);
}

.progressBars .filled {
  background: var(--cyan);
  transform: scaleY(1.2);
}

.deviceChooser {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.deviceChooser button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  transition: color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.deviceChooser button:active {
  background: var(--surface-3);
  color: var(--text);
  transform: scale(0.98);
}

.installAppCard {
  border-color: rgba(54, 207, 218, 0.2);
  background: var(--surface);
}

.installAppCard span {
  border: 0;
  background: transparent;
  color: var(--cyan);
}

.supportMessages,
.supportForm textarea,
.webInput {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
}

.supportForm textarea:focus,
.webInput:focus {
  border-color: rgba(54, 207, 218, 0.65);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

.supportMessage {
  border-radius: 8px;
}

.supportMessage.fromUser {
  border-color: rgba(54, 207, 218, 0.22);
  background: var(--cyan-soft);
}

.supportMessage.fromAdmin {
  background: var(--surface-3);
}

.webMode #screen-profile,
.webMode .referralCard,
.webMode .referralHead,
.webMode .referralHead > div,
.webMode .referralLinkBox,
.webMode .referralActions,
.webMode .referralStats,
.webMode .referralInvitedList {
  min-width: 0;
  max-width: 100%;
}

.webMode .referralCard,
.webMode .referralLinkBox,
.webMode .referralActions,
.webMode .referralStats,
.webMode .referralInvitedList {
  width: 100%;
}

.webMode #referralCode {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webMode .referralActions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.webMode .referralActions > button {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding-inline: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.referralHead b {
  border-color: rgba(224, 185, 102, 0.26);
  background: var(--gold-soft);
  color: var(--gold);
}

.referralLinkBox {
  margin-top: 16px;
  padding: 15px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.referralStats {
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.referralStats div {
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.referralStats div:last-child {
  border-right: 0;
}

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

.referralInviteItem {
  border-radius: 6px;
  background: var(--surface-2);
}

.webLinkCard strong {
  border-color: rgba(54, 207, 218, 0.24);
  border-radius: 8px;
  background: var(--cyan-soft);
  color: var(--cyan);
}

.statusToast {
  min-height: 44px;
  display: flex;
  align-items: center;
  bottom: calc(88px + env(safe-area-inset-bottom));
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(16, 21, 26, 0.97);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
  transform: translate(-50%, 14px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.24s var(--ease-spring);
}

.statusToast.visible {
  transform: translate(-50%, 0) scale(1);
}

.statusToast[data-tone="ok"] {
  border-color: rgba(68, 212, 160, 0.32);
  color: var(--ok);
}

.statusToast[data-tone="error"] {
  border-color: rgba(255, 115, 123, 0.34);
  color: var(--danger);
}

.sheetBackdrop {
  background: rgba(3, 5, 7, 0.76);
  backdrop-filter: blur(5px);
  animation: backdropIn 0.2s ease both;
}

.devicesSheet {
  width: min(100%, 600px);
  max-height: min(72vh, 640px);
  border-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  animation: sheetRise 0.32s var(--ease-out) both;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.sheetClose {
  border-radius: 8px;
  background: var(--surface-2);
}

.deviceItem {
  border-radius: 8px;
  background: var(--surface-2);
}

.deleteDeviceButton {
  border-radius: 8px;
}

.paymentMethods .primaryButton,
.paymentMethods .outlineButton {
  justify-content: flex-start;
  padding-inline: 16px;
}

.tabbar {
  width: min(100%, 600px);
  height: calc(76px + env(safe-area-inset-bottom));
  gap: 0;
  padding: 5px 14px calc(7px + env(safe-area-inset-bottom));
  border-color: var(--line);
  background: rgba(8, 11, 14, 0.96);
  backdrop-filter: blur(20px);
}

.tab {
  position: relative;
  min-width: 0;
  min-height: 58px;
  gap: 4px;
  color: #687681;
  transition: color 0.18s ease, transform 0.18s ease;
}

.tab::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: var(--cyan);
  opacity: 0;
  transform: translateX(-50%) scaleX(0.45);
  transition: opacity 0.18s ease, transform 0.22s var(--ease-out);
}

.tab span {
  width: 24px;
  height: 24px;
  font-size: 0;
}

.tab .uiIcon {
  width: 22px;
  height: 22px;
}

.tab b {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tab.active::before {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.tab:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .primaryButton:hover {
    background: var(--red-2);
    box-shadow: 0 12px 26px rgba(223, 38, 49, 0.24);
  }

  .outlineButton:hover,
  .darkButton:hover,
  .channelButton:hover,
  .trialButton:hover,
  .logoutButton:hover,
  .webLoginButton:hover,
  .starsLinkButton:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
  }

  .planCard:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    transform: translateY(-2px);
  }
}

@media (max-width: 420px) {
  .app {
    padding: 14px 12px 110px;
  }

  .brandCard,
  .brandCard.compact,
  .brandCard.mainHeader {
    margin-inline: 0;
    padding-inline: 46px;
  }

  .brandLogo,
  .brandCard.compact .brandLogo {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .brandCard.compact .brandLogo {
    width: 54px;
    height: 54px;
  }

  .brandCard h1 {
    font-size: 22px;
  }

  .brandCard.compact h1 {
    font-size: 20px;
  }

  .brandCard p {
    font-size: 13px;
  }

  .subscriptionCard,
  .setupCard,
  .infoCard,
  .emptyAccountCard,
  .installAppCard {
    margin-inline: 0;
    padding: 18px;
  }

  .plansGrid {
    margin-inline: 0;
    padding: 0;
  }

  .planCard {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 16px;
  }

  .primaryButton,
  .outlineButton,
  .darkButton {
    min-height: 48px;
    font-size: 15px;
  }

  .legalLinks {
    margin-inline: 0;
  }

  .webMode .referralActions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 350px) {
  .brandCard,
  .brandCard.compact,
  .brandCard.mainHeader {
    padding-inline: 42px;
  }

  .planCard {
    grid-template-columns: 1fr;
  }

  .planBottom {
    width: 100%;
  }

  .planBottom .primaryButton {
    min-width: 100%;
  }

  .referralStats {
    grid-template-columns: repeat(2, 1fr);
  }

  .referralStats div:nth-child(2) {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
