/* /app page — AI chat */
.app-body {
  background: var(--ink);
  color: #fff;
  min-height: 100svh;
  position: relative;
}
.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.app-bg canvas {
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: fadeIn 3s var(--ease) forwards;
}
.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 20%, var(--ink) 60%);
}
.app-head {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, var(--ink) 60%, transparent);
}
@media (min-width: 640px) {
  .app-head {
    padding: 20px 32px;
  }
}
.ring-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.net {
  display: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding-inline: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.net .live-dot::before,
.net .live-dot::after {
  background: rgba(255, 255, 255, 0.35);
}
.net.on {
  color: var(--accent);
  border-color: rgba(240, 179, 158, 0.3);
}
.net.on .live-dot::before,
.net.on .live-dot::after {
  background: var(--accent);
}
@media (min-width: 640px) {
  .net {
    display: inline-flex;
  }
}
.btn.addr {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
}
.app-main {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 76px);
}
@media (min-width: 640px) {
  .app-main {
    padding-inline: 32px;
  }
}
.app-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.app-main[data-state="chat"] .app-hero {
  display: none;
}
.app-hero .h1 {
  margin-top: 20px;
  font-size: clamp(2.4rem, 6vw, 3.8rem);
}
.app-hero .lead {
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
}
.fine {
  margin: 12px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* Thread */
.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 24px;
}
.msg-user {
  align-self: flex-end;
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  border-top-right-radius: 6px;
  background: rgba(240, 179, 158, 0.16);
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  animation: swapIn 0.4s var(--ease);
}
.msg-bot {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  align-self: flex-start;
  max-width: 100%;
  animation: swapIn 0.4s var(--ease);
}
.msg-bot .avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-top: 4px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f2ee;
}
.portrait {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f2ee;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9);
  margin-bottom: 20px;
  animation: appear 0.8s var(--ease) forwards, float 7s ease-in-out 1s infinite;
}
.bot-body {
  min-width: 0;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 18px;
  border-top-left-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  padding: 14px 16px;
}
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
}
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s;
}
.steps li::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-sizing: border-box;
}
.steps li.active {
  color: rgba(255, 255, 255, 0.85);
}
.steps li.active::before {
  border-color: rgba(240, 179, 158, 0.3);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.steps li.done {
  color: rgba(255, 255, 255, 0.7);
}
.steps li.done::before {
  border: 0;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0b09' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 9px no-repeat;
}
.bot-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.bot-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bot-text strong {
  font-weight: 600;
}
.bot-text ul {
  margin: 6px 0;
  padding-left: 18px;
}
.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sources a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  max-width: 100%;
}
.sources a span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sources a:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.followups .chip {
  cursor: pointer;
  font-size: 13px;
  padding: 6px 12px;
}
.source-note {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* Composer */
.composer {
  position: sticky;
  bottom: 16px;
  margin-top: 24px;
  padding: 8px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(26, 23, 20, 0.8);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  z-index: 10;
}
.composer-in {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
}
.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
  padding: 8px 0;
}
.composer textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.composer .send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.composer .send:disabled {
  opacity: 0.6;
}
.examples {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.app-main[data-state="chat"] .examples {
  display: none;
}
.examples .chip {
  cursor: pointer;
}

/* Wallet sheet */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s;
}
@media (min-width: 640px) {
  .sheet {
    align-items: center;
  }
}
.sheet-card {
  width: 100%;
  max-width: 440px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--ink-2);
  padding: 24px;
  animation: swapIn 0.4s var(--ease);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 {
  font-size: 24px;
}
.sheet-head .x {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}
.sheet-head .x:hover {
  background: rgba(255, 255, 255, 0.1);
}
.sheet-sub {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.65);
}

/* Product results */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.card {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.3s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
}
.card.best {
  border-color: rgba(240, 179, 158, 0.45);
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(26, 23, 20, 0.35);
}
.thumb svg {
  width: 44px;
  height: 44px;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}
.thumb.logo {
  background: #f6f2ec;
}
.thumb.logo img {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 14px;
}
.best-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  z-index: 1;
}
.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px;
  gap: 4px;
}
.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.card-meta {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}
.card-meta b {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}
.card-why {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.75);
  flex: 1;
}
.price {
  margin: 8px 0 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.price small {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}
.price em {
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  margin-left: 4px;
}
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.card-actions .btn {
  height: 38px;
  font-size: 13px;
}
.btn.ghost-dark {
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.btn.ghost-dark:hover {
  background: rgba(255, 255, 255, 0.1);
}
.btn.light {
  background: #fff;
  color: var(--ink);
}
.btn.light:hover {
  background: var(--paper-2);
}
.store-link {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  transition: color 0.3s;
}
.store-link:hover {
  color: #fff;
}
.receipt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.receipt svg {
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  flex: 0 0 auto;
}

/* Checkout */
.pay-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.pay-item .mini {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: #fff;
  color: rgba(26, 23, 20, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pay-item .mini img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.pay-item .mini svg {
  width: 26px;
  height: 26px;
}
.pay-item p {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}
.rows {
  margin: 16px 0 0;
  padding: 4px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
}
.rows > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.rows > div + div {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.rows dt {
  color: rgba(255, 255, 255, 0.6);
}
.rows dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.rows dd small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-left: 4px;
}
.rows .total {
  font-size: 16px;
  font-weight: 500;
}
.rows .total dt {
  color: #fff;
}
.field {
  display: block;
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 14px;
  outline: 0;
}
.field input:focus {
  border-color: rgba(240, 179, 158, 0.5);
}
.pay-status {
  padding: 24px 0 8px;
  text-align: center;
}
.pay-status h3 {
  margin: 16px 0 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.pay-status p {
  margin: 6px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}
.ring {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.tick {
  width: 52px;
  height: 52px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.5s var(--ease);
}
.tick svg {
  width: 26px;
  height: 26px;
}
@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
#pay-body .fine {
  text-align: center;
}
.wallets {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wallet-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 14px;
  text-align: left;
  transition: background 0.3s;
}
.wallet-opt:hover {
  background: rgba(255, 255, 255, 0.08);
}
.wallet-opt img,
.wallet-opt .wicon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  font-style: normal;
  font-weight: 600;
}
.wallet-opt em {
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
.wallet-empty {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
}
.wallet-empty a {
  color: var(--accent);
  text-decoration: underline;
}
.sheet-error {
  margin: 12px 0 0;
  font-size: 13px;
  color: #fca5a5;
}
.btn.wide {
  width: 100%;
  margin-top: 16px;
}
