:root {
  --bg: #0b0d10;
  --bg2: #12161c;
  --bg3: #1a2029;
  --border: #243041;
  --text: #e8edf5;
  --muted: #8b97a8;
  --orange: #f7931a;
  --orange-dim: rgba(247, 147, 26, 0.15);
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
  --font: "Inter", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.app { max-width: 1120px; margin: 0 auto; padding: 0 20px 80px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11,13,16,0.85);
  border-bottom: 1px solid var(--border);
  margin: 0 -20px; padding: 12px 20px;
}
.topbar-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--orange), #ffb347);
  display: grid; place-items: center; color: #111; font-size: 14px; font-weight: 800;
}
.demo-badge {
  font-size: 11px; font-weight: 600; color: var(--orange);
  background: var(--orange-dim); border: 1px solid rgba(247,147,26,0.35);
  padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); padding: 8px 12px; border-radius: 10px;
  font-size: 0.9rem; white-space: nowrap; text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--bg3); box-shadow: inset 0 -2px 0 var(--orange); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; background: var(--bg2);
  border: 1px solid var(--border); display: grid; place-items: center; position: relative;
}
.icon-btn:hover { border-color: var(--orange); }
.badge-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  background: var(--orange); border-radius: 50%;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; font-size: 0.875rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text);
  transition: 0.15s ease;
}
.btn:hover { border-color: var(--orange); }
.btn-primary { background: var(--orange); color: #111; border-color: var(--orange); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

/* Hero / meta */
.page-head { padding: 28px 0 8px; }
.page-head h1 { font-size: 1.65rem; font-weight: 750; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 0.95rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.pill {
  font-size: 12px; color: var(--muted); background: var(--bg2);
  border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px;
}

/* Sections */
.section { margin-top: 28px; }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.section-title h2 { font-size: 1.1rem; font-weight: 700; }
.section-title .sub { color: var(--muted); font-size: 0.85rem; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 0.8rem;
  background: var(--bg2); border: 1px solid var(--border); color: var(--muted);
}
.chip:hover, .chip.active { color: var(--text); border-color: var(--orange); background: var(--orange-dim); }

/* Cards grid */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; }
}

.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.card:hover { border-color: #3a4a60; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--orange); }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card h3 { font-size: 1.05rem; font-weight: 700; }
.card .proto { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.heat {
  font-size: 12px; font-weight: 700; color: var(--orange);
  background: var(--orange-dim); padding: 4px 8px; border-radius: 8px; white-space: nowrap;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
  background: var(--bg3); color: var(--muted); border: 1px solid var(--border);
}
.card-summary { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.card-foot {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center;
  justify-content: space-between;
}
.meta-inline { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); }
.warn { color: #fbbf24; }
.ok { color: var(--green); }
.danger { color: #f87171; }

/* Protocol heat bars */
.heat-list { display: flex; flex-direction: column; gap: 10px; }
.heat-row { display: grid; grid-template-columns: 120px 1fr 40px; gap: 10px; align-items: center; }
.heat-row .name { font-size: 0.85rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: var(--bg3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #c46b0a, var(--orange)); border-radius: 999px; }
.heat-row .val { font-size: 12px; color: var(--orange); font-weight: 700; text-align: right; }

/* Project detail */
.detail-hero { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.stat {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; min-width: 120px;
}
.stat .label { font-size: 11px; color: var(--muted); }
.stat .value { font-size: 0.95rem; font-weight: 650; margin-top: 2px; }

.steps { display: flex; flex-direction: column; gap: 16px; }
.step {
  display: grid; grid-template-columns: 160px 1fr; gap: 16px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
@media (max-width: 640px) { .step { grid-template-columns: 1fr; } }
.step-img {
  background: var(--bg3); min-height: 120px; display: grid; place-items: center;
  color: var(--muted); font-size: 0.8rem; text-align: center; padding: 12px;
  border-right: 1px solid var(--border);
  background-image:
    linear-gradient(135deg, rgba(247,147,26,0.08), transparent 50%),
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(255,255,255,0.02) 8px, rgba(255,255,255,0.02) 16px);
}
.step-body { padding: 16px 18px; }
.step-body h4 { font-size: 1rem; margin-bottom: 6px; }
.step-body p { color: var(--muted); font-size: 0.9rem; }
.source {
  margin-top: 10px; font-size: 12px; color: var(--muted);
  padding-top: 8px; border-top: 1px dashed var(--border);
}
.source a { font-weight: 600; }

/* Timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 0 0 18px 0; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--muted); background: var(--bg);
}
.tl-item.done .tl-dot { background: var(--orange); border-color: var(--orange); }
.tl-item.future .tl-dot { background: transparent; border-color: var(--orange); border-style: dashed; }
.tl-item.highlight .tl-dot { box-shadow: 0 0 0 4px var(--orange-dim); }
.tl-date { font-size: 12px; color: var(--muted); }
.tl-title { font-size: 0.95rem; font-weight: 600; }

/* Events / account */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.list-item h4 { font-size: 0.95rem; }
.toggle-group { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle {
  font-size: 12px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); color: var(--muted); background: var(--bg3);
}
.toggle.on { color: #111; background: var(--orange); border-color: var(--orange); font-weight: 650; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
input[type="email"], input[type="text"] {
  flex: 1; min-width: 200px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text); font-size: 0.9rem;
}
input:focus { outline: none; border-color: var(--orange); }

/* Reports */
.report {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem; color: #c5d0de; line-height: 1.65;
}
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--bg3); border: 1px solid var(--orange); color: var(--text);
  padding: 12px 18px; border-radius: 12px; z-index: 100; opacity: 0; transition: 0.25s ease;
  box-shadow: var(--shadow); font-size: 0.9rem; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer-note {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.8rem; text-align: center;
}
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* Inbox dropdown */
.inbox-panel {
  position: absolute; right: 0; top: 44px; width: 320px; max-width: 90vw;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); display: none; z-index: 60; overflow: hidden;
}
.inbox-panel.open { display: block; }
.inbox-panel .ih { padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 650; font-size: 0.9rem; }
.inbox-panel .im { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.inbox-panel .im.unread { background: var(--orange-dim); }
.inbox-panel .im .t { color: var(--muted); font-size: 11px; margin-top: 4px; }
.wrap-rel { position: relative; }

.protocol-card .plist { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.p-link {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 8px 10px; border-radius: 8px; background: var(--bg3); font-size: 0.85rem;
}
.p-link:hover { outline: 1px solid var(--orange); }

/* Timeline scroll */
.timeline-scroll {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.timeline-scroll::-webkit-scrollbar { width: 6px; }
.timeline-scroll::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
}

/* Protocol rank */
.rank-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700; color: var(--orange);
  background: var(--orange-dim); padding: 2px 8px; border-radius: 999px;
  margin-bottom: 6px;
}
.protocol-card .bar { margin-top: 12px; }

/* How-to summary block */
.howto-summary h3 { font-size: 1rem; margin-bottom: 10px; }
.howto-summary ol {
  margin: 0 0 14px 1.2rem; color: var(--muted); font-size: 0.9rem;
}
.howto-summary li { margin-bottom: 6px; }
.source-links { font-size: 0.85rem; display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.ts { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Hot tweets */
.tweet-list { display: flex; flex-direction: column; gap: 8px; }
.tweet-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: start;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; color: inherit;
}
.tweet-row:hover { border-color: var(--orange); text-decoration: none; }
.tweet-row .rank {
  font-weight: 800; color: var(--orange); font-size: 0.95rem; padding-top: 2px;
}
.tw-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tw-sum { font-size: 0.9rem; line-height: 1.45; }
.tw-go { font-size: 12px; color: var(--orange); white-space: nowrap; padding-top: 2px; }

/* Inbox as buttons */
.inbox-panel .im {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  padding: 12px 14px; font-size: 0.85rem; color: inherit;
}
.inbox-panel .im:hover { background: var(--bg3); }
.inbox-panel .im.unread { background: var(--orange-dim); }
