/* StarSeek — 全ページ共通の唯一の CSS
   正本: docs/DESIGN.md v4（トークンはそこから機械的に起こす。食い違ったら文書が勝つ）
   契約: docs/PRELAUNCH_GUARDS.md §1 — 幕（.viewport::after）は「覆う」だけ。
         動画要素を visibility:hidden / display:none / opacity:0 で隠さない（LSN-0239）。 */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg: #07080c;            /* Void */
  --surface-1: #0f1116;     /* Carbon */
  --surface-2: #171a21;     /* Graphite */
  --surface-3: #20242d;     /* Slate */
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --ink: #f5f6f8;           /* Snow */
  --ink-2: #b4b9c4;         /* Mist */
  --ink-3: #7c8390;         /* Fog */
  --ink-4: #4f5563;         /* Ash — 無効状態のみ */
  --accent: #4da3ff;        /* Signal Blue — 押せる・選ばれている だけ */
  --live: #ff3b30;          /* 生配信中の表示だけ */
  --player-bg: #000;
  --font-latin: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ja: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --r: 8px;
  --r-pill: 9999px;
  --hd-h: 56px;
  --row-h: 56px;
  --max: 1280px;
  --gutter: clamp(16px, 3vw, 32px);
  --t: 150ms ease;
  color-scheme: dark;
}

/* ── Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font-family: var(--font-latin), var(--font-ja);
  font-size: 15px; line-height: 1.7; letter-spacing: 0.01em;
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
}
:lang(ja) body, body:lang(ja) { font-family: var(--font-ja), var(--font-latin); }
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; line-height: 1.35; margin: 0; letter-spacing: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }

/* 言語切替: data-l の対で書く。JS が無くても JA が読める */
[data-l="en"] { display: none; }
html[lang="en"] [data-l="ja"] { display: none; }
html[lang="en"] [data-l="en"] { display: revert; }

/* ── Type roles ──────────────────────────────────────────── */
.t-caption { font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.t-label { font-size: 13px; line-height: 1.4; font-weight: 500; }
.t-body-sm { font-size: 14px; }
.t-title-sm { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.t-title { font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.t-headline { font-size: 32px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.t-page { font-size: clamp(28px, 4vw, 40px); font-weight: 600; color: var(--ink); line-height: 1.2; }

/* ── Header ──────────────────────────────────────────────── */
.hd { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
.hd__in { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); height: var(--hd-h); display: flex; align-items: center; gap: 16px; }
.brand { font-family: var(--font-latin); font-weight: 600; font-size: 18px; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.brand-tag { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { display: inline-flex; align-items: center; height: 36px; padding: 0 10px; border-radius: var(--r); font-size: 14px; color: var(--ink-2); transition: background var(--t), color var(--t); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); }
.hd__tools { display: flex; align-items: center; gap: 8px; }
.lang { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: 2px; }
.lang button { height: 26px; padding: 0 10px; border-radius: var(--r-pill); font-family: var(--font-latin); font-size: 12px; font-weight: 500; color: var(--ink-3); transition: background var(--t), color var(--t); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.menu { display: none; width: 44px; height: 44px; border-radius: var(--r); font-size: 20px; color: var(--ink); }
.menu:hover { background: var(--surface-2); }
.drawer { display: none; background: var(--bg); border-bottom: 1px solid var(--line); }
.drawer[data-open="true"] { display: block; }
.drawer ul { list-style: none; margin: 0; padding: 8px var(--gutter) 12px; }
.drawer a { display: block; padding: 12px 8px; color: var(--ink); font-size: 16px; border-radius: var(--r); }
.drawer a:hover { background: var(--surface-2); }

/* ── Buttons / Inputs / Pills / Chips ────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r); font-size: 15px; font-weight: 500; white-space: nowrap; transition: background var(--t), color var(--t), border-color var(--t); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: #fff; }
.btn--ghost { border: 1px solid var(--line-strong); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }
.input { width: 100%; height: 40px; padding: 0 16px 0 40px; border-radius: var(--r-pill); background: var(--surface-1); border: 1px solid var(--line); color: var(--ink); outline: 0; transition: border-color var(--t); }
.input::placeholder { color: var(--ink-3); }
.input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 2px var(--accent); }
.search { position: relative; }
.search::before { content: ""; position: absolute; left: 14px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; border: 2px solid var(--ink-3); box-sizing: border-box; }
.search::after { content: ""; position: absolute; left: 24px; top: 50%; width: 6px; height: 2px; margin-top: 3px; background: var(--ink-3); transform: rotate(45deg); }
.pill { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background var(--t), color var(--t); }
.pill:hover { background: var(--surface-3); color: var(--ink); }
.pill[aria-pressed="true"], .pill.is-on { background: var(--ink); color: var(--bg); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip--live { background: transparent; color: var(--live); border: 1px solid var(--live); }

/* ── Avatar（頭文字タイルが下、取れた画像が上） ────────── */
.av { position: relative; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; }
.av__i { font-family: var(--font-latin), var(--font-ja); font-weight: 600; font-size: 13px; color: var(--ink-2); letter-spacing: 0; line-height: 1; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av--24 { width: 24px; height: 24px; }
.av--24 .av__i { font-size: 10px; }
.av--48 { width: 48px; height: 48px; }
.av--48 .av__i { font-size: 17px; }
.av--64 { width: 64px; height: 64px; }
.av--64 .av__i { font-size: 22px; }

/* ── Home ────────────────────────────────────────────────── */
.home { max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter) 48px; }
.home__grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.stage { min-width: 0; }

/* 舷窓ではなく「舞台」。枠線を付けない。幕は ::after のオーバーレイで、動画要素は隠さない（G1-1） */
.viewport { position: relative; width: 100%; aspect-ratio: 16 / 9; background: var(--player-bg); border-radius: var(--r); overflow: hidden; }
.viewport iframe, .viewport #ss-player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.viewport::after { content: ""; position: absolute; inset: 0; background: var(--player-bg); opacity: 0; pointer-events: none; transition: opacity var(--t); }
.viewport[data-curtain="on"]::after { opacity: 1; }

.now { display: flex; align-items: center; gap: 12px; min-height: var(--row-h); padding: 8px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.now__state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.now__state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.now[data-state="live"] .now__state { color: var(--live); }
.now[data-state="live"] .dot { background: var(--live); }
.now[data-state="tap"] .now__state { color: var(--ink); }
.now[data-state="tap"] .dot { background: var(--ink); }
.now[data-state="error"] .now__state { color: var(--ink-3); }
.now[data-state="tuning"] .dot { background: var(--ink-4); }
.now__name { font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.now__title { flex: 1 1 160px; min-width: 0; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now__actions { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.now__official { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.now__official:hover { color: var(--ink); }
.now__msg { padding: 10px 4px 0; font-size: 13px; color: var(--ink-3); }

.info { display: flex; gap: 16px; padding: 20px 4px 0; }
.info__body { min-width: 0; flex: 1; }
.info__name { font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.info__meta { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.info__note { margin-top: 10px; font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.info__foot { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-3); }
.info__foot a { color: var(--accent); }
.info__foot a:hover { text-decoration: underline; }

/* ── Browser panel ───────────────────────────────────────── */
.browser { position: sticky; top: calc(var(--hd-h) + 16px); max-height: calc(100vh - var(--hd-h) - 32px); display: flex; flex-direction: column; min-width: 0; background: var(--surface-1); border-radius: var(--r); }
.browser__top { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.browser__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.browser__cats .pill { height: 30px; padding: 0 12px; font-size: 12.5px; }
.browser__list { overflow-y: auto; overscroll-behavior: contain; padding: 4px 6px 6px; flex: 1 1 auto; min-height: 0; }
.browser__foot { padding: 10px 14px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.browser__foot a { color: var(--accent); }
.browser__foot a:hover { text-decoration: underline; }
.browser__empty { padding: 24px 12px; font-size: 14px; color: var(--ink-3); text-align: center; }
.grp { position: sticky; top: 0; z-index: 1; background: var(--surface-1); padding: 12px 10px 4px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--row-h); padding: 6px 10px; border-radius: var(--r); text-align: left; color: var(--ink); transition: background var(--t); }
.row:hover { background: var(--surface-2); }
.row[aria-selected="true"] { background: var(--surface-3); }
.row[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; background: var(--accent); border-radius: 1px; }
.row__body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.row__name { font-size: 15px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.is-dormant .row__name { color: var(--ink-3); font-weight: 400; }
.row__tag { flex: 0 0 auto; }

/* ── Talk（中央が応答したときだけ現れる） ───────────────── */
.talk { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.talk__hd { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.talk__hd .t { font-size: 20px; font-weight: 600; color: var(--ink); }
.talk__hd .s { font-size: 13px; color: var(--ink-3); }

/* ── Page（下層） ─────────────────────────────────────────── */
.page { max-width: var(--max); margin: 0 auto; padding: 40px var(--gutter) 64px; }
.page__hd { max-width: 72ch; }
.page__hd .lead { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.page__hd .t-caption { margin-top: 8px; }
.section { margin-top: 48px; }
.section__hd { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section__hd h2 { font-size: 20px; }
.section__hd .n { font-size: 13px; color: var(--ink-3); font-family: var(--font-latin); }
.section__hd .who { font-size: 13px; color: var(--ink-3); }

/* 全チャンネル一覧（静的・JS 無しで読める） */
.filters { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.filters .search { max-width: 420px; }
.filters__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.crow { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto auto; gap: 4px 14px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.crow__av { grid-column: 1; grid-row: 1 / span 3; }
.crow__top { grid-column: 2; grid-row: 1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.crow__name { font-size: 15px; font-weight: 500; color: var(--ink); }
.crow__name:hover { text-decoration: underline; }
.crow__meta { font-size: 12px; color: var(--ink-3); }
.crow__ext { grid-column: 3; grid-row: 1 / span 3; font-size: 13px; color: var(--ink-2); white-space: nowrap; padding-top: 2px; }
.crow__ext:hover { color: var(--ink); }
.crow__why { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--ink-2); }
.crow__sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.crow__faces { grid-column: 2; grid-row: 3; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.crow__faces a { color: var(--accent); }
.crow__faces a:hover { text-decoration: underline; }
.crow.is-dormant .crow__name { color: var(--ink-3); font-weight: 400; }
.crow[hidden] { display: none; }

/* 記事一覧 */
.alist { margin-top: 8px; }
.aline { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 16px 4px; border-bottom: 1px solid var(--line); transition: background var(--t); }
.aline:hover { background: var(--surface-1); }
.aline .cat { font-size: 12px; color: var(--ink-3); }
.aline .t { font-size: 17px; font-weight: 500; color: var(--ink); line-height: 1.5; }
.aline .s { font-size: 14px; color: var(--ink-2); }

/* リンク集 */
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-top: 12px; }
.lcard { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-1); transition: background var(--t); }
.lcard:hover { background: var(--surface-2); }
.lcard__kind { font-size: 12px; color: var(--ink-3); }
.lcard__name { font-size: 15px; font-weight: 500; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; }
.lcard__name .arrow { color: var(--ink-3); font-weight: 400; }
.lcard__blurb { font-size: 13px; color: var(--ink-2); }
.lcard__note { font-size: 12px; color: var(--ink-3); }
.lcard__ch { font-size: 12px; color: var(--accent); margin-top: 4px; }

/* このサイトについて */
.doc { max-width: 72ch; }
.doc h2 { font-size: 20px; margin: 40px 0 10px; }
.doc h3 { font-size: 15px; color: var(--ink); margin: 20px 0 6px; }
.doc p { color: var(--ink-2); margin: 0 0 1em; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc ul, .doc ol { margin: 0 0 1.2em 1.2em; padding: 0; color: var(--ink-2); }
.doc li { margin-bottom: .4em; }
.doc a { color: var(--accent); }
.doc a:hover { text-decoration: underline; }
.doc dl { margin: 0 0 1.2em; }
.doc dt { font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 16px; }
.doc dd { margin: 4px 0 0; color: var(--ink-2); }
.notice { padding: 14px 16px; border-radius: var(--r); background: var(--surface-1); margin: 1.2em 0; }
.notice p { margin: 0; font-size: 14px; }

/* ── Footer ──────────────────────────────────────────────── */
.ft { border-top: 1px solid var(--line); margin-top: 48px; }
.ft__in { max-width: var(--max); margin: 0 auto; padding: 32px var(--gutter) 40px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; font-size: 13px; color: var(--ink-3); }
.ft__col { display: flex; flex-direction: column; gap: 6px; }
.ft__col .brand { font-size: 15px; }
.ft__col a { color: var(--ink-2); }
.ft__col a:hover { color: var(--ink); }
.ft__bottom { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) 32px; font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1023px) {
  .home__grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .browser { position: static; max-height: none; }
  .browser__cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .browser__cats::-webkit-scrollbar { display: none; }
  .browser__list { overflow: visible; }
  .grp { position: static; }
}
@media (max-width: 767px) {
  :root { --hd-h: 52px; }
  .brand-tag, .nav { display: none; }
  .menu { display: inline-flex; align-items: center; justify-content: center; }
  .home { padding: 0 0 40px; }
  .home__grid { gap: 0; }
  /* SP: プレーヤーはヘッダー直下に固定し、その下が縦に流れる（DESIGN.md「Player Stage」）。
     sticky は親の高さの中でしか効かないので、.stage の箱を消して .home__grid（一覧まで含む）を親にする */
  .stage { display: contents; }
  .stage__sticky { position: sticky; top: var(--hd-h); z-index: 30; background: var(--bg); }
  .viewport { border-radius: 0; }
  .now { padding: 8px var(--gutter); }
  .now__name { max-width: 55%; }
  .now__actions { width: 100%; margin-left: 0; justify-content: space-between; }
  .now__msg { padding: 8px var(--gutter) 0; }
  .info { padding: 16px var(--gutter) 0; }
  .info__note { display: none; }
  .info.is-open .info__note { display: block; }
  .info__toggle { display: inline; }
  .browser { border-radius: 0; margin-top: 16px; }
  .talk { margin: 40px var(--gutter) 0; }
  .ft__in { grid-template-columns: minmax(0, 1fr); }
  .crow { grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto auto auto; }
  .crow__av { grid-row: 1 / span 4; }
  .crow__ext { grid-column: 2; grid-row: 4; padding-top: 0; }
}
@media (min-width: 768px) { .info__toggle { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }
