/* KIOG Web — ダークテーマ（Figmaページ08のトークン踏襲: #1A1B1E / CTA #5865F2） */
:root {
  --bg: #1A1B1E; --bg2: #232428; --bg3: #2B2D31;
  --border: #3a3c42; --text: #F2F3F5; --sub: #949BA4;
  --cta: #5865F2; --like: #ff4d6d; --gold: #f0c674;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  font-size: 14px; padding-bottom: 64px;
}
button { font-family: inherit; }
.hidden { display: none !important; }
.loading { padding: 48px; text-align: center; color: var(--sub); }

#app { max-width: 560px; margin: 0 auto; padding: 16px 14px; }
h1 { font-size: 20px; margin: 6px 0 14px; }
h2 { font-size: 14px; color: var(--sub); margin: 20px 0 10px; font-weight: 600; }

/* ---- 下部タブ ---- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; background: var(--bg2); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar button {
  flex: 1; background: none; border: none; color: var(--sub);
  padding: 8px 0 6px; font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
#tabbar button .ico { font-size: 20px; }
#tabbar button.active { color: var(--text); }

/* ---- ログイン ---- */
.login { text-align: center; padding-top: 10vh; }
.login .logo { font-size: 34px; font-weight: 800; letter-spacing: 4px; margin-bottom: 6px; }
.login .sub { color: var(--sub); margin-bottom: 28px; }
.btn-cta {
  display: inline-block; background: var(--cta); color: #fff; border: none;
  border-radius: 10px; padding: 12px 28px; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.dev-people { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dev-people button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 10px 14px; font-size: 15px; cursor: pointer;
}
.dev-people button:hover { background: var(--bg3); }

/* ---- 人 ---- */
.avatar { border-radius: 50%; object-fit: cover; background: var(--bg3); flex: none; }
.me-card {
  background: linear-gradient(135deg, #2b2d55, var(--bg2));
  border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  display: flex; gap: 14px; align-items: center;
}
.me-card .nm { font-size: 18px; font-weight: 700; }
.me-card .ss { color: var(--sub); font-size: 12px; margin-top: 2px; }
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 8px; text-align: center;
}
.stat .v { font-size: 18px; font-weight: 700; }
.stat .k { font-size: 11px; color: var(--sub); margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge-t {
  background: rgba(240,198,116,.12); color: var(--gold);
  border: 1px solid rgba(240,198,116,.35); border-radius: 999px;
  padding: 3px 10px; font-size: 12px;
}
.person-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; cursor: pointer;
}
.person-row .nm { font-weight: 600; }
.person-row .st { color: var(--sub); font-size: 12px; margin-top: 1px; }
.person-row .likes { margin-left: auto; color: var(--like); font-size: 13px; flex: none; }

/* ---- クリップ ---- */
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.hscroll::-webkit-scrollbar { display: none; }
.clipcard { flex: none; width: 132px; cursor: pointer; }
.clipcard .th { position: relative; width: 132px; height: 176px; border-radius: 10px;
  overflow: hidden; background: var(--bg3); }
.clipcard img, .grid-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clipcard .tt { font-size: 12px; margin-top: 5px; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.grid-item { position: relative; aspect-ratio: 9/14; overflow: hidden; border-radius: 4px;
  background: var(--bg3); cursor: pointer; }
.grid-item .lk {
  position: absolute; left: 6px; bottom: 4px; font-size: 11px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.grid-item .sv { position: absolute; right: 5px; top: 4px; font-size: 12px;
  text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.dur {
  position: absolute; right: 5px; bottom: 4px; font-size: 10px; color: #fff;
  background: rgba(0,0,0,.55); border-radius: 4px; padding: 1px 5px;
}

/* ---- コレクションのフィルタ ---- */
.seg { display: flex; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.seg button { flex: 1; background: none; border: none; color: var(--sub);
  padding: 9px 0; font-size: 13px; cursor: pointer; }
.seg button.active { background: var(--cta); color: #fff; font-weight: 600; }
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chiprow::-webkit-scrollbar { display: none; }
.pchip { display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--sub); font-size: 10px;
  cursor: pointer; flex: none; width: 52px; }
.pchip .avatar { border: 2px solid transparent; }
.pchip.active { color: var(--text); }
.pchip.active .avatar { border-color: var(--cta); }
.sortrow { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.sortrow select { background: var(--bg2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 8px; font-size: 12px; }

/* ---- リールビューア ---- */
.reel {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: flex; align-items: center; justify-content: center; touch-action: none;
}
.reel video { max-width: 100%; max-height: 100%; }
.reel .close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; z-index: 3;
  background: rgba(0,0,0,.45); color: #fff; border: none; border-radius: 50%;
  width: 36px; height: 36px; font-size: 17px; cursor: pointer;
}
.reel .side {
  position: absolute; right: 10px; bottom: 120px; z-index: 3;
  display: flex; flex-direction: column; gap: 18px; align-items: center;
}
.reel .side button {
  background: none; border: none; color: #fff; font-size: 28px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,.7); filter: grayscale(1);
}
.reel .side button.on { filter: none; }
.reel .side .cnt { font-size: 12px; }
.reel .info {
  position: absolute; left: 14px; right: 70px; bottom: 26px; z-index: 3;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
.reel .info .tt { font-size: 15px; font-weight: 700; }
.reel .info .dt { font-size: 12px; color: #ccc; margin-top: 3px; }
.reel .info .pp { display: flex; gap: 6px; margin-top: 8px; }
.reel .prog { position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 3;
  background: rgba(255,255,255,.2); }
.reel .prog i { display: block; height: 100%; width: 0; background: #fff; }
.reel .heart {
  position: absolute; z-index: 4; font-size: 80px; pointer-events: none;
  animation: pop .7s ease-out forwards;
}
@keyframes pop {
  0% { transform: scale(.4); opacity: 0; }
  25% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* ---- リザルト ---- */
.res-head { background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.res-head .dt { font-size: 17px; font-weight: 700; }
.res-head .sm { color: var(--sub); font-size: 12px; margin-top: 3px; }
.award-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 6px; }
.award-row .aw { color: var(--gold); font-weight: 600; font-size: 13px; }
.award-row .who { color: var(--sub); font-size: 13px; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table td, .stat-table th { padding: 7px 6px; border-bottom: 1px solid var(--border);
  text-align: right; white-space: nowrap; }
.stat-table td:first-child, .stat-table th:first-child { text-align: left; }
.stat-table th { color: var(--sub); font-weight: 500; font-size: 11px; }
.namecell { display: flex; align-items: center; gap: 7px; }
.empty { color: var(--sub); text-align: center; padding: 32px 0; }

/* ---- 役割称号（§8.4） ---- */
.role-card {
  background: linear-gradient(135deg, rgba(240,198,116,.10), var(--bg2));
  border: 1px solid rgba(240,198,116,.35); border-radius: 16px;
  padding: 14px 16px; margin: 10px 0 14px;
}
.role-card .role-t { font-size: 20px; font-weight: 800; color: var(--gold); }
.role-card .role-tag { font-size: 13px; margin-top: 3px; }
.role-card .role-r { font-size: 12px; color: var(--sub); margin-top: 5px; }
.role-card .role-note { font-size: 10px; color: var(--sub); margin-top: 7px; opacity: .8; }
.role-mini {
  background: rgba(240,198,116,.12); color: var(--gold);
  border-radius: 999px; padding: 1px 8px; font-size: 10px;
  margin-left: 6px; vertical-align: 1px; white-space: nowrap;
}

/* ---- 再生数（§8.2） ---- */
.grid-item .vw {
  position: absolute; top: 6px; left: 6px; font-size: 11px;
  background: rgba(0,0,0,.55); border-radius: 6px; padding: 1px 6px;
}

/* ---- クリップ説明・会話全文（§8.1） ---- */
.reel .desc {
  font-size: 12px; color: #d8dadf; margin-top: 4px; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 78vw;
}
.reel .desc .more { color: var(--cta); font-weight: 600; }
.reel .lines {
  position: absolute; inset: 0; background: rgba(0,0,0,.72);
  display: flex; align-items: flex-end; z-index: 5;
}
.reel .lines.hidden { display: none; }
.reel .lines-in {
  background: var(--bg2); border-radius: 16px 16px 0 0; width: 100%;
  max-height: 62vh; overflow-y: auto; padding: 14px 16px 28px;
}
.reel .lines-head {
  font-size: 12px; color: var(--sub); margin-bottom: 10px;
  cursor: pointer; text-align: center;
}
.reel .line { font-size: 13px; line-height: 1.7; }
.reel .line b { color: var(--gold); font-weight: 600; margin-right: 6px; }
/* #23: 話者を特定できない行（ゲーム音声の可能性）は淡色で控えめに */
.reel .line.unknown { opacity: .55; }
.reel .line.unknown b { color: var(--sub); font-weight: 400; }

/* ---- レア称号のフレーズ表示（流行語・名言迷言） ---- */
.award-row .val { font-size: 15px; font-weight: 700; color: var(--gold); margin-top: 1px; }

/* #30 パスC: その日のダイジェスト（不参加者向けの読み物） */
.digest { background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.digest p { margin: 0 0 10px; font-size: 14px; line-height: 1.9; }
.digest p:last-child { margin-bottom: 0; }

/* ---- コメント（#50・モバイルファースト） ---- */
.reel .side .cmt-dc { text-decoration: none; }
.grid-item .cm {
  position: absolute; left: 6px; bottom: 6px;
  font-size: 11px; background: rgba(0,0,0,.6); border-radius: 6px;
  padding: 1px 5px;
}
.reel #reel-comments .lines-in {
  /* 入力欄がキーボードで隠れないよう、シートの下に余白を持たせる */
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  max-height: 78vh;
}
.cmt { display: flex; gap: 10px; padding: 8px 0; }
.cmt .avatar { border-radius: 50%; flex: none; }
.cmt-b { flex: 1; min-width: 0; }
.cmt-h { display: flex; align-items: center; gap: 8px; }
.cmt-h b { font-size: 12px; color: var(--gold); font-weight: 600; }
.cmt-del {
  margin-left: auto; background: none; border: 0; color: var(--sub);
  font-size: 11px; cursor: pointer; padding: 2px 4px;
}
.cmt-t { font-size: 14px; line-height: 1.6; word-break: break-word; }
.cmt-r { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.cmt-r button {
  background: var(--bg); border: 1px solid transparent; border-radius: 12px;
  padding: 2px 8px; font-size: 13px; cursor: pointer; color: var(--fg);
}
.cmt-r button.on { border-color: var(--cta); background: rgba(88,101,242,.18); }
.cmt-r button i { font-style: normal; font-size: 11px; margin-left: 4px;
  color: var(--sub); }
.cmt-form { display: flex; gap: 8px; margin-top: 12px; position: sticky;
  bottom: 0; background: var(--bg2); padding-top: 8px; }
.cmt-form input {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid #2a2a32;
  border-radius: 10px; padding: 10px 12px; color: var(--fg); font-size: 15px;
}
.cmt-form .btn-cta { padding: 10px 16px; border-radius: 10px; }
.cmt-link { display: block; margin-top: 12px; font-size: 13px; color: var(--cta);
  text-decoration: none; }

/* #51: 非公開ボタン（出演者本人にだけ出る） */
.reel .side #reel-hide .cnt { font-size: 10px; }

/* #53: 今夜のダイジェスト動画 */
.digest-video {
  width: 100%; border-radius: 12px; background: #000; display: block;
  margin: 4px 0 16px;
}

/* ---- 本棚ビュー（#54-2） ---- */
.shelf { display: grid; gap: 12px; }
.shelf-card {
  display: flex; gap: 12px; background: var(--bg2); border-radius: 12px;
  overflow: hidden; cursor: pointer;
}
.shelf-card .th { position: relative; width: 128px; flex: none; background: #000; }
.shelf-card .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf-card .th .noimg {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 28px; opacity: .5;
}
.shelf-card .th .dg, .shelf-card .th .n {
  position: absolute; font-size: 11px; background: rgba(0,0,0,.65);
  border-radius: 6px; padding: 1px 5px;
}
.shelf-card .th .dg { top: 6px; left: 6px; }
.shelf-card .th .n { bottom: 6px; right: 6px; }
.shelf-card .b { padding: 10px 12px 10px 0; min-width: 0; }
.shelf-card .dt { font-size: 13px; color: var(--gold); font-weight: 600; }
.shelf-card .pp { display: flex; gap: 2px; margin: 6px 0; }
.shelf-card .pp .avatar { border-radius: 50%; }
.shelf-card .hd {
  font-size: 12px; color: var(--sub); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- セッションページ（#54-1） ---- */
.sess-head { margin-bottom: 12px; }
.sess-head .back {
  background: none; border: 0; color: var(--sub); font-size: 13px;
  cursor: pointer; padding: 4px 0;
}
.sess-head .sm { font-size: 13px; color: var(--sub); }
.sess-head .pp { display: flex; gap: 3px; margin: 8px 0; }
.sess-head .pp .avatar { border-radius: 50%; }
.sess-head .dc { font-size: 13px; color: var(--cta); text-decoration: none; }
.quotes { display: grid; gap: 8px; }
.quote { background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
.quote.jump { cursor: pointer; }
.quote .t { font-size: 15px; line-height: 1.6; }
.quote .m { font-size: 11px; color: var(--sub); margin-top: 4px; }
.buzz { display: flex; flex-wrap: wrap; gap: 8px; }
.bz {
  background: var(--bg2); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; display: flex; align-items: baseline; gap: 6px;
}
.bz.jump { cursor: pointer; }
.bz b { color: var(--gold); }
.bz .c { font-size: 11px; color: var(--sub); }
.bz .w { font-size: 11px; color: var(--sub); }
.chapters { display: grid; gap: 4px; }
.ch { font-size: 13px; line-height: 1.7; }
.ch.jump { cursor: pointer; }
.ch .tm { color: var(--sub); font-variant-numeric: tabular-nums; margin-right: 8px; }

/* ---- 流行語年表（#55） ---- */
.shelf-nav { margin-bottom: 12px; }
.shelf-nav button {
  background: var(--bg2); border: 0; border-radius: 999px; color: var(--cta);
  font-size: 13px; padding: 8px 14px; cursor: pointer;
}
.bw-filter { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bw-filter select, .bw-filter .clr {
  background: var(--bg2); border: 1px solid #2a2a32; border-radius: 8px;
  color: var(--fg); font-size: 13px; padding: 6px 10px;
}
.bw-filter .clr { cursor: pointer; color: var(--sub); }
.bw-list { display: grid; gap: 10px; }
/* #55-6: 1エントリが単体で意味の通るカード体裁（スクショ映え） */
.bw-card {
  background: var(--bg2); border-radius: 12px; padding: 14px 16px;
  border-left: 3px solid var(--gold);
}
.bw-card[onclick] { cursor: pointer; }
.bw-card .w { font-size: 20px; font-weight: 700; color: var(--gold); }
.bw-card .q { font-size: 14px; line-height: 1.6; margin-top: 6px; }
.bw-card .m {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px;
  font-size: 11px; color: var(--sub);
}
.bw-card .m .rt { color: var(--cta); }
.bw-card .m .cl { color: var(--cta); }

/* ---- 事実カード（#56） ---- */
.fact-cards { display: grid; gap: 10px; margin-bottom: 8px; }
.fact-card {
  background: var(--bg2); border-radius: 12px; padding: 12px 14px;
}
.fact-card .fc-t { font-size: 12px; color: var(--sub); }
.fact-card .fc-v { font-size: 20px; font-weight: 700; color: var(--gold); }
.fact-card .fc-s { font-size: 11px; color: var(--sub); margin-top: 6px; }
.fc-items { display: grid; gap: 6px; margin-top: 6px; }
.fc-item {
  display: flex; align-items: baseline; gap: 8px; font-size: 15px;
}
.fc-item[onclick] { cursor: pointer; }
.fc-item .l { font-weight: 600; color: var(--gold); }
.fc-item .n { font-size: 12px; color: var(--fg); }
.fc-item .d { font-size: 11px; color: var(--sub); margin-left: auto; }
.fc-item .cl { font-size: 11px; color: var(--cta); }
