:root {
  --bg: #070b14;
  --surface: #0f172a;
  --surface-2: #162033;
  --border: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --rose: #e11d48;
  --rose-soft: rgba(225, 29, 72, 0.16);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: radial-gradient(circle at top, #181024 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.boot-splash {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.boot-icon { font-size: 3rem; }
.boot-title { color: var(--muted); font-size: 0.95rem; }

#blazor-error-ui {
  background: #7f1d1d;
  color: #fecaca;
  bottom: 0;
  left: 0;
  position: fixed;
  width: 100%;
  padding: 0.75rem 1rem;
  display: none;
  z-index: 1000;
}
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

.app-shell {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 5.5rem;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(7, 11, 20, 0.86);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-title { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-sub { font-size: 0.75rem; color: var(--muted); }

.main-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.card {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1.15rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.card-hero {
  background: linear-gradient(145deg, rgba(136, 19, 55, 0.35), rgba(15, 23, 42, 0.95));
  border-color: rgba(225, 29, 72, 0.35);
  text-align: center;
  padding: 1.75rem 1.25rem;
}

.card-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.65rem 0; display: flex; align-items: center; gap: 0.5rem; }
.muted { color: var(--muted); font-size: 0.84rem; }

.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.pill-emerald { background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.35); color: #6ee7b7; }
.pill-rose { background: var(--rose-soft); border-color: rgba(225, 29, 72, 0.35); color: #fda4af; }
.pill-amber { background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.35); color: #fcd34d; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  border-radius: 0.85rem;
  padding: 0.72rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--rose); color: #fff; }
.btn-primary:hover { background: #f43f5e; }
.btn-emerald { background: #059669; color: #fff; }
.btn-emerald:hover { background: #10b981; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #1e293b; }
.btn-danger { background: rgba(225, 29, 72, 0.15); color: #fda4af; border: 1px solid rgba(225, 29, 72, 0.3); }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.78rem; border-radius: 0.65rem; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%;
  background: #090e1a;
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 0.8rem;
  padding: 0.68rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--rose);
}

.field-label { display: block; font-size: 0.76rem; color: var(--muted); margin-bottom: 0.3rem; font-weight: 600; }
.row { display: flex; gap: 0.6rem; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }

.alert-error {
  background: rgba(225, 29, 72, 0.14);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fecdd3;
  border-radius: 0.85rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.83rem;
}
.alert-ok {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
  border-radius: 0.85rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.83rem;
}

.list-item {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.match-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0.4rem 0;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  z-index: 30;
  background: rgba(10, 15, 28, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.45rem 0.4rem max(0.55rem, env(safe-area-inset-bottom));
}

.nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.25rem;
  border-radius: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.nav-btn.active { color: #fb7185; background: rgba(225, 29, 72, 0.1); }
.nav-icon { font-size: 1.2rem; line-height: 1; }

/* Chat & Product Research Cards */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 55dvh;
  overflow-y: auto;
  padding-right: 0.2rem;
}
.msg {
  max-width: 92%;
  padding: 0.75rem 0.95rem;
  border-radius: 1rem;
  font-size: 0.88rem;
  line-height: 1.48;
  white-space: pre-wrap;
}
.msg-user {
  align-self: flex-end;
  background: var(--rose);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}
.msg-assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 0.25rem;
}

.research-wrap {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.shop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.shop-card {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  background: #090e1a;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.55rem;
  text-decoration: none;
  color: inherit;
}
.shop-card:hover { border-color: var(--rose); }
.shop-thumb {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  object-fit: cover;
  background: #1e293b;
  flex-shrink: 0;
}
.reddit-card {
  display: block;
  background: #090e1a;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.78rem;
}
.reddit-card:hover { border-color: #fb923c; }

.code-box {
  background: #050810;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  padding: 0.6rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: #6ee7b7;
  word-break: break-all;
}
