/* 차분한 앱 화면: 옅은 회색 바탕 위에 흰 면, 글꼴은 Pretendard 하나.
   눈에 띄는 것은 맨 위의 화제 구름 하나로 두고, 나머지는 조용하게 정돈한다. */

:root {
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #eceef1; /* 단추 묶음의 홈, 작은 표시의 바탕 */
  --raised: #ffffff; /* 홈 안에서 골라진 단추 */
  --hover: #f6f7f9; /* 흰 면 위의 줄에 마우스를 올렸을 때 */
  --ink: #171a21;
  --ink-2: #3f4651; /* 두 번째로 진한 글자: 출처 이름 등 */
  --muted: #666d79;
  --faint: #a9afb9;
  --line: #e7e9ed;
  --placeholder: #8a919c;
  --accent: #ff4a1c; /* 점·막대에만 쓴다. 작은 글자에는 --accent-ink */
  --accent-ink: #c4380f;
  --on-accent: #ffffff;
  --market-top: #c8251a; /* 예측시장에서 확률이 가장 높은 선택지의 막대(진한 빨강) */
  --market-top-ink: #b3201a; /* 같은 선택지의 확률 글자 */
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  --section-gap: 56px; /* 가운데 열의 구역 사이 */
  --radius-panel: 24px;
  --radius-card: 20px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-1: 0 1px 2px rgba(23, 26, 33, 0.06);
  --shadow-2: 0 2px 6px rgba(23, 26, 33, 0.05), 0 14px 32px rgba(23, 26, 33, 0.1);
  --page: 1020px; /* 넓은 화면에서 화제 구름과 그 아래 두 열이 함께 쓰는 폭 */
  /* 사진·영상이 있는 글의 표시: 이름 앞 원 셋의 파랑·보라 */
  --photo-bg: hsl(204 92% 93%);
  --photo-ink: hsl(204 90% 36%);
  --video-bg: hsl(262 90% 95%);
  --video-ink: hsl(262 62% 52%);
  /* 화제 구름: 채도, 가운데 밝기, 가장자리 밝기, 맨 앞 구름의 가운데 덧칠, 입자 */
  --orb-s: 94%;
  --orb-l: 89%;
  --orb-edge: 73%;
  --orb-core: rgb(255 255 255 / 0.5);
  --orb-grain: 0.2;
  --orb-grain-blend: multiply;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #171a20;
    --surface-2: #23272f;
    --raised: #343a44;
    --hover: #1c1f26;
    --ink: #eceef2;
    --ink-2: #c3c8d0;
    --muted: #9aa1ad;
    --faint: #5d6470;
    --line: #262a32;
    --placeholder: #6b7280;
    --accent: #ff5a2e;
    --accent-ink: #ff8a66;
    --market-top: #d4372a;
    --market-top-ink: #ff7a6b;
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-2: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 36px rgba(0, 0, 0, 0.45);
    --photo-bg: hsl(204 55% 20%);
    --photo-ink: hsl(204 92% 72%);
    --video-bg: hsl(262 38% 25%);
    --video-ink: hsl(262 92% 82%);
    --orb-s: 62%;
    --orb-l: 23%;
    --orb-edge: 40%;
    --orb-core: rgb(0 0 0 / 0.3);
    --orb-grain: 0.28;
    --orb-grain-blend: overlay;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "cv08"; /* 대문자 I에 세리프를 달아 "AI"가 "Al"로 읽히지 않게 */
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* 화면 가장자리로 번지는 구름 때문에 페이지가 옆으로 밀리지 않게 */
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

p { margin: 0; }

/* 휴대폰에서 누를 때 생기는 파란 상자 대신 각 부품의 눌림 모양을 쓴다 */
a,
button { -webkit-tap-highlight-color: transparent; }

/* 화면 틀: 맨 위 한 줄에 이름과 언어. 그 아래 화제 구름이 화면 가운데에 크게 뜨고,
   구름 폭 안에서 커뮤니티 소식(왼쪽)과 예측시장(오른쪽)이 같은 가장자리에 맞춰 선다. */
.top,
.layout,
.foot {
  max-width: calc(var(--page) + 56px);
  margin: 0 auto;
  padding: 0 28px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "topics topics"
    "feed markets";
  column-gap: 48px;
}

.topics { grid-area: topics; }
.feed { grid-area: feed; }
.markets { grid-area: markets; }

[hidden] { display: none !important; }

/* ── 맨 위 한 줄: 이름과 언어 ─────────────── */

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

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* 이름 앞의 표시(브라우저 탭 아이콘과 같은 그림): 지금 화제 구역처럼 가장자리가 흐린 원 여섯 개를 고리로 겹쳤다.
   맨 앞(아래)의 주황이 가장 크고, 크기와 자리를 조금씩 어긋나게 해 전체가 하나의 둥근 구름 덩어리로 보인다. */
.brand::before {
  content: "";
  flex: none;
  width: 1.05em;
  height: 1.05em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='a'%3E%3Cstop offset='0' stop-color='%23fabd2e' stop-opacity='0.92'/%3E%3Cstop offset='.55' stop-color='%23fabd2e' stop-opacity='0.78'/%3E%3Cstop offset='1' stop-color='%23fbc956' stop-opacity='0.36'/%3E%3C/radialGradient%3E%3CradialGradient id='b'%3E%3Cstop offset='0' stop-color='%23f25fa8' stop-opacity='0.92'/%3E%3Cstop offset='.55' stop-color='%23f25fa8' stop-opacity='0.78'/%3E%3Cstop offset='1' stop-color='%23f584bd' stop-opacity='0.36'/%3E%3C/radialGradient%3E%3CradialGradient id='c'%3E%3Cstop offset='0' stop-color='%2327ce96' stop-opacity='0.92'/%3E%3Cstop offset='.55' stop-color='%2327ce96' stop-opacity='0.78'/%3E%3Cstop offset='1' stop-color='%2343dba8' stop-opacity='0.36'/%3E%3C/radialGradient%3E%3CradialGradient id='d'%3E%3Cstop offset='0' stop-color='%239269f2' stop-opacity='0.92'/%3E%3Cstop offset='.55' stop-color='%239269f2' stop-opacity='0.78'/%3E%3Cstop offset='1' stop-color='%23ad8ef5' stop-opacity='0.36'/%3E%3C/radialGradient%3E%3CradialGradient id='e'%3E%3Cstop offset='0' stop-color='%2331a8f6' stop-opacity='0.92'/%3E%3Cstop offset='.55' stop-color='%2331a8f6' stop-opacity='0.78'/%3E%3Cstop offset='1' stop-color='%2359b8f8' stop-opacity='0.36'/%3E%3C/radialGradient%3E%3CradialGradient id='f'%3E%3Cstop offset='0' stop-color='%23fb7237' stop-opacity='1'/%3E%3Cstop offset='.55' stop-color='%23fb7237' stop-opacity='0.9'/%3E%3Cstop offset='1' stop-color='%23fc8e5f' stop-opacity='0.5'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='15.2' cy='8.7' r='7.2' fill='url(%23a)'/%3E%3Ccircle cx='9.8' cy='12.7' r='7.6' fill='url(%23b)'/%3E%3Ccircle cx='22.1' cy='11.9' r='7.4' fill='url(%23c)'/%3E%3Ccircle cx='10.1' cy='19.7' r='8.0' fill='url(%23d)'/%3E%3Ccircle cx='22.3' cy='19.3' r='7.8' fill='url(%23e)'/%3E%3Ccircle cx='15.8' cy='22.6' r='8.8' fill='url(%23f)'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 둘 중 하나를 고르는 단추 묶음: 홈 안의 흰 손잡이가 골라진 쪽으로 미끄러진다 */
.lang {
  position: relative;
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  isolation: isolate;
}

.lang::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  z-index: -1;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: var(--raised);
  box-shadow: var(--shadow-1);
}

.lang:has([data-lang="en"][aria-pressed="true"])::before { translate: 100% 0; }

.is-ready .lang::before { transition: translate 280ms var(--ease-out); }

.lang button {
  min-width: 36px;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 0.7rem/1.5 var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 200ms ease;
}

.lang button:hover,
.lang button[aria-pressed="true"] { color: var(--ink); }

/* 커뮤니티 소식 제목 옆의 수집 시각. 최근에 수집했으면 점이 주황으로 켜진다. */
.collected {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.dot[data-fresh="true"] {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* 소스 단추: 커뮤니티 소식 머리의 검색 칸 옆. 누르면 머리 아래에 소스 알약이 펼쳐지고 + 가 − 로 돈다.
   접혀 있어도 지금 고른 소스 이름이 단추에 남는다. */
.sources-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  height: 36px;
  margin-block: -3px;
  padding: 0 12px 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.sources-toggle:hover { background: var(--hover); }

.feed.is-sources-open .sources-toggle { box-shadow: inset 0 0 0 1.5px var(--ink); }

.sources-label {
  color: var(--muted);
  font-weight: 600;
}

.sources-current {
  max-width: 11em;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
}

/* + / − : 펼치면 세로 막대가 돌아 누워 − 가 된다 */
.pm {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.pm::before,
.pm::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 1.7px;
  border-radius: 1px;
  background: currentColor;
  translate: -50% -50%;
}

.pm::after {
  rotate: 90deg;
  transition: rotate 260ms var(--ease-out);
}

.feed.is-sources-open .pm::after { rotate: 0deg; }

/* 펼침 칸: 높이를 0에서 내용 높이까지 부드럽게 바꾼다. 위아래만 잘라서 휴대폰의 알약 줄은 옆으로 넘칠 수 있다. */
.sources-drawer {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* 휴대폰의 가로 알약 줄이 칸을 페이지 밖까지 넓히지 않게 */
  grid-template-rows: 0fr;
  transition: grid-template-rows 280ms var(--ease-out);
}

.feed.is-sources-open .sources-drawer { grid-template-rows: 1fr; }

.sources-clip {
  min-height: 0;
  overflow-x: visible;
  overflow-y: clip;
}

/* 소스 알약: 넓은 화면에서는 여러 줄로 감기고, 휴대폰에서는 한 줄로 옆으로 넘긴다. 고른 것은 진한 알약. */
.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 16px; /* 위: 키보드 고리가 잘리지 않을 만큼. 아래: 글 목록 판까지의 간격 */
}

.src {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.src:hover {
  background: var(--hover);
  color: var(--ink);
}

.src[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
  box-shadow: none;
}

.src-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.src[aria-pressed="true"] .src-count { color: color-mix(in srgb, var(--surface) 72%, transparent); }

/* 지금 글이 하나도 없는 소스는 한 단계 흐리게 */
.src.is-empty:not(:hover, [aria-pressed="true"]) { color: var(--muted); }

/* 맨 아래 안내문: 페이지 폭 끝까지 긋는 가는 선 아래로 이름과 '지난 화제' 링크 한 줄, 안내 문장, 연락처.
   상자 없이 페이지 폭을 그대로 쓰고, 문장마다 줄을 나눠 넓은 화면에서도 한 줄이 너무 길어지지 않게 한다. */
.foot {
  padding-bottom: 56px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
  word-break: keep-all;
}

.foot-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding-top: 28px;
  /* 회색 바탕 위라 흰 판 안의 구분선(--line)보다 한 단계 짙게 */
  border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}

.foot-brand {
  color: var(--ink-2);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.foot-notes { margin-top: 12px; }
.foot-notes p + p { margin-top: 6px; }

.foot-contact-line {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 12px;
}

/* 연락처를 아직 정하지 않았으면 빈 이름표만 남지 않게 줄째 감춘다 */
.foot-contact-line:has(.foot-contact:empty) { display: none; }

.foot-label { color: var(--ink-2); font-weight: 600; }

.foot-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-2);
  font-weight: 700;
  text-decoration: none;
}

.foot-link .icon { font-size: 0.95em; transition: translate 0.2s ease; }
.foot-link:hover { color: var(--ink); }
.foot-link:hover .icon { translate: 2px 0; }
.foot-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

/* ── 가운데 열: 구역 둘(화제 → 커뮤니티)의 공통 머리말 ───── */

.topics,
.feed {
  min-width: 0;
  margin-top: var(--section-gap);
}

/* 맨 위에 오는 구역은 이름 줄 바로 아래에서 시작한다 */
.topics,
.topics[hidden] ~ .feed { margin-top: 28px; }

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 30px;
  margin-bottom: 12px;
}

.sec-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.03em;
  word-break: keep-all;
}

/* 커뮤니티 소식 머리: 왼쪽에 제목과 수집 시각, 오른쪽에 소스 단추와 글 검색 칸.
   한 줄에 다 들어가지 않으면(좁은 두 칸 화면의 영어 제목 등) 제목을 접지 않고 도구를 다음 줄로 내린다. */
.feed-head {
  flex-wrap: wrap;
  row-gap: 14px;
}

.feed-title {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
}

.feed-title .sec-title { white-space: nowrap; }

.feed-tools {
  display: flex;
  flex: 1 1 300px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

/* 글 검색 칸. 소스 단추와 함께 머리 줄(30px)보다 조금 커서 위아래로 3px씩 내밀어
   제목 자리와 아래 판까지의 간격이 다른 구역과 같게 남는다. */
.search-box {
  display: flex;
  flex: 0 1 260px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 36px;
  margin-block: -3px;
  padding: 0 14px 0 13px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  cursor: text;
  transition: box-shadow 140ms ease;
}

.search-box:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink); }

.search-box .icon { font-size: 15px; }

.search {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  appearance: none;
}

.search:focus-visible { outline: none; }

.search::placeholder { color: var(--placeholder); }

.search::-webkit-search-cancel-button { cursor: pointer; }

/* ── 지금 화제: 겹쳐 놓인 구름 ──────────────
   주제마다 가장자리가 흐려지는 색 구름 하나. 맨 앞의 큰 구름이 지금 보는 주제이고,
   옆과 뒤의 구름을 누르면 그 주제가 앞으로 온다. 자리(앞·오른쪽·왼쪽·위)는 data-slot이 정하고,
   구름의 색과 생김새는 app.js의 CLOUDS가 주제마다 다르게 준다. 단위는 구역 폭의 1%. */

.topics { container: topics / inline-size; }

.icon {
  display: inline-grid;
  flex: none;
  width: 1em;
  height: 1em;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.cloud-stage {
  --stage-h: 68;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  height: calc(var(--stage-h) * 1cqw);
  margin-top: 6px;
  isolation: isolate;
  touch-action: pan-y; /* 세로 스크롤은 브라우저가, 가로 밀기는 주제 넘기기가 처리 */
  user-select: none;
}

/* 넓은 화면: 무대를 화면 높이에도 맞춘다. 키가 작은 화면에서는 무대 폭을 줄여 가운데에 두어 구름과 그 아래
   '화제 순위' 단추, 그리고 다음 구역(커뮤니티 소식)의 머리와 첫 글 줄까지 첫 화면에 들어온다.
   첫 화면이 구름만으로 차서 아래에 글이 더 있는지 모르는 일이 없게 하려는 것이다(1440×900 기준).
   키가 1024px 이상인 화면에서는 무대가 내용 폭(1020px)을 다 쓴다. 무대가 단위(cqw)의 기준이 되어 구름과 글자가 함께 줄어든다. */
@media (min-width: 861px) {
  .cloud-stage {
    container-type: inline-size;
    width: min(100%, max(560px, calc((100svh - 330px) * 100 / var(--stage-h))));
    height: auto;
    aspect-ratio: 100 / var(--stage-h);
    margin-inline: auto;
  }
}

/* 구름 하나(단추). 이 상자는 따로 쌓이는 층을 만들지 않는다(z-index·transform·애니메이션을 두지 않는다).
   그래서 안의 색 구름, 눌리는 자리, 글이 무대 안에서 각각 따로 쌓인다. 색 구름끼리는 앞뒤 순서(--z)대로 겹치고,
   글은 모든 색 구름 위에 놓인다. 옆 구름 이름이 앞 구름 색 밑에 깔려 물드는 일이 없다. */
.orb {
  /* 마우스를 따라 앞의 구름일수록 조금 더 움직인다. 색 구름, 눌리는 자리, 글이 함께 쓴다. */
  --shift: translate(calc(var(--px, 0) * var(--par) * 1px), calc(var(--py, 0) * var(--par) * 1px));
  position: absolute;
  top: calc((var(--cy) - var(--h) / 2) * 1cqw);
  left: calc((var(--cx) - var(--w) / 2) * 1cqw);
  display: grid;
  place-items: center;
  width: calc(var(--w) * 1cqw);
  height: calc(var(--h) * 1cqw);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  pointer-events: none; /* 상자 모서리가 옆 구름을 가리지 않게. 눌리는 곳은 .orb-hit */
  transition:
    top 820ms var(--ease),
    left 820ms var(--ease),
    width 820ms var(--ease),
    height 820ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}

@keyframes orb-in {
  from { opacity: 0; scale: 0.78; }
}

.orb:focus-visible { outline: none; }

.orb:focus-visible .orb-label {
  border-radius: 6px;
  outline: 2px solid var(--ink);
  outline-offset: 5px;
}

/* 구름: 가운데가 밝고 가장자리로 갈수록 색이 짙어지다 투명해지는 덩어리 셋을 겹친다 */
.orb-cloud {
  position: absolute;
  inset: 0;
  z-index: var(--z);
  background:
    radial-gradient(44% 45% at var(--p1),
      hsl(var(--h1) var(--orb-s) var(--orb-l) / 0.97) 0 30%,
      hsl(var(--h1) var(--orb-s) var(--orb-l) / 0.8) 54%,
      hsl(var(--h1) var(--orb-s) var(--orb-edge) / 0.34) 78%,
      hsl(var(--h1) var(--orb-s) var(--orb-edge) / 0) 100%),
    radial-gradient(30% 34% at var(--p2),
      hsl(var(--h2) var(--orb-s) var(--orb-edge) / 0.86) 0 12%,
      hsl(var(--h2) var(--orb-s) var(--orb-edge) / 0.42) 56%,
      hsl(var(--h2) var(--orb-s) var(--orb-edge) / 0) 100%),
    radial-gradient(28% 32% at var(--p3),
      hsl(var(--h3) var(--orb-s) var(--orb-edge) / 0.8) 0 10%,
      hsl(var(--h3) var(--orb-s) var(--orb-edge) / 0.38) 56%,
      hsl(var(--h3) var(--orb-s) var(--orb-edge) / 0) 100%);
  opacity: var(--fog, 1);
  filter: blur(var(--blur, 0.5cqw));
  pointer-events: none;
  rotate: var(--rot);
  transform: var(--shift);
  /* inset: 앞 구름은 안개 폭이 달라서(아래), 자리를 옮길 때 그 폭도 함께 천천히 바뀐다 */
  transition: opacity 700ms ease, scale 500ms var(--ease), inset 820ms var(--ease), transform 600ms ease-out;
  animation:
    drift var(--dur) ease-in-out infinite alternate,
    orb-in 900ms var(--ease) calc(var(--i) * 70ms) backwards;
}

/* 고운 입자를 얹어 매끈한 그러데이션 느낌을 던다 */
.orb-cloud::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--orb-grain);
  mix-blend-mode: var(--orb-grain-blend);
  mask-image: radial-gradient(closest-side, #000 35%, transparent 88%);
}

/* 맨 앞 구름은 글자가 놓이는 가운데를 한 겹 더 밝힌다 */
.orb-cloud::after {
  content: "";
  position: absolute;
  inset: 20% 22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--orb-core) 0 30%, transparent 100%);
  opacity: 0;
  transition: opacity 700ms ease;
}

.orb.is-front .orb-cloud::after { opacity: 1; }

@keyframes drift {
  from {
    translate: -1.6% 1.2%;
    rotate: calc(var(--rot) - 2.5deg);
  }

  to {
    translate: 1.6% -1.6%;
    rotate: calc(var(--rot) + 3deg);
  }
}

/* 눌리는 자리: 구름에서 색이 진한 몸통만. 맨 앞 구름은 더 안쪽으로 줄여 옆 구름 자리를 침범하지 않는다. */
.orb-hit {
  position: absolute;
  inset: var(--hit, 14%);
  z-index: var(--z);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  transform: var(--shift);
  transition: transform 600ms ease-out;
}

.orb.is-front { --hit: 19% 23%; }

.orb:hover .orb-cloud { scale: 1.03; }
.orb:not(.is-front):hover .orb-cloud { scale: 1.08; }
.orb:active .orb-cloud { scale: 0.98; }

/* 글: 모든 색 구름 위(--z + 10)에 놓는다 */
.orb-body {
  position: relative;
  z-index: calc(var(--z) + 10);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 56%;
  text-align: center;
  translate: var(--tx, 0) var(--ty, 0);
  transform: var(--shift);
  transition: translate 820ms var(--ease), transform 600ms ease-out, opacity 500ms ease, visibility 500ms;
  animation: orb-in 900ms var(--ease) calc(var(--i) * 70ms) backwards;
}

.orb-label {
  font-size: var(--fs);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  word-break: keep-all;
  text-wrap: balance;
  transition: font-size 600ms var(--ease);
}

/* 옆 구름에서 주제 이름 위에 붙는 순위. 맨 앞 구름은 위의 둥근 표시가 대신한다. */
.orb-rank {
  margin-bottom: 0.3em;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
  font-size: clamp(0.72rem, 1.1cqw, 0.84rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* 맨 앞 구름에만 나오는 것: 순위 표시, 제목, 요약 단추 */
.orb-tag,
.orb-title,
.orb-cta { display: none; }

.orb.is-front .orb-rank { display: none; }

.orb.is-front .orb-tag,
.orb.is-front .orb-title,
.orb.is-front .orb-cta { animation: settle 520ms var(--ease) 160ms backwards; }

@keyframes settle {
  from { opacity: 0; translate: 0 8px; }
}

/* 구름 속 글자 크기는 구름과 함께 구역 폭(cqw)을 따라가되, 너무 작거나 크지 않게 위아래를 막는다.
   여백은 em으로 두어 글자와 같은 비율로 커진다. */
.orb.is-front .orb-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.95em;
  padding: 0.34em 0.95em 0.34em 0.85em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: clamp(0.72rem, 1.1cqw, 0.84rem);
  font-weight: 600;
  line-height: 1.5;
}

.orb-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

.orb.is-front .orb-title {
  display: -webkit-box;
  margin-top: 0.55em;
  overflow: hidden;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
  font-size: clamp(0.9rem, 1.55cqw, 1.1rem);
  line-height: 1.5;
  word-break: keep-all;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.orb.is-front .orb-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-top: 1.15em;
  padding: 0.64em 1.02em 0.64em 0.94em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: clamp(0.8rem, 1.3cqw, 0.94rem);
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--ink) 18%, transparent);
}

.orb-cta .icon:first-child { color: var(--accent); }
.orb-cta .icon:last-child { transition: translate 220ms ease; }
.orb:hover .orb-cta .icon:last-child { translate: 3px 0; }

/* 자리. 구름 여섯이 비스듬히 내려다본 회전목마처럼 둥근 고리를 이룬다: 앞이 가장 아래·가장 크고, 양옆이 그보다 위,
   뒤의 셋은 맨 위에서 둥근 지붕을 만든다(가운데가 가장 높고 양쪽은 조금 낮고 안쪽). 그래서 모인 모양이 옆으로 누운
   타원이 된다. 일부러 좌우를 맞추지 않아 크기도 높이도 조금씩 다르다.
   앞·양옆 구름만 크게 두고 글을 띄운다. 뒤의 구름은 글 없이 흐릿한 색 덩어리로만 비쳐 배경을 풍성하게 채운다. */
.orb[data-slot="front"] { --cx: 50; --cy: 39; --w: 84; --h: 62; --z: 8; --par: 9; --fs: clamp(1.9rem, 4.3cqw, 3rem); }
.orb[data-slot="right"] { --cx: 81; --cy: 33; --w: 57; --h: 45; --z: 7; --par: 5; --fs: clamp(1.12rem, 2.4cqw, 1.66rem); --tx: 12%; --ty: -8%; }
.orb[data-slot="left"] { --cx: 19; --cy: 31.5; --w: 55; --h: 43; --z: 6; --par: 4; --fs: clamp(1.08rem, 2.3cqw, 1.6rem); --tx: -12%; --ty: -10%; }
.orb[data-slot="upright"] { --cx: 75.5; --cy: 14; --w: 43; --h: 27; --z: 3; --par: 2.5; --fog: 0.78; --blur: 1.1cqw; }
.orb[data-slot="upleft"] { --cx: 24.5; --cy: 13.5; --w: 42; --h: 26; --z: 2; --par: 2; --fog: 0.72; --blur: 1.1cqw; }
.orb[data-slot="top"] { --cx: 50; --cy: 7; --w: 46; --h: 22; --z: 1; --par: 1; --fog: 0.72; --blur: 1.4cqw; }

/* 양옆 이름은 두 줄까지 접어 칸 밖으로 나가지 않게 한다 */
.orb[data-slot="right"] .orb-body,
.orb[data-slot="left"] .orb-body { max-width: 44%; }

/* 앞 구름 글은 조금 좁게 접어 가까이 붙은 양옆 구름 이름과 부딪히지 않게 한다 */
.orb.is-front .orb-body { max-width: 54%; }

/* 앞 구름의 안개는 양옆을 조금 덜 덮게 좁혀 옆 구름 이름이 흐려지지 않게 한다 */
.orb[data-slot="front"] .orb-cloud { inset: 0 7%; }

/* 뒤의 구름: 글은 숨기고(앞으로 오면 다시 나타난다) 모양만 남긴다 */
.orb[data-slot="upright"] .orb-body,
.orb[data-slot="upleft"] .orb-body,
.orb[data-slot="top"] .orb-body {
  opacity: 0;
  visibility: hidden;
}

/* 좁은 폭: 넓은 화면과 같은 누운 타원을 그대로 줄인다.
   글자는 폭에 맞춰 함께 줄어 구름 밖으로 비어져 나오지 않게 한다. 구름이 글자에 덮이지 않게 글자를 작게 두고,
   앞 구름에서는 한 줄 제목을 빼 이름과 'AI 요약' 단추만 남긴다(제목은 요약 창에 있다).
   양옆 이름은 제 구름의 가운데에서 살짝 위에 둔다. 딱 가운데에 두면 앞 구름의 순위 표시와 한 줄로 늘어서 답답하다. */
@container topics (max-width: 600px) {
  .cloud-stage { --stage-h: 84; }

  .orb[data-slot="front"] { --cx: 50; --cy: 46; --w: 92; --h: 78; --fs: clamp(1.1rem, 5.7cqw, 1.45rem); }
  .orb[data-slot="right"] { --cx: 85; --cy: 31; --w: 66; --h: 50; --fs: clamp(0.78rem, 3.8cqw, 0.92rem); --tx: -6%; --ty: -25%; }
  .orb[data-slot="left"] { --cx: 15; --cy: 30; --w: 66; --h: 48; --fs: clamp(0.78rem, 3.8cqw, 0.92rem); --tx: 6%; --ty: -27%; }
  .orb[data-slot="upright"] { --cx: 77; --cy: 14.5; --w: 52; --h: 30; }
  .orb[data-slot="upleft"] { --cx: 23; --cy: 14; --w: 50; --h: 29; }
  .orb[data-slot="top"] { --cx: 50; --cy: 7.5; --w: 54; --h: 24; }

  .orb-body { max-width: 56%; }
  .orb.is-front .orb-body { max-width: 58%; }
  .orb[data-slot="right"] .orb-body,
  .orb[data-slot="left"] .orb-body { max-width: 48%; }
  .orb-rank { margin-bottom: 1px; font-size: clamp(0.6rem, 2.8cqw, 0.68rem); }

  .orb.is-front .orb-tag { margin-bottom: 8px; padding: 3px 9px 3px 8px; font-size: clamp(0.62rem, 3cqw, 0.72rem); }
  .orb.is-front .orb-title { display: none; }
  .orb.is-front .orb-cta { margin-top: 12px; padding: 7px 11px 7px 10px; font-size: clamp(0.7rem, 3.4cqw, 0.8rem); }
}

/* 아주 좁은 폭(320px 화면)의 영어: 이름이 길어 양옆 이름이 앞 구름의 순위 표시("Hottest right now")와 맞닿는다.
   이때만 양옆 이름을 제 구름 위쪽으로 올려 표시보다 위에 둔다. */
@container topics (max-width: 300px) {
  :root:lang(en) .orb[data-slot="right"] { --ty: -95%; }
  :root:lang(en) .orb[data-slot="left"] { --ty: -97%; }
}

/* ── 화제 순위: 구름 아래에서 순위가 한 줄씩 굴러 넘어가는 단추와, 누르면 펼쳐지는 전체 목록 ──────────────
   구름에는 뜨거운 여섯 개만 뜨고(글자는 셋), 단추와 목록에는 전부를 순위와 이름으로 늘어놓는다.
   목록 줄을 누르면 구름과 같은 AI 요약 창이 뜬다. 단추와 목록은 같은 폭으로 가운데에 놓는다. */

.topics { --rank-w: 380px; }

.topic-more {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.more-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, var(--rank-w));
  height: 44px;
  padding: 0 14px 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.more-toggle:hover { background: var(--hover); }

/* 한 줄 높이의 창. 안의 줄들이 위로 미끄러지며 다음 순위가 아래에서 올라온다(--tick은 app.js가 준다).
   맨 끝에 1위가 한 번 더 붙어 있어, 거기까지 오면 움직임 없이 맨 앞으로 되돌아간다. */
.ticker {
  --tick-h: 24px;
  flex: 1 1 auto;
  min-width: 0;
  height: var(--tick-h);
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
}

.ticker-track {
  display: grid;
  translate: 0 calc(var(--tick, 0) * var(--tick-h) * -1);
  transition: translate 560ms var(--ease-out);
}

.ticker-track.is-instant { transition: none; }

.ticker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--tick-h);
  min-width: 0;
}

.ticker-rank,
.topic-row-rank {
  color: var(--muted);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.ticker-rank {
  flex: none;
  min-width: 1.2em;
}

/* 1~3위 숫자만 강조색 */
.ticker-item.is-top .ticker-rank,
.topic-list .is-top .topic-row-rank { color: var(--accent-ink); }

.ticker-name,
.topic-row-label {
  min-width: 0;
  overflow: hidden;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.more-chevron {
  color: var(--muted);
  font-size: 15px;
  transition: rotate 280ms var(--ease-out);
}

.topics.is-listing .more-chevron { rotate: 180deg; }

.topic-drawer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 0fr;
  transition: grid-template-rows 360ms var(--ease-out);
}

.topics.is-listing .topic-drawer { grid-template-rows: 1fr; }

.topic-drawer-clip {
  min-height: 0;
  overflow-x: visible;
  overflow-y: clip;
}

/* 단추 바로 아래에 같은 폭으로 펼쳐지는 판 */
.topic-panel {
  width: min(100%, var(--rank-w));
  margin: 10px auto 4px; /* 아래 4px: 판의 그림자가 잘리지 않게 */
  padding: 6px;
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
}

/* 순위와 이름만 담은 얇은 줄. 8위까지 보이고 9위가 반쯤 비치며, 나머지는 판 안에서 내려 본다.
   위나 아래로 더 있으면 그쪽 끝을 흐리게 한다(--fade-top·--fade-bottom은 app.js가 준다). */
.topic-list {
  --row-h: 44px;
  --fade-top: 0px;
  --fade-bottom: 0px;
  display: grid;
  max-height: calc(var(--row-h) * 8.5);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  mask-image: linear-gradient(to bottom, transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
}

.topic-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  width: 100%;
  height: var(--row-h);
  padding: 0 16px 0 4px;
  border: 0;
  border-radius: 16px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.topic-row:hover { background: var(--hover); }

/* 판 안에서 내려 보는 칸이라 바깥 고리는 잘린다. 안쪽에 그린다. */
.topic-row:focus-visible { outline-offset: -2px; }

/* 펼칠 때 줄들이 위에서부터 차례로 내려앉는다(--i는 순위 순서, app.js가 준다) */
.topics.is-listing .topic-list li {
  animation: rank-in 440ms var(--ease-out) backwards;
  animation-delay: calc(min(var(--i, 0), 9) * 28ms + 60ms);
}

@keyframes rank-in {
  from {
    opacity: 0;
    translate: 0 -10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topic-drawer,
  .more-chevron,
  .ticker-track { transition: none; }

  .topics.is-listing .topic-list li { animation: none; }
}

/* ── AI 요약 시트: 주제를 누르면 뜨는 창. 좁은 화면에서는 아래에서 올라온다. ── */

html { scrollbar-gutter: stable; }

html:has(.sheet[open]) { overflow: hidden; }

.sheet {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.sheet::backdrop {
  background: rgba(13, 13, 12, 0.48);
  backdrop-filter: blur(6px);
  animation: fade 220ms ease-out;
}

/* 머리줄(AI 요약 표시, 닫기)은 고정하고 그 아래 내용만 스크롤한다. */
.sheet-card {
  display: flex;
  flex-direction: column;
  max-height: min(86dvh, 860px);
  overflow: hidden;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
  animation: sheet-in 320ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.sheet.is-closing .sheet-card { animation: sheet-out 170ms ease-in forwards; }
.sheet.is-closing::backdrop { animation: fade 170ms ease-in reverse forwards; }

@keyframes fade {
  from { opacity: 0; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(0.975); }
}

@keyframes sheet-out {
  to { opacity: 0; transform: translateY(12px) scale(0.985); }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
}

@keyframes sheet-down {
  to { transform: translateY(100%); }
}

.sheet-grab { display: none; }

.sheet-top {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0 28px;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.ai-badge .icon { color: var(--accent); }

.sheet-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.sheet-close:hover {
  background: var(--ink);
  color: var(--surface);
}

.sheet-content {
  padding: 0 28px 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  animation: fade 220ms ease-out;
}

.sheet-eyebrow {
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.sheet-title {
  margin: 6px 0 0;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.035em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.sheet-summary {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.sheet-summary li {
  position: relative;
  padding-left: 18px;
  font-size: 0.98rem;
  line-height: 1.68;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.sheet-summary li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.sheet-label {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.sheet-sources {
  margin-top: 8px;
  padding: 4px 0;
  border-radius: 18px;
  background: var(--surface-2);
}

.sheet-source {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: inherit;
  text-decoration: none;
}

.sheet-source + .sheet-source { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 7%, transparent); }

.sheet-source-text {
  flex: 1;
  min-width: 0;
}

.sheet-source-title {
  display: block;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-source-sub {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.sheet-source .icon {
  color: var(--faint);
  font-size: 14px;
  transition: color 140ms ease, transform 140ms ease;
}

.sheet-source:hover .icon {
  color: var(--ink);
  transform: translate(2px, -2px);
}

.sheet-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
  word-break: keep-all;
}

/* 요약 문장 끝의 근거 글 번호. 누르면 아래 근거 글 목록의 그 번호로 내려간다. */
.cite {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  vertical-align: 0.18em;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.cite + .cite { margin-left: 3px; }

.cite:hover {
  background: var(--ink);
  color: var(--surface);
}

.source-num {
  flex: none;
  width: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sheet-source.is-cited { animation: cited 1.4s ease-out; }

@keyframes cited {
  from { background: color-mix(in srgb, var(--accent) 16%, transparent); }
}

/* 요약 창 맨 아래: 이 화제의 고정 페이지로 가는 링크 */
.sheet-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.sheet-page .icon { transition: transform 140ms ease; }
.sheet-page:hover .icon { transform: translateX(3px); }

.sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 14px 8px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.chip-rank {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.chip:hover {
  background: var(--ink);
  color: var(--surface);
}

.chip:hover .chip-rank { color: inherit; opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
  .orb,
  .orb-cloud,
  .orb-body,
  .orb-live,
  .orb.is-front .orb-tag,
  .orb.is-front .orb-title,
  .orb.is-front .orb-cta,
  .sheet-card,
  .sheet-content,
  .sheet-source.is-cited,
  .sheet::backdrop { animation: none; }

  .orb,
  .orb-cloud,
  .orb-hit,
  .orb-body,
  .orb-label { transition: none; }
}

/* ── 커뮤니티 소식: 흰 판 하나에 최신순 글 줄과 페이지 단추 ───────────── */

.feed { padding: 0 0 56px; }

/* clip: 판의 둥근 모서리 밖으로 글 줄의 눌림 바탕이 비어져 나오지 않게 자른다 */
.feed-panel {
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: clip;
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
}

.status:not(:empty) { padding: 20px 24px; }

/* 글 줄의 판 안쪽 여백 */
.panel { --pad: 24px; }

/* 페이지를 넘기면 새 목록이 살짝 떠오르며 바뀐다. 목록 판은 키보드 초점을 받지만 고리는 그리지 않는다. */
.panel.is-paging { animation: fade 200ms ease-out; }

.panel:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .panel.is-paging { animation: none; }
}

/* 글 줄 하나: 제목, 발췌, 그 아래 한 줄에 출처·올린 때·표시 */
.item {
  position: relative;
  display: block;
  padding: 18px var(--pad) 17px;
  color: inherit;
  text-decoration: none;
  isolation: isolate;
}

/* 줄 사이의 가는 선 */
.item + .item::before {
  content: "";
  position: absolute;
  top: 0;
  right: var(--pad);
  left: var(--pad);
  height: 1px;
  background: var(--line);
  transition: opacity 160ms ease;
}

/* 마우스를 올리거나 누르면 줄 안쪽에 둥근 바탕이 깔리고, 그 줄 위아래의 가는 선은 잠시 감춘다 */
.item::after {
  content: "";
  position: absolute;
  inset: 3px calc(var(--pad) - 12px);
  z-index: -1;
  border-radius: 16px;
  background: var(--hover);
  opacity: 0;
  transition: opacity 160ms ease;
}

.item:hover::after,
.item:active::after { opacity: 1; }

.item:hover::before,
.item:hover + .item::before { opacity: 0; }

.item:focus-visible {
  border-radius: 16px;
  outline-offset: -3px;
}

/* 글 아래 한 줄: 출처, 올린 때(오늘 글은 시:분, 그 전 글은 11/16처럼 날짜만), 표시(선정·새 글·원문) */
.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.item-src {
  color: var(--ink-2);
  font-weight: 600;
}

.item-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.68rem;
  font-weight: 700;
}

.tag-pick {
  background: var(--ink);
  color: var(--surface);
}

.tag-new {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-ink);
}

.tag-original {
  color: var(--muted);
  font-weight: 600;
}

.item-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: -0.02em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.item:visited .item-title { color: var(--muted); }

/* 사진·영상이 있는 글: 제목 앞에 작은 그림 칸. 사진은 파랑 칸에 산과 해, 영상은 보라 칸에 재생 삼각형.
   칸 바닥이 글자 바닥보다 4px 내려와 한글 글자 높이의 가운데에 맞는다. */
.media {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 7px;
  padding: 3.5px;
  border-radius: 6px;
  vertical-align: -4px;
}

.media svg {
  display: block;
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.media-image {
  background: var(--photo-bg);
  color: var(--photo-ink);
}

.media-video {
  background: var(--video-bg);
  color: var(--video-ink);
}

/* 그림 칸과 제목의 첫 낱말은 줄이 바뀌어도 함께 간다 */
.title-start { white-space: nowrap; }

.item-excerpt {
  display: -webkit-box;
  max-width: 66ch;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* 페이지 단추 줄: 판 맨 아래 가운데. 지금 페이지는 진한 칸, 끝에 닿은 화살표는 흐리게. */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px 22px;
}

.pager-num,
.pager-step {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.pager-step { color: var(--ink-2); }

.pager-step .icon { font-size: 16px; }

.pager-num:hover:not([aria-current="page"]),
.pager-step:hover:not(:disabled) {
  background: var(--hover);
  color: var(--ink);
}

.pager-num[aria-current="page"] {
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
  cursor: default;
}

.pager-step:disabled {
  opacity: 0.3;
  cursor: default;
}

.pager-gap {
  min-width: 22px;
  color: var(--faint);
  text-align: center;
}

/* ── 예측시장 위젯 ─────────────────────── */

.markets {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  max-height: 100vh;
  max-height: 100dvh;
  /* 카드 줄이 양옆으로 4px 내미는 자리를 안쪽 여백으로 두어, 이 열이 옆으로 밀리거나 카드 테두리가 잘리지 않게.
     위쪽은 바깥 여백 + 안쪽 여백(32px)이 구역 간격이 되어 머리말이 옆의 '커뮤니티 소식'과 같은 높이에 온다.
     화면에 붙어 따라올 때는 안쪽 여백만큼 화면 위에서 떨어진다. */
  margin: calc(var(--section-gap) - 32px) -4px 0;
  padding: 32px 4px 24px;
  overflow-y: auto;
  scrollbar-width: none;
}

.markets::-webkit-scrollbar { display: none; }

/* 화제 구역이 없으면 예측시장이 맨 위 줄에서 시작하므로 바깥 여백을 뺀다 */
.topics[hidden] ~ .markets { margin-top: 0; }

.markets-head {
  display: flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 12px;
}

.markets-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.03em;
}

/* 머리말 옆의 예측 개수 */
.markets-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.markets-count:empty { display: none; }

/* 카드 줄: 한 장이 꽉 차지 않고 다음 카드가 옆에 걸쳐 보여 "더 있다"를 알린다 */
.market-rail { position: relative; display: flow-root; }

.market-track {
  --fade-left: 0px;
  --fade-right: 0px;
  display: grid;
  grid-auto-columns: clamp(176px, 84%, 264px);
  grid-auto-flow: column;
  gap: 10px;
  /* 카드 테두리와 그림자가 잘리지 않게 사방에 4px 여유를 두고, 그만큼 바깥으로 넓혀 카드 자리는 그대로 둔다 */
  margin: -4px;
  padding: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding: 0 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  /* 반쯤 잘린 카드가 걸친 가장자리만 흐린다 */
  mask-image: linear-gradient(to right, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent);
}

.market-track::-webkit-scrollbar { display: none; }

/* 카드 줄에 키보드로 들어왔을 때의 고리. 줄에 직접 그리면 가장자리 마스크에 지워지므로 감싼 틀에 그린다. */
.market-track:focus-visible { outline: none; }

.market-rail:has(> .market-track:focus-visible)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  pointer-events: none;
}

.mcard {
  display: flex;
  flex-direction: column;
  min-height: 184px;
  padding: 18px 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  scroll-snap-align: start;
}

.mcard-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.02em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* 선택지: 이름과 확률을 한 줄에 적고(확률은 오른쪽 끝에 맞춘다), 그 아래에 확률만큼 긴 얇은 선을 긋는다.
   선 길이는 실제 확률이다(카드 폭 = 100%). 축과 바탕 줄은 없고 선 끝은 각지다. 선은 회색이고
   가장 높은 선택지만 진한 빨강이다(2026-11-28 사용자 스케치). 선택지 수가 카드마다 달라도
   선택지들이 카드 아래쪽에 붙어 옆 카드와 높이가 맞는다. */
.mcard-outcomes {
  --bar: color-mix(in srgb, var(--ink) 22%, var(--surface));
  display: grid;
  gap: 12px;
  margin: auto 0 0;
  padding: 18px 0 0;
  list-style: none;
}

.mcard-outcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 5px;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
}

.mcard-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcard-value {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mcard-bar {
  grid-column: 1 / -1;
  width: var(--p);
  min-width: 2px;
  height: 3px;
  background: var(--bar);
}

.mcard-outcome.is-top {
  color: var(--ink);
  font-weight: 700;
}

.mcard-outcome.is-top .mcard-bar { background: var(--market-top); }

.mcard-outcome.is-top .mcard-value {
  color: var(--market-top-ink);
  font-weight: 800;
}

/* 카드 줄 위에 떠 있는 둥근 넘김 단추 */
.float-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--raised);
  color: var(--ink);
  font-size: 14px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  translate: 0 -50%;
  transition: scale 140ms ease;
}

.float-nav:hover { scale: 1.08; }
.float-nav.is-previous { left: 6px; }
.float-nav.is-next { right: 6px; }

.markets-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
  word-break: keep-all;
}

/* 위젯 맨 아래의 작은 출처 표기 */
.markets-source {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

/* ── 중간 폭: 예측시장이 화제와 커뮤니티 소식 사이로 내려와 한 열이 된다 ── */

@media (max-width: 959px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas:
      "topics"
      "markets"
      "feed";
  }

  /* 화제가 없으면 예측시장이 맨 위 구역이 된다 */
  .topics[hidden] ~ .markets { margin-top: 28px; }
  .topics[hidden] ~ .feed { margin-top: var(--section-gap); }

  .markets {
    position: static;
    max-height: none;
    margin-top: var(--section-gap);
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }
}

/* ── 좁은 화면: 이름 → 화제 → 예측시장 → 커뮤니티 소식 → 안내문, 한 열로 ── */

@media (max-width: 860px) {
  :root {
    --section-gap: 40px;
    --radius-panel: 20px;
  }

  .top { padding: 20px 16px 0; }

  .layout { padding: 0 16px; }

  /* 구름 무대를 화면 끝까지 넓혀 그 경계에서 자른다. 구름은 화면 가장자리까지 번지고 페이지는 옆으로 밀리지 않는다.
     구름 자리는 그대로 두려고 넓힌 만큼(16px) 오른쪽으로 옮긴다. */
  .cloud-stage {
    margin-inline: -16px;
    overflow-x: clip;
  }

  .orb { left: calc((var(--cx) - var(--w) / 2) * 1cqw + 16px); }

  .brand { font-size: 1.45rem; }

  .feed { padding-bottom: 28px; }

  .foot { padding: 0 16px 40px; }

  .foot-head { padding-top: 24px; }

  .topics,
  .topics[hidden] ~ .markets { margin-top: 24px; }

  .sec-title,
  .markets-title { font-size: 1.15rem; }

  /* 휴대폰에서는 카드 줄을 화면 끝까지 늘려 다음 카드가 화면 밖으로 이어지게 */
  .market-track {
    grid-auto-columns: 62%;
    margin: -4px -16px;
    padding: 4px 16px;
    scroll-padding: 0 16px;
    mask-image: none;
  }

  .float-nav { display: none; }

  /* 요약 시트는 아래에서 올라오는 화면 폭 시트로 */
  .sheet {
    width: 100%;
    margin: auto 0 0;
  }

  .sheet-card {
    max-height: 88dvh;
    padding-top: 10px;
    border-radius: 26px 26px 0 0;
    animation-name: sheet-up;
  }

  .sheet.is-closing .sheet-card { animation-name: sheet-down; }

  .sheet-grab {
    display: block;
    width: 40px;
    height: 4px;
    flex: none;
    margin: 0 auto 12px;
    border-radius: 2px;
    background: var(--line);
  }

  .sheet-top { padding: 0 14px 0 20px; }

  .sheet-content { padding: 0 20px calc(24px + env(safe-area-inset-bottom)); }

  .sheet-title { font-size: 1.32rem; }

  /* 소스 알약은 한 줄로 두고 옆으로 넘긴다 */
  .source-list {
    flex-wrap: nowrap;
    margin: 0 -16px;
    padding: 4px 16px 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .source-list::-webkit-scrollbar { display: none; }

  /* 첫 줄에 제목과 수집 시각, 둘째 줄에 소스 단추와 검색 칸(남는 폭 전부).
     글씨가 16px보다 작으면 아이폰이 칸을 누를 때 화면을 확대한다. */
  .feed-head {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .feed-title {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .feed-tools { flex: 1 1 100%; }

  .search-box {
    flex: 1 1 auto;
    height: 44px;
    margin-block: 0;
  }

  .sources-toggle {
    height: 44px;
    margin-block: 0;
  }

  .sources-current { max-width: 7em; }

  .search { font-size: 1rem; }

  /* 손가락으로 누르기 쉽게 언어 단추를 키운다 */
  .lang button { padding: 6px 11px; }

  .panel { --pad: 16px; }

  .item { padding: 15px var(--pad); }

  .item-title { font-size: 1.02rem; }

  /* 페이지 단추는 손가락 높이로 키우고, 좁은 폭에 다 들어가게 사이를 좁힌다 */
  .pager {
    gap: 2px;
    padding: 12px 8px 18px;
  }

  .pager-num,
  .pager-step { height: 40px; }
}
