/* 見た目の方向性: 「やわらかい」（パステル・丸み）。2026-10-21 中村さんが選択 */
:root {
  --bg: #fff8f1; --surface: #ffffff; --surface-2: #fdf1e8; --text: #4a2a1e; --muted: #9a7b6e; --line: #f3e3d8; --line-strong: #ead2c3;
  --accent: #e8708a; --accent-soft: #fbeaf0; --accent-text: #ffffff; --danger: #c0392b;
  --first-bg: #fbeaf0; --first-fg: #8a2d50; --first-dot: #e8708a;
  --regular-bg: #e4f5ee; --regular-fg: #0d5c47; --regular-dot: #3fb489;
  --absence-bg: #fdf0da; --absence-fg: #7a4a08; --absence-dot: #e9a23b;
  --milestone-bg: #efedfe; --milestone-fg: #3c3489; --milestone-dot: #8b82e0;
  --known-bg: #f4efe9; --known-fg: #6a5a51; --known-dot: #b9a89c;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(122, 74, 50, 0.06), 0 4px 14px rgba(122, 74, 50, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #221b18; --surface: #2c2421; --surface-2: #362c28; --text: #f6ebe4; --muted: #b8a399; --line: #3d322d; --line-strong: #4a3d37;
    --accent: #f08aa1; --accent-soft: #4a2a33; --accent-text: #2a1015;
    --first-bg: #4a2a33; --first-fg: #f8c7d6; --first-dot: #f08aa1;
    --regular-bg: #1f3a30; --regular-fg: #a8e6cc; --regular-dot: #55c99c;
    --absence-bg: #43331a; --absence-fg: #f6d39a; --absence-dot: #f0b45a;
    --milestone-bg: #2f2b4d; --milestone-fg: #cfcaf7; --milestone-dot: #a39cf0;
    --known-bg: #362c28; --known-fg: #d3c4bb; --known-dot: #8f7f75;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.5em; margin: 0; }

/* 上の帯 */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 20px; padding-top: max(12px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.brand { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd3dc, var(--accent)); }
.spacer { flex: 1; }
.status { font-size: 13px; color: var(--muted); background: var(--surface); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); }
.status:empty { display: none; }
.status.live { color: #c0392b; border-color: #f5c4c4; }
.status.live::before { content: "●"; margin-right: 6px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* タブ（丸いスイッチ） */
.tabs { position: sticky; top: 56px; z-index: 9; display: flex; gap: 4px; margin: 0 auto; width: fit-content; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.tab { background: transparent; color: var(--muted); border-radius: 999px; padding: 8px 16px; font-weight: 700; white-space: nowrap; flex: 0 0 auto; }
.tab.active { background: var(--accent); color: var(--accent-text); }

main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 16px 20px 24px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
h3 { font-size: 14px; margin: 20px 0 6px; color: var(--muted); font-weight: 700; }

/* 部品 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 380px; margin: 48px auto; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.card.row { display: flex; flex-wrap: wrap; gap: 8px; }
.card.row input { flex: 1 1 180px; }
.notice { margin-top: 12px; border-color: var(--accent); background: var(--accent-soft); }
.credential { font-size: 18px; font-weight: 700; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 11px 14px; outline: none; transition: border-color 0.15s, background 0.15s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: var(--surface); }
textarea { resize: vertical; line-height: 1.6; }
button { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 11px 20px; background: var(--accent); color: var(--accent-text); cursor: pointer; transition: transform 0.08s, background 0.15s; }
button:active { transform: scale(0.97); }
button.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
button.small { padding: 7px 14px; font-size: 14px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 4px; }
.toolbar input { flex: 1; background: var(--surface); border-color: var(--line); border-radius: 999px; padding-left: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; background: var(--surface); color: var(--muted); border: 1px solid var(--line); padding: 7px 16px; font-size: 14px; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* 数字 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 8px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.3; }
.stat:nth-child(4) .value { color: var(--first-dot); }

/* 来場アラートの一覧 */
.feed, .list, .plain { list-style: none; margin: 0; padding: 0; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop 0.25s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }
.avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 19px; background: var(--known-bg); color: var(--known-fg); }
.item.first .avatar { background: var(--first-bg); color: var(--first-fg); box-shadow: 0 0 0 3px var(--first-dot); }
.item.regular .avatar { background: var(--regular-bg); color: var(--regular-fg); }
.item.absence .avatar { background: var(--absence-bg); color: var(--absence-fg); }
.item.milestone .avatar { background: var(--milestone-bg); color: var(--milestone-fg); }
.item.first { background: linear-gradient(90deg, var(--first-bg), var(--surface) 55%); border-color: color-mix(in srgb, var(--first-dot) 35%, var(--line)); }
.item.milestone { background: linear-gradient(90deg, var(--milestone-bg), var(--surface) 55%); }
.who { flex: 1; min-width: 0; text-align: left; background: transparent; color: var(--text); padding: 0; font-weight: 400; border-radius: 10px; }
.who:active { transform: none; }
.name { font-weight: 700; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-size: 13px; color: var(--muted); }
.memo { font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface-2); border-radius: 8px; padding: 2px 10px; width: fit-content; max-width: 100%; }
.memo::before { content: "メモ  "; color: var(--muted); font-size: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 38%; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--known-bg); color: var(--known-fg); white-space: nowrap; }
.tag.first { background: var(--first-bg); color: var(--first-fg); }
.tag.regular { background: var(--regular-bg); color: var(--regular-fg); }
.tag.absence { background: var(--absence-bg); color: var(--absence-fg); }
.tag.milestone { background: var(--milestone-bg); color: var(--milestone-fg); }
.tag.visit-no { font-size: 14px; padding: 4px 12px; }
.tag.fc { background: var(--regular-bg); color: var(--regular-fg); }
/* つながりの表示・画面オン */
.conn-banner { position: sticky; top: 56px; z-index: 10; margin: 0 auto 8px; max-width: 900px; padding: 10px 16px; border-radius: 14px; background: #ffe0dc; color: #a3271a; font-weight: 700; font-size: 14px; text-align: center; }
@media (prefers-color-scheme: dark) { .conn-banner { background: #4d2420; color: #ffb3a8; } }
.wake-state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--regular-bg); color: var(--regular-fg); margin-right: 8px; }
/* ホーム画面に置く・通知の案内 */
.setup-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.setup-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.setup-row.compact { padding: 8px 14px; box-shadow: none; }
.setup-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.person-delete { flex-wrap: wrap; align-items: center; }
.person-delete input { flex: 1 1 220px; }
/* 管理の目安 */
.admin-health { margin-bottom: 14px; }
.admin-health li.warn { color: #a3271a; font-weight: 700; }
/* はじめに・データ */
.consent-card { max-width: 720px; margin: 12px auto; }
.consent-card ul li, .settings-card ul li { margin: 6px 0; }
.card-danger { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
/* 切り抜き */
.section-title { font-size: 16px; margin: 22px 0 10px; }
.clip-step { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.clip-step-title { font-weight: 700; font-size: 17px; }
.clip-hint { font-weight: 700; }
.clip-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.thumb-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumb { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; background: var(--surface-2); color: var(--text); border-radius: 12px; border: 2px solid transparent; }
.thumb:hover { border-color: var(--accent); }
.thumb img { width: 96px; height: auto; border-radius: 8px; display: block; background: #000; min-height: 60px; }
.thumb span { font-size: 12px; }
.people-pick { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pick { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.clip-video { width: 100%; max-height: 60vh; border-radius: 14px; background: #000; }
/* 動画編集の AI（2026-11-03） */
.clip-ai-steps { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.clip-ai-steps li.done { color: var(--text, inherit); }
.clip-ai-steps li.now { color: var(--accent, #d66b8a); font-weight: 700; }
.clip-assist { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.clip-assist-text { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.clip-step-sub { font-weight: 700; font-size: 13px; }
.clip-ai-title { font-weight: 700; font-size: 16px; }
.clip-redo { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.clip-step textarea { width: 100%; font: inherit; }
progress { width: 100%; height: 12px; accent-color: var(--accent); }
a.button-link { display: inline-block; text-decoration: none; font-weight: 700; border-radius: 999px; padding: 7px 14px; font-size: 14px; background: var(--accent); color: var(--accent-text); }
/* テンプレート */
.templates-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.templates-head p { margin: 0; }
.template-item .who { cursor: default; }
.template-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.template-form { display: flex; flex-direction: column; gap: 12px; }
.template-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
button.danger { color: #a3271a; border-color: #e7b3ab; }
.quick-templates { margin-bottom: 8px; }
.reader { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; border: 0; padding: 0; background: var(--bg); color: var(--text); }
.reader[open] { display: flex; flex-direction: column; }
.reader-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.reader-title { font-weight: 700; font-size: 18px; }
.reader-tools { display: flex; gap: 8px; }
.reader-body { flex: 1; overflow-y: auto; padding: 28px clamp(18px, 5vw, 64px); white-space: pre-wrap; line-height: 1.7; font-weight: 700; }
/* アイテム */
.item-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-chip { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--milestone-bg); color: var(--milestone-fg); white-space: nowrap; }
.item-chip.gloves { background: var(--first-bg); color: var(--first-fg); }
.item-chip.unknown { background: var(--known-bg); color: var(--known-fg); border: 1px dashed currentColor; }
.tag.here-today { background: var(--regular-bg); color: var(--regular-fg); }
.tag.remain { font-size: 13px; }
.tag.remain.mid { background: #fff1d6; color: #8a5300; }
.tag.remain.soon { background: #ffe0dc; color: #a3271a; }
@media (prefers-color-scheme: dark) { .tag.remain.mid { background: #4a3814; color: #ffd28a; } .tag.remain.soon { background: #4d2420; color: #ffb3a8; } }
.chips-label { align-self: center; margin-right: 2px; }
.item time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.greet { flex: none; background: var(--accent-soft); color: var(--first-fg); font-size: 13px; padding: 8px 14px; }
.greet.done { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.item.compact { padding: 6px 14px; margin-left: 58px; box-shadow: none; }
.item.compact .avatar { display: none; }
.item.compact .name { font-size: 15px; }
.item.compact .meta, .item.compact .memo { display: none; }

.more-row { display: flex; justify-content: center; margin: 14px 0; }

/* 前回からの日数の色分け */
.gap-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.gap { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.gap.g1 { background: #e4f5ee; color: #0d5c47; }
.gap.g2 { background: #e3eefc; color: #1b4f8f; }
.gap.g3 { background: #fdf0da; color: #7a4a08; }
.gap.g4 { background: #fde3d3; color: #8a3612; }
.gap.g5 { background: #efebe7; color: #6a5a51; }
@media (prefers-color-scheme: dark) {
  .gap.g1 { background: #1f3a30; color: #a8e6cc; }
  .gap.g2 { background: #1e2f47; color: #b5d0f5; }
  .gap.g3 { background: #43331a; color: #f6d39a; }
  .gap.g4 { background: #4a2a1c; color: #f6bf9f; }
  .gap.g5 { background: #362c28; color: #d3c4bb; }
}

/* 初見バトルモード */
.battle-bar { margin-top: 8px; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.battle-bar.active { background: linear-gradient(90deg, var(--milestone-bg), var(--first-bg)); border-color: var(--line-strong); }
.battle-title { font-weight: 700; font-size: 16px; }
.battle-score { display: flex; align-items: baseline; gap: 12px; margin-top: 4px; font-weight: 700; }
.battle-score .own { font-size: 24px; color: var(--first-fg); }
.battle-score .vs { color: var(--muted); }
.battle-score .rival { font-size: 18px; color: var(--muted); }
.presence-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pill { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.pill.here, .presence.here { background: var(--regular-bg); color: var(--regular-fg); }
.pill.maybe, .presence.maybe { background: var(--absence-bg); color: var(--absence-fg); }
.pill.away, .presence.away { background: var(--known-bg); color: var(--known-fg); }
.presence { flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.presence.here::before { content: "● "; }
.presence.maybe::before { content: "◐ "; }
.presence.away::before { content: "○ "; }
.item.faded { opacity: 0.6; }
#battleTabs .chip::after, #battleFanclubTabs .chip::after { content: attr(data-count); margin-left: 6px; font-size: 12px; opacity: 0.8; }

/* タップ企画 */
.tap-head { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.tap-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tap-name { font-size: 20px; font-weight: 700; }
.tap-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); }
.tap-day-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tap-day { font-weight: 700; }
.tap-stats { grid-template-columns: 1fr 1fr; margin-top: 0; }
.tap-stats .stat { box-shadow: none; background: var(--surface-2); border: 0; }
.tap-item { align-items: center; }
.tap-rank { flex: none; width: 26px; text-align: center; font-weight: 700; color: var(--muted); }
.tap-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; max-width: 360px; }
.tap-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.tap-bar span { background: var(--known-dot); }
.tap-item.over .tap-bar span { background: var(--absence-dot); }
.tap-num { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tap-estimate { font-size: 22px; font-weight: 700; }
.tap-status.over { background: var(--absence-bg); color: var(--absence-fg); }
.tap-ref { font-size: 12px; color: var(--muted); font-weight: 700; }
.tap-estimate { color: var(--muted); }
.tap-note { margin-top: 12px; }
.tap-item.over { border-color: color-mix(in srgb, var(--absence-dot) 45%, var(--line)); }
button:disabled { opacity: 0.4; cursor: default; }

/* 視聴者一覧 */
.list { display: flex; flex-direction: column; gap: 8px; }
.row-btn { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; font-weight: 400; box-shadow: var(--shadow); }
.row-btn:active { transform: scale(0.99); }
.row-btn .avatar { width: 40px; height: 40px; font-size: 16px; }
.chev { color: var(--muted); font-size: 22px; }

/* 視聴者カード */
.sheet { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 0; border-radius: 24px; padding: 22px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(74, 42, 30, 0.25); }
.sheet::backdrop { background: rgba(74, 42, 30, 0.35); backdrop-filter: blur(2px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-head .avatar { width: 56px; height: 56px; font-size: 24px; background: var(--first-bg); color: var(--first-fg); }
.sheet-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.card-name { font-size: 22px; font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.mini { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.mini .label { font-size: 12px; color: var(--muted); font-weight: 700; }
.mini .value { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.greet-row { margin-bottom: 14px; }
.greet-row button { width: 100%; background: var(--accent); color: var(--accent-text); }
.greet-row button.done { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.memo-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; }
.plain li { padding: 8px 2px; border-bottom: 1px dashed var(--line-strong); font-size: 14px; }
.plain li:last-child { border-bottom: 0; }

/* 設定 */
.settings-card { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.settings-card h2 { margin: 0; }
.settings-card p { margin: 0; }
.tiktok-status { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 700; }
.tiktok-status.linked { background: var(--regular-bg); color: var(--regular-fg); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
label.check input { width: 20px; height: 20px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 管理 */
.table { width: 100%; margin-top: 12px; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.table tr:last-child td { border-bottom: 0; }
.table th { color: var(--muted); font-weight: 700; font-size: 13px; background: var(--surface-2); }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }

@media (max-width: 640px) {
  main { padding: 12px 14px 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat .value { font-size: 22px; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .item { flex-wrap: wrap; }
  .tags { max-width: 100%; justify-content: flex-start; order: 3; width: 100%; padding-left: 58px; }
  .item.compact { margin-left: 24px; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
}

/* ---------- 第2層のメニュー（2026-11-01） ---------- */
.subtabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px auto 0; padding: 0 12px; }
.subtab { background: var(--surface); color: var(--muted); border: 1px solid var(--line); padding: 6px 16px; font-size: 14px; }
.subtab.active { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

/* ---------- 画面の並び: 広い画面では右側に視聴者欄 ---------- */
.layout { flex: 1; width: 100%; display: flex; justify-content: center; align-items: flex-start; gap: 16px; }
.layout > main { flex: 1 1 auto; min-width: 0; margin: 0; }
.viewer-panel { flex: 0 0 340px; position: sticky; top: 118px; max-height: calc(100vh - 130px); overflow-y: auto; padding: 16px 16px 24px; margin: 16px 16px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel-title { font-size: 18px; margin: 0; }
.viewer-panel .chips { flex-wrap: wrap; padding: 10px 0; }
.viewer-panel .chip { padding: 5px 12px; font-size: 13px; }
.viewer-panel .gap-legend { display: none; }
.list.compact { gap: 6px; }
.list.compact .row-btn { padding: 8px 10px; gap: 8px; box-shadow: none; flex-wrap: wrap; }
.list.compact .row-btn .avatar { width: 34px; height: 34px; font-size: 14px; }
.list.compact .name { font-size: 16px; }
.list.compact .gap { font-size: 11px; padding: 2px 8px; margin-left: 42px; }
.list.compact .who { flex: 1 1 calc(100% - 50px); }
.list.compact .chev { display: none; }
@media (min-width: 1000px) { .panel-close { display: none; } }
/* 狭い画面: 右下のボタンで、右からかぶせて開く */
@media (max-width: 999px) {
  .viewer-panel { position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; margin: 0; width: min(92vw, 380px); max-height: none; border-radius: var(--radius) 0 0 var(--radius); padding-top: max(16px, env(safe-area-inset-top)); box-shadow: -8px 0 30px rgba(74, 42, 30, 0.18); }
}
.viewer-panel-btn { position: fixed; z-index: 20; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); box-shadow: 0 6px 18px rgba(74, 42, 30, 0.22); }

/* ---------- アイテムごとの表示 ---------- */
.items-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.items-head .chips { padding: 10px 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.item-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; min-width: 0; }
.item-box-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; background: transparent; color: var(--text); text-align: left; border: 0; border-radius: 8px; cursor: pointer; min-height: 44px; }
.item-box-head:active { transform: none; }
.item-box-head[aria-expanded="true"] { padding-bottom: 10px; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 8px; }
.item-box-chev { flex: none; width: 10px; height: 10px; margin: 0 4px 0 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.item-box-head[aria-expanded="true"] .item-box-chev { transform: rotate(225deg) translate(-2px, -2px); }
.item-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: contain; }
.item-icon.blank { display: inline-flex; align-items: center; justify-content: center; background: var(--milestone-bg); color: var(--milestone-fg); font-weight: 700; }
.item-box-name { flex: 1; font-weight: 700; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-box-total { font-weight: 700; color: var(--muted); }
.holders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.holder { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.holder:last-child { border-bottom: 0; }
.holder-name { min-width: 0; text-align: left; background: transparent; color: var(--text); padding: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px; }
.holder-name:active { transform: none; }
.holder-count { font-weight: 700; font-size: 17px; }
.holder-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.holder-edit { padding: 3px 10px; font-size: 13px; justify-self: end; }
.tag.manual { background: var(--absence-bg); color: var(--absence-fg); }
.empty-holders { margin: 6px 0 0; }

/* ---------- 手で入れる小窓 ---------- */
.item-form { display: flex; flex-direction: column; gap: 12px; }
.item-form select, .item-form input[type=search] { width: 100%; }
.item-kinds { border: 0; padding: 0; margin: 0; }
.item-kinds legend { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.item-kind-row { display: flex; flex-wrap: wrap; gap: 8px; }
.item-kind { flex-direction: row; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); font-weight: 700; cursor: pointer; }
.item-kind input { position: absolute; opacity: 0; pointer-events: none; }
.item-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.item-kind .item-icon { width: 32px; height: 32px; border-radius: 8px; }
.item-form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.item-form-row label { flex: 1 1 140px; }
.remain-inputs { display: flex; gap: 6px; }
.remain-inputs select { flex: 1; min-width: 0; }

/* ---------- アクション（2026-11-01） ---------- */
.actions-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; }
.act-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.act-chip { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--known-bg); color: var(--known-fg); white-space: nowrap; }
.act-chip.comment { background: #e3eefc; color: #1b4f8f; }
.act-chip.like { background: var(--first-bg); color: var(--first-fg); }
.act-chip.gift { background: var(--absence-bg); color: var(--absence-fg); }
.act-chip.follow { background: var(--regular-bg); color: var(--regular-fg); }
.act-chip.share { background: var(--milestone-bg); color: var(--milestone-fg); }
@media (prefers-color-scheme: dark) { .act-chip.comment { background: #1e2f47; color: #b5d0f5; } }

/* ---------- アイコン（2026-11-01） ---------- */
.avatar { position: relative; overflow: hidden; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: var(--surface); }
.avatar.card-avatar { width: 64px; height: 64px; font-size: 24px; }
.profile-link { display: inline-block; margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--accent); text-decoration: none; }

/* ---------- ギフトの音（2026-11-01） ---------- */
.sound-btn.on { background: var(--regular-bg); color: var(--regular-fg); border-color: var(--regular-dot); }
.sound-btn.wait { background: var(--absence-bg); color: var(--absence-fg); border-color: var(--absence-dot); }
.sound-head { display: flex; flex-direction: column; gap: 12px; }
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sound-row > button { flex: none; }
.sound-title { font-weight: 700; font-size: 17px; }
.sound-vol { flex-direction: row; align-items: center; gap: 10px; }
.sound-vol input { flex: 1; max-width: 320px; padding: 0; background: transparent; }
.sound-specials { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.special-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.special-name { font-weight: 700; }
.sound-specials, #soundsView .toolbar { margin-bottom: 4px; }
#soundsView .toolbar { margin-top: 14px; }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gift-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 400; box-shadow: var(--shadow); min-width: 0; }
.gift-card.has-sound { border-color: var(--accent); background: var(--accent-soft); }
.gift-icon { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; }
.gift-icon img { width: 100%; height: 100%; object-fit: contain; }
.gift-icon.heart { color: var(--accent); }
.gift-name { font-weight: 700; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-dia { font-size: 12px; color: var(--muted); }
.gift-sound { font-size: 12px; font-weight: 700; color: var(--muted); }
.gift-card.has-sound .gift-sound { color: var(--accent); }
.sound-choices { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.sound-choices li { display: flex; gap: 8px; align-items: center; }
.sound-choice { flex: 1; display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px; font-weight: 700; }
.sound-choice.current { background: var(--accent); color: var(--accent-text); }
.sound-choice.current .muted { color: inherit; }
.sound-try { flex: none; }
.gift-en { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -3px; }

/* ---------- 模擬レビューを受けた見直し（2026-11-01） ---------- */
/* 記録の状態（いつも小さく出す） */
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rec-state { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.rec-state.ok { background: #e6f4ea; color: #2e6b3f; }
.rec-state.warn { background: #fff1d6; color: #8a5a00; }
@media (prefers-color-scheme: dark) { .rec-state.ok { background: #1f3a29; color: #a8dcb6; } .rec-state.warn { background: #4a3814; color: #ffd28a; } }
/* 横に並ぶ小さなボタンの列: 見出しの文字を縦に折らない（スマホで大きな丸になるのを防ぐ） */
.chips { align-items: center; }
.chip, .chips-label { flex: none; white-space: nowrap; }
.topbar button, .topbar select { flex: none; white-space: nowrap; }
.holder-edit { padding: 3px 12px; }
.item-edit-who { font-weight: 700; margin: 0 0 8px; }
/* スマホ: 上の段を1行に（題名は丸いマークだけ、@ハンドルと説明は省く） */
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand-text { display: none; }
  .status { min-width: 0; overflow: hidden; padding: 3px 10px; }
  .status-handle, .rec-note { display: none; }
  .topbar .small { padding: 5px 10px; }
  .tabs { top: 48px; }
  main { padding-bottom: 88px; }   /* 右下の「リスナー」ボタンに、いちばん下の行が隠れないように */
}
.wake-state { flex: none; white-space: nowrap; }

/* ---------- 本物の配信での再評価を受けた見直し（2026-11-01 夜） ---------- */
/* ホーム画面の案内などを1行に */
.setup-row.one-line { flex-wrap: wrap; padding: 8px 14px; box-shadow: none; }
.setup-row.one-line .setup-text { flex: 1 1 200px; font-size: 14px; font-weight: 700; }
.setup-row.one-line .setup-actions button { white-space: nowrap; }
.setup-how { flex-basis: 100%; }
/* バトルのチーム（相手の名前・点数・順位） */
.battle-teams { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.battle-teams li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; align-items: baseline; gap: 8px; font-size: 15px; }
.battle-teams li.own { font-weight: 700; color: var(--accent-strong, #b0475f); font-size: 18px; }
.team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-rank { color: var(--muted); font-size: 13px; }
.team-score { font-variant-numeric: tabular-nums; }
.battle-bar .ghost.small { margin-top: 8px; }
/* 今日のバトル */
.battles-list { display: grid; gap: 12px; }
.battle-card { padding: 14px 16px; }
.battle-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.battle-card h4 { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.supporters { margin: 0; padding-left: 1.6em; display: grid; gap: 4px; }
.supporters li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.link-btn { background: transparent; color: var(--text); padding: 0; font-weight: 700; border: 0; text-align: left; }
/* 長い見出しを折り返さない（タブレットの「このバトルでアクションしたリスナー」） */
.actions-stats .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
/* 右下のリスナーボタン: スマホでは小さな丸に */
.vp-icon { display: none; }
@media (max-width: 640px) {
  .viewer-panel-btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
  .viewer-panel-btn .vp-label { display: none; }
  .viewer-panel-btn .vp-icon { display: inline; font-size: 22px; }
  main { padding-bottom: 72px; }
}

/* 2026-11-02 みおさんの要望: 入室の経路・ギフターレベル・海外かも・イベント・ランキング */
.tag.enter { background: #e3eefc; color: #1b4f8f; }
.tag.enter.rec { background: #fdf0da; color: #7a4a08; }
.tag.enter.share { background: #e4f5ee; color: #0d5c47; }
.tag.enter.follow { background: var(--first-bg); color: var(--first-fg); }
.tag.gifter { background: #efe7fb; color: #5b3a8f; }
.tag.gifter.high { background: #5b3a8f; color: #fff; }
.tag.gifter-up { background: #ffe0dc; color: #a3271a; }
.gifter-box { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.gifter-up-note { font-size: 11px; font-weight: 700; color: #a3271a; white-space: nowrap; }
.tag.foreign { background: #efebe7; color: #6a5a51; border: 1px dashed currentColor; }
.tag.region-pending { background: transparent; color: var(--muted, #8a7f78); border: 1px dotted currentColor; }   /* 地域を調べている途中（2026-11-04） */
@media (prefers-color-scheme: dark) {
  .tag.enter { background: #1e2f47; color: #b5d0f5; }
  .tag.enter.rec { background: #43331a; color: #f6d39a; }
  .tag.enter.share { background: #1f3a30; color: #a8e6cc; }
  .tag.gifter { background: #2f2b4d; color: #cfcaf7; }
  .tag.gifter.high { background: #8b82e0; color: #1a1530; }
  .tag.gifter-up { background: #4a2a1c; color: #f6bf9f; }
  .gifter-up-note { color: #f6bf9f; }
  .tag.foreign { background: #362c28; color: #d3c4bb; }
}
.chip.toggle.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.enter-summary { margin: 12px 0 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
/* アクセス経路（ホームの上。2026-11-03 中村さん「もっと目立つように」） */
.access-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.access-title { font-size: 16px; font-weight: 800; }
.access-more { margin-left: auto; }
.access-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin: 10px 0 8px; background: var(--line); }
.access-bar > span { display: block; height: 100%; }
.access-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.access-item { display: inline-flex; align-items: center; gap: 6px; }
.access-item b { font-size: 15px; }
.enter-note { margin-left: 4px; }
.battle-hidden { margin-top: 6px; color: var(--muted); }

.event-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 14px 0 0; }
.event-mini { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow); }
.event-mini.official { border-left: 5px solid var(--accent); }
.event-mini.original { border-left: 5px solid var(--regular-dot); }
.event-mini.done { opacity: 0.75; }
.event-mini-name { font-size: 12px; color: var(--muted); font-weight: 700; }
.event-mini-main { font-size: 15px; font-weight: 700; }
.lap-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.lap-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.events-list { display: flex; flex-direction: column; gap: 14px; }
.event-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.event-name { font-size: 18px; font-weight: 700; }
.event-gifts, .gift-chosen { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.gift-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 2px 10px 2px 4px; border-radius: 999px; background: var(--surface-2); }
.gift-pill .gift-icon img { border-radius: 50%; }
.gift-pill button { padding: 0 6px; min-height: 0; }
.event-big { display: flex; align-items: baseline; gap: 6px; }
.event-count { font-size: 40px; font-weight: 700; line-height: 1.1; }
.event-headline { font-weight: 700; margin: 4px 0; }
.event-adjust { margin-top: 10px; }
.event-history { margin-top: 10px; font-size: 14px; }
.event-people li { flex-wrap: wrap; }
.act-chip.reached { background: var(--regular-bg); color: var(--regular-fg); }
.event-form { display: flex; flex-direction: column; gap: 12px; }
.event-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
.event-form label.check { flex-direction: row; align-items: center; font-weight: 400; }
.official-pick { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.official-pick > span { font-size: 14px; font-weight: 700; }
.official-pick p { margin: 0; font-weight: 400; }
/* 公式イベントの選び（自前の選び欄。2026-11-05 中村さん「プルダウンは自前の、質の高いものに」） */
.ev-pick-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; text-align: left; background: var(--surface); color: var(--text); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); font: inherit; min-height: 56px; }
.ev-pick-btn[aria-expanded="true"] { border-color: var(--accent); }
.ev-pick-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ev-pick-name { font-weight: 700; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.ev-pick-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
.ev-pick-chev { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.ev-pick-btn[aria-expanded="true"] .ev-pick-chev { transform: rotate(225deg) translate(-2px, -2px); }
.ev-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; padding: 8px; background: var(--surface-2); border-radius: var(--radius-sm); overscroll-behavior: contain; }
.ev-pick-head { font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 4px 0; }
.ev-pick-item { position: relative; display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 12px; text-align: left; background: var(--surface); color: var(--text); border: 1.5px solid transparent; border-radius: 10px; font: inherit; }
.ev-pick-item .tag { position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 2px 8px; background: var(--regular-bg); color: var(--regular-fg); }
.ev-pick-item:has(.tag) .ev-pick-name { padding-right: 70px; }
.ev-pick-item.on { border-color: var(--accent); background: var(--accent-soft); }
.official-classes { display: flex; flex-direction: column; gap: 10px; }
.om-title { font-size: 13px; font-weight: 700; color: var(--text); margin: 2px 0 6px; }
.om-hint { margin: 0; padding: 10px 12px; font-size: 13px; background: var(--absence-bg); color: var(--absence-fg); border-radius: 10px; }
.class-cards, .om-group { display: flex; flex-direction: column; gap: 6px; }
.om-list { display: flex; flex-direction: column; gap: 14px; }
.class-card, .om-card { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 11px 12px; text-align: left; background: var(--surface); color: var(--text); border: 1.5px solid var(--line-strong); border-radius: 12px; font: inherit; font-weight: 400; }
.class-card.on, .om-card.on { border-color: var(--accent); background: var(--accent-soft); }
.om-card:disabled { opacity: .5; }
.om-check { flex: none; width: 20px; height: 20px; margin-top: 1px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); position: relative; }
.om-check.box { border-radius: 6px; }
.on > .om-check { border-color: var(--accent); background: var(--accent); }
.on > .om-check::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--accent-text); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.class-body, .om-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.class-name { font-weight: 700; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.class-guess { font-size: 11px; color: var(--muted); }
.class-sum, .om-meta { font-size: 12.5px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.om-text { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.om-ng summary { font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 4px 2px; }
.om-ng-item { display: flex; flex-direction: column; gap: 1px; padding: 6px 4px; font-size: 13px; border-top: 1px dashed var(--line); }
.om-multi { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.om-multi-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border-radius: 10px; }
.event-form.multi .single-only { display: none !important; }
.official-url summary { font-weight: 400; font-size: 13px; color: var(--muted, #888); cursor: pointer; }
.official-url-row { display: flex; gap: 6px; margin-top: 6px; }
.official-url-row input { flex: 1; min-width: 0; }
.event-kind { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.gift-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.gift-picks-note { grid-column: 1 / -1; }
.gift-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; background: var(--surface-2); color: var(--text); border: 2px solid transparent; border-radius: var(--radius-sm); font-size: 12px; }
.gift-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.gift-pick .gift-name { font-weight: 700; text-align: center; word-break: break-all; }
.gift-pick .gift-dia { color: var(--muted); }
.rank-custom { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; }
.rank-value { font-weight: 700; white-space: nowrap; }
.rank-stats { margin-top: 4px; grid-template-columns: repeat(2, 1fr); }

/* 入口の分析（2026-11-03） */
.ent-card { margin-top: 12px; }
.ent-charts { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; }
@media (max-width: 640px) { .ent-charts { grid-template-columns: 1fr; } }
.ent-pie-box { position: relative; width: 200px; height: 200px; margin: 0 auto; }
.ent-pie { width: 200px; height: 200px; }
.ent-seg { cursor: pointer; transition: stroke-width .15s; }
.ent-pie-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.ent-pie-num { font-size: 22px; font-weight: 700; }
.ent-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ent-bar-row { width: 100%; display: grid; grid-template-columns: 11em 1fr 7.5em; gap: 8px; align-items: center; background: transparent; color: var(--text); padding: 4px 6px; border-radius: var(--radius-sm); text-align: left; }
.ent-bar-row.on, .ent-bar-row:hover { background: var(--surface-2); }
.ent-bar-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ent-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ent-bar-track { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.ent-bar-fill { display: block; height: 100%; border-radius: 999px; }
.ent-bar-num { font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap; }
.ent-h { margin: 16px 0 8px; }
.ent-stack { display: flex; flex-direction: column; gap: 6px; }
.ent-stack-row { display: grid; grid-template-columns: 8.5em 1fr 4.5em; gap: 8px; align-items: center; font-size: 13px; }
.ent-stack-track { height: 16px; }
.ent-stack-bar { display: flex; height: 100%; border-radius: 6px; overflow: hidden; }
.ent-stack-seg { display: block; height: 100%; }
/* スマホ: 名前と人数を1行目、棒を2行目に（長い名前が切れないように。2026-11-03） */
@media (max-width: 640px) { .ent-bar-row { grid-template-columns: 1fr auto; grid-template-areas: 'label num' 'track track'; row-gap: 4px; } .ent-bar-row .ent-bar-label { grid-area: label; } .ent-bar-row .ent-bar-num { grid-area: num; } .ent-bar-row .ent-bar-track { grid-area: track; } .ent-stack-row { grid-template-columns: 6.5em 1fr 3.5em; } }

/* アイテム: リスナーのアイコンと、札のアイテムのアイコン（2026-11-03） */
.holder { grid-template-columns: 32px minmax(0, 1fr) auto; }
.holder .avatar { width: 32px; height: 32px; font-size: 13px; grid-row: span 2; align-self: center; }
.item-chip { display: inline-flex; align-items: center; gap: 4px; }
.item-chip .item-icon { width: 20px; height: 20px; border-radius: 4px; }
.item-chip .item-icon.blank { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }

/* 入口の分析の「← 戻る」（2026-11-03） */
.back-row { margin: 0 0 10px; }

/* 説明の吹き出し（2026-11-03 中村さん。パソコンはカーソル、スマホ・タブレットはタップ） */
.help-term { display: inline-flex; align-items: center; gap: 5px; }
.help-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 「?」は押しやすい大きさに（見た目は小さく、押せる範囲は広く） */
.help-mark { position: relative; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; font-size: 11px; font-weight: 800; line-height: 1; background: var(--line-strong); color: var(--text); cursor: pointer; }
.help-mark::before { content: ''; position: absolute; inset: -8px; }
.help-mark:hover { background: var(--accent); color: var(--accent-text); }
.help-tip { position: fixed; z-index: 1000; max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 12px; background: var(--text); color: var(--surface); font-size: 13px; line-height: 1.6; white-space: pre-line; box-shadow: 0 6px 20px rgba(0,0,0,.18); pointer-events: auto; }
.help-tip::after { content: ''; position: absolute; left: calc(var(--arrow-x, 50%) - 6px); border: 6px solid transparent; }
.help-tip.above::after { top: 100%; border-top-color: var(--text); }
.help-tip.below::after { bottom: 100%; border-bottom-color: var(--text); }

/* 開発中の画面のお知らせ（2026-11-03） */
.dev-note { background: #fff4d6; color: #7a5b00; border: 1px solid #f0d58a; font-size: 14px; font-weight: 700; margin-bottom: 12px; }
/* いちばん上のメニューが6つになったので、スマホの幅では3つずつ2段に（横に隠れないように。2026-11-03） */
@media (max-width: 560px) {
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: calc(100vw - 24px); border-radius: 18px; gap: 3px; }
  .tab { padding: 7px 4px; text-align: center; border-radius: 12px; }
}

/* モデレーター（2026-11-04）: 配信者さん本人だけのもの（設定・リスナーの記録の削除）は出さない。サーバーでも止めている */
body.role-moderator #settingsTab, body.role-moderator .card-danger { display: none !important; }
.mod-login { margin-top: 18px; line-height: 1.9; }
#modInviteForm input { flex: 1; min-width: 0; }
.mod-link { word-break: break-all; user-select: all; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; }

/* バトルの勝ち負けのバーと、貢献の上位5人（2026-11-04 中村さん「実際の配信のバトル画面みたいに」）。自分はピンク・相手は青 */
:root { --vs-own: #ec5f86; --vs-rival: #4d8bf0; --vs-c2: #22a874; --vs-c3: #f08a24; --vs-c4: #9a9aa2; --vs-text: #ffffff; }
@media (prefers-color-scheme: dark) { :root { --vs-own: #e0577d; --vs-rival: #3f7be0; --vs-c2: #1f9a6a; --vs-c3: #e07d1c; --vs-c4: #84848c; } }
.vs-bar { margin-top: 10px; }
.vs-names { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; }
.vs-own { color: var(--vs-own); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-rival { color: var(--vs-rival); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.vs-track { display: flex; height: 28px; border-radius: 999px; overflow: hidden; margin-top: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04); }
.vs-fill { display: flex; align-items: center; font-size: 14px; font-weight: 700; color: var(--vs-text); white-space: nowrap; transition: width 0.6s ease; min-width: 0; }
.vs-fill.own { background: linear-gradient(90deg, #ff8fb0, var(--vs-own)); justify-content: flex-start; padding-left: 12px; }
.vs-fill.rival { background: linear-gradient(90deg, var(--vs-rival), #8db8ff); justify-content: flex-end; padding-right: 12px; }
.battle-contrib-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.top5 { display: grid; grid-template-columns: repeat(5, minmax(0, 62px)); gap: 6px; margin: 0; padding: 0; list-style: none; flex: 1 1 320px; max-width: 360px; }
@media (max-width: 480px) { .top5 { grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: none; flex-basis: 100%; } .top5-who .avatar { width: 36px; height: 36px; } }
.top5-who { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; padding: 4px 2px; background: transparent; border-radius: 12px; color: var(--text); font-weight: 400; position: relative; }
.top5-who .avatar { width: 40px; height: 40px; font-size: 16px; box-shadow: 0 0 0 2px var(--vs-own); }
.top5-rank { position: absolute; top: 0; left: 6px; z-index: 1; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; line-height: 18px; font-weight: 700; text-align: center; color: #fff; background: #b9a89c; }
.top5-rank.r1 { background: #e9a23b; } .top5-rank.r2 { background: #9aa7b8; } .top5-rank.r3 { background: #c27b4a; }
.top5-name { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top5-pts { font-size: 12px; font-weight: 700; color: var(--vs-own); }
.top5-empty { margin: 4px 0; }
.battle-contrib { margin-top: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.contrib-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contrib-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contrib-rank { width: 22px; text-align: right; font-weight: 700; color: var(--muted); }
.contrib-list .avatar { width: 32px; height: 32px; font-size: 14px; }

/* ランキングオフかも（2026-11-04） */
.tag.off { background: var(--known-bg); color: var(--known-fg); border: 1px dashed var(--line-strong); }

/* パスワードを変える（2026-11-05） */
.pw-form { display: grid; gap: 8px; max-width: 420px; }

/* リスナーのカードのコメント（2026-11-05） */
.first-comment { margin: 4px 0 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--first-bg); }
.first-comment-body { margin-top: 4px; font-size: 15px; color: var(--first-fg); white-space: pre-wrap; word-break: break-word; }
.card-comments { max-height: 260px; overflow-y: auto; }
.card-comments li { word-break: break-word; }

/* ===== スマホの見た目の仕上げ（2026-11-05 中村さん「アプリがチープに見える部分は全体的に直す」） ===== */
/* ボタン・チップは折り返さない（1文字ずつ縦に並ばないように） */
button, .button-link, .chip, .tab, .subtab, .tag, .act-chip { white-space: nowrap; }
.templates-head button { flex: none; }
/* 入力欄は枠の中に収める */
input, select, textarea { max-width: 100%; min-width: 0; box-sizing: border-box; }
label.check { flex-direction: row; align-items: center; white-space: nowrap; }
/* ラベル（メンレベ: など）は止めたまま、選ぶところだけ横に動く（ラベルは app.js の pinChipLabels で外に出す） */
.chips-row { display: flex; align-items: center; gap: 8px; }
.chips-row.hidden { display: none; }
.chips-row > .chips-label { flex: none; white-space: nowrap; }
.chips-row > .chips { flex: 1 1 auto; min-width: 0; }
/* 第2層のタブは1行で横に動く */
.subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
.subtabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
@media (max-width: 600px) {
  /* iPhone は 16px より小さい入力欄を押すと画面を拡大するので、16px にする */
  input, select, textarea { font-size: 16px; }
  /* 説明の文とボタンは縦に並べる（ボタンが押しつぶされないように） */
  .templates-head { flex-direction: column; align-items: stretch; }
  .templates-head button { align-self: flex-start; }
  .person-delete { flex-direction: column; align-items: stretch; }
  .person-delete input, .person-delete button { width: 100%; flex: none; }
  .person-delete label.check { justify-content: flex-start; gap: 8px; }
  .pw-form input, .pw-form button { width: 100%; }
}
html, body { overflow-x: clip; }   /* 横に白い所が出ないように（clip は上に止まる見出しを壊さない） */

/* ホーム画面に置く案内（2026-11-05 中村さん「もっと目立つように」） */
.install-card { padding: 18px 18px 14px; border-radius: var(--radius); background: linear-gradient(135deg, var(--first-bg), var(--milestone-bg)); border: 2px solid var(--accent); box-shadow: var(--shadow); }
.install-title { font-size: 18px; font-weight: 800; color: var(--first-fg); }
.install-why { margin: 6px 0 10px; font-size: 14px; line-height: 1.7; }
.install-btn { width: 100%; margin: 4px 0 10px; font-size: 16px; padding: 14px 20px; }
.install-steps { margin: 0 0 8px; padding-left: 1.4em; font-size: 14px; line-height: 1.9; }
.install-steps li::marker { font-weight: 800; color: var(--accent); }
.install-later { display: block; margin-left: auto; }

/* アイテムの「だれ」（2026-11-05 中村さん「名前の部分一致で候補を」）: 探した結果を押して選ぶ */
.who-picker { display: flex; flex-direction: column; gap: 8px; }
.who-label { font-size: 14px; color: var(--muted); font-weight: 500; }
.who-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.who-list li + li { border-top: 1px solid var(--line); }
.who-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: transparent; color: var(--text); font-weight: 400; border-radius: 0; text-align: left; white-space: normal; }
.who-row.chosen { background: var(--accent-soft); }
.who-row .avatar, .who-chosen .avatar { width: 36px; height: 36px; flex: none; font-size: 15px; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-empty { padding: 12px; }
.who-chosen { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid var(--accent); }
.who-chosen .who-text { flex: 1; }
/* 公式イベントのカードは、名前を折り返す（ボタン全体の「折り返さない」の例外。2026-11-05） */
button.ev-pick-btn, button.ev-pick-item, button.class-card, button.om-card { white-space: normal; }
.ev-pick-list { overflow-x: hidden; }
.ev-pick-item .ev-pick-name { font-size: 14.5px; }
/* 登録の画面の横はみ出しを防ぐ（iPhone の Safari は日付の欄が中身の幅まで広がる。2026-11-05 中村さん「右に白いところが出る」） */
.sheet { overflow-x: hidden; }
.event-form, .event-form .field, .event-form fieldset { min-width: 0; max-width: 100%; }
.event-form .field-row > label { flex: 1 1 140px; min-width: 0; }
.event-form input, .event-form select, .event-form textarea { min-width: 0; max-width: 100%; box-sizing: border-box; }
.event-form input[type=date] { -webkit-appearance: none; appearance: none; width: 100%; min-height: 44px; display: block; }
.event-form input[type=date]::-webkit-date-and-time-value { text-align: left; }
/* 録音した音（2026-11-05） */
.my-sounds-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.my-sounds-head > div { min-width: 0; }
.my-sounds-head button { flex: none; }
.my-sound-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.my-sound { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.my-sound-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; overflow-wrap: anywhere; }
.my-sound button { flex: none; }
.sound-choices li.sound-group { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 8px; }
button.record-open { width: 100%; white-space: normal; }
.record-box { display: flex; flex-direction: column; gap: 14px; }
.record-name { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
.record-main { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; }
.record-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 120px; height: 120px; border-radius: 50%; background: var(--accent-soft); color: var(--text); border: 2px solid var(--accent); font-size: 15px; }
.record-dot { width: 34px; height: 34px; border-radius: 50%; background: #e0414f; transition: border-radius .15s, transform .15s; }
.record-btn.on { background: #ffe5e8; animation: rec-pulse 1.2s infinite; }
.record-btn.on .record-dot { border-radius: 6px; transform: scale(.8); }
@keyframes rec-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 65, 79, .35); } 50% { box-shadow: 0 0 0 12px rgba(224, 65, 79, 0); } }
.record-time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.record-result { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.record-file { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.record-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.record-file-btn { display: inline-block; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; text-align: center; }
.record-file input:focus-visible + .record-file-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.my-sound { flex-wrap: wrap; }
.my-sound-name { flex: 1 1 calc(100% - 64px); }
.my-sound .my-sound-name + button { margin-left: auto; }
.my-sound button.small:not(.sound-try) { padding: 5px 12px; font-size: 13px; }

/* ---------- スマホの見直し（2026-11-05 夜 中村さん） ---------- */
/* 上のメニューは、上の帯のすぐ下に止める（帯の高さは app.js が --topbar-h に入れる。枠の上が帯に隠れないように） */
.tabs, .conn-banner { top: var(--topbar-h, 56px); }
@media (max-width: 640px) { .tabs { top: var(--topbar-h, 48px); } }
/* 名前の欄（ボタン）の中の文字は折り返す（「9回目・メンレベ2・フォロー」が右のコインに重ならないように） */
.who, .who .name, .who .meta, .who .memo { white-space: normal; }
/* 小さな文は、ひとまとまり（9回目・メンレベ2 など）ごとにだけ折り返す。名前は1行（長いときは …） */
.meta-parts { display: flex; flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
.meta-parts .meta-part { white-space: nowrap; }
.meta-parts .meta-sep { display: none; }   /* 区切りの点は出さない（折り返したとき、行の終わりに点だけ残るため）。すき間で区切る */
.rank-period-title .rp { white-space: nowrap; }
.rank-item .who .name, .item .who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { flex: none; margin-left: auto; }
@media (max-width: 640px) {
  /* 上の帯: ライバーさんの選ぶ欄を縮めて、はみ出さないように */
  .topbar .spacer { display: none; }
  #liverSelect { flex: 1 1 auto; min-width: 0; width: 0; text-overflow: ellipsis; }
  .topbar #soundBtn, .topbar #logoutBtn { padding: 5px 9px; font-size: 13px; }
  .topbar #status { flex: none; overflow: visible; }   /* 「● 配信中」は縮めない（選ぶ欄の方を縮める。2026-11-05 夜 中村さん「配の偏だけ出ている」） */
}
/* 管理画面の表: 状態の文字を縦1文字ずつにしない */
#liverRows td:nth-child(3) { min-width: 11em; }   /* 状態: 長い文（記録の抜け など）は折り返す。前は折り返さない決まりで、表が画面の外まで広がっていた（2026-11-17 中村さん「スマホで右の方が見られない」） */
@media (max-width: 640px) { #liverRows td:last-child { padding-left: 4px; } #liverRows td:last-child button { margin: 2px 0; } }
/* 2段目のメニュー（便利機能の「動画編集・タップ・ギフトの音」など）: 帯を画面の幅に収め、その中で横に動かす（中身の幅に広がって、はみ出た分が切れていた） */
.subtabs { align-self: stretch; width: auto; max-width: 100vw; min-width: 0; box-sizing: border-box; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
/* イベント登録: 質問（種類・開催中の公式イベント・エントリーしているクラス・ミッション など）を見出しとして目立たせる（2026-11-05 夜 中村さん「説明文みたいで小さくて見づらい」） */
.event-form .event-kind legend,
.event-form .official-pick > span:first-child,
.event-form .field > span:first-child,
.event-form .official-class > .om-title,
.event-form .om-group > .om-title,
.event-form .om-multi > .om-title,
.event-form label > span.q,
.sheet .q, .tap-settings .q {
  display: block; font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.4;
  padding-left: 10px; border-left: 4px solid var(--accent); margin: 6px 0 8px;
}
.event-form .event-kind legend { padding: 0 6px 0 10px; margin: 0 0 4px; }
.event-form > label:not(.check), .event-form .field-row > label { font-size: 15px; color: var(--text); }
.event-form .official-pick { gap: 6px; }
.event-form .official-class + .official-class, .event-form .om-group + .om-group { margin-top: 8px; }
/* 下から出る画面の上の帯（題名と「閉じる」）は、スクロールしても上に残す */
#eventDialog .sheet-head, #itemDialog .sheet-head, #itemFixDialog .sheet-head, #noticeDialog .sheet-head, #templateEditor .sheet-head, #recordDialog .sheet-head, #soundDialog .sheet-head { position: sticky; top: -22px; z-index: 5; margin: -22px -22px 4px; padding: 14px 22px 12px; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: 24px 24px 0 0; }
/* ランキングの期間（2026-11-05 夜 中村さん） */
.rank-date { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.rank-date input { width: auto; }
.rank-period-title { font-size: 19px; font-weight: 800; color: var(--text); margin: 14px 0 2px; line-height: 1.4; }
.rank-period-title:empty { display: none; }
.rank-note { margin: 0 0 10px; }
/* スマホの上の帯: 「● 配信中」と「@ハンドル」の両方が見えるように、丸いマークを外し、すき間とボタンを小さく（2026-11-05 夜） */
@media (max-width: 640px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar .brand { display: none; }
  .topbar #soundBtn, .topbar #logoutBtn { padding: 4px 8px; font-size: 12px; }
  .topbar #status { padding: 3px 8px; font-size: 12px; }
  .topbar #status.live::before { margin-right: 4px; }
  #liverSelect { font-size: 14px; padding-left: 8px; padding-right: 22px; }
}
/* スマホの上の帯: 「配信中」「待機中」の文字と、うまくいっているときの「記録中」・「画面オン」は出さない。配信中は赤い丸の点滅だけ（2026-11-05 夜 中村さん「ログアウトが見切れる。配信中・記録中の文字はいらない」）
   つなぎ直し中・保存に失敗などの困ったときの札（warn）は出す */
@media (max-width: 640px) {
  .topbar #status .status-word, .topbar #status .rec-state.ok, .topbar .wake-state { display: none; }
  .topbar #status:not(.live):not(:has(.rec-state.warn)) { display: none; }
  .topbar #status.live { padding: 3px 7px; border: 0; background: transparent; }
  .topbar #status.live::before { margin-right: 0; font-size: 14px; }
}

/* 入力の画面の質問（アイテムの手入力・声かけ・録音・タップ企画の設定）も、イベント登録と同じ見出しに（2026-11-06 中村さん）。ラベルの中の入力欄は見出しの下に */
.sheet label:has(> span.q), .tap-settings label:has(> span.q) { display: flex; flex-direction: column; gap: 4px; font-weight: 400; }
.sheet legend.q { padding: 0 6px 0 10px; margin: 0 0 6px; }
.item-kinds:has(> legend.q) { border: 0; padding: 0; margin: 0; }
.sheet .who-label.q { margin-top: 2px; }
.who-text .meta-parts { font-size: inherit; color: inherit; }
.who-text .meta-parts .meta-part:first-child { white-space: normal; overflow-wrap: anywhere; }   /* 長い @ハンドルだけは途中で折り返してよい */
/* アイテムの手入力: 残り時間（日・時間の2つの選ぶ欄）は1行まるごと使う（スマホで「分からない」が「分」だけに見えていた） */
.item-form-row label:has(.remain-inputs) { flex: 1 1 100%; }
.remain-inputs { display: flex; gap: 8px; }
.remain-inputs select { flex: 1 1 0; min-width: 0; }
/* 了解の画面のチェック欄は折り返す（スマホで右が切れていた。2026-11-06 総点検） */
label.check.consent-check { white-space: normal; align-items: flex-start; line-height: 1.6; }
label.check.consent-check input { margin-top: 4px; flex: none; }
/* モデレーター: 本人だけの操作のボタンは出さない（押してもサーバーで止まるため。2026-11-06 中村さん） */
body.role-moderator #tapSettingsBtn, body.role-moderator #templateDelete, body.role-moderator #eventDelete, body.role-moderator #mySoundAdd { display: none !important; }
/* 声かけ: モデレーターは読むだけ（書く・直す・並べ替えのボタンを出さない。2026-11-06 中村さん） */
body.role-moderator #newTemplateBtn, body.role-moderator #templateIdeas, body.role-moderator .template-actions .owner-edit { display: none !important; }
/* みおさんの画面だけの骨（🦴）: 右上の画面の外から下りてきて、約2.6秒で引っ込む（2026-11-06 中村さん）。下のボタンは押せる */
.bone-peek {
  position: fixed; top: 0; right: max(10px, env(safe-area-inset-right)); z-index: 60;
  width: 76px; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  font-size: 56px; line-height: 1; pointer-events: none; user-select: none;
  transform-origin: 50% 0%; filter: drop-shadow(0 4px 6px rgba(74, 42, 30, 0.25));
  animation: bone-peek 2.6s cubic-bezier(.3, .7, .3, 1) both;
}
@keyframes bone-peek {
  0%   { transform: translateY(-110%) rotate(-25deg); }
  16%  { transform: translateY(14px) rotate(10deg); }
  24%  { transform: translateY(6px) rotate(-8deg); }
  32%  { transform: translateY(10px) rotate(5deg); }
  40%  { transform: translateY(8px) rotate(-3deg); }
  72%  { transform: translateY(8px) rotate(0deg); }
  82%  { transform: translateY(16px) rotate(-6deg); }
  100% { transform: translateY(-115%) rotate(20deg); }
}
.bone-emoji { display: block; height: 76px; line-height: 76px; }
/* 骨のすぐ下の小さな文字（骨より大きくしない） */
.bone-word { margin-top: -8px; font-size: 12px; font-weight: 800; line-height: 1.3; white-space: nowrap; color: #c2456a; letter-spacing: 0.04em;
  padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 1px 4px rgba(74, 42, 30, 0.18); }
@media (max-width: 640px) { .bone-peek { width: 68px; min-height: 68px; font-size: 50px; } .bone-emoji { height: 68px; line-height: 68px; } .bone-word { font-size: 11px; margin-top: -7px; padding: 1px 6px; } }
@media (prefers-reduced-motion: reduce) {
  .bone-peek { animation: bone-fade 2.6s ease both; transform: translateY(8px); }
  @keyframes bone-fade { 0%, 100% { opacity: 0; } 15%, 80% { opacity: 1; } }
}
/* 絵文字が2つ以上のセット（😫🦴🦴）: 1つずつ小さくして横に並べ、ログアウトのボタンくらいの幅に収める */
.bone-peek.many { width: auto; min-width: 76px; }
.bone-peek.many .bone-emoji { font-size: 30px; letter-spacing: -2px; white-space: nowrap; }
@media (max-width: 640px) { .bone-peek.many .bone-emoji { font-size: 27px; } }
/* 超レア: ちいさな骨のなだれ（2026-11-06 中村さん）。上のメニューの枠の下の線より下には出さない（枠ごと overflow で切る）。下のボタンは押せる */
.bone-rain { position: fixed; top: 0; left: 0; right: 0; overflow: hidden; pointer-events: none; z-index: 59; }
.bone-drop { position: absolute; top: 0; line-height: 1; transform: translateY(-120%); animation-name: bone-drop; animation-timing-function: cubic-bezier(.35, .1, .6, 1); animation-fill-mode: both; filter: drop-shadow(0 1px 1px rgba(74, 42, 30, 0.2)); }
@keyframes bone-drop {
  0%   { transform: translate(0, -120%) rotate(0deg); opacity: 0; }
  12%  { opacity: 1; }
  78%  { opacity: 0.95; }
  100% { transform: translate(var(--drift, 0px), var(--fall, 120px)) rotate(var(--spin, 90deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bone-drop { animation-name: bone-drop-fade; transform: translateY(calc(var(--fall, 120px) * 0.4)); }
  @keyframes bone-drop-fade { 0%, 100% { opacity: 0; } 30%, 70% { opacity: 1; } }
}
/* モデレーターには期間のランキングを出さない（2026-11-06 中村さん） */
body.role-moderator #tabs [data-group="ranking"] { display: none !important; }
/* 音のオンオフのトグルスイッチ（2026-11-06 中村さん「丸が左で白ならオフ、押したら右に行ってピンクでオン。間にバー」） */
.sound-head .sound-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; flex: none; width: 58px; height: 34px; padding: 0; border-radius: 999px; border: 1px solid var(--line-strong, #e5cfc2); background: #e9dfd8; transition: background .2s ease, border-color .2s ease; cursor: pointer; }
.switch .switch-knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(74, 42, 30, 0.3); transition: transform .2s ease; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on .switch-knob { transform: translateX(24px); }
.switch:focus-visible { outline: 3px solid var(--accent-soft, #fbe6ea); outline-offset: 2px; }
.switch:active { transform: none; }
@media (prefers-color-scheme: dark) { .switch { background: #4a3d37; border-color: #5a4a43; } }
@media (prefers-reduced-motion: reduce) { .switch, .switch .switch-knob { transition: none; } }
/* 設定のいちばん上のご案内へのリンク（モデレーターには出さない） */
.guide-link { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); border-color: var(--accent); background: var(--accent-soft); margin-bottom: 12px; }
.guide-link-title { font-weight: 700; }
.guide-link-title::after { content: " ›"; }
body.role-moderator #guideLink { display: none !important; }

/* 2026-11-07 アイテムを正確に: 記録が抜けた時間の帯・「ずれているかも」・数を直す小窓 */
.items-gaps { background: var(--absence-bg); color: var(--absence-fg); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; line-height: 1.6; }
.items-gaps-title { font-weight: 700; }
.items-gaps ul { margin: 4px 0; padding-left: 1.2em; }
.tag.maybe-off { background: var(--absence-bg); color: var(--absence-fg); border: 1px dashed var(--absence-dot); }
.item-fix-list { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item-fix-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.item-fix-row:last-child { border-bottom: 0; }
.item-fix-text { flex: 1; min-width: 0; }
.item-fix-remain { font-weight: 700; font-size: 17px; }
.item-fix-row.removed .item-fix-remain { color: var(--muted); text-decoration: line-through; font-weight: 400; font-size: 15px; }
.item-fix-row button { flex: none; }
.removed-by-hand { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.battle-gap-note { background: var(--absence-bg); color: var(--absence-fg); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; line-height: 1.6; }
.notice-btn { position: relative; }
.notice-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #d9534f; color: #fff; font-size: 11px; font-weight: 700; }
.notice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notice-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.notice-item.unread { background: var(--absence-bg); border-color: var(--absence-dot); }
.notice-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.notice-body { margin: 6px 0 0; line-height: 1.6; font-size: 14px; }
.items-gaps-title { display: flex; align-items: center; gap: 6px; }
.items-gaps .gap-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.items-gaps .gap-close { flex: none; background: transparent; color: var(--absence-fg); border: 0; padding: 0 4px; font-size: 18px; line-height: 1.2; cursor: pointer; }
.items-gaps ul { list-style: none; padding-left: 0; }
.notice-btn { display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px; }
.notice-btn .bell { display: block; }

/* 3組・4組のバトル（2026-11-09 中村さん「最大4人（1対1対1対1）まで」）: 組ごとの色。自分はピンク、相手は青・緑・オレンジ（5組目からは灰色） */
.team-dot { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.team-dot.c0, .vs-fill.seg.c0 { background: var(--vs-own); }
.team-dot.c1, .vs-fill.seg.c1 { background: var(--vs-rival); }
.team-dot.c2, .vs-fill.seg.c2 { background: var(--vs-c2); }
.team-dot.c3, .vs-fill.seg.c3 { background: var(--vs-c3); }
.team-dot.c4, .vs-fill.seg.c4 { background: var(--vs-c4); }
.vs-bar.multi .vs-fill.seg { justify-content: center; padding: 0 6px; overflow: hidden; }
.vs-bar.multi .vs-fill.seg + .vs-fill.seg { box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.85); }
.vs-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 16px; }
@media (min-width: 640px) { .vs-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vs-legend li { display: flex; align-items: center; min-width: 0; font-size: 14px; }
.vs-legend li.own { font-weight: 700; }
.vs-legend-name { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-legend-score { flex: 0 0 auto; margin-left: 6px; font-variant-numeric: tabular-nums; color: var(--muted, #8a7a72); }
.battle-teams .team-name { display: flex; align-items: center; min-width: 0; }
.battle-teams .team-name > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* スマホ配信ボード（2026-11-17。MVP設計 103章） */
.board-intro { margin-bottom: 12px; }
.board-grid { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 14px; align-items: start; }
.board-preview-card { position: sticky; top: 110px; }
.board-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
/* 見本（左）と、選んだものの調整（右）を横に並べる（2026-11-21 中村さん「見本を左に寄せて、右に調整するものを」） */
.board-stage { display: grid; grid-template-columns: minmax(0, 1fr) 68px; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.board-phone { position: relative; width: 100%; align-self: start; aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  background-color: #8d8894; background-image: linear-gradient(45deg, #7c7783 25%, transparent 25%, transparent 75%, #7c7783 75%), linear-gradient(45deg, #7c7783 25%, transparent 25%, transparent 75%, #7c7783 75%);
  background-size: 24px 24px; background-position: 0 0, 12px 12px; }
/* 見本の上の部品（貢献ボード・カウンター）。枠そのものが絵を持っていて、指で動かすと絵ごと動く（MVP設計 108章） */
.board-drag { position: absolute; box-sizing: border-box; border-radius: 8px; cursor: grab; touch-action: none; outline: 1px dashed rgba(255, 255, 255, 0.55); outline-offset: 1px; }
.board-drag.selected { outline: 2px dashed #ff9db5; outline-offset: 2px; }
.board-drag:focus-visible { outline: 2px solid #ff9db5; outline-offset: 2px; }
.board-drag.is-empty { background: rgba(255, 255, 255, 0.14); }
.board-drag.dragging { cursor: grabbing; }
.board-layer-bg { position: absolute; inset: 0; pointer-events: none; }
.board-layer-img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.board-drag.is-empty .board-layer-img, .board-drag.no-img .board-layer-img { display: none; }
.board-drag-label { position: absolute; left: 0; top: -19px; padding: 0 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; white-space: nowrap; pointer-events: none; display: none; }
.board-drag.selected .board-drag-label, .board-drag.is-empty .board-drag-label { display: block; }
.board-resize { position: absolute; right: -13px; bottom: -13px; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid #d6718a; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); cursor: nwse-resize; touch-action: none; display: none; }
.board-drag.selected .board-resize { display: block; }
/* 右の調整: えらぶボタンと、縦のつまみ2本 */
.board-tools { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.board-pick { display: flex; flex-direction: column; gap: 6px; }
.board-pick-btn { padding: 7px 2px; font-size: 11px; font-weight: 700; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: inherit; white-space: nowrap; min-width: 0; }
.board-pick-btn[aria-pressed="true"] { background: #d6718a; border-color: #d6718a; color: #fff; }
.board-pick-btn:disabled { opacity: 0.4; }
.board-faders { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; min-height: 160px; }
.board-fader { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 0; }
.board-fader-name { font-size: 11px; font-weight: 700; white-space: nowrap; }
.vslider { flex: 1 1 auto; width: 30px; min-height: 120px; display: flex; justify-content: center; padding: 12px 0; box-sizing: border-box; cursor: pointer; touch-action: none; outline: none; -webkit-tap-highlight-color: transparent; }
.vslider-track { position: relative; width: 6px; height: 100%; border-radius: 3px; background: rgba(0, 0, 0, 0.14); }
.vslider-fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px; background: #e9a3b4; }
.vslider-thumb { position: absolute; left: 50%; width: 24px; height: 24px; margin: 0 0 -12px -12px; border-radius: 50%; background: #fff; border: 2px solid #d6718a; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.vslider:focus-visible .vslider-thumb { box-shadow: 0 0 0 3px rgba(214, 113, 138, 0.35); }
.vslider[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.board-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.board-form { display: flex; flex-direction: column; gap: 12px; }
.board-form input[type=range] { width: 100%; }
.board-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 6px; }
.board-tiers input { min-width: 0; width: 100%; }
.board-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.board-url { display: flex; flex-direction: column; gap: 10px; }
.board-url-row { display: flex; gap: 8px; }
.board-url-row input { flex: 1 1 auto; min-width: 0; font-size: 13px; }
.board-steps { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.board-flow { margin: 0; padding-left: 1.5em; display: flex; flex-direction: column; gap: 14px; }
.board-flow > li { padding-left: 2px; }
.board-flow > li > * { display: block; margin-top: 6px; }
.board-flow > li > b { margin-top: 0; }
.board-flow > li > .board-url-row { display: flex; }
.board-flow > li > .board-url-row.hidden, .board-flow.hidden { display: none; }
.board-manual > summary { cursor: pointer; color: var(--muted, #888); }
.board-manual > ol { margin-top: 8px; }
.board-people-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board-people-list li { display: flex; align-items: center; gap: 8px; }
.board-people-list .board-person-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-people-list .board-person-tier { flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.board-people-list li.is-hidden .board-person-name { color: var(--muted); text-decoration: line-through; }
@media (max-width: 720px) {
  .board-grid { grid-template-columns: minmax(0, 1fr); }
  .board-preview-card { position: static; }
  .board-phone { max-width: 260px; margin: 0 auto; }
}

/* 管理画面の配信者さんの一覧: スマホでは表をやめて、1人ずつ縦に並べる（2026-11-17 中村さん「ユーザーを選ぶところが大きくなって、右の方が見られなくなった」。
   状態の文が長いと表が画面の倍の幅になり、右のボタンが画面の外に出て、横にも動かせなかった） */
@media (max-width: 640px) {
  #liverTable, #liverTable tbody { display: block; }
  #liverTable thead { display: none; }
  #liverRows tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  #liverRows tr:last-child { border-bottom: 0; }
  #liverRows td { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  #liverRows td:nth-child(1) { font-weight: 700; }
  #liverRows td:nth-child(2) { display: block; color: var(--muted); font-size: 13px; }
  #liverRows td:nth-child(3) { margin-top: 4px; font-size: 14px; }
  #liverRows td:last-child { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-left: 0; }
  #liverRows td:last-child button { margin: 0; }
}
