:root {
  --bg: #000000;
  --bg-elevated: #16181c;
  --bg-hover: #080808;
  --border: #2f3336;
  --text: #e7e9ea;
  --text-muted: #71767b;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --danger: #f4212e;
  --success: #00ba7c;
  --warning: #ffd400;
  --radius: 16px;
  --sidebar-w: 260px;
  --timeline-w: 600px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app {
  display: flex;
  justify-content: center;
  max-width: calc(var(--sidebar-w) + var(--timeline-w) + 48px);
  margin: 0 auto;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-w);
  min-height: 100vh;
  padding: 12px 12px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  background: var(--bg-elevated);
  text-decoration: none;
}

.brand-mark {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 800;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--text);
  font-size: 19px;
  font-weight: 500;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-elevated);
  text-decoration: none;
}

.nav-item.active {
  font-weight: 800;
}

.nav-icon {
  width: 1.25em;
  text-align: center;
  opacity: 0.9;
}

.sidebar-note {
  margin-top: auto;
  padding: 12px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Timeline */
.timeline {
  flex: 1;
  max-width: var(--timeline-w);
  width: 100%;
  border-right: 1px solid var(--border);
  min-height: 100vh;
}

.timeline-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.65);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.timeline-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.timeline-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.loading,
.empty,
.error {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty h2,
.error h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.empty p,
.error p {
  margin: 0;
  font-size: 15px;
}

/* Post card */
.post {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

.post:hover {
  background: var(--bg-hover);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1d9bf0, #0c4a6e);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.post-body {
  min-width: 0;
}

.post-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  margin-bottom: 4px;
}

.display-name {
  font-weight: 800;
  color: var(--text);
}

.handle,
.sep,
.date {
  color: var(--text-muted);
  font-weight: 400;
}

.date {
  white-space: nowrap;
}

.badge {
  display: inline-block;
  margin: 6px 0 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  border: 1px solid transparent;
}

.badge-charged,
.badge-arrested {
  color: #ff7a00;
  background: rgba(255, 122, 0, 0.12);
  border-color: rgba(255, 122, 0, 0.35);
}

.badge-sentenced,
.badge-convicted {
  color: #f4212e;
  background: rgba(244, 33, 46, 0.12);
  border-color: rgba(244, 33, 46, 0.35);
}

.badge-acquitted,
.badge-charges-dropped,
.badge-discharged {
  color: #00ba7c;
  background: rgba(0, 186, 124, 0.12);
  border-color: rgba(0, 186, 124, 0.35);
}

.badge-default {
  color: var(--accent);
  background: rgba(29, 155, 240, 0.12);
  border-color: rgba(29, 155, 240, 0.35);
}

.who-line {
  margin: 0 0 6px;
  font-size: 15px;
}

.who-line .who {
  font-weight: 700;
}

.who-line .role {
  color: var(--text-muted);
}

.summary {
  margin: 0 0 10px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

.source-link:hover {
  color: var(--accent-hover);
}

.source-link .ext {
  font-size: 12px;
  opacity: 0.8;
}

/* Mobile */
@media (max-width: 860px) {
  .app {
    flex-direction: column;
    max-width: 100%;
  }

  .sidebar {
    position: static;
    width: 100%;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
  }

  .brand {
    padding: 8px;
    flex: 1;
    min-width: 180px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .nav {
    flex-direction: row;
    margin-top: 0;
    gap: 4px;
  }

  .nav-item {
    font-size: 15px;
    padding: 8px 14px;
    gap: 8px;
  }

  .sidebar-note {
    display: none;
  }

  .timeline {
    border-right: none;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .post {
    grid-template-columns: 40px 1fr;
    gap: 10px;
    padding: 12px;
  }

  .avatar {
    width: 40px;
    height: 40px;
    font-size: 12px;
  }

  .brand-sub {
    display: none;
  }
}
