:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --paper: #ffffff;
  --paper-soft: #f8fafd;
  --ink: #142033;
  --muted: #64748b;
  --line: rgba(20, 32, 51, 0.1);
  --blue: #1666d9;
  --orange: #f27a1a;
  --green: #169b70;
  --red: #d94848;
  --violet: #7457d9;
  --teal: #0f8f8a;
  --shadow: 0 14px 34px rgba(25, 41, 70, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: 1.15;
  overflow-wrap: anywhere;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(92px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  margin: -12px -12px 12px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 8px 18px rgba(25, 41, 70, 0.08);
}

.brand-lockup b,
.brand-lockup small,
.profile-name b,
.profile-name small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup b {
  font-size: 16px;
}

.brand-lockup small,
.profile-name small {
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--blue);
  background: rgba(22, 102, 217, 0.1);
  font-weight: 900;
}

.screen {
  display: none;
}

.screen.is-active {
  display: grid;
  gap: 12px;
}

.screen-title {
  display: grid;
  gap: 5px;
  padding: 2px 2px 0;
}

.screen-title h1 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.screen-title p,
.panel p,
.vuk-card p,
.mode small,
.route-step small,
.level-card small,
.action-item small,
.leaderboard-item small,
.offer-card small {
  color: var(--muted);
  line-height: 1.35;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
  align-items: end;
  min-height: 184px;
  overflow: hidden;
  padding: 18px 14px 0;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(20, 32, 51, 0.16), transparent 46%),
    linear-gradient(135deg, #1666d9 0%, #147c9b 52%, #169b70 100%);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-width: 0;
  padding-bottom: 18px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 800;
}

.hero-card h1 {
  margin-top: 16px;
  max-width: 470px;
  font-size: 36px;
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero-card p {
  max-width: 500px;
  margin-top: 9px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  line-height: 1.35;
}

.vuk-mascot {
  width: 150px;
  max-width: 42vw;
  align-self: end;
  transform: translateY(8px);
  filter: drop-shadow(0 14px 18px rgba(10, 19, 31, 0.22));
}

.stats-grid,
.mode-grid,
.offer-grid,
.profile-stats {
  display: grid;
  gap: 10px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric,
.panel,
.mode,
.level-card,
.vuk-card,
.offer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(25, 41, 70, 0.07);
}

.metric {
  min-width: 0;
  min-height: 86px;
  padding: 12px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  min-width: 0;
  margin: 5px 0 2px;
  font-size: 24px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  padding: 15px;
}

.panel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.panel-row.compact {
  align-items: start;
}

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

.helper-line {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.panel h2,
.vuk-card h2,
.offer-section h2 {
  margin-bottom: 5px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
}

.primary-action,
.soft-action {
  justify-self: end;
  min-width: 96px;
  color: #fff;
  background: var(--orange);
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(242, 122, 26, 0.22);
}

.soft-action {
  color: var(--blue);
  background: rgba(22, 102, 217, 0.1);
  box-shadow: none;
}

.progress-line,
.quota-bar,
.level-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 102, 217, 0.12);
}

.progress-line {
  margin-top: 14px;
}

.progress-line span,
.quota-bar span,
.level-meter span {
  display: block;
  width: var(--value, 0%);
  min-width: 4px;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.route-list,
.quota-list,
.level-list,
.action-list,
.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.route-step,
.quota,
.action-item,
.leaderboard-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.route-step:first-child,
.quota:first-child,
.action-item:first-child,
.leaderboard-item:first-child {
  border-top: 0;
}

.route-step,
.action-item {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
}

.route-number,
.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.route-step b,
.route-step small,
.action-item b,
.action-item small,
.level-card b,
.level-card small,
.leaderboard-item b,
.leaderboard-item small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.route-step button,
.action-item button,
.level-card button,
.offer-card button {
  min-width: 82px;
  padding: 0 12px;
  color: var(--blue);
  background: rgba(22, 102, 217, 0.1);
  font-weight: 850;
}

.quota {
  gap: 6px;
}

.quota-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
}

.quota-top span {
  color: var(--muted);
  white-space: nowrap;
}

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

.mode {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 5px;
  min-height: 102px;
  padding: 13px;
  text-align: left;
}

.mode span {
  font-size: 22px;
}

.mode b {
  font-size: 15px;
}

.mode small {
  font-size: 12px;
}

.mode-blue { border-top: 4px solid var(--blue); }
.mode-green { border-top: 4px solid var(--green); }
.mode-orange { border-top: 4px solid var(--orange); }
.mode-violet { border-top: 4px solid var(--violet); }
.mode-teal { border-top: 4px solid var(--teal); }
.mode-red { border-top: 4px solid var(--red); }

.level-list {
  margin-top: 0;
}

.level-card {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.level-card.is-current {
  border-color: rgba(22, 102, 217, 0.38);
  background: linear-gradient(180deg, rgba(22, 102, 217, 0.08), #fff 48%);
}

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

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

.vuk-card img {
  width: 96px;
  max-width: 100%;
}

.vuk-card .primary-action {
  justify-self: start;
  margin-top: 12px;
}

.offer-section {
  display: grid;
  gap: 9px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.offer-card {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  text-align: left;
}

.offer-card.is-featured {
  border-color: rgba(242, 122, 26, 0.42);
  background: linear-gradient(180deg, rgba(242, 122, 26, 0.1), #fff 58%);
}

.offer-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.offer-top strong {
  display: block;
  font-size: 17px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.offer-badge {
  min-height: 24px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--orange);
  background: rgba(242, 122, 26, 0.12);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.offer-price {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.price-box {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--paper-soft);
}

.price-box.is-disabled {
  color: var(--muted);
  background: rgba(100, 116, 139, 0.08);
}

.price-box b,
.price-box small {
  display: block;
}

.price-box b {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.price-box small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.offer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.offer-meta span {
  min-height: 24px;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(20, 32, 51, 0.06);
  font-size: 11px;
  font-weight: 800;
}

.profile-card {
  display: grid;
  gap: 14px;
}

.profile-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-size: 22px;
  font-weight: 900;
}

.profile-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-stats span {
  min-width: 0;
  min-height: 62px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(22, 102, 217, 0.07);
}

.profile-stats b,
.profile-stats small {
  display: block;
  overflow-wrap: anywhere;
}

.profile-stats small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.leaderboard-item {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
}

.leaderboard-item.is-current .leaderboard-rank {
  background: var(--orange);
}

.account-panel {
  gap: 12px;
}

.account-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.account-actions button {
  min-height: 48px;
  padding: 0 10px;
  color: var(--blue);
  background: rgba(22, 102, 217, 0.1);
  font-size: 13px;
  font-weight: 900;
}

.account-actions button:last-child {
  color: var(--red);
  background: rgba(217, 72, 72, 0.1);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 -10px 26px rgba(25, 41, 70, 0.12);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 50px;
  padding: 4px 2px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.bottom-nav button.is-active {
  color: var(--blue);
  background: rgba(22, 102, 217, 0.1);
}

.bottom-nav span,
.bottom-nav b {
  display: block;
  max-width: 100%;
}

.bottom-nav span {
  font-size: 18px;
}

.bottom-nav b {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 12px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 12px;
  z-index: 10;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(20, 32, 51, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 680px) {
  .mode-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .offer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 420px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

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

  .hero-card {
    grid-template-columns: minmax(0, 1fr) 100px;
    min-height: 172px;
    padding: 15px 12px 0;
  }

  .hero-card h1 {
    font-size: 29px;
  }

  .hero-card p {
    font-size: 14px;
  }

  .vuk-mascot {
    width: 118px;
  }

  .metric {
    padding: 10px;
  }

  .metric strong {
    font-size: 23px;
  }

  .panel-row,
  .level-top,
  .offer-top {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .soft-action {
    justify-self: stretch;
    width: 100%;
  }

  .route-step,
  .action-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .route-step button,
  .action-item button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .offer-price {
    grid-template-columns: 1fr;
  }

  .vuk-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .vuk-card img {
    width: 78px;
  }

  .account-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 340px) {
  .stats-grid,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .vuk-mascot {
    display: none;
  }
}
