/* ============ THEME · mobile-first ============ */
:root {
  --bg-app: #050708;
  --bg-card: #131417;
  --bg-card-hover: #1a1b1f;
  --bg-elevated: #1e1f24;

  --border: #24252b;
  --border-strong: #34353d;

  --text-primary: #f4f5f7;
  --text-secondary: #a7abb3;
  --text-tertiary: #7c8088;
  --text-muted: #565a61;
  --accent: #21e07b;

  --radius-card: 16px;
  --radius-btn: 14px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pad: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: #030304;
  color: var(--text-primary);
  display: grid;
  place-items: center;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* phone frame */
.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 480px) {
  body { padding: 20px; }
  .app {
    height: min(920px, calc(100dvh - 40px));
    border-radius: 32px;
    box-shadow: 0 0 0 1px #1e1f23, 0 30px 80px rgba(0, 0, 0, .7);
  }
}

/* ============ SPACE BACKGROUND (welcome) ============ */
.space {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(130% 85% at 50% 8%, #0d3524 0%, #08211a 34%, #050d0b 62%, var(--bg-app) 100%);
  pointer-events: none;
}

.space-glow {
  position: absolute;
  left: 50%;
  top: 26%;
  width: 340px;
  height: 340px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(33, 224, 123, .22) 0%, rgba(33, 224, 123, .07) 45%, transparent 70%);
  filter: blur(6px);
}

.stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: .92;
  filter: saturate(1.05);
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 65% at 50% 22%, rgba(8, 46, 32, .3), transparent 65%),
    linear-gradient(180deg, rgba(5, 7, 8, .35) 0%, rgba(5, 7, 8, .5) 42%, rgba(5, 7, 8, .93) 100%);
}

/* ============ SCREENS ============ */
.screen {
  position: relative;
  z-index: 1;
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  background: var(--bg-app);
}
.screen.active { display: flex; animation: screen-in .22s ease; }
#screen-welcome { background: transparent; }

@keyframes screen-in {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: none; }
}

.screen-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px var(--pad) 24px;
  -webkit-overflow-scrolling: touch;
}

.screen-footer {
  position: sticky;
  bottom: 0;
  padding: 12px var(--pad) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg-app) 72%, transparent);
}

/* ============ TOPBAR ============ */
.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 14px 12px 8px;
  padding-top: calc(14px + env(safe-area-inset-top));
}

.topbar::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: start;
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: #33343a;
  margin-bottom: 10px;
}

.topbar-title {
  grid-column: 2;
  grid-row: 2;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

.topbar .icon-btn { grid-row: 2; }
.topbar .icon-btn:first-of-type { grid-column: 1; justify-self: start; }
.topbar .icon-btn:last-of-type { grid-column: 3; justify-self: end; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .15s;
}
.icon-btn:active { background: var(--bg-card); }

/* ============ WELCOME ============ */
.welcome-content {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(56px + env(safe-area-inset-top)) var(--pad) calc(24px + env(safe-area-inset-bottom));
}

.welcome-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 80px;
  height: 80px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(33, 224, 123, .12);
  border: 1px solid rgba(33, 224, 123, .3);
  box-shadow: 0 0 40px rgba(33, 224, 123, .32), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.brand-logo img { width: 46px; height: 46px; object-fit: contain; }

.brand-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.slogan {
  font-size: clamp(36px, 10.5vw, 46px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -.035em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .55);
}

.accent {
  color: var(--accent);
  text-shadow: 0 0 26px rgba(33, 224, 123, .45);
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(8px);
  font-size: 13px;
  color: var(--text-secondary);
}
.trust-pill svg { color: var(--accent); }

.welcome-foot { margin-top: auto; }

.terms {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-tertiary);
  max-width: 300px;
  margin-inline: auto;
  text-align: center;
  line-height: 1.5;
}
.terms a { color: var(--text-secondary); text-decoration: underline; }

/* ============ LISTS ============ */
.lead {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 14px 0 20px;
}

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
}
.wallet-btn:active {
  transform: scale(.985);
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.wallet-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.wallet-icon-fallback {
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.row-chevron {
  margin-left: auto;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ============ CHOSEN WALLET (import screen) ============ */
.chosen-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.chosen-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.chosen-meta { display: flex; flex-direction: column; gap: 2px; }
.chosen-label { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; }
.chosen-name { font-size: 16px; font-weight: 700; }

/* ============ IMPORT OPTIONS ============ */
.option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
}
.option-card:active {
  transform: scale(.985);
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.option-icon {
  flex-shrink: 0;
  display: block;
  line-height: 0;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35));
}
.option-card:active .option-icon { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3)); }

.option-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.option-title { font-size: 16px; font-weight: 700; }
.option-sub { font-size: 13px; color: var(--text-tertiary); }

/* ============ FIELDS ============ */
.field-box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: border-color .15s;
}
.field-box:focus-within { border-color: var(--border-strong); }

.field-textarea,
.field-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.field-textarea {
  min-height: 150px;
  padding: 16px 16px 34px;
  resize: none;
  line-height: 1.55;
}

.field-counter {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.field-counter.ok { color: var(--accent); }

.field-box-row { display: flex; align-items: center; }
.field-input { padding: 16px 52px 16px 16px; }

.eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 12px;
}
.eye-btn:active { color: var(--text-primary); }

::placeholder { color: var(--text-muted); }

/* ============ BUTTONS ============ */
.btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, opacity .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-light {
  background: #ffffff;
  color: #0b0c0e;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.btn-light:active { background: #e9eaec; }

.btn-primary { background: var(--accent); color: #04140b; }
.btn-primary:active:not(:disabled) { background: #1cc96d; }

.btn-ghost {
  margin-top: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-ghost:active { background: var(--bg-card-hover); }

.privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.privacy svg { flex-shrink: 0; }

/* ============ TOAST ============ */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  animation: toast-in .18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ SHORT SCREENS ============ */
@media (max-height: 700px) {
  .welcome-content { padding-top: calc(36px + env(safe-area-inset-top)); }
  .welcome-hero { gap: 18px; }
  .slogan { font-size: 34px; }
}
