:root {
  --bg: #0b0d14;
  --panel: #111522;
  --panel2: #171d2c;
  --border: #252b3a;
  --text: #e7ecf5;
  --text2: #9aa6bd;
  --cyan: #00cfff;
  --green: #22c55e;
  --danger: #ff5d5d;
  --warn: #ffd166;
  --mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 146, 177, .55) rgba(11, 13, 20, .2);
}
*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
*::-webkit-scrollbar-track {
  background: rgba(11, 13, 20, .18);
}
*::-webkit-scrollbar-thumb {
  border: 2px solid rgba(11, 13, 20, .38);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 207, 255, .65), rgba(125, 146, 177, .42));
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 207, 255, .8);
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(0, 207, 255, .08), transparent 34%),
    linear-gradient(320deg, rgba(34, 197, 94, .08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans KR", sans-serif;
}

.top-date {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 38px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 20, .88);
  backdrop-filter: blur(12px);
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 38%) 1fr;
  gap: 14px;
  height: calc(100vh - 38px);
  padding: 14px;
}

.search-pane,
.reader-pane {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(17, 21, 34, .94);
}

.search-pane { display: flex; flex-direction: column; }
.toolbar {
  display: grid;
  grid-template-columns: 1.25fr 150px 150px 1fr auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.toolbar.simple {
  grid-template-columns: 1fr auto;
}
label { display: grid; gap: 5px; min-width: 0; }
label span {
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
}
input,
select,
button {
  height: 34px;
  border-radius: 5px;
  font: inherit;
}
input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  padding: 0 9px;
  outline: none;
}
input:focus,
select:focus { border-color: var(--cyan); }
button {
  align-self: end;
  border: 0;
  background: var(--cyan);
  color: #001018;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.query-preview {
  display: none;
  margin: 10px 12px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--cyan);
  background: rgba(0, 207, 255, .06);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.news-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 12px 0;
}
.news-tab {
  height: 30px;
  border: 1px solid var(--border);
  background: rgba(23, 29, 44, .88);
  color: var(--text2);
  font-size: 12px;
  font-weight: 800;
}
.news-tab.active {
  border-color: rgba(0, 207, 255, .7);
  background: rgba(0, 207, 255, .15);
  color: var(--cyan);
}
.tab-panel {
  display: none;
  min-height: 0;
}
.tab-panel.active {
  display: flex;
  flex: 1;
  min-height: 0;
}
#results-panel.active {
  flex-direction: column;
}
.status {
  padding: 10px 12px;
  color: var(--text2);
  font-size: 12px;
}
.status.error { color: var(--danger); }
.highlights {
  margin: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 207, 255, .035);
  overflow: hidden;
}
.highlights.active {
  flex-direction: column;
  overflow-y: auto;
}
.highlights-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  font-size: 12px;
}
.highlights-head strong { color: var(--text); }
.headline-grid {
  display: none;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 10px;
}
.sector-strip {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  padding: 8px 10px;
  border-top: 1px solid rgba(37, 43, 58, .75);
  border-bottom: 1px solid rgba(37, 43, 58, .75);
  background: rgba(17, 21, 34, .96);
  backdrop-filter: blur(10px);
}
.sector-chip {
  flex: 0 0 auto;
  height: 25px;
  border: 1px solid rgba(0, 207, 255, .24);
  border-radius: 999px;
  background: rgba(0, 207, 255, .07);
  color: #bfeeff;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.sector-chip:hover {
  border-color: rgba(0, 207, 255, .75);
  background: rgba(0, 207, 255, .16);
  color: var(--cyan);
}
.lead-story,
.side-stories,
.topic-sections {
  min-width: 0;
}
.lead-story {
  display: none;
}
.lead-story .highlight-result {
  padding: 10px;
  grid-template-columns: 92px 1fr;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(17, 21, 34, .72);
}
.lead-story .highlight-result h2 {
  font-size: 14px;
  line-height: 1.32;
}
.side-stories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.side-stories .highlight-result {
  grid-template-columns: 54px 1fr;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(17, 21, 34, .72);
}
.side-stories .highlight-result h2,
.topic-card .highlight-result h2 {
  font-size: 14px;
}
.topic-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 10px;
}
.topic-card {
  scroll-margin-top: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(11, 13, 20, .38);
  overflow: visible;
}
.topic-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.topic-title span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topic-title::before {
  display: none;
}
.topic-title span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 207, 255, .8);
}
.topic-title em {
  color: var(--text2);
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
}
.topic-card .highlight-result {
  border-bottom: 1px solid rgba(37, 43, 58, .8);
}
.topic-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
}
.topic-list .highlight-result {
  grid-template-columns: 1fr;
  gap: 9px;
  min-height: 218px;
  padding: 10px;
  border: 1px solid rgba(37, 43, 58, .92);
  border-radius: 10px;
  background: rgba(17, 21, 34, .72);
}
.topic-list .result-thumb {
  aspect-ratio: 16 / 9;
  min-height: 112px;
}
.topic-list .highlight-result h2 {
  font-size: 15px;
  line-height: 1.34;
}
.topic-more {
  margin: 0 10px 10px;
}
.topic-more summary {
  display: grid;
  place-items: center;
  height: 30px;
  border: 1px solid rgba(0, 207, 255, .35);
  border-radius: 5px;
  background: rgba(0, 207, 255, .08);
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.topic-more summary::-webkit-details-marker {
  display: none;
}
.topic-more .more-open {
  display: none;
}
.topic-more[open] .more-closed {
  display: none;
}
.topic-more[open] .more-open {
  display: inline;
}
.topic-list-extra {
  margin-top: 8px;
  border-top: 1px solid rgba(37, 43, 58, .8);
}
.results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 12px 18px;
}
.result-pages {
  display: none !important;
  flex-shrink: 0;
  gap: 6px;
  align-items: center;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--border);
  background: rgba(11, 13, 20, .55);
}
.result-pages.active {
  display: flex;
}
.result-page-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(23, 29, 44, .9);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}
.result-page-btn:hover {
  border-color: rgba(0, 207, 255, .55);
  color: var(--text);
}
.result-page-btn.active {
  border-color: rgba(0, 207, 255, .85);
  background: rgba(0, 207, 255, .18);
  color: var(--cyan);
}
.result-page-btn:disabled {
  opacity: .4;
  cursor: default;
}
.result,
.highlight-result {
  position: relative;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: start;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}
.highlight-result {
  padding: 10px;
}
.result-copy {
  min-width: 0;
}
.result-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.25 / 1;
  overflow: hidden;
  border: 1px solid rgba(37, 43, 58, .95);
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 20%, rgba(0, 207, 255, .22), transparent 34%),
    linear-gradient(145deg, rgba(34, 197, 94, .11), rgba(23, 29, 44, .95));
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}
.result-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-thumb span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(11, 13, 20, .74);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.result-thumb:not(.fallback):has(img) span {
  display: none;
}
.compact-card .result-thumb,
.topic-result .result-thumb {
  border-radius: 7px;
}
.result:hover,
.highlight-result:hover {
  background: rgba(0, 207, 255, .045);
}
.result:hover h2,
.highlight-result:hover h2 { text-decoration: underline; }
.result.active,
.highlight-result.active {
  border-color: rgba(0, 207, 255, .5);
  background:
    linear-gradient(90deg, rgba(0, 207, 255, .2), rgba(0, 207, 255, .06) 42%, rgba(34, 197, 94, .035));
  box-shadow:
    inset 4px 0 0 var(--cyan),
    0 0 0 1px rgba(0, 207, 255, .28),
    0 12px 30px rgba(0, 207, 255, .12);
  transform: translateX(2px);
}
.result.active::after,
.highlight-result.active::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  pointer-events: none;
}
.result.active .result-thumb,
.highlight-result.active .result-thumb {
  border-color: rgba(0, 207, 255, .85);
  box-shadow: 0 0 0 2px rgba(0, 207, 255, .16);
}
.result.active h2,
.highlight-result.active h2 {
  color: #d7f6ff;
}
.result-url {
  margin-bottom: 5px;
  color: var(--green);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.result h2,
.highlight-result h2 {
  margin: 0;
  color: #8ab4ff;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}
.result-date {
  margin-top: 7px;
  color: #c7d2e5;
  font-size: 12px;
}
.reader-loading { color: var(--cyan); font-weight: 700; }

.reader-pane {
  overflow-y: auto;
  padding: 14px;
  scroll-behavior: auto;
}
.reader-empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  color: var(--text2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}
.reader h1 {
  margin: 0 0 12px;
  font-size: clamp(25px, 4vw, 40px);
  line-height: 1.18;
}
.reader.frame-reader h1,
.reader.frame-reader .source-url {
  display: none;
}
.reader.frame-reader .article-meta {
  margin-bottom: 8px;
}
.reader.frame-reader .reader-state {
  margin-bottom: 8px;
}
.reader-state {
  margin-bottom: 12px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}
.article-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--text2);
  font-size: 12px;
}
.warning {
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 209, 102, .36);
  border-radius: 6px;
  background: rgba(255, 209, 102, .09);
  color: var(--warn);
  font-weight: 700;
}
.article-body {
  max-width: 920px;
  color: #dfe7f3;
  font-size: 17px;
  line-height: 1.85;
}
.article-body.loading {
  display: grid;
  min-height: 280px;
  place-items: center;
  border: 1px dashed rgba(0, 207, 255, .25);
  border-radius: 10px;
  background: rgba(0, 207, 255, .035);
  color: var(--cyan);
  font-weight: 800;
}
.article-body a {
  pointer-events: none;
  color: inherit;
  text-decoration: none;
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.embedded-page {
  padding: 18px;
  border: 1px solid rgba(37, 43, 58, .9);
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
}
.embedded-page-frame {
  max-width: none;
  width: 100%;
}
.linked-page-frame {
  max-width: none;
  width: 100%;
}
.link-frame-scroll {
  height: calc(100vh - 112px);
  min-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(37, 43, 58, .9);
  border-radius: 10px;
  background: #fff;
}
.article-frame {
  width: 100%;
  height: calc(100vh - 112px);
  min-height: 560px;
  border: 1px solid rgba(37, 43, 58, .9);
  border-radius: 10px;
  background: #fff;
}
.link-frame-scroll .article-frame {
  height: 9000px;
  min-height: 9000px;
  border: 0;
  border-radius: 0;
}
.raw-link-frame {
  pointer-events: none;
}
.simple-reader .top-date,
.simple-reader .search-pane,
.simple-reader .source-url {
  display: none;
}
.simple-reader .workspace {
  display: block;
  height: 100vh;
  padding: 0;
  overflow: hidden;
}
.simple-reader .reader-pane {
  height: 100vh;
  padding: 0;
  overflow: hidden;
  border: 0;
}
.simple-reader .reader {
  height: 100vh;
}
.simple-reader .reader h1 {
  font-size: 18px;
  margin-bottom: 6px;
}
.simple-reader .article-meta,
.simple-reader .reader-state {
  display: none;
}
.simple-reader .linked-page-frame {
  height: 100vh;
  max-width: none;
  width: 100%;
}
.simple-reader .link-frame-scroll {
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border: 0;
  border-radius: 0;
}
.simple-reader .link-frame-scroll .article-frame {
  height: 30000px;
  min-height: 30000px;
  border: 0;
  border-radius: 0;
}
.embedded-page span {
  cursor: default;
}
.embedded-page nav,
.embedded-page aside,
.embedded-page footer {
  display: none;
}
.source-url {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text2);
}
.source-url span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
}
.source-url p {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
  .search-pane,
  .reader-pane { min-height: 420px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar.simple { grid-template-columns: 1fr; }
  button { grid-column: 1 / -1; }
  .headline-grid,
  .topic-sections { grid-template-columns: 1fr; }
  .result,
  .highlight-result,
  .lead-story .highlight-result,
  .side-stories .highlight-result {
    grid-template-columns: 72px 1fr;
  }
}
