/* ============================================================
   DESIGN TOKENS - locked from the approved art + ui-ux-pro-max
   "iOS notification / fintech dark" system search.
   Palette: cool blue on black, pulled from the multi-exposure
   photo's own blue tone. Cards: off-white iOS-notification cream,
   near-black card text (matches the baked avatar exactly).
   Type: Inter (closest bundleable stand-in for the SF-Pro
   iOS-notification look; system-font stack is banned as the
   visible face, so it is fetched, not defaulted).
   Spacing scale: 8 / 12 / 16 / 24 / 32 / 48.
   Radius: 22px (card), 14px (chip) - iOS-style continuous corners.
   Motion: card slide-down-in / slide-right-out, one idiom reused
   everywhere a card enters or leaves.
   ============================================================ */
:root {
  --bg: #050608;
  --bg-panel: #0B0F14;
  --line: #232A34;
  --face-blue: #6FA9D6;
  --face-blue-soft: rgba(111, 169, 214, 0.35);
  --card-bg: #EDEBE4;
  --card-bg-pinned: #E4E9EE;
  --text-dark: #17181B;
  --text-sub: #6E6E73;
  --text-light: #F5F6F8;
  --text-dim: #8B94A0;
  --radius-card: 22px;
  --radius-chip: 14px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-light);
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

#boot-error {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: #E94B4B;
  color: #fff;
  font: 600 13px/1.4 'Inter', sans-serif;
  padding: 10px 16px;
  white-space: pre-wrap;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; }

.stage {
  height: 100svh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(12px, 2vw, 20px) clamp(14px, 3vw, 32px);
  gap: clamp(8px, 1.4vh, 16px);
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.brand-name {
  font-weight: 800;
  font-size: clamp(15px, 1.6vw, 19px);
  letter-spacing: 0.02em;
}

.brand-ticker {
  font-size: clamp(11px, 1.1vw, 13px);
  color: var(--face-blue);
  font-weight: 600;
  border: 1px solid var(--face-blue-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.uptime {
  font-size: clamp(11px, 1.1vw, 13px);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- hero / main ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(12px, 2vw, 28px);
  min-height: 0;
}

.portrait {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  background: #000;
  min-height: 0;
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 20%;
}

.portrait-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(5,6,8,0.55) 100%),
              linear-gradient(90deg, rgba(5,6,8,0.15) 0%, rgba(5,6,8,0) 30%);
  pointer-events: none;
}

.feed-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
}

.feed-line {
  margin: 0;
  font-size: clamp(13px, 1.5vw, 16px);
  color: var(--text-light);
  font-weight: 500;
  line-height: 1.4;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.feed-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.feed-counter {
  font-size: clamp(12px, 1.3vw, 14px);
  font-weight: 700;
  color: var(--face-blue);
  font-variant-numeric: tabular-nums;
}

/* ---------- feed list / notification cards ---------- */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}

/* hard safety net: pinned card (1st) + at most 3 live cards ever render,
   regardless of any timer backlog from a throttled/backgrounded tab */
.feed-list > .notif-card:nth-child(n + 5) {
  display: none;
}

.notif-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--card-bg);
  border-radius: var(--radius-card);
  padding: clamp(10px, 1.4vh, 14px) clamp(12px, 1.6vw, 16px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  flex-shrink: 0;
}

.notif-pinned {
  background: var(--card-bg-pinned);
  border: 1px solid rgba(111, 169, 214, 0.4);
}

.notif-icon {
  width: clamp(30px, 3vw, 38px);
  height: clamp(30px, 3vw, 38px);
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
}

.notif-icon img { width: 100%; height: 100%; object-fit: cover; }

.notif-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.notif-amount {
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 700;
  color: var(--text-dark);
}

.notif-sub, .notif-title {
  font-size: clamp(12px, 1.3vw, 13.5px);
  color: var(--text-sub);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-title { color: var(--text-dark); font-weight: 600; }

.notif-source {
  font-size: clamp(11px, 1.2vw, 12.5px);
  color: var(--text-sub);
}

.notif-source code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: var(--text-dark);
  font-weight: 600;
}

.copy-btn {
  flex-shrink: 0;
  background: rgba(23,24,27,0.08);
  border: none;
  border-radius: var(--radius-chip);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 160ms var(--ease), transform 160ms var(--ease);
}

.copy-btn:hover { background: rgba(23,24,27,0.16); }
.copy-btn:active { transform: scale(0.94); }
.copy-btn.copied { background: var(--face-blue); color: #06131C; }

.notif-live {
  cursor: pointer;
  transform: translateY(-14px);
  opacity: 0;
  transition: transform 320ms var(--ease), opacity 320ms var(--ease);
}

.notif-live.notif-in,
.notif-live.notif-seed {
  transform: translateY(0);
  opacity: 1;
}

.notif-live.notif-out {
  transform: translateX(60px);
  opacity: 0;
  transition: transform 240ms var(--ease), opacity 240ms var(--ease);
}

/* ---------- chrome row ---------- */
.chrome-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
  flex-wrap: wrap;
}

.buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--face-blue);
  color: #06131C;
  font-weight: 800;
  font-size: clamp(13px, 1.4vw, 15px);
  letter-spacing: 0.02em;
  padding: clamp(10px, 1.4vh, 13px) clamp(18px, 2vw, 24px);
  border-radius: 999px;
  text-decoration: none;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
  box-shadow: 0 6px 20px rgba(111, 169, 214, 0.3);
}

.buy-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(111, 169, 214, 0.42); }
.buy-btn:active { transform: translateY(0); }

.chain-tag {
  font-size: clamp(11px, 1.2vw, 12.5px);
  color: var(--text-dim);
}

/* ---------- footer ---------- */
.footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-top: 1px solid var(--line);
  padding-top: var(--space-2);
}

.x-link {
  display: inline-flex;
  flex-shrink: 0;
}

.x-icon {
  width: 30px;
  height: 30px;
  transition: transform 160ms var(--ease);
}

.x-link:hover .x-icon { transform: scale(1.08); }

.footer-note {
  font-size: clamp(11px, 1.2vw, 12.5px);
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- responsive ---------- */
@media (min-width: 1200px) {
  .notif-card { padding: 18px 22px; }
  .notif-amount { font-size: 22px; }
  .notif-sub, .notif-title { font-size: 15px; }
  .feed-line { font-size: 18px; }
  .feed-list { gap: var(--space-3); }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(90px, 26vh) 1fr;
  }
  .portrait-img { object-position: 62% 15%; }
  .feed-list { gap: var(--space-1); }
  .notif-card { padding: 10px 12px; }
  .feed-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

@media (max-width: 400px) {
  .stage { padding: 10px 12px; gap: 8px; }
  .hero { grid-template-rows: minmax(72px, 20vh) 1fr; gap: 10px; }
  .brand-name { font-size: 14px; }
  .chrome-row { gap: 10px; }
  .footer-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .notif-live, .notif-live.notif-in, .notif-live.notif-out, .buy-btn, .copy-btn {
    transition: none !important;
  }
}
