:root {
  --bg: #07050a;
  --bg-mid: #100b17;
  --bg-hover: #1a1322;
  --border: #2c2338;
  --text: #ece7f5;
  --text-dim: #9a8bb0;
  --text-dimmer: #6b5c82;
  --accent: #b388ff;
  --like: #ff4fa3;
  --repost: #7ee787;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  width: 380px;
  max-height: 560px;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { display: flex; flex-direction: column; }

.head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.logo { font-weight: 800; font-size: 15px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.spider { font-size: 16px; }
.sub { font-size: 10px; color: var(--text-dimmer); white-space: nowrap; }

.tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 700;
  font-size: 11.5px;
  padding: 8px 6px;
  cursor: pointer;
  position: relative;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.notif-badge {
  display: none;
  margin-left: 4px;
  background: var(--like);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 5px;
  vertical-align: 2px;
}
.notif-badge.show { display: inline-block; }

.feed { display: flex; flex-direction: column; }
.notifs { padding-top: 2px; }
.notifs-note { font-size: 10.5px; color: var(--text-dimmer); padding: 8px 14px; border-bottom: 1px solid var(--border); }
.notif-row { display: flex; gap: 9px; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.notif-row:hover { background: var(--bg-mid); }
.notif-icon { width: 26px; text-align: center; font-size: 15px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-line { font-size: 12.5px; }
.notif-line b { font-weight: 700; }
.notif-ref { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 10.5px; color: var(--text-dimmer); margin-top: 3px; }

/* ---------- reply threading (same idea as skyclone: parent inline above the reply) ---------- */
.thread-group { position: relative; }
.thread-parent-post { border-bottom: none !important; opacity: .92; }
.thread-group::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 44px;
  bottom: 60px;
  width: 2px;
  background: var(--border);
}

.post {
  display: flex;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.post:hover { background: var(--bg-mid); }

.repost-line {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 14px 0 40px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
}
.body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-size: 12.5px; }
.name { font-weight: 700; }
.handle, .time, .dot { color: var(--text-dim); }
.text { margin-top: 2px; white-space: pre-wrap; word-wrap: break-word; font-size: 13px; }

.actions { display: flex; gap: 16px; margin-top: 7px; color: var(--text-dim); font-size: 11.5px; }
.act { display: flex; align-items: center; gap: 4px; cursor: pointer; border-radius: 999px; padding: 3px 5px; margin: -3px -5px; }
.act:hover { background: var(--bg-hover); }
.act.like:hover, .act.like.on { color: var(--like); }
.act.like .icon { display: inline-block; }
.act.like.on .icon { filter: none; }
.act.repost:hover, .act.repost.on { color: var(--repost); }
.act.witch:hover { color: #ff7a1a; }

/* witch button: same burn-and-vanish trick as skyclone, scoped small */
.post.hexed {
  pointer-events: none;
  animation: witch-burn .8s ease-in forwards;
}
.post.hexed::after {
  content: "🔥";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  opacity: 0;
  animation: witch-flame .8s ease-in forwards;
}
.post.hex-collapse {
  transition: max-height .22s ease, padding .22s ease, border-color .22s ease;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-bottom-color: transparent !important;
}
@keyframes witch-burn {
  0% { filter: none; transform: scale(1) rotate(0deg); opacity: 1; }
  55% { filter: sepia(1) saturate(5) hue-rotate(-30deg) brightness(1.8); transform: scale(.92) rotate(2deg); }
  100% { filter: sepia(1) saturate(6) hue-rotate(-30deg) brightness(2.2) blur(2px); transform: scale(.55) rotate(-6deg) translateY(4px); opacity: 0; }
}
@keyframes witch-flame {
  0% { opacity: 0; transform: scale(.6); }
  45% { opacity: .9; transform: scale(1) translateY(-3px); }
  100% { opacity: 0; transform: scale(1.3) translateY(-14px); }
}

.foot {
  padding: 10px 14px 14px;
  font-size: 10.5px;
  color: var(--text-dimmer);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ---------- toast + spider crawl (fires once, first time notifications open) ---------- */
.toast {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translate(-50%, 10px);
  z-index: 70;
  background: var(--text);
  color: var(--bg);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
  max-width: 85%;
  text-align: center;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.spider-crawler {
  position: fixed;
  left: -30px;
  font-size: 20px;
  z-index: 90;
  pointer-events: none;
  animation: spider-crawl 1.6s linear forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6));
}
@keyframes spider-crawl {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(90px, -6px) rotate(-8deg); }
  40% { transform: translate(180px, 5px) rotate(6deg); }
  60% { transform: translate(270px, -6px) rotate(-6deg); }
  80% { transform: translate(360px, 5px) rotate(6deg); }
  100% { transform: translate(430px, 0) rotate(0deg); }
}
