/* TrendPulse — static client styles. No external fonts, no CDN. */
:root {
  --bg: #070b16;
  --bg-soft: #0c1222;
  --surface: #121a2e;
  --surface-2: #17203a;
  --line: #24304d;
  --text: #e8eefc;
  --muted: #94a3c4;
  --accent: #6ea0ff;
  --accent-2: #ff5c92;
  --good: #45d6a0;
  --warn: #ffb454;
  --bad: #ff6b6b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(3, 8, 20, 0.45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
html[data-theme="light"] {
  --bg: #f4f7fc;
  --bg-soft: #eaeff8;
  --surface: #ffffff;
  --surface-2: #f2f5fb;
  --line: #dbe3f1;
  --text: #101828;
  --muted: #5a6780;
  --accent: #2456d6;
  --accent-2: #d6246e;
  --good: #0f9d68;
  --warn: #b36b00;
  --bad: #c03333;
  --shadow: 0 8px 24px rgba(20, 35, 70, 0.10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 12% -8%, rgba(110, 160, 255, 0.16), transparent 60%),
              radial-gradient(900px 500px at 92% 0%, rgba(255, 92, 146, 0.12), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic",
    "Hiragino Sans", "Yu Gothic", "Noto Sans CJK KR", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}
img, svg { max-width: 100%; height: auto; }
a { color: inherit; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(14px, 4vw, 28px); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg-soft); }
}
.header-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: -0.02em; font-size: 1.12rem; text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-block; box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.brand small { color: var(--muted); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.header-spacer { flex: 1 1 auto; }
.lang-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-nav a {
  text-decoration: none; font-size: 0.8rem; padding: 5px 9px; border-radius: 999px;
  color: var(--muted); border: 1px solid transparent; white-space: nowrap;
}
.lang-nav a[aria-current="true"] { color: var(--text); background: var(--surface); border-color: var(--line); }
.lang-nav a:hover { color: var(--text); border-color: var(--line); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-size: 0.8rem; font-family: inherit;
}
.theme-toggle:hover { border-color: var(--accent); }

/* country tabs */
.country-nav { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-soft) 70%, transparent); }
.country-nav ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 8px 0; flex-wrap: wrap; }
.country-nav button {
  font: inherit; font-size: 0.86rem; cursor: pointer; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 6px 14px;
  white-space: nowrap;
}
.country-nav button[aria-selected="true"] {
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; font-weight: 600;
}
html[data-theme="light"] .country-nav button[aria-selected="true"] { color: #fff; }

/* hero */
.hero { padding: clamp(26px, 5vw, 52px) 0 10px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent); }
.hero h1 {
  margin: 0 0 12px; font-size: clamp(1.75rem, 4.4vw, 3rem); line-height: 1.18;
  letter-spacing: -0.03em; overflow-wrap: anywhere;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { margin: 0; color: var(--muted); max-width: 62ch; font-size: clamp(0.95rem, 1.6vw, 1.05rem); }
.hero-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; }
.hero-stats li {
  font-size: 0.78rem; color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.hero-stats strong { color: var(--text); font-weight: 700; }

/* controls */
.controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 22px 0 12px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search input {
  width: 100%; font: inherit; font-size: 0.92rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 36px 10px 12px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: var(--bg-soft);
}
.search input:not(:placeholder-shown) ~ kbd { display: none; }
.platforms { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 100%; }
.filter-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-width: 54px; }
.platforms button {
  font: inherit; font-size: 0.8rem; cursor: pointer; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px;
}
.platforms button[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); font-weight: 600; }
html[data-theme="dark"] .platforms button[aria-pressed="true"] { color: #08101f; }
.select-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.select-wrap select {
  font: inherit; font-size: 0.82rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; max-width: 100%;
}
.result-bar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  font-size: 0.82rem; color: var(--muted); margin: 6px 2px 18px;
}
.result-bar strong { color: var(--text); }
.chip-live { display: inline-flex; align-items: center; gap: 6px; }

/* feed */
.feed { display: block; }
.group { margin: 0 0 26px; }
.group-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.group-head h2 { margin: 0; font-size: 1rem; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.flag {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 2px 6px;
}
.badge-platform {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 6px; padding: 2px 7px;
}
.group-meta { margin-left: auto; font-size: 0.74rem; color: var(--muted); font-family: var(--mono); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; min-width: 0; transition: transform 0.14s ease, border-color 0.14s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-1px); }
.card-top { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; color: var(--muted); }
.rank { font-family: var(--mono); color: var(--accent); font-weight: 600; }
.card h3 {
  margin: 0; font-size: 0.98rem; line-height: 1.4; font-weight: 650;
  letter-spacing: -0.01em; overflow-wrap: anywhere; word-break: break-word;
}
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card .extra { margin: 0; font-size: 0.8rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot {
  margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
  font-size: 0.72rem; color: var(--muted); font-family: var(--mono);
}
.card-foot .ext { color: var(--accent-2); }
.card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.group-error, .empty, .notice {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 16px; color: var(--muted); font-size: 0.86rem; background: var(--surface);
}
.notice strong { color: var(--text); }
.skeleton { height: 96px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -60% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .card { transition: none; }
}

/* source status */
.sources-panel { margin: 34px 0 10px; }
.sources-panel h2 { font-size: 1.05rem; margin: 0 0 4px; }
.sources-panel .hint { margin: 0 0 12px; color: var(--muted); font-size: 0.82rem; }
.source-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 8px; }
.source-list li {
  display: flex; align-items: center; gap: 8px; font-size: 0.8rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); min-width: 0;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--good); }
.dot.err { background: var(--bad); }
.dot.load { background: var(--warn); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.source-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.source-list .count { margin-left: auto; font-family: var(--mono); color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.source-list .count.err { color: var(--bad); }

/* about + footer */
.about { margin: 38px 0 10px; border-top: 1px solid var(--line); padding-top: 22px; }
.about h2 { font-size: 1.05rem; margin: 0 0 8px; }
.about p { color: var(--muted); font-size: 0.88rem; margin: 0 0 8px; max-width: 78ch; }
.about code { font-family: var(--mono); font-size: 0.82em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.site-footer { margin-top: 26px; border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: 0.82rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.operated { font-weight: 600; color: var(--text); }

/* legal pages */
.prose { max-width: 76ch; padding: 28px 0 10px; }
.prose h1 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); letter-spacing: -0.02em; margin: 0 0 6px; }
.prose h2 { font-size: 1.06rem; margin: 26px 0 8px; }
.prose p, .prose li { color: var(--muted); font-size: 0.94rem; }
.prose ul { padding-left: 20px; }
.prose a { color: var(--accent); }
.updated { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
.back { display: inline-block; margin: 8px 0 18px; font-size: 0.86rem; color: var(--accent); text-decoration: none; }

@media (max-width: 560px) {
  .header-inner { gap: 8px; }
  .brand small { display: none; }
  .controls { padding: 10px; }
  .platforms { width: 100%; }
  .platforms button { flex: 1 1 auto; text-align: center; }
  .cat-row { gap: 6px; }
  .filter-label { min-width: auto; }
  .card { padding: 12px; }
  .group-meta { width: 100%; margin-left: 0; }
}

@media (max-width: 430px) {
  .country-nav ul { gap: 4px; padding: 6px 0; }
  .country-nav button { padding: 5px 10px; font-size: 0.8rem; }
  .hero { padding-top: 20px; }
}
