:root {
  --bg0: #040b16;
  --bg1: #071428;
  --card: rgba(12, 28, 58, 0.72);
  --card-solid: #0c1c3a;
  --line: rgba(130, 175, 255, 0.18);
  --line-strong: rgba(110, 165, 255, 0.45);
  --text: #eef4ff;
  --muted: #8ea6c9;
  --accent: #2f6dff;
  --accent2: #6aa5ff;
  --buy: #3d8bff;
  --buy-glow: rgba(61, 139, 255, 0.45);
  --sell: #2ec4a0;
  --sell-glow: rgba(46, 196, 160, 0.4);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: Manrope, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
}
body { padding-bottom: 120px; overflow-x: hidden; }

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 600px at 0% -10%, rgba(47, 109, 255, 0.28), transparent 55%),
    radial-gradient(800px 500px at 110% 10%, rgba(30, 90, 200, 0.22), transparent 50%),
    linear-gradient(165deg, #0a1830 0%, var(--bg0) 45%, #02060e 100%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: float 12s ease-in-out infinite;
}
.orb-a {
  width: 220px; height: 220px;
  left: -60px; top: 80px;
  background: radial-gradient(circle, #2f6dff, transparent 70%);
}
.orb-b {
  width: 180px; height: 180px;
  right: -40px; top: 220px;
  background: radial-gradient(circle, #1fa8ff, transparent 70%);
  animation-delay: -4s;
}
.orb-c {
  width: 260px; height: 260px;
  left: 30%; bottom: -80px;
  background: radial-gradient(circle, #1a4db8, transparent 70%);
  animation-delay: -7s;
  opacity: 0.35;
}
.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 170, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 20%, black 20%, transparent 70%);
  pointer-events: none;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.05); }
}

.top {
  padding: 18px 18px 6px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.brand-row { display: flex; gap: 12px; align-items: center; }
.logo-mark {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-family: Syne, sans-serif;
  font-weight: 800;
  font-size: 22px;
  background: linear-gradient(145deg, #4d8fff, #1a4fd0);
  box-shadow: 0 10px 28px rgba(47, 109, 255, 0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}
.brand {
  font-family: Syne, sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}
.sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.mode-pill {
  margin-top: 4px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(8, 20, 42, 0.7);
  white-space: nowrap;
}
.mode-pill.buy { color: #9cc4ff; border-color: rgba(61,139,255,.45); background: rgba(47,109,255,.18); }
.mode-pill.sell { color: #8ff0d2; border-color: rgba(46,196,160,.45); background: rgba(46,196,160,.15); }

.steps {
  display: flex;
  gap: 6px;
  padding: 8px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }
.step {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(142, 166, 201, 0.55);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.step.done { color: var(--accent2); }
.step.active {
  color: white;
  background: rgba(47, 109, 255, 0.22);
  border-color: rgba(106, 165, 255, 0.35);
}

.app {
  padding: 10px 16px 28px;
  display: grid;
  gap: 12px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(30, 70, 150, 0.55), rgba(10, 24, 48, 0.85)),
    var(--card-solid);
  box-shadow: var(--shadow);
  animation: rise 0.45s ease both;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(106,165,255,.35), transparent 70%);
  pointer-events: none;
}
.hero-card h1 {
  margin: 0 0 8px;
  font-family: Syne, sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}
.hero-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 34ch;
  position: relative;
  z-index: 1;
}

.mode-grid {
  display: grid;
  gap: 12px;
}
.mode-card {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px 18px 16px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.5s ease both;
}
.mode-card:nth-child(2) { animation-delay: 0.06s; }
.mode-card:active { transform: scale(0.985); }
.mode-card.buy {
  background:
    linear-gradient(145deg, rgba(47, 109, 255, 0.28), rgba(12, 28, 58, 0.85));
}
.mode-card.sell {
  background:
    linear-gradient(145deg, rgba(46, 196, 160, 0.22), rgba(12, 28, 58, 0.85));
}
.mode-card:hover { border-color: var(--line-strong); }
.mode-card .icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 22px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}
.mode-card.buy .icon { box-shadow: 0 0 24px var(--buy-glow); }
.mode-card.sell .icon { box-shadow: 0 0 24px var(--sell-glow); }
.mode-card h3 {
  margin: 0 0 6px;
  font-family: Syne, sans-serif;
  font-size: 20px;
  font-weight: 800;
}
.mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.mode-card .arrow {
  position: absolute;
  right: 16px; bottom: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08);
  font-weight: 800;
  color: white;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise 0.35s ease both;
}
.card h2 {
  margin: 0 0 4px;
  font-family: Syne, sans-serif;
  font-size: 17px;
  font-weight: 800;
}
.card .lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid.one { grid-template-columns: 1fr; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 30, 60, 0.9), rgba(8, 18, 38, 0.9));
  color: var(--text);
  border-radius: 16px;
  padding: 14px 12px;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: 0.16s ease;
  position: relative;
  overflow: hidden;
}
.chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: translateX(-100%);
  transition: 0.4s ease;
}
.chip:hover::before { transform: translateX(100%); }
.chip:hover { border-color: rgba(106, 165, 255, 0.55); transform: translateY(-1px); }
.chip.active {
  border-color: rgba(61, 126, 255, 0.95);
  background: linear-gradient(180deg, rgba(61, 126, 255, 0.4), rgba(22, 55, 120, 0.55));
  box-shadow: 0 8px 22px rgba(47, 109, 255, 0.28), inset 0 0 0 1px rgba(160, 200, 255, 0.12);
}
.chip .emoji {
  display: block;
  font-size: 20px;
  margin-bottom: 6px;
}
.chip .hint {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.cat-iphone.active, .cat-macbook.active, .cat-ipad.active, .cat-watch.active {
  border-color: rgba(106,165,255,.9);
}
.cat-samsung.active {
  border-color: rgba(90, 140, 255, .9);
}

.navrow {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: 0.15s ease;
}
.btn.ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.primary {
  background: linear-gradient(180deg, #7ab0ff, var(--accent));
  color: white;
  box-shadow: 0 12px 28px rgba(47, 109, 255, 0.4);
  min-width: 126px;
}
.btn.primary.sell-tone {
  background: linear-gradient(180deg, #5ee0bc, #1fa884);
  box-shadow: 0 12px 28px rgba(46, 196, 160, 0.35);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn:not(:disabled):active { transform: scale(0.98); }

.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(4, 11, 22, 0.9);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: rise 0.3s ease both;
}
.bar-label { font-size: 12px; font-weight: 700; color: var(--accent2); letter-spacing: 0.03em; text-transform: uppercase; }
.bar-meta { color: var(--muted); font-size: 13px; margin-top: 2px; max-width: 52vw; }

.empty {
  color: var(--muted);
  padding: 28px 8px;
  text-align: center;
}

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