:root {
  --bg-0: #0b0d1a;
  --bg-1: #14172a;
  --fg-0: #e8ecf6;
  --fg-1: #b3b8cd;
  --fg-2: #7d8299;
  --accent: #7c5cff;
  --accent-2: #18d2c0;
  --danger: #ff5c8a;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.08);
  --glow: 0 10px 40px rgba(124, 92, 255, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: "Inter", "Noto Sans SC", system-ui, -apple-system, "Segoe UI",
               Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* ---------- Background ---------- */
.bg-aurora {
  position: fixed; inset: 0;
  z-index: -2;
  background:
    radial-gradient(60% 50% at 20% 10%, rgba(124,92,255,0.35), transparent 60%),
    radial-gradient(45% 40% at 85% 20%, rgba(24,210,192,0.25), transparent 60%),
    radial-gradient(55% 45% at 50% 95%, rgba(255,92,138,0.25), transparent 60%),
    linear-gradient(180deg, #0b0d1a 0%, #0a0c18 100%);
  filter: saturate(1.05);
  animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(2%, -2%, 0) scale(1.04); }
}
.bg-noise {
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 13, 26, 0.55);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 {
  font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
  margin: 0;
  background: linear-gradient(120deg, #fff, #b9a7ff 60%, #6cf2e0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .55; transform: scale(.95); }
  50%      { opacity: 1;   transform: scale(1.1); }
}
.meta { display: flex; gap: 18px; align-items: center; color: var(--fg-1); font-size: 13px; }
.clock { font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.updated { color: var(--fg-2); }
.hello { color: var(--accent-2); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 84px;
  align-self: start;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px 14px;
  backdrop-filter: blur(12px);
  box-shadow: var(--glow);
}
.sidebar-title { font-size: 12px; color: var(--fg-2); margin: 4px 8px 12px; letter-spacing: 2px; }
.cats { list-style: none; margin: 0; padding: 0; }
.cats li { margin: 4px 0; }
.cat-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 12px;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--fg-1); cursor: pointer;
  font-size: 14px;
  transition: all .2s ease;
}
.cat-btn:hover { background: rgba(255,255,255,0.05); color: var(--fg-0); }
.cat-btn.active {
  background: linear-gradient(120deg, rgba(124,92,255,.25), rgba(24,210,192,.18));
  border-color: rgba(124,92,255,.4);
  color: #fff;
  box-shadow: 0 6px 20px rgba(124,92,255,0.18);
}
.cat-arrow { color: var(--fg-2); transform: translateX(-2px); transition: transform .2s; }
.cat-btn.active .cat-arrow { color: var(--accent-2); transform: translateX(0); }
.sidebar-foot { margin-top: 14px; padding: 0 8px; color: var(--fg-2); font-size: 11px; }

/* ---------- Content ---------- */
.content-head h2 {
  margin: 0 0 18px; font-size: 20px; font-weight: 600;
  color: #fff;
}

.news-list { list-style: none; margin: 0; padding: 0; }
.news-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px 18px 14px 56px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .5s ease, border-color .2s;
}
.news-card:hover { border-color: rgba(124,92,255,0.45); }
.news-card::before {
  content: attr(data-rank);
  position: absolute; left: 14px; top: 16px;
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, #7c5cff, #18d2c0);
  color: #0b0d1a;
}
.news-card.is-new { animation: fadeIn .6s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.news-title {
  font-size: 16px; font-weight: 600; color: #fff;
  margin: 0 0 6px;
  line-height: 1.45;
}
.news-row {
  display: flex; gap: 10px; align-items: center;
  font-size: 12px; color: var(--fg-2);
}
.news-row .src { color: var(--accent-2); }
.news-row .time { font-variant-numeric: tabular-nums; }

.news-card details { margin-top: 10px; }
.news-card summary {
  list-style: none; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--fg-1);
  padding: 4px 0;
  display: flex; align-items: center; gap: 6px;
}
.news-card summary::-webkit-details-marker { display: none; }
.news-card summary::after {
  content: "▾"; transition: transform .25s; color: var(--fg-2);
}
.news-card details[open] summary::after { transform: rotate(180deg); }
.news-card .summary-text {
  margin-top: 8px;
  font-size: 13px; line-height: 1.7; color: var(--fg-1);
}
.news-card .read-more {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px;
  color: var(--accent-2);
  text-decoration: none; font-size: 13px;
  border-bottom: 1px dashed transparent;
  transition: border-color .2s;
}
.news-card .read-more:hover { border-bottom-color: var(--accent-2); }

.news-skeleton {
  background: var(--card); border: 1px dashed var(--card-border);
  border-radius: 12px; padding: 24px;
  text-align: center; color: var(--fg-2);
}

/* ---------- Pager ---------- */
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: 18px 0 8px;
}
.pager.hidden { display: none; }
.pg-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--fg-1);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px; cursor: pointer;
  transition: all .15s ease;
  backdrop-filter: blur(8px);
}
.pg-btn:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(124,92,255,0.5);
  transform: translateY(-1px);
}
.pg-btn:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.pg-info {
  font-size: 13px; color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  min-width: 160px; text-align: center;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(5, 6, 14, 0.65);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: modalIn .25s ease;
}
.modal.hidden { display: none; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(420px, 92vw);
  background: linear-gradient(160deg, rgba(28,30,52,.95), rgba(15,16,30,.95));
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
.modal-card p { margin: 0 0 16px; color: var(--fg-1); font-size: 13px; }
.modal-card input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--card-border);
  background: rgba(0,0,0,.25);
  color: #fff; border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.modal-card input:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn {
  padding: 9px 16px; border-radius: 10px; font-size: 13px;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
}
.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0b0d1a; font-weight: 600;
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(124,92,255,.35); }
.btn.ghost {
  background: transparent; color: var(--fg-1); border-color: var(--card-border);
}
.btn.ghost:hover { color: #fff; border-color: var(--fg-2); }
