:root {
  color-scheme: dark;
  --bg: #0e0f10;
  --panel: #151617;
  --panel-soft: #1d1e21;
  --line: #2a2b2f;
  --text: #ece8df;
  --muted: #9a9ba2;
  --dim: #6f737d;
  --accent: #f0a000;
  --accent-soft: #33240a;
  --green: #4dbd8b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 54px 1px minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1d1e20;
  background: #111214;
  padding: 0 18px 0 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.mark {
  width: 28px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #202124;
  font-size: 26px;
  line-height: 1;
}

.top-actions,
.detail-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn,
.drawer-backdrop {
  display: none;
}

.ghost {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #1a1b1f;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.ghost:hover {
  border-color: #555862;
}

.search {
  width: min(260px, 28vw);
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0f1012;
  color: var(--text);
  padding: 0 10px;
  outline: 0;
}

.search:focus {
  border-color: var(--accent);
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.gold-strip {
  background: #f0a000;
}

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  border-right: 2px solid #070707;
  background: #121314;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 48px 1fr;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}

.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tabs span {
  margin-left: 8px;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--panel-soft);
  color: #b9bbc3;
  font-size: 12px;
}

.topic-list {
  overflow: auto;
  min-height: 0;
  scrollbar-color: #4b4c50 #111214;
  scrollbar-width: thin;
}

.topic-item {
  width: 100%;
  min-height: 88px;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  border: 0;
  border-bottom: 1px solid #202124;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.topic-item:hover {
  background: #18191b;
}

.topic-item.active {
  border-left: 3px solid var(--accent);
  background: #222326;
  box-shadow: inset 0 1px 0 #2b2c30, inset 0 -1px 0 #2b2c30;
}

.topic-item.unread .topic-title {
  color: #f0f0f1;
  font-weight: 700;
}

.topic-item:not(.unread) .topic-title {
  color: #7f8085;
}

.topic-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding-top: 22px;
}

.topic-type,
.pill {
  border-radius: 4px;
  background: #1d1f24;
  color: #aeb4c1;
  font-size: 12px;
  line-height: 22px;
  min-width: 52px;
  text-align: center;
  padding: 0 8px;
}

.type-alert {
  background: #352507;
  color: #ffb126;
}

.type-summary {
  background: #1d3148;
  color: #6bb7ff;
}

.type-macro,
.type-politics {
  background: #1d1f24;
  color: #aeb4c1;
}

.type-crypto,
.type-listings {
  background: #202531;
  color: #b7c1d3;
}

.topic-time {
  color: #b3bdce;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.topic-title {
  min-width: 0;
  padding: 20px 16px 16px 0;
  color: #a9aaae;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 650;
}

.topic-item.active .topic-title {
  color: var(--text);
}

.topic-item.active .topic-meta {
  padding-left: 0;
}

.list-loader {
  min-height: 48px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid #202124;
  color: var(--dim);
  font-size: 12px;
}

.detail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 34px clamp(24px, 6vw, 110px) 72px;
}

.detail-tools {
  justify-content: space-between;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 22px;
}

.article {
  max-width: 920px;
  margin: 0 auto;
}

.article h1 {
  margin: 0 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.12;
  font-weight: 700;
}

.article .date {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  margin-bottom: 24px;
}

.article .date strong {
  color: var(--accent);
}

.article .body {
  color: #e1ded8;
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-line;
}

.summary-image {
  display: block;
  width: min(100%, 720px);
  margin: 0 0 34px;
  border-radius: 7px;
  background: #e9e5d6;
}

.ai-summary {
  position: relative;
  margin: 34px 0 34px;
  border: 1px solid #2a2c31;
  border-radius: 8px;
  background: #151618;
  padding: 28px 28px 22px;
}

.ai-label {
  position: absolute;
  top: -15px;
  left: 20px;
  border: 1px solid #2a2c31;
  border-radius: 5px;
  background: #181a1f;
  color: #70b9ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 5px 10px;
}

.ai-summary ul {
  margin: 0;
  padding-left: 18px;
}

.ai-summary li {
  color: #e8e8ea;
  font-size: 17px;
  line-height: 1.65;
  margin: 7px 0;
  padding-left: 3px;
}

.ai-summary li::marker {
  color: #70b9ff;
}

.section {
  margin-top: 62px;
  padding-top: 26px;
  border-top: 1px solid #1d1e20;
}

.summary-sections {
  margin-top: 66px;
}

.summary-section {
  border-top: 1px solid #2a2b2f;
  padding: 34px 0;
}

.summary-section h2 {
  margin: 0 0 16px;
  color: #f0eee9;
  font-size: 18px;
  line-height: 1.4;
}

.summary-section div {
  color: #dfddd7;
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-line;
}

.linked-source {
  color: var(--dim);
  font-size: 13px;
  margin-top: 18px;
}

.section h2 {
  margin: 0 0 22px;
  color: #888b93;
  font-size: 12px;
  text-transform: uppercase;
}

.source {
  margin: 0 0 16px;
  color: #9ea4ae;
  font-size: 14px;
  line-height: 1.6;
}

.source b {
  color: #d0d2d7;
}

.source a {
  color: #c8d3e4;
  text-decoration: none;
}

.source a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.raw-box {
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0c0d;
  color: #cfd3dc;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
}

.empty {
  color: var(--muted);
}

@media (max-width: 820px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .shell {
    min-height: 100vh;
    height: auto;
    grid-template-rows: auto 1px auto;
  }

  .topbar {
    min-height: 58px;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px 8px 0;
  }

  .brand {
    flex: 0 0 auto;
    gap: 9px;
  }

  .mark {
    width: 34px;
    height: 40px;
  }

  .brand strong {
    font-size: 16px;
    white-space: nowrap;
  }

  .top-actions {
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
    gap: 8px;
  }

  .search {
    width: min(42vw, 180px);
    min-width: 92px;
  }

  .ghost {
    height: 34px;
    padding: 0 9px;
    white-space: nowrap;
  }

  .switch {
    font-size: 0;
    gap: 0;
  }

  .switch input {
    width: 20px;
    height: 20px;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
  }

  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
  }

  .drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .workspace {
    display: block;
    min-height: auto;
  }

  .sidebar {
    position: fixed;
    top: 59px;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(88vw, 380px);
    height: calc(100dvh - 59px);
    max-height: none;
    transform: translateX(-102%);
    transition: transform 180ms ease;
    border-right: 0;
    border-top: 1px solid var(--accent);
    border-bottom: 2px solid #070707;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.42);
    grid-template-rows: 44px minmax(0, 1fr);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .tabs button {
    font-size: 14px;
  }

  .tabs span {
    margin-left: 5px;
    padding: 2px 6px;
  }

  .topic-list {
    max-height: none;
    overscroll-behavior: contain;
  }

  .topic-item {
    min-height: 74px;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 7px;
  }

  .topic-meta {
    gap: 5px;
    padding-top: 17px;
  }

  .topic-type,
  .pill {
    min-width: 48px;
    line-height: 21px;
    font-size: 11px;
    padding: 0 6px;
  }

  .topic-time {
    font-size: 10px;
  }

  .topic-title {
    padding: 15px 12px 12px 0;
    font-size: 13px;
    line-height: 1.45;
  }

  .detail {
    overflow: visible;
    padding: 28px 14px 52px;
  }

  .detail-tools {
    margin-bottom: 18px;
  }

  .article {
    max-width: 100%;
  }

  .article h1 {
    margin-bottom: 18px;
    font-size: clamp(30px, 10.5vw, 44px);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .article .date {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
    font-size: 11px;
    line-height: 1.45;
    margin-bottom: 22px;
  }

  .ai-summary {
    margin: 32px 0 28px;
    padding: 24px 16px 16px;
  }

  .ai-label {
    left: 12px;
    font-size: 11px;
    padding: 5px 8px;
  }

  .ai-summary ul {
    padding-left: 16px;
  }

  .ai-summary li {
    font-size: 14px;
    line-height: 1.55;
  }

  .article .body {
    font-size: 15px;
    line-height: 1.8;
  }

  .summary-image {
    width: 100%;
    margin-bottom: 26px;
  }

  .summary-sections {
    margin-top: 42px;
  }

  .summary-section {
    padding: 26px 0;
  }

  .summary-section h2 {
    font-size: 16px;
  }

  .summary-section div,
  .source {
    font-size: 14px;
  }

  .section {
    margin-top: 42px;
    padding-top: 22px;
  }
}

@media (max-width: 430px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    padding: 8px 10px;
  }

  .brand {
    justify-content: space-between;
  }

  .top-actions {
    justify-content: stretch;
    width: 100%;
  }

  .search {
    flex: 1;
    width: auto;
  }

  .ghost {
    flex: 0 0 auto;
  }

  .sidebar {
    top: 105px;
    height: calc(100dvh - 105px);
    grid-template-rows: 42px minmax(0, 1fr);
  }

  .topic-list {
    max-height: none;
  }

  .article h1 {
    font-size: clamp(27px, 11.5vw, 38px);
  }

  .detail-tools {
    align-items: flex-start;
  }

  #copyBtn {
    max-width: 120px;
  }
}
