:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --ink: #202427;
  --muted: #66707a;
  --line: #d8d1c6;
  --panel: #fffdf8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --blue: #2563eb;
  --red: #be123c;
  --shadow: 0 16px 50px rgba(44, 39, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0)),
    var(--bg);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 52px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 8px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 430px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 8px 24px rgba(44, 39, 31, 0.06);
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.icon-button,
.tab,
.main-tab,
.topic-card,
.signal-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
}

.icon-button svg,
.tab svg,
.main-tab svg,
.topic-card svg,
.repo-link svg,
.text-link svg {
  width: 18px;
  height: 18px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.status-strip > div {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 253, 248, 0.86);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.main-tabs,
.tabs,
.range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.main-tab,
.tab,
.range-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 900;
}

.range-tabs {
  margin-top: 0;
  margin-bottom: 18px;
}

.range-tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.main-tab.is-active,
.tab.is-active,
.range-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.message {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(180, 83, 9, 0.3);
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  color: #78350f;
}

.message.inline {
  margin: 0;
  grid-column: 1 / -1;
}

.message.dark {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

.view,
.repo-panel {
  display: none;
}

.view.is-active,
.repo-panel.is-active {
  display: block;
}

.briefing-band {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
}

.briefing-copy h2 {
  margin: 8px 0 0;
  font-size: 30px;
  line-height: 1.12;
}

.briefing-band .section-kicker {
  color: #5eead4;
}

.briefing-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.briefing-item {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 148px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.briefing-item span {
  color: #5eead4;
  font-size: 12px;
  font-weight: 900;
}

.briefing-item strong {
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.briefing-item em {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-style: normal;
}

.topic-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.topic-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px;
  text-align: left;
}

.topic-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.topic-card strong {
  color: var(--muted);
  font-size: 13px;
}

.topic-card.is-active {
  border-color: var(--accent);
  background: #ecfdf5;
}

.news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.timeline-column,
.side-panel,
.github-leaders {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
}

.side-panel + .side-panel {
  margin-top: 14px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
}

.panel-heading.compact {
  align-items: center;
}

.panel-heading h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.panel-heading.compact h2 {
  margin: 0;
  font-size: 18px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.event-list {
  display: grid;
  gap: 0;
}

.event-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  padding: 0 0 14px;
}

.event-item + .event-item {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.event-time {
  display: grid;
  align-content: start;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.event-time strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.event-card h3 {
  margin: 9px 0 8px;
  font-size: 21px;
  line-height: 1.28;
}

.event-card h3 a,
.repo-name a {
  text-decoration: none;
  overflow-wrap: anywhere;
}

.event-card h3 a:hover,
.repo-name a:hover {
  color: var(--accent-strong);
}

.event-card p {
  margin-bottom: 10px;
  color: #3f464b;
  line-height: 1.65;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.signal-list,
.source-list,
.leader-list {
  display: grid;
  gap: 10px;
}

.signal-item,
.source-item,
.leader-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7ef;
  text-align: left;
  text-decoration: none;
}

.signal-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.signal-item em,
.leader-item em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.source-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.source-item span,
.leader-item strong,
.signal-item span {
  overflow-wrap: anywhere;
}

.source-item strong,
.signal-item strong {
  color: var(--accent-strong);
}

.github-leaders {
  margin-bottom: 18px;
}

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

.repo-card {
  min-width: 0;
  min-height: 250px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.repo-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.repo-name {
  min-width: 0;
}

.repo-name a {
  display: block;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
}

.owner {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.rank {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-weight: 900;
}

.description {
  min-height: 62px;
  margin: 16px 0;
  color: #3f464b;
  line-height: 1.6;
}

.meta-row,
.topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf7ef;
  color: #3f464b;
  font-size: 12px;
  font-weight: 800;
}

.pill svg {
  width: 14px;
  height: 14px;
}

.language-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
}

.repo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.created {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.skeleton {
  min-height: 250px;
  border-radius: 8px;
  background: linear-gradient(90deg, #ede6da 25%, #faf7ef 37%, #ede6da 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton.slim {
  min-height: 64px;
}

.skeleton.brief {
  min-height: 148px;
}

.event-skeleton {
  min-height: 120px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (max-width: 1020px) {
  .briefing-band,
  .news-layout {
    grid-template-columns: 1fr;
  }

  .briefing-list,
  .topic-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1240px);
    padding-top: 22px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    min-width: 0;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .main-tabs,
  .tabs,
  .range-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .main-tab,
  .tab,
  .range-tab {
    justify-content: center;
  }

  .event-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .event-time {
    grid-template-columns: auto 1fr;
  }

  .repo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .briefing-list,
  .topic-strip {
    grid-template-columns: 1fr;
  }
}
