@font-face {
  font-family: "Loos Wide";
  src: local("Loos Wide"), local("LoosWide");
  font-display: swap;
}

:root {
  --bg: #0c0c0c;
  --surface: #131313;
  --text: #ffffff;
  --muted: #9d9d9d;
  --muted-2: #7e7e7e;
  --blue: #164bd6;
  --green: #24b24a;
  --green-soft: rgba(36, 178, 74, 0.14);
  --white-soft: #ececec;
  --radius-card: 40px;
  --radius-button: 28px;
  --radius-nav: 32px;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.42);
  --shell-width: 1280px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", sans-serif;
  overflow-x: hidden;
}

button {
  font: inherit;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
}

.page-shell {
  width: min(100%, calc(var(--shell-width) + 48px));
  margin: 0 auto;
  padding: 16px 16px calc(112px + env(safe-area-inset-bottom));
}

.app-gate {
  max-width: 560px;
  margin: 0 auto 24px;
}

.app-gate.is-hidden {
  display: none;
}

.app-gate-card {
  display: grid;
  gap: 16px;
  text-align: center;
  padding-top: 32px;
  padding-bottom: 32px;
}

.app-gate-text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
  word-break: break-word;
}

.soon-card {
  padding-top: 40px;
  padding-bottom: 40px;
}

.soon-card h2 {
  font-size: 40px;
  line-height: 1;
}

body.is-blocked .app-shell,
body.is-blocked .bottom-nav {
  display: none;
}

.app-shell {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 16px - 112px - env(safe-area-inset-bottom));
  padding: 24px 12px 32px;
  background: #0C0C0C;
}

.app-shell::before {
  content: none;
}

.view {
  display: none;
  position: relative;
  z-index: 1;
}

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

.app-header {
  display: grid;
  gap: 8px;
  text-align: center;
  margin-bottom: 24px;
}

.header-kicker,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Loos Wide", "Poppins", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  font-size: 32px;
  line-height: 1.04;
}

h2 {
  font-size: 28px;
  line-height: 1.08;
}

.header-copy,
.actions-intro p,
.topup-caption {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.content-grid {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.cards-column,
.action-list,
.topup-layout,
.topup-links {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.connect-layout,
.connect-actions,
.soon-layout {
  display: grid;
  gap: 20px;
}

.connect-layout,
.soon-layout {
  max-width: 560px;
  margin: 0 auto;
  min-width: 0;
}

.connect-step {
  display: none;
}

.connect-step.is-active {
  display: grid;
  gap: 20px;
}

.connect-progress {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.connect-progress-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.connect-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #ececec;
  overflow: hidden;
}

.connect-progress-fill {
  display: block;
  width: 33.333%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.connect-panel {
  text-align: center;
  padding-top: 20px;
  padding-bottom: 20px;
}

.connect-panel .card-title-prominent {
  margin-bottom: 0;
}

.connect-instruction-card {
  padding-top: 20px;
  padding-bottom: 20px;
}

.connect-instruction-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.connect-key-card {
  gap: 0;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 30px;
  background: rgba(129, 26, 47, 0.36);
  box-shadow: inset 0 0 0 1px rgba(190, 52, 81, 0.84);
}

.status-banner.is-hidden {
  display: none;
}

.status-banner-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #c13957;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.status-banner-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 24px 18px;
  min-width: 0;
  max-width: 100%;
}

.balance-card,
.key-card,
.topup-balance-card {
  text-align: center;
}

.card-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
}

.card-icon img {
  width: 35px;
  height: 35px;
}

.card-icon-light {
  background: #f5f5f5;
}

.card-icon-light img {
  width: 22px;
  height: 22px;
}

.card-title {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #f1f1f1;
}

.card-title-prominent {
  font-size: 18px;
  line-height: 1.35;
  font-weight: 500;
}

.balance-amount {
  margin: 0 0 20px;
  font-family: "Loos Wide", "Poppins", sans-serif;
  font-size: 48px;
  line-height: 0.96;
  letter-spacing: 0.01em;
}

.balance-amount-small {
  margin-bottom: 8px;
  font-size: 40px;
}

.primary-button,
.submit-button {
  width: 100%;
  max-width: 100%;
  min-height: 64px;
  padding: 16px 22px;
  border-radius: var(--radius-button);
  background: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  transition: transform 160ms ease, filter 160ms ease;
}

.primary-button:hover,
.submit-button:hover,
.action-button:hover,
.amount-chip:hover,
.back-button:hover {
  transform: translateY(-1px);
}

.primary-button:hover,
.submit-button:hover {
  filter: brightness(1.06);
}

.button-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.trial-card {
  --subscription-accent: rgba(36, 178, 74, 0.9);
  --subscription-accent-soft: rgba(36, 178, 74, 0.22);
  --subscription-accent-glow: rgba(36, 178, 74, 0.16);
  --subscription-progress-start: #29c24d;
  --subscription-progress-end: #21a642;
  border: 2px solid var(--subscription-accent);
  box-shadow:
    inset 0 0 0 1px rgba(36, 178, 74, 0.08),
    0 0 30px rgba(36, 178, 74, 0.06);
}

.trial-card .card-icon {
  background: var(--subscription-accent-soft);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 24px var(--subscription-accent-glow);
}

.trial-card.is-expired {
  --subscription-accent: rgba(193, 57, 87, 0.92);
  --subscription-accent-soft: rgba(193, 57, 87, 0.22);
  --subscription-accent-glow: rgba(193, 57, 87, 0.18);
  --subscription-progress-start: #d24a67;
  --subscription-progress-end: #c13957;
  border-color: var(--subscription-accent);
  box-shadow:
    inset 0 0 0 1px rgba(193, 57, 87, 0.08),
    0 0 30px rgba(193, 57, 87, 0.05);
}

.trial-card.is-neutral {
  --subscription-accent: rgba(80, 80, 80, 0.9);
  --subscription-accent-soft: rgba(80, 80, 80, 0.18);
  --subscription-accent-glow: rgba(80, 80, 80, 0.12);
  --subscription-progress-start: #7a7a7a;
  --subscription-progress-end: #6a6a6a;
}

.trial-subtitle:empty {
  display: none;
}

.trial-head {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
  text-align: center;
}

.trial-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.16;
  font-family: "Loos Wide", "Poppins", sans-serif;
}

.trial-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.trial-meta,
.trial-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.trial-meta {
  margin-bottom: 8px;
}

.trial-progress {
  width: 100%;
  height: 16px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: #242424;
  overflow: hidden;
}

.trial-progress-fill {
  display: block;
  width: 18%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--subscription-progress-start), var(--subscription-progress-end));
}

.key-value {
  margin: 0;
  padding: 18px 22px;
  border-radius: 24px;
  background: #1a1a1a;
  color: #d4d4d4;
  font-size: 17px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.key-card {
  gap: 0;
}

.key-card .card-title {
  margin-bottom: 24px;
}

.key-card .key-value {
  margin-bottom: 24px;
}

.copy-button.is-copied {
  filter: brightness(1.08);
}

.actions-column {
  display: grid;
  gap: 24px;
}

.actions-intro {
  display: none;
  gap: 12px;
}

.action-button {
  width: 100%;
  max-width: 100%;
  min-height: 64px;
  padding: 14px 14px 14px 22px;
  border-radius: var(--radius-button);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  transition: transform 160ms ease, background-color 160ms ease;
}

.action-button span:first-child {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.submit-button {
  justify-content: space-between;
  text-align: left;
}

.submit-button.is-loading,
.primary-button.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.action-button:hover {
  background: #181818;
}

.action-button.is-selected {
  background: #181818;
  box-shadow: inset 0 0 0 1.5px var(--blue);
}

.action-arrow {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--white-soft);
}

.action-arrow img {
  width: 18px;
  height: 18px;
}

.topup-layout {
  max-width: 560px;
  margin: 0 auto;
}

.back-button {
  width: fit-content;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white-soft);
  transition: transform 160ms ease, opacity 160ms ease;
}

.back-button img {
  width: 18px;
  height: 18px;
}

.back-button:hover {
  opacity: 0.92;
}

.topup-header {
  padding-top: 8px;
  text-align: center;
}

.topup-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.amount-chip {
  min-height: 52px;
  padding: 16px 12px;
  border-radius: 24px;
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px transparent;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
  min-width: 0;
}

.amount-chip:hover,
.amount-chip.is-selected {
  background: #1b1b1b;
}

.amount-chip.is-selected {
  color: #ffffff;
  box-shadow: inset 0 0 0 1.5px var(--blue);
}

.bottom-nav {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-nav);
  background: rgba(18, 18, 18, 0.94);
  backdrop-filter: blur(24px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.36);
}

.nav-item {
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 24px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  color: var(--muted-2);
  transition: color 160ms ease, background-color 160ms ease;
}

.nav-item img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
  opacity: 0.52;
  transition: opacity 160ms ease;
}

.nav-item span {
  font-size: 11px;
  line-height: 1.2;
}

.nav-item.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.is-active img {
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
}

.modal-backdrop.is-hidden {
  display: none;
}

.trial-modal {
  position: relative;
  width: min(100%, 360px);
  overflow: hidden;
  border-radius: 28px;
  background: #151515;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.trial-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(12, 12, 12, 0.32);
  font-size: 20px;
  line-height: 1;
}

.trial-modal-image {
  width: 100%;
  height: auto;
  aspect-ratio: 331 / 165;
  object-fit: cover;
}

.trial-modal-body {
  display: grid;
  gap: 12px;
  padding: 20px 20px 24px;
  text-align: center;
}

.trial-modal-body h3 {
  margin: 0;
  font-family: "Loos Wide", "Poppins", sans-serif;
  font-size: 24px;
  line-height: 1.05;
}

.trial-modal-body p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.trial-modal-button {
  margin-top: 8px;
}

body.is-booting .app-header,
body.is-booting .status-banner,
body.is-booting .card,
body.is-booting .action-button,
body.is-booting .submit-button,
body.is-booting .bottom-nav,
body.is-booting .amount-chip,
body.is-booting .back-button,
body.is-booting .connect-progress,
body.is-booting .trial-modal {
  opacity: 0;
  transform: translateY(12px);
}

body.is-ready .app-header,
body.is-ready .status-banner,
body.is-ready .card,
body.is-ready .action-button,
body.is-ready .submit-button,
body.is-ready .bottom-nav,
body.is-ready .amount-chip,
body.is-ready .back-button,
body.is-ready .connect-progress,
body.is-ready .trial-modal {
  animation: rise-in 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body.is-ready .card:nth-of-type(2),
body.is-ready .action-button:nth-of-type(2),
body.is-ready .amount-chip:nth-of-type(2) {
  animation-delay: 60ms;
}

body.is-ready .card:nth-of-type(3),
body.is-ready .action-button:nth-of-type(3),
body.is-ready .amount-chip:nth-of-type(3) {
  animation-delay: 120ms;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 479px) {
  .page-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .card {
    padding: 22px 14px;
  }

  .primary-button,
  .submit-button,
  .action-button {
    min-height: 60px;
  }

  .primary-button,
  .submit-button {
    padding-left: 18px;
    padding-right: 18px;
  }

  .action-button {
    padding-left: 18px;
  }

  .trial-title {
    font-size: 18px;
  }

  .trial-meta,
  .trial-dates {
    font-size: 11px;
  }
}

@media (min-width: 768px) {
  .page-shell {
    padding: 24px 24px calc(120px + env(safe-area-inset-bottom));
  }

  .app-shell {
    min-height: calc(100vh - 24px - 120px - env(safe-area-inset-bottom));
    padding: 32px 24px 48px;
    border-radius: 48px;
  }

  .app-header {
    text-align: left;
    margin-bottom: 32px;
  }

  h1 {
    font-size: 44px;
  }

  .balance-amount {
    font-size: 54px;
  }

  .balance-amount-small {
    font-size: 48px;
  }

  .card-title-prominent {
    font-size: 20px;
  }

  .key-value {
    font-size: 18px;
  }

  .status-banner-title {
    font-size: 16px;
  }

  .content-grid {
    gap: 32px;
  }
}

@media (min-width: 1040px) {
  .page-shell {
    padding: 32px 24px calc(128px + env(safe-area-inset-bottom));
  }

  .app-shell {
    overflow: visible;
    min-height: calc(100vh - 32px - 128px - env(safe-area-inset-bottom));
    padding: 40px 40px 56px;
    border-radius: 56px;
  }

  .content-grid {
    grid-template-columns: minmax(380px, 444px) minmax(0, 1fr);
    align-items: start;
  }

  .cards-column {
    position: sticky;
    top: 40px;
    align-self: start;
  }

  .actions-column {
    gap: 32px;
    padding-top: 0;
  }

  .actions-intro {
    display: grid;
  }

  .topup-layout {
    max-width: 680px;
    padding-top: 24px;
  }

  .connect-layout {
    max-width: 680px;
    padding-top: 24px;
  }

  .topup-options {
    gap: 16px;
  }

  .amount-chip {
    min-height: 64px;
    border-radius: 28px;
    font-size: 18px;
  }

  .bottom-nav {
    max-width: 720px;
    padding: 12px;
  }

  .nav-item {
    min-height: 64px;
  }

  .nav-item span {
    font-size: 12px;
  }
}
