:root {
  --bg: #1a0b2e;
  --bg-deep: #110722;
  --text: #5aead2;
  --link: #4be3a0;
  --warn: #ff9900;
  --surface: rgba(26, 11, 46, 0.62);
  --border: rgba(90, 234, 210, 0.2);
  --edge: rgba(255, 255, 255, 0.16);
  --muted: rgba(255, 255, 255, 0.55);
  --font: "Nunito", "Varela Round", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fbf3fb;
  --bg-deep: #f2e6fa;
  --text: #7d6bb3;
  --link: #6aa8c4;
  --warn: #ff8fb2;
  --surface: rgba(255, 250, 253, 0.72);
  --border: rgba(197, 163, 224, 0.32);
  --edge: rgba(255, 255, 255, 0.8);
  --muted: rgba(60, 40, 90, 0.6);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(1000px 600px at 85% -10%, rgba(255, 153, 0, 0.06), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(90, 234, 210, 0.07), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
}
:root[data-theme="light"] body {
  background-image:
    radial-gradient(1000px 620px at 85% -10%, rgba(255, 199, 222, 0.5), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(196, 226, 255, 0.45), transparent 60%);
}

::selection { background: var(--link); color: var(--bg); }

.bg-waves {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(115deg, rgba(90, 234, 210, 0.035) 0 2px, transparent 2px 9px);
  mask-image: radial-gradient(circle at 50% 20%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 20%, #000, transparent 75%);
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 12px auto 0;
  padding: 10px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--edge);
  transition: box-shadow 0.3s, background 0.3s;
}
.topbar.scrolled { box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 var(--edge); }

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--link);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.back-link:hover { background: var(--link); color: var(--bg); border-color: transparent; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 0.95rem;
}
.brand-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--warn), #ff6b9d);
  color: #1a0b2e;
  font-size: 0.75rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.brand-accent { color: var(--link); }

.topbar-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  transition: border-color 0.2s;
}
.search:focus-within { border-color: var(--link); }
.search input {
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  width: 200px;
}
.search input::placeholder { color: var(--muted); }

.select, .icon-btn, .primary-btn, .ghost-btn {
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.85rem;
}
.select option { background: var(--bg-deep); color: var(--text); }
.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.primary-btn {
  padding: 8px 18px;
  border: 1px solid transparent;
  background: linear-gradient(140deg, var(--link), var(--text));
  color: #10241f;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(75, 227, 160, 0.25);
}
.primary-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.ghost-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.85rem;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.15); }
.ghost-btn.danger { color: var(--warn); border-color: rgba(255, 153, 0, 0.4); }
.ghost-btn.danger:hover { background: var(--warn); color: var(--bg); }

/* ---------- hero ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 34px 16px 60px; }

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px;
  margin-bottom: 22px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--edge), 0 14px 40px rgba(0, 0, 0, 0.25);
}
.hero-avatar {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.hero-text { flex: 1 1 220px; }
.hero-name { font-size: 1.6rem; font-weight: 900; letter-spacing: 1px; }
.hero-handle { color: var(--link); font-size: 0.88rem; font-weight: 700; }
.hero-bio { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.hero-stats { display: flex; gap: 10px; }
.stat {
  min-width: 74px;
  padding: 10px 14px;
  text-align: center;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.stat b { display: block; font-size: 1.15rem; font-weight: 900; }
.stat span { font-size: 0.7rem; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { background: rgba(255, 255, 255, 0.13); }
.chip.active { background: var(--link); color: #10241f; border-color: transparent; }
.chip small { opacity: 0.6; margin-left: 5px; font-weight: 400; }

/* ---------- grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--edge), 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  animation: cardIn 0.45s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card:hover {
  transform: translateY(-4px);
  border-color: var(--link);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38), 0 0 26px rgba(75, 227, 160, 0.18);
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.02) 30%, rgba(255, 255, 255, 0.07) 45%, rgba(255, 255, 255, 0.02) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  overflow: hidden;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.card:hover .thumb img { transform: scale(1.05); }
.thumb .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(10, 4, 20, 0.1), rgba(10, 4, 20, 0.45));
  opacity: 0;
  transition: opacity 0.25s;
}
.thumb .play::after {
  content: "▶";
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding-left: 4px;
  border-radius: 999px;
  background: rgba(26, 11, 46, 0.7);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 1.2rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.card:hover .thumb .play { opacity: 1; }
@media (pointer: coarse) { .thumb .play { opacity: 1; } }

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--warn), #ff7a00);
  color: #1a0b2e;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 6px 16px rgba(255, 153, 0, 0.4);
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title {
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sub { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.pill {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--link);
  font-weight: 700;
  font-size: 0.72rem;
}
.card-stats { margin-top: auto; display: flex; gap: 12px; font-size: 0.76rem; color: var(--muted); }
.card-stats b { color: var(--text); font-weight: 700; }

/* ---------- status ---------- */
.status { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 0.92rem; }
.status[hidden] { display: none; }
.status.error { color: var(--warn); }
.sentinel { height: 1px; }
.sentinel[hidden] { display: none; }

/* ---------- footer ---------- */
.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 18px 40px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 2px;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-brand:hover { color: var(--link); }
.footer-note { color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 4, 20, 0.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  width: min(1120px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), inset 0 1px 0 var(--edge);
}
.lb-embed {
  flex: 0 0 auto;
  width: 550px;
  max-width: 100%;
  min-height: 120px;
  border-radius: 16px;
  overflow: hidden;
}
.lb-embed > div { width: 100%; }
.lb-embed .twitter-tweet { margin: 0 auto !important; }
.lb-embed .twitter-tweet-rendered { max-width: 100% !important; }
.lb-info {
  flex: 1 1 420px;
  min-width: 300px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.lb-info h2 { font-size: 1.3rem; font-weight: 900; line-height: 1.35; }
.lb-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.lb-stats { display: flex; gap: 16px; font-size: 0.82rem; color: var(--muted); }
.lb-stats b { color: var(--text); font-weight: 700; }
.lb-divider { height: 1px; background: var(--border); }
.lb-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-tags span {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  font-size: 0.72rem;
  color: var(--muted);
}
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.lb-note {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lb-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.2); }
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.lb-arrow:hover { background: rgba(255, 255, 255, 0.2); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
body.locked { overflow: hidden; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(10, 4, 20, 0.9);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(560px, 94vw);
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), inset 0 1px 0 var(--edge);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 1.15rem; font-weight: 900; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field span { font-size: 0.76rem; letter-spacing: 0.6px; color: var(--muted); font-weight: 700; }
.field input {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}
.field input:focus { border-color: var(--link); }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.modal-hint { font-size: 0.76rem; color: var(--muted); }
.modal-hint code { color: var(--link); }
.modal-preview {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  font-size: 0.74rem;
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}
/* ---------- admin / account ---------- */
a.ghost-btn { text-decoration: none; display: inline-flex; align-items: center; }
.acct-email {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--link);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.acct-note { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(14px);
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
  z-index: 700;
  pointer-events: none;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .lb-arrow { display: none; }
  .lb-stage { flex-direction: column; width: min(582px, 94vw); }
  .lb-embed { width: 100%; }
  .lb-info { width: 100%; min-width: 0; }
}
@media (max-width: 640px) {
  .topbar { top: 8px; padding: 10px 12px; }
  .back-label { display: none; }
  .back-link { padding: 7px 11px; font-size: 0.9rem; }
  .search input { width: 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .card-title { font-size: 0.86rem; }
  .hero { padding: 16px; }
  .hero-avatar { width: 72px; height: 72px; border-radius: 20px; }
  .hero-name { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
