:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #edf5ff;
  --text: #17212b;
  --muted: #6a7b8f;
  --line: #dfe7f0;
  --accent: #2aabee;
  --accent-strong: #168acd;
  --danger: #e55b64;
  --shadow: 0 10px 28px rgba(30, 75, 115, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 90px);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.title-block {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

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

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

h2 {
  margin-bottom: 14px;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin: 20px 0 10px;
  font-size: 15px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.avatar-button {
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #35c7a4 0%, #2aabee 100%);
  background-position: center;
  background-size: cover;
  color: #fff;
  font-weight: 800;
  overflow: hidden;
}

.avatar.big {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.avatar.has-photo {
  color: transparent;
}

.account-menu {
  position: absolute;
  z-index: 5;
  top: calc(env(safe-area-inset-top) + 74px);
  right: 16px;
  left: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 44px rgba(34, 67, 98, 0.18);
  backdrop-filter: blur(18px);
}

.account-menu button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 0 16px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.account-menu .account-summary {
  justify-content: flex-start;
  gap: 12px;
  min-height: 72px;
  border-top: 0;
}

.logout-link {
  color: var(--danger) !important;
}

.screen {
  display: none;
  animation: appear 160ms ease-out;
}

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

.card,
.balance-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  padding: 16px;
}

.balance-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #e8f6ff 100%);
}

.balance-panel strong {
  display: block;
  margin: 3px 0;
  font-size: 38px;
  line-height: 1;
}

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

small {
  display: block;
  font-size: 12px;
}

.primary-button,
.secondary-button,
.small-button,
.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:active {
  background: var(--accent-strong);
}

.secondary-button,
.small-button {
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.danger-button {
  margin-top: 10px;
  background: #fff0f1;
  color: var(--danger);
}

.full {
  width: 100%;
}

.section-head,
.device-row,
.list button,
.copy-field,
.store-grid {
  display: flex;
  align-items: center;
}

.section-head {
  justify-content: space-between;
  gap: 12px;
}

.section-head h2 {
  margin-bottom: 0;
}

.device-row,
.list button {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.device-row {
  gap: 12px;
  padding: 14px 0;
}

.device-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-soft);
}

.device-row span:nth-child(2) {
  flex: 1;
}

.chevron {
  color: var(--muted);
  font-size: 24px;
}

.referral-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.social-card h2 {
  margin-bottom: 12px;
}

.social-grid,
.support-grid,
.profile-actions {
  display: grid;
  gap: 10px;
}

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

.social-grid button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.profile-card {
  background: linear-gradient(135deg, #ffffff 0%, #eaf7ff 100%);
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.profile-head h2,
.profile-head p {
  margin-bottom: 2px;
}

.profile-head p {
  color: var(--muted);
}

.profile-meta {
  margin: 0 0 16px;
}

.profile-meta div,
.verified-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.profile-meta dt,
.verified-row span {
  color: var(--muted);
}

.profile-meta dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

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

.profile-actions .danger-button {
  margin-top: 0;
}

.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.note.center {
  text-align: center;
}

.referral-card p,
.hero-card p,
details p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.hero-card {
  text-align: center;
}

.hero-icon {
  margin-bottom: 8px;
  font-size: 42px;
}

.list {
  overflow: hidden;
  margin: 0 -16px 16px;
}

.list button {
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
}

.list.compact {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.copy-field {
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: var(--bg);
}

.copy-field input,
.text-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.copy-field button {
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 700;
}

.text-input {
  min-height: 46px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--bg);
}

.store-grid,
.amount-grid {
  display: grid;
  gap: 10px;
}

.store-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

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

.amount-grid button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
}

.amount-grid .is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.amount-grid button:active,
.payment-list button:active,
.social-grid button:active,
.secondary-button:active,
.small-button:active {
  transform: translateY(1px);
}

.payment-list {
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.payment-list button {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.payment-list button:first-child {
  border-top: 0;
}

.payment-list .is-selected {
  background: var(--surface-soft);
}

.payment-list button > span:nth-child(2) {
  flex: 1;
}

.payment-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface);
}

.radio-dot {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 50%;
}

.is-selected .radio-dot {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 0 42%, transparent 47%);
}

.timeline p {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.timeline span {
  color: var(--muted);
  font-size: 13px;
}

details {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

summary {
  font-weight: 700;
}

.support-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 10px 10px calc(env(safe-area-inset-bottom) + 10px);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.tabbar button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tabbar .is-active {
  background: var(--surface-soft);
  color: var(--accent-strong);
}

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