:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-alt: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #656d76;
  --accent: #58a6ff;
  --green: #3fb950;
  --gold: #d29922;
  --red: #f85149;
  --radius: 8px;
  --max-w: 960px;
  --time-col: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #000;
  font-weight: 900;
  font-size: 13px;
  border-radius: 6px;
}

.logo-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.logo-text b {
  color: var(--text);
  font-weight: 800;
}

.nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  transition: all 0.15s;
}
.nav-btn:hover { color: var(--text); background: var(--surface); }
.nav-btn.active {
  color: var(--accent);
  background: rgba(88,166,255,0.08);
  border-color: rgba(88,166,255,0.3);
  font-weight: 600;
}

.login-placeholder {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 13px;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Demo banner */
.demo-banner {
  background: rgba(88,166,255,0.04);
  border-bottom: 1px solid rgba(88,166,255,0.1);
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: 6px 16px;
  letter-spacing: 0.3px;
}

/* Container */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* Global controls */
.global-controls {
  margin-bottom: 24px;
}

.controls-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.controls-row input,
.controls-row select {
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0 12px;
  font-size: 13px;
}
.controls-row input { flex: 1; min-width: 180px; max-width: 320px; }
.controls-row select { width: 160px; }
.controls-row input::placeholder { color: var(--text-dim); }

/* Clear button */
.clear-btn {
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.clear-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-bar button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 13px;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-bar button:hover { color: var(--text); border-color: var(--text-dim); }
.filter-bar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

.view-header {
  margin-bottom: 20px;
}

.view-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.view-desc {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Timeline */
.timeline { display: grid; gap: 0; }

.date-group { padding-top: 20px; }
.date-group:first-child { padding-top: 0; }

.date-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 0 8px calc(var(--time-col) + 20px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.timeline-items { display: grid; gap: 14px; }

/* Timeline row: time-col + card */
.timeline-row {
  display: grid;
  grid-template-columns: var(--time-col) 1fr;
  gap: 16px;
  position: relative;
}

.time-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 18px;
  position: relative;
}

.time-col .time {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.time-col .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(88,166,255,0.12);
  margin-top: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.time-col .line {
  width: 2px;
  flex: 1;
  background: linear-gradient(to bottom, rgba(88,166,255,0.4), rgba(88,166,255,0.08));
  margin-top: 4px;
  min-height: 20px;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: grid;
  gap: 10px;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--text-dim); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-source {
  color: var(--text-muted);
  font-weight: 500;
}

.card-handle {
  opacity: 0.6;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  background: rgba(63,185,80,0.12);
  color: var(--green);
  font-weight: 800;
  font-size: 12px;
}

.card-featured-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  background: rgba(88,166,255,0.1);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.card-summary {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-recommendation {
  font-size: 13px;
  color: var(--gold);
  line-height: 1.55;
  padding: 8px 12px;
  background: rgba(210,153,34,0.06);
  border-radius: 6px;
  border-left: 3px solid var(--gold);
}

.card-rec-label {
  font-weight: 700;
  margin-right: 4px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  color: var(--text-muted);
}
.tag.cat {
  color: var(--accent);
  border-color: rgba(88,166,255,0.3);
  background: rgba(88,166,255,0.06);
  font-weight: 600;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.card-scores {
  display: flex;
  gap: 14px;
}

.card-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  margin-left: auto;
}

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

.daily-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.daily-section h3 {
  font-size: 16px;
  margin: 0 0 14px;
  color: var(--accent);
}

.daily-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.daily-item:last-child { border-bottom: none; }

.daily-item h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}

.daily-item p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* About */
.about-content { max-width: 680px; }

.about-sections {
  margin-top: 24px;
  display: grid;
  gap: 24px;
}

.about-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.about-block h3 {
  font-size: 16px;
  margin: 0 0 10px;
  color: var(--accent);
}

.about-block p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 6px 0 0;
  line-height: 1.6;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text);
}
.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--text-dim);
}
.empty-state .clear-btn {
  height: 32px;
  padding: 0 16px;
}

/* Responsive */
@media (max-width: 768px) {
  :root { --time-col: 0px; }
  .topbar-inner { padding: 0 12px; gap: 8px; height: 52px; }
  .logo-text { display: none; }
  .login-placeholder { display: none; }
  .container { padding: 16px 12px 48px; }
  .controls-row input { max-width: 100%; }
  .controls-row select { width: 130px; }
  .daily-grid { grid-template-columns: 1fr; }
  .view-title { font-size: 20px; }
  .date-label { padding-left: 0; font-size: 12px; }
  .demo-banner { font-size: 11px; padding: 5px 12px; }

  .timeline-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .time-col {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0 0 6px;
  }
  .time-col .dot { display: none; }
  .time-col .line { display: none; }
  .time-col .time { font-size: 12px; font-weight: 600; color: var(--text-muted); }

  .card { padding: 14px 16px; }
  .card-title { font-size: 15px; }
  .card-footer { font-size: 11px; }
  .nav-btn { padding: 7px 10px; font-size: 13px; }
}
