/* vendor/bootstrap_icons.css */
/* bootstrap-icons 1.11.3 subset (generated by scripts/build_bootstrap_icons.py)
 * 編集禁止: スクリプトを再実行して再生成すること。
 * 含まれるクラス数: 358
 * フォント定義は app/views/layouts/shared/_bootstrap_icons_font_face.html.erb で出力する
 * unresolved-upstream: bi-xxx
 */
/* design-allow-start: all */
.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
  display: inline-block;
  font-family: "bootstrap-icons" !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  vertical-align: -.125em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bi-1-circle::before { content: "\f797"; }
.bi-1-circle-fill::before { content: "\f796"; }
.bi-2-circle::before { content: "\f79d"; }
.bi-2-circle-fill::before { content: "\f79c"; }
.bi-3-circle::before { content: "\f7a3"; }
.bi-3-circle-fill::before { content: "\f7a2"; }
.bi-4-circle::before { content: "\f7a9"; }
.bi-5-circle::before { content: "\f7af"; }
.bi-activity::before { content: "\f66b"; }
.bi-alarm::before { content: "\f102"; }
.bi-alphabet::before { content: "\f68a"; }
.bi-apple::before { content: "\f65b"; }
.bi-archive::before { content: "\f10d"; }
.bi-arrow-bar-up::before { content: "\f115"; }
.bi-arrow-clockwise::before { content: "\f116"; }
.bi-arrow-counterclockwise::before { content: "\f117"; }
.bi-arrow-down::before { content: "\f128"; }
.bi-arrow-down-circle::before { content: "\f119"; }
.bi-arrow-left::before { content: "\f12f"; }
.bi-arrow-left-circle::before { content: "\f12a"; }
.bi-arrow-left-right::before { content: "\f12b"; }
.bi-arrow-repeat::before { content: "\f130"; }
.bi-arrow-return-left::before { content: "\f131"; }
.bi-arrow-right::before { content: "\f138"; }
.bi-arrow-right-circle::before { content: "\f134"; }
.bi-arrow-up::before { content: "\f148"; }
.bi-arrow-up-circle::before { content: "\f13a"; }
.bi-arrow-up-short::before { content: "\f145"; }
.bi-arrows-angle-expand::before { content: "\f14a"; }
.bi-award::before { content: "\f154"; }
.bi-award-fill::before { content: "\f153"; }
.bi-back::before { content: "\f155"; }
.bi-badge-ad::before { content: "\f161"; }
.bi-bag-check::before { content: "\f171"; }
.bi-bag-plus::before { content: "\f176"; }
.bi-balloon-heart-fill::before { content: "\f707"; }
.bi-bank::before { content: "\f62e"; }
.bi-bar-chart::before { content: "\f17e"; }
.bi-bar-chart-fill::before { content: "\f17a"; }
.bi-bar-chart-line::before { content: "\f17c"; }
.bi-bar-chart-line-fill::before { content: "\f17b"; }
.bi-bar-chart-steps::before { content: "\f17d"; }
.bi-bell::before { content: "\f18a"; }
.bi-bell-slash::before { content: "\f631"; }
.bi-bezier2::before { content: "\f18c"; }
.bi-book::before { content: "\f194"; }
.bi-bookmark::before { content: "\f1a2"; }
.bi-bookmark-check::before { content: "\f196"; }
.bi-bookmark-check-fill::before { content: "\f195"; }
.bi-bookmark-fill::before { content: "\f199"; }
.bi-bookmark-plus::before { content: "\f19d"; }
.bi-bookmark-star::before { content: "\f19f"; }
.bi-bounding-box-circles::before { content: "\f1b5"; }
.bi-box-arrow-in-down::before { content: "\f1bc"; }
.bi-box-arrow-in-down-left::before { content: "\f1ba"; }
.bi-box-arrow-in-right::before { content: "\f1be"; }
.bi-box-arrow-left::before { content: "\f1c2"; }
.bi-box-arrow-right::before { content: "\f1c3"; }
.bi-box-arrow-up-right::before { content: "\f1c5"; }
.bi-box-seam::before { content: "\f1c7"; }
.bi-briefcase::before { content: "\f1cc"; }
.bi-brightness-high::before { content: "\f1d2"; }
.bi-broadcast::before { content: "\f1d6"; }
.bi-brush::before { content: "\f1d8"; }
.bi-bug::before { content: "\f1dc"; }
.bi-building::before { content: "\f1dd"; }
.bi-buildings::before { content: "\f87d"; }
.bi-bullseye::before { content: "\f1de"; }
.bi-calculator::before { content: "\f1e0"; }
.bi-calendar-check::before { content: "\f1e2"; }
.bi-calendar-check-fill::before { content: "\f1e1"; }
.bi-calendar-day::before { content: "\f1e6"; }
.bi-calendar-event::before { content: "\f1e8"; }
.bi-calendar-heart-fill::before { content: "\f70f"; }
.bi-calendar-month::before { content: "\f1ed"; }
.bi-calendar-week::before { content: "\f1f3"; }
.bi-calendar-x::before { content: "\f1f5"; }
.bi-calendar3::before { content: "\f214"; }
.bi-camera-reels::before { content: "\f21b"; }
.bi-camera-video::before { content: "\f21f"; }
.bi-camera-video-fill::before { content: "\f21c"; }
.bi-card-list::before { content: "\f227"; }
.bi-card-text::before { content: "\f228"; }
.bi-caret-down-fill::before { content: "\f229"; }
.bi-caret-right-fill::before { content: "\f231"; }
.bi-caret-up-fill::before { content: "\f235"; }
.bi-cash-coin::before { content: "\f632"; }
.bi-chat::before { content: "\f268"; }
.bi-chat-dots::before { content: "\f24a"; }
.bi-chat-fill::before { content: "\f24b"; }
.bi-chat-heart::before { content: "\f714"; }
.bi-chat-left-dots::before { content: "\f24d"; }
.bi-chat-left-text::before { content: "\f252"; }
.bi-chat-square-dots::before { content: "\f25f"; }
.bi-check-all::before { content: "\f269"; }
.bi-check-circle::before { content: "\f26b"; }
.bi-check-circle-fill::before { content: "\f26a"; }
.bi-check-lg::before { content: "\f633"; }
.bi-check2::before { content: "\f272"; }
.bi-check2-all::before { content: "\f26f"; }
.bi-check2-circle::before { content: "\f270"; }
.bi-chevron-bar-down::before { content: "\f274"; }
.bi-chevron-bar-up::before { content: "\f278"; }
.bi-chevron-down::before { content: "\f282"; }
.bi-chevron-left::before { content: "\f284"; }
.bi-chevron-right::before { content: "\f285"; }
.bi-chevron-up::before { content: "\f286"; }
.bi-circle::before { content: "\f28a"; }
.bi-circle-fill::before { content: "\f287"; }
.bi-clipboard::before { content: "\f290"; }
.bi-clipboard-check::before { content: "\f28b"; }
.bi-clipboard-data::before { content: "\f28c"; }
.bi-clipboard-plus::before { content: "\f28e"; }
.bi-clock::before { content: "\f293"; }
.bi-clock-history::before { content: "\f292"; }
.bi-cloud::before { content: "\f2c1"; }
.bi-cloud-upload::before { content: "\f2c0"; }
.bi-coin::before { content: "\f634"; }
.bi-collection::before { content: "\f2cc"; }
.bi-collection-play::before { content: "\f2cb"; }
.bi-compass::before { content: "\f2d1"; }
.bi-controller::before { content: "\f2d4"; }
.bi-copy::before { content: "\f759"; }
.bi-cpu::before { content: "\f2d6"; }
.bi-credit-card-2-front::before { content: "\f2da"; }
.bi-cursor::before { content: "\f2e3"; }
.bi-dash::before { content: "\f2ea"; }
.bi-dash-circle::before { content: "\f2e6"; }
.bi-dash-lg::before { content: "\f63b"; }
.bi-diagram-3::before { content: "\f2ee"; }
.bi-display::before { content: "\f302"; }
.bi-door-open::before { content: "\f308"; }
.bi-droplet-half::before { content: "\f30c"; }
.bi-easel::before { content: "\f310"; }
.bi-emoji-frown::before { content: "\f31d"; }
.bi-emoji-heart-eyes::before { content: "\f31f"; }
.bi-emoji-laughing-fill::before { content: "\f320"; }
.bi-emoji-smile::before { content: "\f327"; }
.bi-envelope::before { content: "\f32f"; }
.bi-envelope-at::before { content: "\f84c"; }
.bi-envelope-check::before { content: "\f68c"; }
.bi-envelope-fill::before { content: "\f32c"; }
.bi-eraser::before { content: "\f331"; }
.bi-eraser-fill::before { content: "\f330"; }
.bi-exclamation-circle::before { content: "\f333"; }
.bi-exclamation-circle-fill::before { content: "\f332"; }
.bi-exclamation-octagon::before { content: "\f337"; }
.bi-exclamation-triangle::before { content: "\f33b"; }
.bi-exclamation-triangle-fill::before { content: "\f33a"; }
.bi-eye::before { content: "\f341"; }
.bi-eye-slash::before { content: "\f340"; }
.bi-eyedropper::before { content: "\f342"; }
.bi-facebook::before { content: "\f344"; }
.bi-fast-forward-fill::before { content: "\f7f3"; }
.bi-file-earmark::before { content: "\f392"; }
.bi-file-earmark-text::before { content: "\f38b"; }
.bi-file-text::before { content: "\f3b9"; }
.bi-files::before { content: "\f3c2"; }
.bi-film::before { content: "\f3c3"; }
.bi-fire::before { content: "\f7f6"; }
.bi-flag::before { content: "\f3cc"; }
.bi-flag-fill::before { content: "\f3cb"; }
.bi-flower1::before { content: "\f3cd"; }
.bi-folder-fill::before { content: "\f3d1"; }
.bi-folder-minus::before { content: "\f3d2"; }
.bi-folder-plus::before { content: "\f3d3"; }
.bi-front::before { content: "\f3dd"; }
.bi-funnel::before { content: "\f3e1"; }
.bi-funnel-fill::before { content: "\f3e0"; }
.bi-gear::before { content: "\f3e5"; }
.bi-gem::before { content: "\f3e6"; }
.bi-geo-alt::before { content: "\f3e8"; }
.bi-gift::before { content: "\f3ec"; }
.bi-gift-fill::before { content: "\f3eb"; }
.bi-globe::before { content: "\f3ee"; }
.bi-globe2::before { content: "\f3ef"; }
.bi-graph-down::before { content: "\f3f1"; }
.bi-graph-down-arrow::before { content: "\f672"; }
.bi-graph-up::before { content: "\f3f2"; }
.bi-graph-up-arrow::before { content: "\f673"; }
.bi-grid::before { content: "\f3fc"; }
.bi-grid-3x3::before { content: "\f3fa"; }
.bi-grid-3x3-gap::before { content: "\f3f9"; }
.bi-grid-3x3-gap-fill::before { content: "\f3f8"; }
.bi-grid-fill::before { content: "\f3fb"; }
.bi-hand-index::before { content: "\f403"; }
.bi-hand-thumbs-up::before { content: "\f407"; }
.bi-hand-thumbs-up-fill::before { content: "\f406"; }
.bi-hash::before { content: "\f40a"; }
.bi-headphones::before { content: "\f413"; }
.bi-heart::before { content: "\f417"; }
.bi-heart-fill::before { content: "\f415"; }
.bi-hourglass-bottom::before { content: "\f41e"; }
.bi-hourglass-split::before { content: "\f41f"; }
.bi-house::before { content: "\f425"; }
.bi-house-door::before { content: "\f423"; }
.bi-image::before { content: "\f42a"; }
.bi-inbox::before { content: "\f42d"; }
.bi-infinity::before { content: "\f69e"; }
.bi-info-circle::before { content: "\f431"; }
.bi-info-circle-fill::before { content: "\f430"; }
.bi-instagram::before { content: "\f437"; }
.bi-journal-bookmark::before { content: "\f43d"; }
.bi-journal-check::before { content: "\f43e"; }
.bi-journal-plus::before { content: "\f442"; }
.bi-journal-text::before { content: "\f444"; }
.bi-journal-x::before { content: "\f445"; }
.bi-journals::before { content: "\f447"; }
.bi-joystick::before { content: "\f448"; }
.bi-key::before { content: "\f44f"; }
.bi-key-fill::before { content: "\f44e"; }
.bi-keyboard::before { content: "\f451"; }
.bi-keyboard-fill::before { content: "\f450"; }
.bi-laptop::before { content: "\f456"; }
.bi-layers::before { content: "\f45b"; }
.bi-layout-sidebar-inset::before { content: "\f45d"; }
.bi-layout-text-window::before { content: "\f464"; }
.bi-lightbulb::before { content: "\f46b"; }
.bi-lightning::before { content: "\f46f"; }
.bi-lightning-charge::before { content: "\f46d"; }
.bi-lightning-charge-fill::before { content: "\f46c"; }
.bi-lightning-fill::before { content: "\f46e"; }
.bi-line::before { content: "\f660"; }
.bi-link-45deg::before { content: "\f470"; }
.bi-list::before { content: "\f479"; }
.bi-list-check::before { content: "\f473"; }
.bi-list-ol::before { content: "\f475"; }
.bi-list-ul::before { content: "\f478"; }
.bi-lock::before { content: "\f47b"; }
.bi-lock-fill::before { content: "\f47a"; }
.bi-magic::before { content: "\f675"; }
.bi-map::before { content: "\f47f"; }
.bi-megaphone::before { content: "\f484"; }
.bi-megaphone-fill::before { content: "\f483"; }
.bi-mic::before { content: "\f490"; }
.bi-mic-fill::before { content: "\f48d"; }
.bi-mic-mute::before { content: "\f48f"; }
.bi-mic-mute-fill::before { content: "\f48e"; }
.bi-moon-stars::before { content: "\f496"; }
.bi-mortarboard::before { content: "\f6fe"; }
.bi-mortarboard-fill::before { content: "\f6fd"; }
.bi-music-note::before { content: "\f4a0"; }
.bi-music-note-beamed::before { content: "\f49e"; }
.bi-music-note-list::before { content: "\f49f"; }
.bi-paint-bucket::before { content: "\f4af"; }
.bi-palette::before { content: "\f4b1"; }
.bi-paperclip::before { content: "\f4b3"; }
.bi-patch-check::before { content: "\f4b6"; }
.bi-patch-check-fill::before { content: "\f4b5"; }
.bi-pause-circle::before { content: "\f4c2"; }
.bi-pause-fill::before { content: "\f4c3"; }
.bi-pc-display::before { content: "\f6a6"; }
.bi-pencil::before { content: "\f4cb"; }
.bi-pencil-fill::before { content: "\f4c9"; }
.bi-pencil-square::before { content: "\f4ca"; }
.bi-people::before { content: "\f4d0"; }
.bi-people-fill::before { content: "\f4cf"; }
.bi-percent::before { content: "\f4d1"; }
.bi-person::before { content: "\f4e1"; }
.bi-person-badge::before { content: "\f4d3"; }
.bi-person-check::before { content: "\f4d6"; }
.bi-person-circle::before { content: "\f4d7"; }
.bi-person-exclamation::before { content: "\f89c"; }
.bi-person-fill::before { content: "\f4da"; }
.bi-person-hearts::before { content: "\f77b"; }
.bi-person-lock::before { content: "\f8a8"; }
.bi-person-plus::before { content: "\f4dd"; }
.bi-person-vcard::before { content: "\f8c9"; }
.bi-person-video3::before { content: "\f679"; }
.bi-person-workspace::before { content: "\f67a"; }
.bi-person-x::before { content: "\f4e0"; }
.bi-person-x-fill::before { content: "\f4df"; }
.bi-phone::before { content: "\f4e7"; }
.bi-phone-landscape::before { content: "\f4e4"; }
.bi-pin-map::before { content: "\f64c"; }
.bi-play-btn::before { content: "\f4f1"; }
.bi-play-btn-fill::before { content: "\f4f0"; }
.bi-play-circle::before { content: "\f4f3"; }
.bi-play-circle-fill::before { content: "\f4f2"; }
.bi-play-fill::before { content: "\f4f4"; }
.bi-plus::before { content: "\f4fe"; }
.bi-plus-circle::before { content: "\f4fa"; }
.bi-plus-lg::before { content: "\f64d"; }
.bi-plus-square::before { content: "\f4fd"; }
.bi-puzzle::before { content: "\f503"; }
.bi-question-circle::before { content: "\f505"; }
.bi-question-circle-fill::before { content: "\f504"; }
.bi-quote::before { content: "\f6b0"; }
.bi-repeat::before { content: "\f813"; }
.bi-reply::before { content: "\f520"; }
.bi-reply-fill::before { content: "\f51f"; }
.bi-robot::before { content: "\f6b1"; }
.bi-rocket-takeoff::before { content: "\f845"; }
.bi-save::before { content: "\f525"; }
.bi-scissors::before { content: "\f528"; }
.bi-search::before { content: "\f52a"; }
.bi-send::before { content: "\f6c0"; }
.bi-send-fill::before { content: "\f6b9"; }
.bi-share::before { content: "\f52e"; }
.bi-shield-check::before { content: "\f52f"; }
.bi-shield-exclamation::before { content: "\f530"; }
.bi-shield-lock::before { content: "\f538"; }
.bi-shield-shaded::before { content: "\f53b"; }
.bi-shield-x::before { content: "\f53e"; }
.bi-shuffle::before { content: "\f544"; }
.bi-signpost-split::before { content: "\f549"; }
.bi-skip-backward-fill::before { content: "\f551"; }
.bi-skip-forward::before { content: "\f55e"; }
.bi-skip-forward-fill::before { content: "\f55d"; }
.bi-slash-circle::before { content: "\f567"; }
.bi-slash-lg::before { content: "\f657"; }
.bi-sliders::before { content: "\f56b"; }
.bi-sliders2::before { content: "\f789"; }
.bi-speedometer2::before { content: "\f580"; }
.bi-square::before { content: "\f584"; }
.bi-square-fill::before { content: "\f582"; }
.bi-star::before { content: "\f588"; }
.bi-star-fill::before { content: "\f586"; }
.bi-stars::before { content: "\f589"; }
.bi-stop-fill::before { content: "\f592"; }
.bi-stopwatch::before { content: "\f597"; }
.bi-sun::before { content: "\f5a2"; }
.bi-symmetry-horizontal::before { content: "\f5a8"; }
.bi-symmetry-vertical::before { content: "\f5a9"; }
.bi-tag::before { content: "\f5b0"; }
.bi-tags::before { content: "\f5b2"; }
.bi-terminal::before { content: "\f5c3"; }
.bi-text-paragraph::before { content: "\f5c8"; }
.bi-three-dots::before { content: "\f5d4"; }
.bi-three-dots-vertical::before { content: "\f5d3"; }
.bi-ticket-perforated::before { content: "\f6ca"; }
.bi-tiktok::before { content: "\f6cc"; }
.bi-toggles::before { content: "\f5d9"; }
.bi-train-front::before { content: "\f81d"; }
.bi-translate::before { content: "\f658"; }
.bi-trash::before { content: "\f5de"; }
.bi-trash3::before { content: "\f78b"; }
.bi-triangle::before { content: "\f5e5"; }
.bi-trophy::before { content: "\f5e7"; }
.bi-trophy-fill::before { content: "\f5e6"; }
.bi-twitter-x::before { content: "\f8db"; }
.bi-type::before { content: "\f5f7"; }
.bi-unlock::before { content: "\f600"; }
.bi-upload::before { content: "\f603"; }
.bi-volume-down::before { content: "\f60b"; }
.bi-volume-mute::before { content: "\f60d"; }
.bi-volume-up::before { content: "\f611"; }
.bi-wallet2::before { content: "\f615"; }
.bi-wifi::before { content: "\f61c"; }
.bi-wifi-off::before { content: "\f61b"; }
.bi-wind::before { content: "\f61d"; }
.bi-x::before { content: "\f62a"; }
.bi-x-circle::before { content: "\f623"; }
.bi-x-circle-fill::before { content: "\f622"; }
.bi-x-lg::before { content: "\f659"; }
.bi-youtube::before { content: "\f62b"; }
.bi-zoom-in::before { content: "\f62c"; }
.bi-zoom-out::before { content: "\f62d"; }
/* design-allow-end: all */
/* theme.css */
/* ===========================
   Theme System
   =========================== */

:root {
  --sidebar-width: 220px; /* 用途: サイドバー幅 */
  --topbar-height: 56px; /* 用途: トップバー高さ */
  --card-radius: 0.75rem; /* 用途: カード・パネルの角丸半径 */
  --z-topbar: 1030; /* 用途: トップバーの z-index 基準値 */
  --z-sidebar: 1040; /* 用途: サイドバーの z-index 基準値。フルスクリーンモーダル類はこれより必ず上にする */
  --z-notification: 1050; /* 用途: 通知バー/トーストの z-index */
  --z-modal: 2000; /* 用途: フルスクリーンモーダルオーバーレイの z-index。sidebar より上であることが必須 */
  --z-editor-modal: 10000; /* 用途: ピクセルアートエディタ等、最前面に来る特殊モーダルの z-index */
  --collab-canvas-scale: 1; /* 用途: 共同制作スペース 大型キャンバス内 bg-decoration-layer の scale 倍率。 JS が ResizeObserver で「実描画幅 / 960」を setProperty で動的更新する。 ここでの定義は fallback (= 等倍) と design check の「未定義 var」 検出回避を兼ねる */
  --vs-pulse-duration: 600ms; /* 用途: ビジュアルステージ (計画書 136) Phase 3 pulse_effect の持続時間。 JS (visual_stage_controller._applyPulse) が intensity 値に応じて 600ms / 1200ms を要素 inline style で setProperty する。 ここでの定義は fallback と design check の「未定義 var」 検出回避を兼ねる */
  --vs-opacity: 1; /* 用途: ビジュアルステージ (計画書 136) Phase 5d set_slot_param による slot 透過度。 JS (_applySlotParam) が param_template の {value} 置換結果を inline style で setProperty する。 ここでの定義は fallback (= 不透明) と design check の「未定義 var」 検出回避を兼ねる */
  --vs-filter-blur: 0px; /* 用途: ビジュアルステージ Phase 5d set_slot_param 用 filter blur。 .has-vs-filter class 配下でのみ filter プロパティに合成される。 fallback は 0px (効果なし) */
  --vs-filter-brightness: 1; /* 用途: ビジュアルステージ Phase 5d set_slot_param 用 filter brightness。 .has-vs-filter class 配下でのみ合成。 fallback は 1 (等倍) */
  --vs-filter-saturate: 1; /* 用途: ビジュアルステージ Phase 5d set_slot_param 用 filter saturate。 .has-vs-filter class 配下でのみ合成。 fallback は 1 (等倍) */

  /* ===========================
     ピクセルアートエディタ専用ダーク UI 固定色
     ユーザーがパレット色を選ぶ UI のため、テーマで色相が変わるとパレット色の見え方が崩れる。
     全テーマで同一のダーク UI に固定するため、ここで集中管理する (テーマ非依存)。
     =========================== */
  --pxe-on-light-rgb: 255, 255, 255; /* 用途: ピクセルアートエディタ内の半透明白オーバーレイ用 RGB (border, hover bg 等を rgba(var(--pxe-on-light-rgb), 0.x) で表現) */
  --pxe-on-dark-rgb: 0, 0, 0; /* 用途: ピクセルアートエディタ内の半透明黒オーバーレイ用 RGB (canvas 背景・パレット背景の暗色化) */
  --pxe-bg: #1a1a2e; /* 用途: ピクセルアートエディタモーダル全体背景 (ダーク UI 固定) */
  --pxe-bg-modal: #2a2a44; /* 用途: エディタモーダルカード背景 */
  --pxe-bg-panel: #2a2a30; /* 用途: エディタサブモーダル (インポート/配色変更) 背景 */
  --pxe-text: #e0e0e0; /* 用途: エディタ内本文テキスト */
  --pxe-text-muted: #9e9e9e; /* 用途: エディタ内弱テキスト。⚠️ #888 は --pxe-bg-modal + --pxe-surface(白 4%) 越しで 4.03 と AA 未満だった（計画書 182 Phase 4） */
  --pxe-text-strong: #fff; /* 用途: エディタ内強調テキスト・hover 時白化 */
  --pxe-border: rgba(255,255,255,0.15); /* 用途: エディタ内汎用ボーダー */
  --pxe-border-soft: rgba(255,255,255,0.08); /* 用途: エディタ内弱めボーダー */
  --pxe-border-faint: rgba(255,255,255,0.06); /* 用途: エディタ内最弱ボーダー */
  --pxe-surface: rgba(255,255,255,0.04); /* 用途: エディタ内サーフェス背景 (ボタン・セル) */
  --pxe-surface-strong: rgba(255,255,255,0.08); /* 用途: エディタ内強サーフェス (hover 等) */
  --pxe-canvas-bg: rgba(0,0,0,0.3); /* 用途: エディタキャンバス枠背景 */
  --pxe-overlay-bg: rgba(0,0,0,0.6); /* 用途: エディタモーダルオーバーレイ */
  --pxe-overlay-bg-strong: rgba(0,0,0,0.7); /* 用途: pxm-modal オーバーレイ */
  --pxe-shadow: 0 8px 32px rgba(0,0,0,0.5); /* 用途: エディタモーダル影 */
  --pxe-shadow-strong: 0 10px 40px rgba(0,0,0,0.5); /* 用途: エディタサブモーダル影 */
  --pxe-accent: #4c9aff; /* 用途: エディタ内アクセント色 (青) */
  --pxe-accent-strong: #3a8aef; /* 用途: アクセント濃 (hover 用) */
  --pxe-accent-soft: #7bb8ff; /* 用途: アクセント淡 (公開バッジ用・ダーク面のアクセント文字) */
  --pxe-text-on-accent: #1a1a2e; /* 用途: エディタの明るい塗り (アクセントボタン / スロットバッジ) の上の文字。--pxe-text-strong(#fff) は accent 地で 2.85 と AA を割る */
  --pxe-accent-rgb: 76, 154, 255; /* 用途: アクセント RGB (rgba 合成用) */
  --pxe-danger: #dc3545; /* 用途: エディタ内エラー・削除色 */
  --pxe-danger-rgb: 220, 53, 69; /* 用途: エラー RGB */
  --pxe-danger-soft: #ff8080; /* 用途: エディタのダーク面に置く危険色の**文字** (--pxe-danger は地・枠専用。文字に使うと 3.07〜3.77 で AA 未満) */
  --pxe-warning: #ffc107; /* 用途: エディタ内警告色 (下書きバッジ等) */
  --pxe-warning-rgb: 255, 193, 7; /* 用途: 警告 RGB */
  --pxe-warning-fg: #1a1a1a; /* 用途: 警告色背景上の文字 */
  --pxe-coin: #ffcc22; /* 用途: Beat/コインアイコン色 */
  --pxe-success-bg-rgb: 76, 175, 80; /* 用途: スロット拡大購入済みバッジ背景 RGB */
  --pxe-material: #ffaa66; /* 用途: 素材提供色 (オレンジ) */
  --pxe-material-strong: #ffbb88; /* 用途: 素材提供色濃 (hover 用) */
  --pxe-material-rgb: 255, 140, 40; /* 用途: 素材提供 RGB */
  --pxe-thank: #ffa9be; /* 用途: お礼ボタン色 (ピンク) */
  --pxe-thank-strong: #ffd1da; /* 用途: お礼ボタン濃 */
  --pxe-thank-rgb: 255, 116, 158; /* 用途: お礼 RGB */
  --pxe-thank-done: #b2e1bb; /* 用途: お礼済色 (薄緑) */
  --pxe-thank-done-rgb: 120, 200, 130; /* 用途: お礼済 RGB */
  --pxe-contest-rgb: 33, 150, 243; /* 用途: コンテスト応募中バッジ RGB */
  --pxe-contest-adopted-rgb: 255, 204, 34; /* 用途: コンテスト採用中バッジ RGB */
}

/* =============================================
   Theme System - 10 keyboard-inspired themes
   5 Light (Classic Beige, Slate, Sakana, Botanical, Shell White)
   5 Dark  (Carbon, Synthwave, Hacker, Tidal, Viper)
   ============================================= */

/* --- L1: Classic Beige (retro beige keyboard) --- */
[data-theme="light-classic"],
:root {
  --sidebar-bg: #2c2520; /* 用途: サイドバー背景 */
  --sidebar-color-strong: #f1eeea; /* 用途: サイドバーの最上段（プロフィール名・統計の数値・ライブの見出し）。白系の rgba(255,255,255,x) を各所で直書きしていたのをこの段に集約した */
  --sidebar-color: #ded6cf; /* 用途: サイドバー文字色 */
  --sidebar-color-dim: #c6b9ad; /* 用途: サイドバーの補助テキスト（部屋の募集状況・本日の戦績・アクセス数のラベル）。opacity で薄くすると実効 2.2〜3.8 まで落ちるので明示的な色で持つ */
  --sidebar-color-faint: #977f69; /* 用途: サイドバーの無効メニュー。操作できないことを示すが存在は見える濃さ */
  --sidebar-accent: #eea4a4; /* 用途: サイドバー内のアクセント（アクティブ項目の左バー・枠線）。--accent は light テーマだと濃色でサイドバーの暗地に沈む（実測 1.13〜1.88）ので、色相・彩度はそのままに明度だけ上げた版を持つ */
  --sidebar-accent-rgb: 238, 164, 164; /* 用途: サイドバーアクセントの RGB。rgba(var(--sidebar-accent-rgb), a) 用 */
  --sidebar-active-color: #fff; /* 用途: サイドバーのアクティブ項目文字色 */
  --sidebar-active-bg: rgba(255,255,255,0.1); /* 用途: サイドバーのアクティブ項目背景 */
  --sidebar-hover-bg: rgba(255,255,255,0.05); /* 用途: サイドバー項目のホバー背景 */
  --sidebar-border: rgba(255,255,255,0.08); /* 用途: サイドバー内の区切り線 */
  --sidebar-profile-bg: rgba(255,255,255,0.06); /* 用途: サイドバー下部のプロフィールカード背景 */
  --sidebar-terms-color: var(--sidebar-color-dim); /* 用途: サイドバー利用規約テキスト。サイドバーの階調に統合（旧値はテーマ別 rgba で 4.65〜5.39 だった） */
  --sidebar-terms-link: var(--sidebar-color); /* 用途: サイドバー利用規約リンク。リンクは押せる = 本文段に置く */
  /* サイドバーは**全 10 テーマとも暗背景**（light テーマでも sidebar-bg は #2c2520 等）。
     body 用の --color-warning / --color-info を持ち込むと light テーマで沈むため
     （実測 2.1〜2.6 で AA 割れ）、サイドバー内のバッジ文字は明色で固定する。
     全 10 テーマの sidebar-bg 上で WCAG AA 5.9+ を確認済み。 */
  /* タイピング個人設定で JS が style.setProperty() する動的変数のうち、**対戦画面も使うもの**の初期値。
     play_typing.css にも同じ定義があるが、単語帳対戦のプレイ画面は play_typing.css を読まず
     （個人設定パネルを持たないため）カウントダウンの色が未定義になっていた。
     動的設定変数は初期値定義必須（theme_system_design.md）なので、共通で持つ theme.css 側に置く */
  --countdown-color: var(--accent); /* 用途: カウントダウン数字の色（個人設定で上書きされる） */
  --typing-area-bg: var(--card-bg); /* 用途: タイピングエリアの背景（個人設定で上書きされる） */
  --sidebar-warning: #fbbf24; /* 用途: サイドバー内バッジの警告色文字（ランクマッチ等） */
  --sidebar-info: #77b7ff; /* 用途: サイドバー内バッジの情報色文字（エンジョイ等）。地が同色の 15% tint なので #58a6ff だと 4.55 まで落ちる */
  --sidebar-info-rgb: 119, 183, 255; /* 用途: サイドバー情報色の RGB 値 */
  --sidebar-success: #4ade80; /* 用途: サイドバー内の進行中・開催中バッジ文字色（ライブイベント等） */
  --sidebar-success-rgb: 74, 222, 128; /* 用途: サイドバー成功色の RGB 値 */
  --topbar-bg: rgba(255,252,245,0.92); /* 用途: トップバー背景 */
  --topbar-shadow: 0 1px 3px rgba(80,60,40,0.12); /* 用途: トップバーの影 */
  --body-bg: #f0e8dc; /* 用途: ページ背景色 */
  --body-gradient: radial-gradient(ellipse at 60% 35%, rgba(220,200,160,0.15) 0%, transparent 55%),
                   linear-gradient(150deg, #f2ead8 0%, #ece2d4 100%); /* 用途: ページ背景の装飾グラデーション */
  --accent: #8b1a1a; /* 用途: アクセントカラー（主要ボタン・リンク・強調） */
  --accent-rgb: 139,26,26; /* 用途: アクセントカラーの RGB 値。rgba(var(--accent-rgb), alpha) 用 */
  --key-led: #c03030; /* 用途: キー LED 色（タイピング強調・キーキャップ装飾） */
  --key-led-rgb: 192,48,48; /* 用途: キー LED の RGB 値。rgba(var(--key-led-rgb), alpha) 用 */
  --border-color: #d8ccbc; /* 用途: 汎用ボーダー色 */
  --text-primary: #2c2218; /* 用途: 本文テキスト色 */
  --text-secondary: #534734; /* 用途: 補助テキスト色（primary より一段薄く、muted より濃い） */
  --text-muted: #665843; /* 用途: 弱めのテキスト色（キャプション等。secondary より body-bg 寄り） */
  --card-bg: rgba(255,252,245,0.88); /* 用途: カード・パネル背景 */
  --card-actions-bg: rgba(248,242,232,0.9); /* 用途: カード内アクションバー背景 */
  --code-bg: rgba(244,238,228,0.9); /* 用途: コードブロック背景 */
  --tag-bg: #e4d8c8; /* 用途: タグ・バッジ背景 */
  --error-bg: #fff0f0; /* 用途: エラー表示の背景 */
  --empty-bg: rgba(255,252,245,0.88); /* 用途: 空状態 (EmptyState) の背景 */
  --footer-border: #d0c4b4; /* 用途: フッターのボーダー色 */
  --footer-color: #7a6a58; /* 用途: フッター文字色 */
}

/* --- L2: Slate (professional gray/navy keyboard) --- */
[data-theme="light-slate"] {
  --sidebar-bg: #1c2028;
  --sidebar-color-strong: #e2e6eb;
  --sidebar-color: #c8d0da;
  --sidebar-color-dim: #a9b5c5;
  --sidebar-color-faint: #6b7f9c;
  --sidebar-accent: #95b1da;
  --sidebar-accent-rgb: 149, 177, 218;
  --body-bg: #eaecf0;
  --body-gradient: radial-gradient(ellipse at 55% 40%, rgba(160,170,200,0.08) 0%, transparent 50%),
                   linear-gradient(160deg, #eceef2 0%, #e4e6ee 100%);
  --accent: #2a4a7a;
  --accent-rgb: 42,74,122;
  --key-led: #4a7acc;
  --key-led-rgb: 74,122,204;
  --border-color: #c8ccd4;
  --text-primary: #1c2028;
  --text-secondary: #444d60;
  --text-muted: #515b6e;
  --card-bg: rgba(255,255,255,0.88);
  --card-actions-bg: rgba(244,246,250,0.9);
  --code-bg: rgba(240,242,248,0.9);
  --tag-bg: #d8dce6;
  --error-bg: #fff5f5;
  --empty-bg: rgba(255,255,255,0.88);
  --footer-border: #c0c4d0;
  --footer-color: #6a7080;
  /* テーマ調整セマンティック色: ネイビー世界の中で対比を出す。WCAG AA 確保のため danger をより濃紅に */
  --color-danger: #9f1239; --color-danger-rgb: 159,18,57;
  --color-success: #166534; --color-success-rgb: 22,101,52;
  --danger-bg: rgba(159,18,57,0.12);
  --lh-danger: #9f1239; --lh-danger-rgb: 159,18,57;
  --lh-success: #166534; --lh-success-rgb: 22,101,52;
  --lh-warning: #92400e; --lh-warning-rgb: 146,64,14;
  --lh-warning-alt: #b45309; --lh-warning-alt-rgb: 180,83,9;
  --lh-upcoming: #6d28d9; --lh-upcoming-rgb: 109,40,217;
}

/* --- L3: Sakana (Japanese blue/salmon keyboard) --- */
[data-theme="light-sakana"] {
  --sidebar-bg: #182838;
  --sidebar-color-strong: #ebeff4;
  --sidebar-color: #cfd9e5;
  --sidebar-color-dim: #acbed2;
  --sidebar-color-faint: #6686ad;
  --sidebar-accent: #e3aaa2;
  --sidebar-accent-rgb: 227, 170, 162;
  --body-bg: #eff2f8;
  --body-gradient: radial-gradient(ellipse at 65% 30%, rgba(208,96,80,0.06) 0%, transparent 45%),
                   radial-gradient(ellipse at 30% 70%, rgba(80,120,180,0.06) 0%, transparent 50%),
                   linear-gradient(160deg, #f0f3f8 0%, #eaeff6 100%);
  /* 4.43 → 4.70: --accent は 393 ルールで文字色に使われるが、body-gradient の最も明るい位置で
     AA (4.5) を 0.07 下回っていた。サーモンの色相は保ったまま僅かに暗くして解消
     (accent 上の #fff も 5.48 → 5.82 に改善)。theme_system_design.md の
     「色の判断材料は WCAG コントラストと用途の一貫性」に従う */
  --accent: #ab4434;
  --accent-rgb: 171,68,52;
  --key-led: #ff7868;
  --key-led-rgb: 255,120,104;
  --border-color: #c8d0e0;
  --text-primary: #1a2838;
  --text-secondary: #42506b;
  --text-muted: #505f7a;
  --card-bg: rgba(255,255,255,0.88);
  --card-actions-bg: rgba(246,248,254,0.9);
  --code-bg: rgba(242,244,252,0.9);
  --tag-bg: #d8e0f0;
  --error-bg: #fff5f3;
  --empty-bg: rgba(255,255,255,0.88);
  --footer-border: #c0c8d8;
  --footer-color: #6070a0;
  /* テーマ調整セマンティック色: アクセント赤茶と差別化。danger 和の朱、success 苔色、upcoming 濃紫 */
  --color-danger: #9f1239; --color-danger-rgb: 159,18,57;
  --color-success: #166534; --color-success-rgb: 22,101,52;
  --danger-bg: rgba(159,18,57,0.12);
  --lh-danger: #9f1239; --lh-danger-rgb: 159,18,57;
  --lh-success: #166534; --lh-success-rgb: 22,101,52;
  --lh-warning: #92400e; --lh-warning-rgb: 146,64,14;
  --lh-warning-alt: #b45309; --lh-warning-alt-rgb: 180,83,9;
  --lh-upcoming: #6d28d9; --lh-upcoming-rgb: 109,40,217;
}

/* --- L4: Botanical (green/cream keyboard) --- */
[data-theme="light-botanical"] {
  --sidebar-bg: #1a2818;
  --sidebar-color-strong: #e7ede5;
  --sidebar-color: #cbd9c7;
  --sidebar-color-dim: #a8c0a2;
  --sidebar-color-faint: #678b5f;
  --sidebar-accent: #73c786;
  --sidebar-accent-rgb: 115, 199, 134;
  --body-bg: #f2f4ec;
  --body-gradient: radial-gradient(ellipse at 45% 50%, rgba(120,170,100,0.08) 0%, transparent 50%),
                   linear-gradient(150deg, #f4f6ec 0%, #eef0e6 100%);
  --accent: #2a6838;
  --accent-rgb: 42,104,56;
  --key-led: #48b858;
  --key-led-rgb: 72,184,88;
  --border-color: #c8d4c0;
  --text-primary: #1a2818;
  --text-secondary: #41523c;
  --text-muted: #486740;
  --card-bg: rgba(255,255,252,0.88);
  --card-actions-bg: rgba(248,250,242,0.9);
  --code-bg: rgba(244,248,238,0.9);
  --tag-bg: #d8e4d0;
  --error-bg: #fff5f5;
  --empty-bg: rgba(255,255,252,0.88);
  --footer-border: #c0d0b8;
  --footer-color: #5a7050;
  /* テーマ調整セマンティック色: アクセント緑との被り回避。success はオリーブの濃色で WCAG AA 確保 */
  --color-danger: #b91c1c; --color-danger-rgb: 185,28,28;
  --color-success: #3f6212; --color-success-rgb: 63,98,18;
  --danger-bg: rgba(185,28,28,0.12);
  --lh-danger: #b91c1c; --lh-danger-rgb: 185,28,28;
  --lh-success: #3f6212; --lh-success-rgb: 63,98,18;
  --lh-warning: #92400e; --lh-warning-rgb: 146,64,14;
  --lh-warning-alt: #b45309; --lh-warning-alt-rgb: 180,83,9;
  --lh-upcoming: #6d28d9; --lh-upcoming-rgb: 109,40,217;
}

/* --- L5: Shell White (minimal white keyboard - SIMPLE) --- */
[data-theme="light-shell"] {
  --sidebar-bg: #1a1a1e;
  --sidebar-color-strong: #dfdfe1;
  --sidebar-color: #c9c9cc;
  --sidebar-color-dim: #adadb2;
  --sidebar-color-faint: #797981;
  --sidebar-accent: #98aac5;
  --sidebar-accent-rgb: 152, 170, 197;
  --body-bg: #f6f6f8;
  --body-gradient: linear-gradient(180deg, #f8f8fa 0%, #f2f2f6 100%);
  --accent: #1f2937;
  --accent-rgb: 31,41,55;
  --key-led: #888890;
  --key-led-rgb: 136,136,144;
  --border-color: #dcdce0;
  --text-primary: #1a1a1e;
  --text-secondary: #505058;
  --text-muted: #646468;
  --card-bg: rgba(255,255,255,0.92);
  --card-actions-bg: rgba(248,248,250,0.9);
  --code-bg: rgba(244,244,248,0.9);
  --tag-bg: #e4e4e8;
  --error-bg: #fff5f5;
  --empty-bg: rgba(255,255,255,0.92);
  --footer-border: #d0d0d4;
  --footer-color: #808088;
  /* テーマ調整セマンティック色: ミニマル無彩色 + 白背景。WCAG AA 確保のため濃色寄りで引き締めミニマル感を演出 */
  --color-danger: #b91c1c; --color-danger-rgb: 185,28,28;
  --color-success: #14532d; --color-success-rgb: 20,83,45;
  --danger-bg: rgba(185,28,28,0.12);
  --lh-danger: #b91c1c; --lh-danger-rgb: 185,28,28;
  --lh-success: #14532d; --lh-success-rgb: 20,83,45;
  --lh-warning: #9a3412; --lh-warning-rgb: 154,52,18;
  --lh-warning-alt: #7c2d12; --lh-warning-alt-rgb: 124,45,18;
  --lh-upcoming: #6d28d9; --lh-upcoming-rgb: 109,40,217;
}

/* =============================================
   Player Overlay Variables
   lyrics-scroll / typing-replay 共通
   ============================================= */

/* Light themes: typing area default bg + accent text */
[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"] {
  --typing-bg: var(--body-bg);
  --text-on-accent: #fff;
  /* 用途: warning 面（警告バッジ・アイコンの地色）の上に置く文字色。
     warning 系は light テーマで暗色 (#92400e) / dark テーマで明色 (#fbbf24) に反転するので、
     文字側も反転させないとどちらかで必ず沈む (#fff 固定だと dark 5 テーマで 1.32〜1.67)。
     --text-on-accent と同じ構造。 */
  --text-on-warning: #fff;
}

/* Light themes: player overlay uses theme-consistent light colors */
[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"],
:root {
  --player-surface: rgba(0, 0, 0, 0.04);
  --player-surface-strong: rgba(0, 0, 0, 0.07);
  --player-hover: rgba(0, 0, 0, 0.06);
  --player-border: rgba(0, 0, 0, 0.1);
  --player-scrollbar: rgba(0, 0, 0, 0.12);
  --player-scrollbar-hover: rgba(0, 0, 0, 0.22);
  --player-menu-bg: rgba(255, 255, 255, 0.96);
  --player-menu-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  --player-float-bg: var(--card-bg);
  --player-float-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  --player-spinner-track: rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.15); /* 用途: カードホバー時の浮き上がり影 */
}

:root {
  /* 用途: 積み上げグラフの玉 (.vcover--dot) を球体に見せる縁の陰影。
     ⚠️ テーマで変えない —— 玉の配色は config/vocabulary_covers.yml 由来の固定色で、
     その上に乗る陰影だけがテーマで動くと同じ玉が面ごとに違う立体に見える。
     上から光が当たる想定 (上辺に白ハイライト / 下辺に影) + 接地の落ち影。 */
  --vstack-dot-sphere:
    inset 0 2px 3px rgba(255, 255, 255, 0.45),
    inset 0 -3px 4px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Dark themes: player overlay retains immersive dark style */
[data-theme="dark-carbon"],
[data-theme="dark-synthwave"],
[data-theme="dark-hacker"],
[data-theme="dark-tidal"],
[data-theme="dark-viper"] {
  /* ダーク系 accent は明色 (橙/マゼンタ/ゴールド/ティール/緑) なのでアクセント上の文字色は黒で WCAG AA 確保 */
  --text-on-accent: #1a1a1a;
  --youtube-red-fg: #ff4949;  /* ブランド色 #ff0000 は暗面でも 3.92。明度だけ上げて 4.70 */
  --text-on-warning: #1a1a1a;  /* ダーク系 warning は明色なので黒字（10.43 以上） */
  --player-surface: rgba(255, 255, 255, 0.06);
  --player-surface-strong: rgba(255, 255, 255, 0.1);
  --player-hover: rgba(255, 255, 255, 0.08);
  --player-border: rgba(255, 255, 255, 0.08);
  --player-scrollbar: rgba(255, 255, 255, 0.15);
  --player-scrollbar-hover: rgba(255, 255, 255, 0.25);
  --player-menu-bg: rgba(20, 20, 28, 0.96);
  --player-menu-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --player-float-bg: rgba(30, 30, 36, 0.92);
  --player-float-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  --player-spinner-track: rgba(255, 255, 255, 0.12);
  --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.5); /* 用途: カードホバー時の浮き上がり影。ダーク背景上で視認性確保 */
}

/* =============================================
   Interaction Variables
   汎用インタラクション（ホバー等）。テーブル行・カード・リンク・ボタン等で共通利用
   ============================================= */

[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"],
:root {
  --hover-bg: rgba(0, 0, 0, 0.05); /* 用途: 汎用ホバー背景（テーブル行・カード・リンク等）。ライト系は黒系、ダーク系は白系の薄い半透明 */
  --bg-secondary: rgba(0, 0, 0, 0.05); /* 用途: 副次パネル・入力欄・プログレスバー溝などの弱い背景。テキストは text-primary を継承する前提 */
  --canvas-overlay-backdrop-bg: #d9d4ca; /* 用途: 共同制作スペース拡大表示の余白色（ライト系）。--body-bg より少し濃い不透明グレージュで canvas との境界を作りつつテーマ感を保つ */
  --canvas-overlay-button-bg: #ffffff; /* 用途: 共同制作スペース拡大時の操作ボタン背景（ライト系）。明るい backdrop の上で確実に視認できる白 */
  --input-bg: rgba(255, 255, 255, 0.6); /* 用途: 入力フィールド背景。ライト系は白寄り、ダーク系は黒寄り */
  --color-danger: #b91c1c; /* 用途: エラー・危険色テキスト。ライト系は濃赤で視認性確保 */
  --color-danger-rgb: 185, 28, 28;
  --color-success: #166534; /* 用途: 成功色テキスト。ライト系は深緑（body-bg 上で WCAG AA 確保） */
  --color-success-rgb: 22, 101, 52;
  --danger-bg: rgba(185, 28, 28, 0.12); /* 用途: 危険系の薄い背景 */
  --utatap-pink: #9d174d; /* 用途: うたたっぷモードの識別色。同系 tint(0.12) の上で 4.89（ライト系は濃ピンク） */
  --utatap-pink-rgb: 157, 23, 77;
  /* 用途: ライブイベント関連バッジ・進捗バー色。home 等 live_events.css 非ロードページでも参照されるため theme.css に集約 */
  --lh-success: #166534;
  --lh-success-rgb: 22, 101, 52;
  --lh-danger: #b91c1c;
  --lh-danger-rgb: 185, 28, 28;
  --lh-warning: #92400e;
  --lh-warning-rgb: 146, 64, 14;
  --lh-warning-alt: #b45309;
  --lh-warning-alt-rgb: 180, 83, 9;
  --lh-upcoming: #6d28d9;
  --lh-upcoming-rgb: 109, 40, 217;
  --lh-marker-color: rgba(0, 0, 0, 0.4); /* 用途: 進行バーの閾値マーカー色 */
  --lh-accent: #ca8a04; /* 用途: ピクセルアートコンテスト等のゴールド系 accent。light テーマは濃ゴールド */
  --lh-accent-rgb: 202, 138, 4;
  --lh-track-bg: rgba(0, 0, 0, 0.08); /* 用途: 進行バーや補助バッジの track/chip 背景。light は薄黒、dark は薄白 */
  /* 用途: ライブイベント主催者識別バッジ。テーマ非依存の不透明強色（公式=黄、ユーザー=青）で識別性最大化。テキスト色も対比固定 */
  --lh-official-bg: #ca8a04; --lh-official-fg: #1a1a1a;
  --lh-user-bg: #0e7490; --lh-user-fg: #ffffff;
  /* 用途: メダル色のテキスト用途専用トークン。light テーマでは body 上に WCAG AA 確保のため濃色化。背景用 --medal-gold 等 (application.css) は鮮色のまま維持 */
  /* 2026-08-20: gold は #92670a だと body-gradient の**最明部**で 3.80 と AA を割っていた（計画書 182 Phase 3-2a）。
     色相 41°・彩度そのままで明度だけ下げた。body 面 5.15 / --bg-tertiary 面 4.70 /
     同系 tint(0.10〜0.14) の上でも 4.9 以上。silver は据え置き、bronze は別途調整 */
  --medal-gold-fg: #775307;
  --medal-silver-fg: #5a5a5e;
  --medal-bronze-fg: #83480c; /* 2026-08-20: 同系 tint (0.14) の上で 4.07 だったので明度だけ下げて 4.79（計画書 182 Phase 3-2a） */
  /* 用途: ★評価を**文字・アイコンとして**描くときの色。--star-active (#ffb700) は
     light の body 面で 1.32 しかなく、塗りや glow 用の鮮色としてのみ使う。
     body / card 面で 4.84。メダルの --medal-gold-fg より一段明るいのは
     ★の金らしさを残すため = **--bg-tertiary のような一段暗い面には載せない**（4.34） */
  --star-fg: #7d5808;
  /* 用途: チャンネル属性バッジ。薄背景+濃文字で WCAG AA 確保。light テーマ用 */
  --badge-popular-bg: rgba(255, 59, 48, 0.12);
  --badge-popular-fg: #b91c1c;
  --badge-beginner-bg: rgba(72, 187, 120, 0.12);
  --badge-beginner-fg: #166534;
  --badge-expert-bg: rgba(159, 122, 234, 0.12);
  --badge-expert-fg: #6b21a8;
}

[data-theme="dark-carbon"],
[data-theme="dark-synthwave"],
[data-theme="dark-hacker"],
[data-theme="dark-tidal"],
[data-theme="dark-viper"] {
  --hover-bg: rgba(255, 255, 255, 0.05);
  --bg-secondary: rgba(255, 255, 255, 0.05);
  --canvas-overlay-backdrop-bg: #1a1a1c; /* 用途: 共同制作スペース拡大表示の余白色（ダーク系）。--body-bg と近い濃グレーで canvas との境界を作りつつテーマ感を保つ */
  --canvas-overlay-button-bg: #2a2a2e; /* 用途: 共同制作スペース拡大時の操作ボタン背景（ダーク系）。暗 backdrop の上で確実に視認できる中明度グレー */
  --input-bg: rgba(0, 0, 0, 0.3);
  --color-danger: #ef4444; /* 用途: エラー・危険色テキスト。ダーク系は明赤 */
  --color-danger-rgb: 239, 68, 68;
  --color-success: #22c55e;
  --color-success-rgb: 34, 197, 94;
  --danger-bg: rgba(239, 68, 68, 0.18);
  --utatap-pink: #f472b6; /* 用途: うたたっぷモードの識別色。ダーク系は明ピンク（同系 tint 上で 4.90） */
  --utatap-pink-rgb: 244, 114, 182;
  /* ライブイベントカラーのダーク系上書き */
  --lh-success: #3fb950;
  --lh-success-rgb: 63, 185, 80;
  --lh-danger: #f85149;
  --lh-danger-rgb: 248, 81, 73;
  --lh-warning: #ffc107;
  --lh-warning-rgb: 255, 193, 7;
  --lh-warning-alt: #ff9800;
  --lh-warning-alt-rgb: 255, 152, 0;
  --lh-upcoming: #c084fc;
  --lh-upcoming-rgb: 192, 132, 252;
  /* ダーク系では --lh-upcoming が薄紫のため、UPCOMING タグの文字を黒側に切り替えて WCAG AA 確保 */
  --tag-upcoming-fg: #1a1a1a;
  --lh-marker-color: rgba(255, 255, 255, 0.3);
  --lh-accent: #ffcc22;
  --lh-accent-rgb: 255, 204, 34;
  --lh-track-bg: rgba(255, 255, 255, 0.1);
  /* ダーク系の主催者識別。鮮黄+黒 / 鮮青+白 で WCAG AA 確保 */
  --lh-official-bg: #ffc107; --lh-official-fg: #1a1a1a;
  --lh-user-bg: #22d3ee; --lh-user-fg: #0a1418;
  /* ダーク系: メダル色テキスト用途は鮮色のまま (背景=暗のため視認性 AAA) */
  --medal-gold-fg: #ffd700;
  --medal-silver-fg: #c0c0c0;
  --medal-bronze-fg: #d5883c; /* 2026-08-20: 同系 tint の上で 4.44 だったので明度だけ上げて 4.93（計画書 182 Phase 3-2a） */
  --star-fg: #ffb700; /* 用途: ★評価の文字・アイコン色。dark は --star-active と同値でよい */
  /* ダーク系チャンネル属性バッジ: 薄背景濃く + 明色文字 */
  --badge-popular-bg: rgba(255, 59, 48, 0.18);
  --badge-popular-fg: #fb7185;
  --badge-beginner-bg: rgba(72, 187, 120, 0.18);
  --badge-beginner-fg: #4ade80;
  --badge-expert-bg: rgba(159, 122, 234, 0.18);
  --badge-expert-fg: #c4b5fd;
}

/* =============================================
   命名揺れエイリアス（外部由来コードや旧命名を吸収）
   theme.css 定義済みトークンへの薄いラッパー
   ============================================= */
:root {
  --border: var(--border-color); /* 用途: --border-color のエイリアス */
  --border-default: var(--border-color);
  --border-subtle: var(--border-color);
  --card-border: var(--border-color);
  --accent-color: var(--accent); /* 用途: --accent のエイリアス */
  --accent-primary: var(--accent);
  --primary-color: var(--accent);
  --color-primary: var(--accent);
  --link-color: var(--accent);
  --accent-bg: rgba(var(--accent-rgb), 0.1); /* 用途: アクセント色の薄背景 */
  --text: var(--text-primary); /* 用途: --text-primary のエイリアス */
  --text-color: var(--text-primary);
  --text-tertiary: var(--text-muted);
  --status-text-color: var(--text-primary);
  --bg: var(--body-bg); /* 用途: --body-bg のエイリアス */
  --bg-primary: var(--body-bg);
  --bg-card: var(--card-bg); /* 用途: --card-bg のエイリアス */
  --bg-elevated: var(--card-bg);
  --bg-surface: var(--card-bg);
  --surface-bg: var(--card-bg);
  --surface-color: var(--card-bg);
  --surface-elevated: var(--card-bg);
  --bg-subtle: var(--bg-secondary); /* 用途: --bg-secondary のエイリアス */
  --bg-tertiary: var(--bg-secondary);
  --surface-2: var(--bg-secondary);
  --surface-secondary: var(--bg-secondary);
  --bg-hover: var(--hover-bg); /* 用途: --hover-bg のエイリアス */
  --surface-hover: var(--hover-bg);
  --tag-hover-bg: var(--hover-bg);
  --color-error: var(--color-danger); /* 用途: --color-danger のエイリアス */
  --danger-color: var(--color-danger);
  --danger: var(--color-danger);
  --success-color: var(--color-success);
  --success: var(--color-success);
  --warning-color: var(--color-warning);
  --warning: var(--color-warning);
  --primary: var(--accent);
  --scrollbar: var(--player-scrollbar); /* 用途: --player-scrollbar のエイリアス */
  --star: var(--star-active);
  --star-color-rgb: 255, 183, 0; /* 用途: ★評価のアクティブ色 RGB */
  /* 用途: トップバー検索ボックスのサーフェス色。ライト/ダーク両対応のニュートラル半透明グレー */
  --topbar-search-bg: rgba(128, 128, 128, 0.08);
  --topbar-search-border: rgba(128, 128, 128, 0.15);
  --topbar-search-focus-bg: rgba(128, 128, 128, 0.05);
  --topbar-search-kbd-bg: rgba(128, 128, 128, 0.1);
}

/* =============================================
   Semantic Warning / Gold Tokens
   Beat表示・警告バッジ・ステータス強調に使用
   ============================================= */

[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"],
:root {
  --color-warning: #92400e; /* 用途: 警告・注目（Beat/ペンディング等）の文字色。ライト系テーマで視認性確保のため濃色（全 5 light テーマで WCAG AA 4.5+ 確保） */
  --color-warning-rgb: 146, 64, 14; /* 用途: 警告色の RGB 値。rgba(var(--color-warning-rgb), alpha) 用 */
}

[data-theme="dark-carbon"],
[data-theme="dark-synthwave"],
[data-theme="dark-hacker"],
[data-theme="dark-tidal"],
[data-theme="dark-viper"] {
  --color-warning: #fbbf24; /* 用途: 警告・注目の文字色。ダーク系テーマでは明色 */
  --color-warning-rgb: 251, 191, 36;
}

/* =============================================
   Semantic Info Tokens
   対戦のエンジョイモード・進行中ステータスなど「中立の情報」を表す青系。
   もとは #2563eb / #3b82f6 のリテラル直書きで、**10 テーマ中 7 テーマで
   WCAG AA (4.5) を割っていた**（ダーク 5 テーマは 3.43〜3.75）。
   warning と同じく light / dark で明度を振り分ける。
   ============================================= */

[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"],
:root {
  --color-info: #1d4ed8; /* 用途: 情報・中立ステータスの文字色。ライト系は濃青（全 5 light テーマで body-bg / card-bg 上とも WCAG AA 5.5+ 確保） */
  --color-info-rgb: 29, 78, 216; /* 用途: 情報色の RGB 値。rgba(var(--color-info-rgb), alpha) 用 */
}

[data-theme="dark-carbon"],
[data-theme="dark-synthwave"],
[data-theme="dark-hacker"],
[data-theme="dark-tidal"],
[data-theme="dark-viper"] {
  --color-info: #58a6ff; /* 用途: 情報・中立ステータスの文字色。ダーク系は明青（全 5 dark テーマで AA 7.0+ 確保）。値はライブイベントの --lh-info と同一（情報色をサイト内で 1 組に保つ） */
  --color-info-rgb: 88, 166, 255;
}

/* =============================================
   Keyboard Pagination Variables
   pagination-plate / keycap 共通
   ============================================= */

/* Light themes: keyboard pagination */
[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"],
:root {
  --plate-bg: rgba(255, 255, 255, 0.7);
  --plate-border: rgba(0, 0, 0, 0.1);
  --plate-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --plate-led-gradient: linear-gradient(90deg, transparent, rgba(var(--key-led-rgb), 0.4), transparent);
  --plate-led-opacity: 0.6;
  --keycap-bg: rgba(255, 255, 255, 0.9);
  --keycap-color: var(--text-primary);
  --keycap-border: rgba(0, 0, 0, 0.12);
  --keycap-shadow: rgba(0, 0, 0, 0.1);
  --keycap-shine: rgba(255, 255, 255, 0.8);
  --keycap-active-bg: var(--accent);
  --keycap-active-color: #fff;
  --keycap-active-border: var(--accent);
  --keycap-active-glow: 0 0 8px rgba(var(--key-led-rgb), 0.3);
  --keycap-active-text-glow: 0 0 4px rgba(255, 255, 255, 0.3);
}

/* Dark themes: keyboard pagination */
[data-theme="dark-carbon"],
[data-theme="dark-synthwave"],
[data-theme="dark-hacker"],
[data-theme="dark-tidal"],
[data-theme="dark-viper"] {
  --plate-bg: rgba(0, 0, 0, 0.4);
  --plate-border: rgba(255, 255, 255, 0.08);
  --plate-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --plate-led-gradient: linear-gradient(90deg, transparent, rgba(var(--key-led-rgb), 0.5), transparent);
  --plate-led-opacity: 0.8;
  --keycap-bg: rgba(255, 255, 255, 0.06);
  --keycap-color: var(--text-primary);
  --keycap-border: rgba(255, 255, 255, 0.1);
  --keycap-shadow: rgba(0, 0, 0, 0.4);
  --keycap-shine: rgba(255, 255, 255, 0.06);
  --keycap-active-bg: rgba(var(--key-led-rgb), 0.2);
  --keycap-active-color: rgb(var(--key-led-rgb));
  --keycap-active-border: rgba(var(--key-led-rgb), 0.5);
  --keycap-active-glow: 0 0 12px rgba(var(--key-led-rgb), 0.3);
  --keycap-active-text-glow: 0 0 6px rgba(var(--key-led-rgb), 0.4);
}

/* --- D1: Carbon (industrial charcoal/orange keyboard) --- */
[data-theme="dark-carbon"] {
  --sidebar-bg: #0e0e10;
  --sidebar-color-strong: #d4d4d4;
  --sidebar-color: #bfbfbf;
  --sidebar-color-dim: #a3a3a3;
  --sidebar-color-faint: #727272;
  --sidebar-accent: #e8742a;
  --sidebar-accent-rgb: 232, 116, 42;
  --sidebar-active-color: #ffd0a0;
  --sidebar-active-bg: rgba(232,116,42,0.1);
  --sidebar-hover-bg: rgba(232,116,42,0.05);
  --sidebar-border: rgba(232,116,42,0.08);
  --sidebar-profile-bg: rgba(232,116,42,0.06);
  --topbar-bg: rgba(18,18,20,0.95);
  --topbar-shadow: 0 1px 4px rgba(0,0,0,0.4);
  --body-bg: #141416;
  --body-gradient: radial-gradient(ellipse at 65% 30%, rgba(232,116,42,0.08) 0%, transparent 50%),
                   linear-gradient(150deg, #1a1a1c 0%, #121214 100%);
  --accent: #e8742a;
  --accent-rgb: 232,116,42;
  --key-led: #ff8c3c;
  --key-led-rgb: 255,140,60;
  --border-color: #2a2a2e;
  --text-primary: #e0dcd8;
  --text-secondary: #aaa6a2;
  --text-muted: #999490;
  --card-bg: rgba(24,24,28,0.88);
  --card-actions-bg: rgba(18,18,22,0.9);
  --code-bg: rgba(14,14,16,0.9);
  --tag-bg: #2a2828;
  --error-bg: #401818;
  --empty-bg: rgba(24,24,28,0.88);
  --footer-border: #2a2a2e;
  --footer-color: #787470;
  /* テーマ調整セマンティック色: 工業オレンジアクセント。color-* と lh-* で値を統一。warning-alt はクラレット赤茶でアクセント橙と差別化 */
  --color-danger: #f87171; --color-danger-rgb: 248,113,113;
  --color-success: #4ade80; --color-success-rgb: 74,222,128;
  --danger-bg: rgba(248,113,113,0.18);
  --lh-danger: #f87171; --lh-danger-rgb: 248,113,113;
  --lh-success: #4ade80; --lh-success-rgb: 74,222,128;
  --lh-warning: #facc15; --lh-warning-rgb: 250,204,21;
  --lh-warning-alt: #d97706; --lh-warning-alt-rgb: 217,119,6;
  --lh-upcoming: #a78bfa; --lh-upcoming-rgb: 167,139,250;
}

/* --- D2: Synthwave (retro synthwave magenta/cyan keyboard) --- */
[data-theme="dark-synthwave"] {
  --sidebar-bg: #0a0818;
  --sidebar-color-strong: #d6cee1;
  --sidebar-color: #c4b8d3;
  --sidebar-color-dim: #a998bf;
  --sidebar-color-faint: #7e659f;
  --sidebar-accent: #ea58a1;
  --sidebar-accent-rgb: 234, 88, 161;
  --sidebar-active-color: #ffb0e0;
  --sidebar-active-bg: rgba(232,72,152,0.1);
  --sidebar-hover-bg: rgba(232,72,152,0.05);
  --sidebar-border: rgba(200,60,160,0.08);
  --sidebar-profile-bg: rgba(200,60,160,0.06);
  --topbar-bg: rgba(14,10,28,0.95);
  --topbar-shadow: 0 1px 4px rgba(0,0,0,0.5);
  --body-bg: #100e20;
  --body-gradient: radial-gradient(ellipse at 60% 25%, rgba(232,72,152,0.1) 0%, transparent 45%),
                   radial-gradient(ellipse at 30% 70%, rgba(64,216,240,0.06) 0%, transparent 45%),
                   linear-gradient(150deg, #161228 0%, #0e0c1c 100%);
  --accent: #ea58a1;
  --accent-rgb: 234,88,161;
  --key-led: #e84898;
  --key-led-rgb: 232,72,152;
  --border-color: #2a2040;
  --text-primary: #e0d8f0;
  --text-secondary: #b09bc6;
  --text-muted: #998ab3;
  --card-bg: rgba(20,16,36,0.88);
  --card-actions-bg: rgba(16,12,28,0.9);
  --code-bg: rgba(12,10,22,0.9);
  --tag-bg: #282040;
  --error-bg: #401028;
  --empty-bg: rgba(20,16,36,0.88);
  --footer-border: #282040;
  --footer-color: #705898;
  /* テーマ調整セマンティック色: ネオン世界。danger は赤紫寄り、success はネオン緑、warning はネオン黄、upcoming はマゼンタに近い紫 */
  --color-danger: #ff5577; --color-danger-rgb: 255,85,119;
  --color-success: #4ade80; --color-success-rgb: 74,222,128;
  --danger-bg: rgba(255,85,119,0.18);
  --lh-danger: #ff5577; --lh-danger-rgb: 255,85,119;
  --lh-success: #4ade80; --lh-success-rgb: 74,222,128;
  --lh-warning: #fde047; --lh-warning-rgb: 253,224,71;
  --lh-warning-alt: #fb923c; --lh-warning-alt-rgb: 251,146,60;
  --lh-upcoming: #c084fc; --lh-upcoming-rgb: 192,132,252;
  /* マゼンタ key-led の半透明背景上では同色文字が WCAG NG なので、白寄りピンクに上書き */
  --keycap-active-color: #ffd0e8;
}

/* --- D3: Hacker (minimal black/gold keyboard - SIMPLE) --- */
[data-theme="dark-hacker"] {
  --sidebar-bg: #0a0a0c;
  --sidebar-color-strong: #d1d1d4;
  --sidebar-color: #bcbcc1;
  --sidebar-color-dim: #9f9fa6;
  --sidebar-color-faint: #6f6f78;
  --sidebar-accent: #b8a060;
  --sidebar-accent-rgb: 184, 160, 96;
  --sidebar-active-color: #d8d0c0;
  --sidebar-active-bg: rgba(200,180,120,0.08);
  --sidebar-hover-bg: rgba(200,180,120,0.04);
  --sidebar-border: rgba(160,150,120,0.06);
  --sidebar-profile-bg: rgba(160,150,120,0.05);
  --topbar-bg: rgba(14,14,16,0.96);
  --topbar-shadow: 0 1px 4px rgba(0,0,0,0.4);
  --body-bg: #121214;
  --body-gradient: linear-gradient(180deg, #161618 0%, #101012 100%);
  --accent: #b8a060;
  --accent-rgb: 184,160,96;
  --key-led: #c8b070;
  --key-led-rgb: 200,176,112;
  --border-color: #242428;
  --text-primary: #d0ccc4;
  --text-secondary: #9e9b97;
  --text-muted: #8d8985;
  --card-bg: rgba(20,20,24,0.88);
  --card-actions-bg: rgba(16,16,18,0.9);
  --code-bg: rgba(12,12,14,0.9);
  --tag-bg: #242424;
  --error-bg: #310f0f;
  --empty-bg: rgba(20,20,24,0.88);
  --footer-border: #242428;
  --footer-color: #686460;
  /* テーマ調整セマンティック色: ターミナル感。success はクラシックなターミナル緑、warning はゴールドアクセントと差別化された黄 */
  --color-danger: #f04b4b; --color-danger-rgb: 240,75,75;
  --color-success: #4ade80; --color-success-rgb: 74,222,128;
  --danger-bg: rgba(239,68,68,0.18);
  --lh-danger: #f04b4b; --lh-danger-rgb: 240,75,75;
  --lh-success: #4ade80; --lh-success-rgb: 74,222,128;
  --lh-warning: #fbbf24; --lh-warning-rgb: 251,191,36;
  --lh-warning-alt: #fb923c; --lh-warning-alt-rgb: 251,146,60;
  --lh-upcoming: #a78bfa; --lh-upcoming-rgb: 167,139,250;
}

/* --- D4: Tidal (deep teal/neon green ocean keyboard) --- */
[data-theme="dark-tidal"] {
  --sidebar-bg: #060e12;
  --sidebar-color-strong: #bdd9d7;
  --sidebar-color: #9dc6c4;
  --sidebar-color-dim: #70acaa;
  --sidebar-color-faint: #477a78;
  --sidebar-accent: #28c8a0;
  --sidebar-accent-rgb: 40, 200, 160;
  --sidebar-active-color: #b0f0d8;
  --sidebar-active-bg: rgba(48,240,160,0.08);
  --sidebar-hover-bg: rgba(48,240,160,0.04);
  --sidebar-border: rgba(40,180,130,0.08);
  --sidebar-profile-bg: rgba(40,180,130,0.05);
  --topbar-bg: rgba(10,18,20,0.95);
  --topbar-shadow: 0 1px 4px rgba(0,0,0,0.4);
  --body-bg: #0a1418;
  --body-gradient: radial-gradient(ellipse at 45% 40%, rgba(48,240,160,0.06) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 70%, rgba(20,100,80,0.08) 0%, transparent 45%),
                   linear-gradient(160deg, #0e1a1e 0%, #0a1418 50%, #060e10 100%);
  --accent: #28c8a0;
  --accent-rgb: 40,200,160;
  --key-led: #30f0a0;
  --key-led-rgb: 48,240,160;
  --border-color: #1a2e30;
  --text-primary: #c8e8e0;
  --text-secondary: #88b8a8;
  --text-muted: #64a090;
  --card-bg: rgba(14,24,28,0.88);
  --card-actions-bg: rgba(10,18,22,0.9);
  --code-bg: rgba(8,14,18,0.9);
  --tag-bg: #1a2e2e;
  --error-bg: #3a1520;
  --empty-bg: rgba(14,24,28,0.88);
  --footer-border: #1a2e30;
  --footer-color: #608878;
  /* テーマ調整セマンティック色: ティールアクセントとの被り回避。success は薄緑、warning-alt は深海珊瑚ピンクで海要素を維持 */
  --color-danger: #f87171; --color-danger-rgb: 248,113,113;
  --color-success: #86efac; --color-success-rgb: 134,239,172;
  --danger-bg: rgba(248,113,113,0.16);
  --lh-danger: #f87171; --lh-danger-rgb: 248,113,113;
  --lh-success: #86efac; --lh-success-rgb: 134,239,172;
  --lh-warning: #fbbf24; --lh-warning-rgb: 251,191,36;
  --lh-warning-alt: #fb7185; --lh-warning-alt-rgb: 251,113,133;
  --lh-upcoming: #a78bfa; --lh-upcoming-rgb: 167,139,250;
}

/* --- D5: Viper (gaming black/vivid green keyboard) --- */
[data-theme="dark-viper"] {
  --sidebar-bg: #080a08;
  --sidebar-color-strong: #c4d6c4;
  --sidebar-color: #aac3aa;
  --sidebar-color-dim: #85a885;
  --sidebar-color-faint: #557955;
  --sidebar-accent: #00cc44;
  --sidebar-accent-rgb: 0, 204, 68;
  --sidebar-active-color: #c0ffc0;
  --sidebar-active-bg: rgba(0,255,85,0.08);
  --sidebar-hover-bg: rgba(0,255,85,0.04);
  --sidebar-border: rgba(0,200,50,0.06);
  --sidebar-profile-bg: rgba(0,200,50,0.05);
  --topbar-bg: rgba(12,14,12,0.96);
  --topbar-shadow: 0 1px 4px rgba(0,0,0,0.5);
  --body-bg: #0c0e0c;
  --body-gradient: radial-gradient(ellipse at 50% 40%, rgba(0,255,85,0.05) 0%, transparent 45%),
                   linear-gradient(180deg, #101210 0%, #080a08 100%);
  --accent: #00cc44;
  --accent-rgb: 0,204,68;
  --key-led: #00ff55;
  --key-led-rgb: 0,255,85;
  --border-color: #1a2a1a;
  --text-primary: #d0e0d0;
  --text-secondary: #90a890;
  --text-muted: #769576;
  --card-bg: rgba(16,20,16,0.88);
  --card-actions-bg: rgba(12,16,12,0.9);
  --code-bg: rgba(10,12,10,0.9);
  --tag-bg: #1a2a1a;
  --error-bg: #330e11;
  --empty-bg: rgba(16,20,16,0.88);
  --footer-border: #1a2a1a;
  --footer-color: #608060;
  /* テーマ調整セマンティック色: 鮮緑アクセントとの被り回避。success はライム/黄緑寄りで識別 */
  --color-danger: #f05454; --color-danger-rgb: 240,84,84;
  --color-success: #a3e635; --color-success-rgb: 163,230,53;
  --danger-bg: rgba(239,68,68,0.18);
  --lh-danger: #f05454; --lh-danger-rgb: 240,84,84;
  --lh-success: #a3e635; --lh-success-rgb: 163,230,53;
  --lh-warning: #facc15; --lh-warning-rgb: 250,204,21;
  --lh-warning-alt: #fb923c; --lh-warning-alt-rgb: 251,146,60;
  --lh-upcoming: #c084fc; --lh-upcoming-rgb: 192,132,252;
}

/* =============================================
   Section Tag / Card Overlay / Rating Tokens
   セクションタグ（HOT/NEW/KIDS）、サムネオーバーレイ、★評価、SEO 番号で共用
   ============================================= */
:root {
  --star-active: #ffb700; /* 用途: ★評価のアクティブ色 */
  --star-inactive: #767676; /* 用途: ★評価の非アクティブ色（5 段中いくつ点いているかを読むための地）。⚠️ rgba(128,128,128,.3) は全 10 テーマで 1.33〜1.51 だった。light / dark どちらの面でも 3.42 以上になる中間グレーにする（計画書 182 Phase 4） */

  --tag-hot-bg: #dc2626; /* 用途: セクションタグ HOT 背景（人気セクション） */
  --tag-hot-fg: #ffffff; /* 用途: セクションタグ HOT 文字 */
  --tag-new-bg: var(--accent); /* 用途: セクションタグ NEW 背景（新着セクション、テーマアクセント連動） */
  --tag-new-fg: var(--text-on-accent); /* 用途: セクションタグ NEW 文字 */
  --tag-kids-bg: #f59e0b; /* 用途: セクションタグ KIDS 背景（キッズ・初心者セクション） */
  --tag-kids-fg: #1a1a1a; /* 用途: セクションタグ KIDS 文字。⚠️ 地の #f59e0b は明るいので #ffffff だと 2.15。暗い文字で 8.10（計画書 182 Phase 4） */
  --tag-live-bg: #15803d; /* 用途: セクションタグ LIVE 背景（開催中ライブイベント）。⚠️ #16a34a だと --tag-live-fg(#ffffff) が 3.30。1 段濃い緑で 5.02（計画書 182 Phase 4） */
  --tag-live-fg: #ffffff; /* 用途: セクションタグ LIVE 文字 */
  --tag-upcoming-bg: var(--lh-upcoming); /* 用途: セクションタグ UPCOMING 背景（開催予定ライブイベント）。--lh-upcoming のテーマ別値を共有 */
  --tag-upcoming-fg: #ffffff; /* 用途: セクションタグ UPCOMING 文字。light テーマのデフォルト（濃紫上の白）。dark テーマでは #1a1a1a に上書き（薄紫上の黒） */

  --card-overlay-bg: rgba(0, 0, 0, 0.78); /* 用途: 動画カードのサムネオーバーレイ背景（時間バッジ・プロフィールのチャンネル名）。サムネ画像の上に載せるため全テーマ共通の暗色 */
  --card-overlay-fg: #f0f0f0; /* 用途: 動画カードオーバーレイ文字色（ライト/ダーク共通） */
  --card-overlay-border: rgba(255, 255, 255, 0.08); /* 用途: 動画カードオーバーレイ枠線 */
  --canvas-overlay-button-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); /* 用途: 共同制作スペース拡大時の操作ボタン影。テーマ問わず canvas 背景画像の上で視認性確保 */
  --avatar-initial-fg: #ffffff; /* 用途: イニシャルアバター（アイコン未設定ユーザー）の文字色。背景は hsl 固定色なのでテーマ問わず白 */
  /* 用途: イニシャルアバター背景 hsl(<hue> 55% L) の L。⚠️ **色相の式は Ruby(UserAvatarHelper::
     AVATAR_HUE_STEP)と JS で共有していて「同じ人は同じ色」を保証しているので、動かすのは明度だけ**。
     45% だと黄〜緑〜シアンの色相帯（184/360）で白文字が AA 未満（最悪 2.26 = h60 の黄）だった。
     30% で全 360 色相が 4.72 以上（計画書 182 Phase 3-5）。 */
  --avatar-initial-l: 30%;

  --seo-num-color: var(--text-muted); /* 用途: SEO セクションの項目番号 (01, 02...) 色 */

  --trophy-gold: #ffb700; /* 用途: 動画カードのゴールドトロフィー色 */
  --trophy-gold-rgb: 255, 183, 0; /* 用途: ゴールドトロフィーの RGB 値（rgba()合成用） */
  --trophy-silver: #d0d0d0; /* 用途: 動画カードのシルバートロフィー色 */
  --trophy-silver-rgb: 208, 208, 208; /* 用途: シルバートロフィーの RGB 値（rgba()合成用） */
  --trophy-bronze: #b8722c; /* 用途: 動画カードのブロンズトロフィー色 */
  --trophy-bronze-rgb: 184, 114, 44; /* 用途: ブロンズトロフィーの RGB 値（rgba()合成用） */
  --trophy-white-rgb: 128, 128, 128; /* 用途: CLEARランクの中立グレー RGB 値 */

  /* メダル色（テーマ非依存固定値）。ランキング 1/2/3 位のメダル背景・グラデーション・上の文字色 */
  --medal-gold: #ffd700; /* 用途: ゴールドメダル基本色（メダル背景） */
  --medal-gold-dim: #f0c800; /* 用途: ゴールドメダルのグラデーション終端 */
  --medal-gold-text: #5a3e00; /* 用途: ゴールドメダル背景の上に乗せる文字色 */
  --medal-silver: #c0c0c0; /* 用途: シルバーメダル基本色 */
  --medal-silver-dim: #e8e8e8; /* 用途: シルバーメダルのグラデーション終端 */
  --medal-silver-text: #444; /* 用途: シルバーメダル背景の上に乗せる文字色 */
  --medal-bronze: #cd7f32; /* 用途: ブロンズメダル基本色 */
  --medal-bronze-dim: #e8a060; /* 用途: ブロンズメダルのグラデーション終端 */
  --medal-bronze-text: #2e1f00; /* 用途: ブロンズメダル背景の上に乗せる文字色。⚠️ #fff はブロンズ地で 2.18 だった。金 (#5a3e00) / 銀 (#444) と同じ「暗い文字」に揃えて 5.09（計画書 182 Phase 4） */

  /* ブランド・固定ステータス色（テーマ非依存固定値） */
  --youtube-red: #ff0000; /* 用途: YouTube アイコン・装飾（ブランドカラーそのもの）。文字色には使わない */
  /* 用途: YouTube リンクの**文字色**。ブランド色 #ff0000 はテーマ追従面で 3.01 しかないので、
     色相・彩度を保って明度だけ下げた版を持つ（--medal-*-fg / --star-fg と同じ形）。
     dark テーマはブランド色のままで足りている（3.92→ここでは 4.6 以上を確保） */
  --youtube-red-fg: #c40000;
  --success-green: #22c55e; /* 用途: タイピング成功・rank.great 等の固定グリーン強調 */

  /* 用途: 装飾的な警告色背景の RGB 値（薄い背景・ボーダー・光彩用）。テーマ非依存の鮮黄で UX 識別性優先。
     文字色用途は --color-warning（テーマ別、light で AA 確保のため濃色）を使う */
  --warning-soft-bg-rgb: 255, 193, 7;
  /* 用途: 警告バッジ・ボタンの強い背景色。テーマ非依存の鮮黄 + 黒文字で UX 識別を優先。
     light テーマでは --color-warning が濃オレンジ茶のため、 元 Bootstrap 鮮黄バッジを再現する用途で使う */
  --warning-badge-bg: #ffc107;
  --warning-badge-fg: #000;

  --modal-panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); /* 用途: パネル（SEO詳細パネル等）の影 */
}

/* =============================================
   Medal Glow Shadow（テーマ別）
   ライト背景では光彩が薄くなるため alpha を強める
   ============================================= */
[data-theme="light-classic"],
[data-theme="light-slate"],
[data-theme="light-sakana"],
[data-theme="light-botanical"],
[data-theme="light-shell"],
:root {
  --medal-gold-shadow: rgba(255, 215, 0, 0.6); /* 用途: ゴールドメダル box-shadow の光彩。ライト系で視認性を確保するため強め */
}

[data-theme="dark-carbon"],
[data-theme="dark-synthwave"],
[data-theme="dark-hacker"],
[data-theme="dark-tidal"],
[data-theme="dark-viper"] {
  --medal-gold-shadow: rgba(255, 215, 0, 0.4); /* 用途: ゴールドメダル box-shadow の光彩。ダーク系では控えめでも光って見える */
}

/* =============================================
   Shared Custom Icons (used in live events + admin)
   CSS mask-image approach — inherits color from currentColor
   ============================================= */
.icon-penlight,
.icon-uchiwa,
.icon-bouquet,
.icon-firework,
.icon-confetti {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -.125em;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.icon-penlight {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='6' y='0' width='4' height='10' rx='2'/%3E%3Crect x='6.5' y='9' width='3' height='6.5' rx='1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='6' y='0' width='4' height='10' rx='2'/%3E%3Crect x='6.5' y='9' width='3' height='6.5' rx='1'/%3E%3C/svg%3E");
}
.icon-uchiwa {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='6.5' r='6'/%3E%3Crect x='6.75' y='11.5' width='2.5' height='4' rx='1.25'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='6.5' r='6'/%3E%3Crect x='6.75' y='11.5' width='2.5' height='4' rx='1.25'/%3E%3C/svg%3E");
}
.icon-bouquet {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='4.8' cy='4' r='2.8'/%3E%3Ccircle cx='11.2' cy='4' r='2.8'/%3E%3Ccircle cx='8' cy='1.8' r='2.8'/%3E%3Ccircle cx='8' cy='5.5' r='2'/%3E%3Cpath d='M4 7.5 L12 7.5 L10.5 15 L5.5 15 Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='4.8' cy='4' r='2.8'/%3E%3Ccircle cx='11.2' cy='4' r='2.8'/%3E%3Ccircle cx='8' cy='1.8' r='2.8'/%3E%3Ccircle cx='8' cy='5.5' r='2'/%3E%3Cpath d='M4 7.5 L12 7.5 L10.5 15 L5.5 15 Z'/%3E%3C/svg%3E");
}
.icon-firework {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='7' r='1.5'/%3E%3Cline x1='8' y1='2' x2='8' y2='4.5' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='8' y1='9.5' x2='8' y2='12' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='3' y1='7' x2='5.5' y2='7' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='10.5' y1='7' x2='13' y2='7' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='4.5' y1='3.5' x2='6' y2='5' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='10' y1='9' x2='11.5' y2='10.5' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='10' y1='5' x2='11.5' y2='3.5' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='4.5' y1='10.5' x2='6' y2='9' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='8' y1='13' x2='8' y2='15.5' stroke='black' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='7' r='1.5'/%3E%3Cline x1='8' y1='2' x2='8' y2='4.5' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='8' y1='9.5' x2='8' y2='12' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='3' y1='7' x2='5.5' y2='7' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='10.5' y1='7' x2='13' y2='7' stroke='black' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='4.5' y1='3.5' x2='6' y2='5' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='10' y1='9' x2='11.5' y2='10.5' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='10' y1='5' x2='11.5' y2='3.5' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='4.5' y1='10.5' x2='6' y2='9' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='8' y1='13' x2='8' y2='15.5' stroke='black' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
}
.icon-confetti {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='2' width='4' height='1.8' rx='.4' transform='rotate(25 3 2.9)'/%3E%3Crect x='9' y='1' width='3.5' height='1.8' rx='.4' transform='rotate(-20 10.75 1.9)'/%3E%3Crect x='10' y='7' width='4' height='1.8' rx='.4' transform='rotate(40 12 7.9)'/%3E%3Crect x='1' y='9' width='3.5' height='1.8' rx='.4' transform='rotate(-30 2.75 9.9)'/%3E%3Crect x='5' y='5.5' width='4' height='1.8' rx='.4' transform='rotate(10 7 6.4)'/%3E%3Crect x='7' y='11' width='4' height='1.8' rx='.4' transform='rotate(-15 9 11.9)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='1' y='2' width='4' height='1.8' rx='.4' transform='rotate(25 3 2.9)'/%3E%3Crect x='9' y='1' width='3.5' height='1.8' rx='.4' transform='rotate(-20 10.75 1.9)'/%3E%3Crect x='10' y='7' width='4' height='1.8' rx='.4' transform='rotate(40 12 7.9)'/%3E%3Crect x='1' y='9' width='3.5' height='1.8' rx='.4' transform='rotate(-30 2.75 9.9)'/%3E%3Crect x='5' y='5.5' width='4' height='1.8' rx='.4' transform='rotate(10 7 6.4)'/%3E%3Crect x='7' y='11' width='4' height='1.8' rx='.4' transform='rotate(-15 9 11.9)'/%3E%3C/svg%3E");
}

/* =============================================
   ユーティリティクラス
   ERB の inline style を排除するための共通クラス
   JS は target.classList.toggle('is-hidden', cond) で表示制御する
   ============================================= */
.is-hidden { display: none !important; } /* design-allow: bang-important */
.is-inline { display: inline; } /* 用途: form タグ等で inline 配置を強制（ERB の style="display:inline" 代替） */

/* =============================================
   印刷スタイル（インク節約・可読性確保）
   ============================================= */
@media print {
  :root {
    --body-bg: #ffffff;
    --body-gradient: none;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;
    --card-bg: #ffffff;
    --border-color: #cccccc;
    --bg-secondary: #f5f5f5;
    --hover-bg: transparent;
  }
  /* design-allow-start: bang-important */
  body { background: #ffffff !important; color: #000000 !important; }
  .sidebar, .admin-sidebar, .topbar, .cookie-consent-banner, .feedback-bar,
  .ad-slot, .pickup-events-scroll-wrapper, .mini-venue,
  .notification-panel, .notification-panel-overlay, .theme-panel, .theme-overlay,
  .live-event-card video {
    display: none !important;
  }
  /* design-allow-end: bang-important */
  a { color: #000000; text-decoration: underline; }
}

/* =============================================
   Forced Colors (Windows ハイコントラスト)
   OS の系統色を尊重しつつ、状態色とフォーカスリングだけ保護
   ============================================= */
@media (forced-colors: active) {
  :root {
    --accent: LinkText;
    --text-primary: CanvasText;
    --text-secondary: CanvasText;
    --text-muted: GrayText;
    --border-color: CanvasText;
    --card-bg: Canvas;
    --body-bg: Canvas;
    --hover-bg: Highlight;
  }
  /* フォーカス可視性を OS 強制色に追従 */
  :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}

/* =============================================
   通報ボタン (非対戦チャット共通)
   chat-report-btn は battle_lobby / live_event_lobby /
   live_event_detail / collab_space から共有利用
   ============================================= */
.chat-report-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  opacity: 0.45;
  margin-left: 0.25rem;
  transition: opacity 0.15s, color 0.15s;
}
.chat-report-btn:hover {
  color: var(--danger);
  opacity: 1;
}
.chat-report-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* =============================================
   モデレーション bot メッセージ (審判くん) 共通スタイル
   battle_lobby (.lobby-chat-msg--bot) /
   live_event 系・collab_space (.le-chat-msg--bot) で利用
   ============================================= */
.lobby-chat-msg--bot,
.le-chat-msg--bot {
  border-left: 3px solid var(--accent);
  padding-left: 0.4rem;
  background: var(--bg-secondary);
}
.lobby-chat-msg-user--bot,
.le-chat-msg-user--bot {
  color: var(--accent);
  font-weight: 600;
}

/* =============================================
   Global Flash（計画書 189 §8.1 / 189-2）
   exceptions_app が turbo-stream で差し込む先。application / admin / auth の
   3 レイアウト共通で使うので、3 つすべてが読む theme.css に置く
   （layout.css は auth が読まない）。
   ⚠️ 空のあいだは何も描かない。position: fixed なので CLS も起こさない
   ============================================= */
.global-flash {
  position: fixed;
  top: calc(var(--topbar-height) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10050; /* custom_dialog (10000) / pixel_art_editor (10002) より上。送信失敗はモーダルの上でも伝える */
  width: min(92vw, 30rem);
  /* ⚠️ 空コンテナがトップバーのクリックを奪わないよう、素通しにする（本文側で auto に戻す） */
  pointer-events: none;
}

/* 配色は .flash-alert（layout.css）と同じ対トークンに揃える（WCAG 検証済みの組み合わせ） */
.global-flash__item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid rgba(var(--color-danger-rgb), 0.3);
  border-radius: 8px;
  box-shadow: var(--plate-shadow);
  color: var(--color-danger);
  font-size: 0.85rem;
  line-height: 1.6;
  pointer-events: auto;
}
.global-flash__item i { flex-shrink: 0; margin-top: 0.15rem; }
.global-flash__body { flex: 1; min-width: 0; }
.global-flash__status { color: var(--text-muted); margin-left: 0.4rem; font-size: 0.75rem; }
.global-flash__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.6;
}
.global-flash__close:hover { opacity: 1; }
/* layout.css */
/* ===========================
   Layout Styles
   =========================== */

/* === Body === */
body {
  background: var(--body-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-feature-settings: "palt";
  margin: 0;
  transition: background 0.4s, color 0.3s;
}

/* 等幅フォント要素では palt を無効化（数値の幅揃え維持） */
code, kbd, samp, pre,
[class*="mono"], .stat-item, .stat-value, .stats-value,
input[type="number"], [type="text"].mono {
  font-feature-settings: normal;
}

/* === Sidebar === */
/* design-allow-start: color-literal */
/* メインサイドバー (.sidebar) はダーク固定背景前提。--sidebar-bg/--sidebar-color と組み合わせる白半透明テキスト・ボーダー・スクロールバーはテーマ非依存 */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-color);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  /* 初期描画 / Turbo 差し替え直後の transition 発火を防ぐため、
     is-hydrated 付与後にだけ transition を有効化する */
  transition: none;
}
body.is-hydrated .sidebar {
  transition: background-color 0.3s, transform 0.3s ease;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand a {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
}

/* Sidebar Profile */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
  background: var(--sidebar-profile-bg);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-profile-avatar {
  font-size: 1.75rem;
  color: var(--sidebar-color-dim);
  flex-shrink: 0;
}

.sidebar-profile-info {
  flex: 1;
  min-width: 0;
}

.sidebar-profile-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-email {
  font-size: 0.6875rem;
  color: var(--sidebar-color-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 計画書 137 §6.1: モード切替 1 ボタン (profile 直下、両モード共通)。
   クリックで現在モードと反対側に切替。
   上段 = 現在のモード、下段 = 切替先のモード の 2 段。
   ⚠️ 最初は gap 0.15rem で 2 行を並べただけだったが、行間が詰まって
      「1 つの文章が折り返している」ようにしか見えなかった。
      2 段の差は余白ではなく**面**で付ける: 上段はサイドバー既存のアクティブ表現
      (背景 + 左バー + 太字、.sidebar-item.active と同じ語彙) を纏い、
      下段は素地のまま区切り線の下に置く。 */
.sidebar-mode-toggle {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: calc(100% - 1.5rem);
  margin: 0.5rem 0.75rem;
  /* ⚠️ .sidebar は縦 flex なので、子はデフォルトで flex-shrink: 1 = 縮む。
     ボタン自身が padding を持っていた頃はその分の高さが残っていたが、padding を
     各段へ移したらモバイル幅 (中身が縦に溢れる) で高さ 0 まで潰れ、overflow: hidden と
     相まって**金色の線 1 本になって消えた**。.sidebar-brand / .sidebar-terms と同じく縮ませない */
  flex-shrink: 0;
  /* 各段が自分の padding を持ち、面いっぱいに背景と区切り線を敷く */
  padding: 0;
  /* ⚠️ --accent-rgb は light テーマだと濃色で、サイドバーの暗地では枠が 1.05〜1.30 と
     ほぼ見えなかった。サイドバー世界のアクセントに置き換える（3.44） */
  border: 1px solid rgba(var(--sidebar-accent-rgb), 0.7);
  border-radius: var(--card-radius);
  /* 角丸の内側に上段の背景を収める */
  overflow: hidden;
  background: transparent;
  /* サイドバーは light テーマでも暗背景 (--sidebar-bg)。body 面用の --text-primary を置くと
     light 5 テーマで 1.00 (実測) になり読めない。sidebar-bg 上で検証済みの token を使う */
  color: var(--sidebar-active-color);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}

.sidebar-mode-toggle:hover {
  border-color: var(--sidebar-accent);
}

/* 上段: 現在のモード。.sidebar-item.active と同じ「背景 + 左バー + 太字」 */
.sidebar-mode-toggle__label {
  display: block;
  /* 下だけ広いのは、境界にまたがるアイコンの上半分 (実高の半分 = 10.8px) を受けるため。
     ⚠️ 詰めるとアイコンの円が文字に被る。日本語より長い pt / de では上段の文字が
        中央まで届くので、余白ではなく重なりで壊れる */
  padding: 0.45rem 0.6rem 0.75rem;
  border-left: 3px solid var(--sidebar-accent);
  background: var(--sidebar-active-bg);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--sidebar-active-color);
}

/* 下段: 押したら移る先。素地に置いて上段との差を面で見せる。
   左の 3px は透明の border で、上段の左バーぶんだけ文字の開始位置を揃えるためのもの。
   0.72rem = 11.5px の小さい文字なので WCAG 上は 4.5:1 が要る。opacity で薄めると
   実効 2.2〜3.8 まで落ちるため、sidebar-bg 上で検証済みの --sidebar-color-dim を使う。 */
.sidebar-mode-toggle__next {
  display: flex;
  align-items: center;
  /* 右寄せ。左端は上段 (現在のモード) が持つ */
  justify-content: flex-end;
  /* 上だけ広いのは上段と同じ理由 (アイコンの下半分を受ける) */
  padding: 0.75rem 0.6rem 0.4rem;
  border-left: 3px solid transparent;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--sidebar-color-dim);
  transition: background 0.15s, color 0.15s;
}

/* ホバーで下段だけ手前に出る = 押した先がここだと分かる。
   .sidebar-item と同じくホバーは背景で示すが、こちらは「今いない側」を
   指す行なので、既定で一段落としてある文字色もあわせて上げる */
.sidebar-mode-toggle:hover .sidebar-mode-toggle__next {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-color-strong);
}

/* 「切り替えられる」ことを伝える唯一の記号。2 段の境界 (行間) に置くことで、
   上と下が入れ替わることを位置そのもので示す。
   ⚠️ 本文と同じ 1em・同じ淡色で行末に置いていた頃は、記号として弱すぎて
      ボタンの用途が読み取れなかった。文字より明確に大きく、枠と同じ
      アクセント色で持つ (--accent は light テーマで濃色 = sidebar-bg 上 1.18 なので使わない)。
   負マージン (= アイコン実高の半分) で行間に食い込ませ、ボタンの高さは増やさない。
   背景で区切り線を切り、線の上に載ったバッジに見せる。 */
.sidebar-mode-toggle__icon {
  position: relative;
  z-index: 1;
  align-self: center;
  margin: -0.675rem 0.65rem;
  padding: 0.1rem 0.3rem;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--sidebar-accent);
  background: var(--sidebar-bg);
  border-radius: 999px;
}

/* §6.1: モード別表示制御。body class に依拠 (JS の display:none トグル禁止) */
.sidebar-mode-vocab-only { display: none; }
body.is-nav-mode-vocab .sidebar-mode-lyrics-only { display: none; }
body.is-nav-mode-vocab .sidebar-mode-vocab-only { display: block; }

/* §4.4: 未実装項目の disabled 表示 (見た目で判別、ラベル付与なし)
   ⚠️ opacity 0.55 だと実効 2.41 で「消えて」見えた。無効な操作要素は WCAG 1.4.3 の
   対象外だが、存在は伝わる必要があるので faint トークン (3.5) で持つ。
   `.footer-link` は ERB/JS のどこからも参照が無い (BEM 接頭辞付きの別クラスだけ) ので外した */
.sidebar-item.is-disabled {
  /* design-allow: contrast-context — pointer-events: none の完全無効。WCAG 1.4.3 の対象外。実測 3.98 */
  color: var(--sidebar-color-faint);
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-section {
  padding: 1.25rem 1.25rem 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  /* 見出しは項目より一段下げる。サイズ・字間・太さでも区別が付いているので
     色は dim (5.5) で十分＝項目 (7.0) との階調が残る */
  color: var(--sidebar-color-dim);
  font-weight: 700;
}

.sidebar-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.25rem;
  color: var(--sidebar-color);
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}

/* ⚠️ ホバーで文字色を上げない。読むのはポインタを当てる**前**なので、
   ホバーを色の褒美にすると既定状態をわざと暗くすることになる。
   フィードバックは背景の変化で十分（アクティブ状態は背景 + 左バー + 太さで示す）。 */
.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-color);
  font-weight: 500;
  /* ⚠️ --accent は light テーマだと濃色で、サイドバーの暗地に対し 1.13〜1.88 =
     アクティブの手がかりとして機能していなかった。サイドバー世界のアクセントを使う（5.5+） */
  border-left-color: var(--sidebar-accent);
}

.sidebar-item i {
  width: 1.5rem;
  margin-right: 0.75rem;
  font-size: 1.1rem;
  text-align: center;
}

/* opacity 0.4 のとき実効 1.79 */
.sidebar-item.disabled {
  /* design-allow: contrast-context — pointer-events: none の完全無効。WCAG 1.4.3 の対象外。実測 3.98 */
  color: var(--sidebar-color-faint);
  cursor: default;
  pointer-events: none;
}

/* Sidebar Terms */
.sidebar-terms {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-terms p {
  font-size: 0.6875rem;
  color: var(--sidebar-terms-color);
  margin: 0 0 0.375rem;
  line-height: 1.4;
}

.sidebar-terms a {
  display: block;
  font-size: 0.6875rem;
  color: var(--sidebar-terms-link);
  text-decoration: none;
  line-height: 1.6;
}

.sidebar-terms a:hover {
  color: var(--sidebar-color-strong);
}

/* === Sidebar: Guest "More" toggle === */
.sidebar-more-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1.25rem;
  border: none;
  background: none;
  /* body 面用の --text-muted は sidebar-bg 上で 2.41。sidebar 用の階調を使う */
  color: var(--sidebar-color);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
/* .sidebar-item と同じ方針: ホバーは背景で示し、文字色は据え置く */
.sidebar-more-toggle:hover {
  background: var(--sidebar-hover-bg);
}
.sidebar-more-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.sidebar-more-chevron-up {
  transform: rotate(180deg);
}
.sidebar-more-items {
  border-top: 1px solid var(--sidebar-border);
}

/* === Sidebar: Section Toggle (collapsible sections) === */
.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.25rem 1.25rem 0.5rem;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  /* 見出しは項目より一段下げる。サイズ・字間・太さでも区別が付く */
  color: var(--sidebar-color-dim);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-section-toggle:hover {
  background: var(--sidebar-hover-bg);
}
.sidebar-section-chevron {
  font-size: 0.6rem;
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
}
.sidebar-section-chevron-up {
  transform: rotate(0deg);
}

/* === Sidebar: Public Additions (CTA, Live Stats) === */
.sidebar-cta {
  display: block;
  margin: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  /* ⚠️ light テーマの --accent は sidebar-bg に対し 1.18〜2.58 で、塗りだけだと
     暗地に沈んでボタンに見えない。輪郭で形を出す（文字は --text-on-accent で 5.31） */
  border: 1px solid var(--sidebar-accent);
  color: var(--text-on-accent);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
}

.sidebar-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  color: var(--text-on-accent); /* ⚠️ #fff 固定は accent 面で dark 5 テーマ 2.13。base と同じトークンにする */
}

.sidebar-live-stats {
  padding: 0.75rem 1rem;
  margin: 0 0.75rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--sidebar-color);
}

.live-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  text-align: center;
}

.live-stat-cell .live-stat-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sidebar-color-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.live-stat-cell .live-stat-label {
  font-size: 0.675rem;
  /* opacity だと実効 4.70 まで落ちるうえ監査ツールから見えない。明示的な色で持つ */
  color: var(--sidebar-color-dim);
}

.live-stat-today {
  text-align: center;
  font-size: 0.675rem;
  /* opacity 0.6 のとき実効 3.84 だった */
  color: var(--sidebar-color-dim);
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* design-allow-end: color-literal */

.live-dot-sm {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--lh-success);
  display: inline-block;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Sidebar Live Event (参加中イベント) === */
/* design-allow-start: color-literal */
/* sidebar live event は --sidebar-bg のダーク前提配色。lh-success rgb をベースにした半透明レイアウトはテーマ非依存 */
.sidebar-live-event {
  display: block;
  padding: 0.625rem 0.75rem;
  margin: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(var(--lh-success-rgb), 0.08);
  border: 1px solid rgba(var(--lh-success-rgb), 0.2);
  transition: background 0.2s;
}
.sidebar-live-event:hover {
  background: rgba(var(--lh-success-rgb), 0.14);
}
.sidebar-live-event-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}
/* --lh-success は body 面用で sidebar-bg 上 2.10。sidebar 専用 token を使う
   (--sidebar-warning / --sidebar-info と同じ理由。計画書 161 参照) */
.sidebar-live-event-label {
  color: var(--sidebar-success);
  font-weight: 600;
}
.sidebar-live-event-time {
  margin-left: auto;
  color: var(--sidebar-color-dim);
  font-size: 0.675rem;
  font-variant-numeric: tabular-nums;
}
.sidebar-live-event-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sidebar-color-strong);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}
.sidebar-live-event-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.7rem;
  color: var(--sidebar-color-dim);
}
.sidebar-live-event-stats i {
  font-size: 0.65rem;
  margin-right: 0.125rem;
}
.sidebar-live-event-action {
  margin-top: 0.375rem;
}
.sidebar-live-event-play-btn {
  display: inline-block;
  font-size: 0.675rem;
  font-weight: 600;
  color: var(--sidebar-success);
  border: 1px solid rgba(var(--sidebar-success-rgb), 0.3);
  border-radius: 4px;
  padding: 0.125rem 0.5rem;
}
/* design-allow-end: color-literal */

/* === Active Live Event Carousel (メインコンテンツ上部) === */
.active-live-event-carousel {
  position: relative;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: rgba(var(--lh-success-rgb), 0.06);
  border: 1px solid rgba(var(--lh-success-rgb), 0.15);
  max-width: 100%;
  overflow: hidden;
}
.active-live-event-carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.active-live-event-carousel-track::-webkit-scrollbar {
  display: none;
}
.active-live-event-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.active-live-event-carousel.is-multi .active-live-event-slide {
  /* 左右ナビ + ドットのスペース確保 */
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  padding-bottom: 1.25rem;
}
.active-live-event-slide:hover {
  color: inherit;
  text-decoration: none;
}
.active-live-event-slide-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  display: block;
}
.active-live-event-slide-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.active-live-event-slide-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--lh-success);
  white-space: nowrap;
  flex-shrink: 0;
}
.active-live-event-slide--reserved .active-live-event-slide-status {
  color: var(--text-muted);
}
.active-live-event-slide-rank {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.active-live-event-slide-rank i {
  font-size: 0.7rem;
}
/* 「順位なし」の - 。弱さは --text-muted が担う。
   opacity を重ねると 2.9 まで落ちるうえ、どのラチェットからも見えない */
.active-live-event-slide-rank-empty {
  color: var(--text-muted);
}
.active-live-event-slide-fill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  flex: 1 1 auto;
}
.active-live-event-slide-fill-track {
  flex: 1 1 auto;
  min-width: 32px;
  max-width: 80px;
  height: 5px;
  background: rgba(var(--lh-success-rgb), 0.15);
  border-radius: 3px;
  overflow: hidden;
  display: block;
}
.active-live-event-slide-fill-bar {
  display: block;
  height: 100%;
  background: var(--lh-success);
  border-radius: 3px;
  transition: width 0.3s;
}
.active-live-event-slide-fill-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.active-live-event-slide-time {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.active-live-event-slide-time i {
  font-size: 0.7rem;
}
/* ナビボタン */
.active-live-event-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid rgba(var(--lh-success-rgb), 0.3);
  background: var(--bg-elevated, var(--bg-primary));
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  font-size: 0.85rem;
  transition: background 0.2s, color 0.2s;
}
.active-live-event-carousel-nav:hover {
  background: var(--lh-success);
  color: var(--text-on-accent);
}
.active-live-event-carousel-nav[aria-disabled="true"] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.active-live-event-carousel-nav--prev { left: 0.4rem; }
.active-live-event-carousel-nav--next { right: 0.4rem; }
.active-live-event-carousel:focus-visible {
  outline: 2px solid var(--lh-success);
  outline-offset: 2px;
}
/* ドット */
.active-live-event-carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.3rem;
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  pointer-events: none;
}
.active-live-event-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(var(--lh-success-rgb), 0.25);
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s, transform 0.2s;
}
.active-live-event-carousel-dot.is-active {
  background: var(--lh-success);
  transform: scale(1.3);
}
/* Compact variant (PlayTyping / Movies pages) */
.active-live-event-carousel--compact .active-live-event-slide {
  padding: 0.3rem 0.75rem;
  gap: 0.5rem;
}
.active-live-event-carousel--compact.is-multi .active-live-event-slide {
  padding-left: 2rem;
  padding-right: 2rem;
  padding-bottom: 1rem;
}
.active-live-event-carousel--compact .active-live-event-slide-thumb {
  width: 44px;
  height: 26px;
}
@media (max-width: 640px) {
  .active-live-event-slide {
    padding: 0.375rem 0.75rem;
    gap: 0.5rem;
  }
  .active-live-event-carousel.is-multi .active-live-event-slide {
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: 1rem;
  }
  .active-live-event-slide-thumb {
    width: 44px;
    height: 26px;
  }
  .active-live-event-slide-fill-track {
    max-width: 56px;
  }
}

/* === Sidebar Battle Status === */
/* design-allow-start: color-literal */
/* sidebar 内の battle status カードはダーク前提配色。半透明白テキスト + warning/info 識別色 */
.sidebar-battle-status {
  display: block;
  padding: 0.5rem 0.75rem;
  margin: 0.375rem 0.75rem 0;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(var(--warning-soft-bg-rgb), 0.2);
  font-size: 0.75rem;
  transition: background 0.2s;
}
.sidebar-battle-status:hover { background: rgba(255,255,255,0.08); }

.battle-status-header {
  display: flex; align-items: center; gap: 0.375rem;
  font-weight: 600; font-size: 0.7rem;
  margin-bottom: 0.375rem;
  color: var(--sidebar-color);
}

.battle-status-room {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.125rem 0; font-size: 0.7rem;
}

.battle-status-mode {
  font-size: 0.6rem; font-weight: 700;
  width: 1.1rem; height: 1.1rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px; flex-shrink: 0;
}
/* サイドバーは全テーマ暗背景なので、body 用の --color-warning / --color-info ではなく
   サイドバー専用の明色トークンを使う（light テーマだと沈んで AA を割る） */
.battle-status-mode-ranked { background: rgba(var(--warning-soft-bg-rgb), 0.15); color: var(--sidebar-warning); }
.battle-status-mode-enjoy { background: rgba(var(--sidebar-info-rgb), 0.15); color: var(--sidebar-info); }

.battle-status-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--sidebar-color);
}

/* opacity 0.6 のとき実効 2.64 で、サイドバーで最も読みにくかった */
.battle-status-info { flex-shrink: 0; white-space: nowrap; color: var(--sidebar-color-dim); font-size: 0.65rem; }

/* opacity 0.5 のとき実効 2.20 */
.battle-status-footer {
  margin-top: 0.25rem; padding-top: 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.625rem; color: var(--sidebar-color-dim); text-align: center;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--warning-badge-bg);
  color: var(--warning-badge-fg);
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 1.1rem;
  height: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0 0.25rem;
}

/* design-allow-end: color-literal */

/* === Topbar === */
.topbar {
  position: fixed;
  top: 0; right: 0;
  left: var(--sidebar-width);
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--topbar-shadow);
  z-index: 1030;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  /* テーマ切り替えの背景色トランジションは初期から有効。
     left のトランジションは折り畳み時のみ必要なので is-hydrated 付与後に有効化する */
  transition: background 0.3s;
}
body.is-hydrated .topbar {
  transition: background 0.3s, left 0.3s ease;
}

/* Topbar: User Menu */
.topbar-user-menu { position: relative; }

.topbar-user-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: border-color 0.2s, color 0.2s;
}

.topbar-user-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.topbar-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 160px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--player-float-shadow);
  z-index: 100;
  padding: 0.375rem 0;
}

.topbar-user-dropdown.open { display: block; }

.topbar-user-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.topbar-user-dropdown a:hover {
  background: var(--hover-bg);
}

.topbar-user-dropdown a i { font-size: 0.95rem; color: var(--text-secondary); }

.topbar-user-dropdown .dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.25rem 0;
}

.topbar-user-dropdown #dropdownUserName { font-weight: 600; }

.topbar-user-dropdown .dropdown-logout { color: var(--text-secondary); }
.topbar-user-dropdown .dropdown-logout:hover { color: var(--color-danger); }

/* button要素（直接 / button_to form内）のスタイルリセット */
.topbar-user-dropdown form { margin: 0; }
.topbar-user-dropdown > button.dropdown-user-item,
.topbar-user-dropdown form .dropdown-user-item,
.topbar-user-dropdown form .dropdown-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s;
  text-align: left;
}
.topbar-user-dropdown > button.dropdown-user-item:hover,
.topbar-user-dropdown form .dropdown-user-item:hover {
  background: var(--hover-bg);
}
.topbar-user-dropdown > button.dropdown-user-item i,
.topbar-user-dropdown form .dropdown-user-item i {
  font-size: 0.95rem;
  color: var(--text-secondary);
}
.topbar-user-dropdown > button.dropdown-user-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.topbar-user-dropdown form .dropdown-logout {
  color: var(--text-secondary);
}
/* 破壊的な操作なので地もエラー面にする。--hover-bg のままだと dark-hacker で 4.49 と
   わずかに AA を割っていた（--error-bg なら 4.82） */
.topbar-user-dropdown form .dropdown-logout:hover {
  background: var(--error-bg);
  color: var(--color-danger);
}

/* Topbar: Theme Button */
.topbar-theme-btn {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  transition: color 0.15s, background 0.15s;
}

.topbar-theme-btn:hover {
  /* bi-moon-stars アイコンのみ。非テキスト 3:1 が基準で 3.96 = 満たす（計画書 178 §8） */
  color: var(--accent); /* design-allow: contrast-on-bg-secondary */
  background: var(--bg-secondary);
}

/* Topbar: Search */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.topbar-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  pointer-events: none;
  z-index: 1;
}

.topbar-search-input {
  width: 100%;
  padding: 0.4375rem 3rem 0.4375rem 2.25rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--topbar-search-bg);
  border: 1px solid var(--topbar-search-border);
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.topbar-search-input::placeholder {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.topbar-search-input:focus {
  background: var(--topbar-search-focus-bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

/* ⚠️ 以前は opacity: 0.7 を掛けており実効 2.74 だった。ヒントでも文字なので薄さは色で表す */
.topbar-search-kbd {
  position: absolute;
  right: 0.625rem;
  padding: 0.0625rem 0.375rem;
  font-family: "SF Mono", "Cascadia Code", monospace;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--topbar-search-kbd-bg);
  border: 1px solid var(--topbar-search-border);
  border-radius: 0.25rem;
  line-height: 1.4;
  pointer-events: none;
}

/* Topbar: Suggest Dropdown */
.topbar-suggest {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow-hover);
  z-index: 1060;
  overflow: hidden;
  display: none;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

.topbar-search.open .topbar-suggest {
  display: block;
}

.topbar-search.open .topbar-search-kbd {
  display: none;
}

.topbar-suggest-section {
  padding: 0.5rem 0.875rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar-suggest-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: background 0.1s;
  cursor: pointer;
}

.topbar-suggest-item i {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 1.125rem;
  text-align: center;
}

.topbar-suggest-item:hover,
.topbar-suggest-item.active {
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--text-primary);
}

.topbar-suggest-item.active i,
.topbar-suggest-item:hover i {
  color: var(--accent);
}

.topbar-suggest-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-suggest-type {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  padding: 0.0625rem 0.375rem;
  border-radius: 0.25rem;
  background: var(--tag-bg);
}

.topbar-suggest-footer {
  padding: 0.5rem 0.875rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

/* === Theme Panel (right slide-out) === */
.theme-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 260px;
  background: rgba(0,0,0,0.96); /* design-allow: color-literal */
  z-index: 1050;
  transform: translate3d(270px, 0, 0);
  transition: transform 0.3s;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent; /* design-allow: color-literal */
}

.theme-panel.open {
  transform: translate3d(0, 0, 0);
}

.theme-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  color: #fff; /* design-allow: color-literal */
  font-weight: 600;
  font-size: 0.9375rem;
  border-bottom: 1px solid rgba(255,255,255,0.08); /* design-allow: color-literal */
}

.theme-panel-close {
  cursor: pointer;
  color: rgba(255,255,255,0.5); /* design-allow: color-literal */
  font-size: 1rem;
  padding: 0.25rem;
  transition: color 0.15s;
}

.theme-panel-close:hover {
  color: #fff; /* design-allow: color-literal */
}

.theme-panel-section {
  padding: 1rem 1.25rem 0.5rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  /* .4 だと 3.69。同じパネルの .theme-card-name と同じ .5 に揃えて 5.26 */
  color: rgba(255,255,255,0.5); /* design-allow: color-literal */
  font-weight: 700;
}

.theme-panel-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem 1rem;
}

.theme-card {
  cursor: pointer;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}

.theme-card:hover {
  transform: scale(1.05);
  border-color: rgba(255,255,255,0.3); /* design-allow: color-literal */
}

.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.3);
}

.theme-card-name {
  display: block;
  text-align: center;
  font-size: 0.625rem;
  color: rgba(255,255,255,0.5); /* design-allow: color-literal */
  padding: 0.25rem 0 0.125rem;
  letter-spacing: 0.02em;
}

/* Mini layout preview */
.theme-preview {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.375rem;
  overflow: hidden;
}

.theme-preview-sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 28%;
}

.theme-preview-topbar {
  position: absolute;
  top: 0;
  left: 28%;
  right: 0;
  height: 16%;
}

.theme-preview-card {
  position: absolute;
  left: 33%;
  right: 8%;
  height: 28%;
  border-radius: 2px;
  border: 1px solid;
}

.theme-preview-card:nth-child(3) {
  top: 24%;
}

.theme-preview-card:nth-child(4) {
  top: 58%;
}

/* Theme panel overlay */
.theme-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3); /* design-allow: color-literal */
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.theme-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* === Topbar: Theme Hint (first-visit tooltip) === */
.topbar-theme-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.topbar-theme-hint {
  position: absolute;
  top: calc(100% + 0.625rem);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: var(--player-menu-shadow);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  pointer-events: none;
  z-index: 1060;
  cursor: pointer;
}

.topbar-theme-hint.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.topbar-theme-hint i {
  color: var(--accent);
  font-size: 0.9375rem;
}

.topbar-theme-hint::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 0.75rem;
  width: 10px;
  height: 10px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
  transform: rotate(45deg);
}

/* === Main === */
.main {
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 1.5rem) 2rem 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* 初期描画 / Turbo 差し替え直後の margin-left トランジション発火を防ぐため、
     is-hydrated 付与後にだけ transition を有効化する */
}
body.is-hydrated .main {
  transition: margin-left 0.3s ease;
}

/* === Breadcrumb === */
.breadcrumb-nav {
  font-size: 0.8125rem;
  margin-bottom: 0.75rem;
}

.breadcrumb-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb-nav a:hover {
  color: var(--text-primary);
}

.breadcrumb-nav .separator {
  color: var(--text-muted);
  margin: 0 0.5rem;
}

.breadcrumb-nav .current {
  color: var(--text-secondary);
}

/* === Page Header === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
}

.page-header h1 i {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

/* === Beat シーズン切替 告知バナー (計画 134) === */
.beat-season-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(var(--color-warning-rgb), 0.08);
  border: 1px solid rgba(var(--color-warning-rgb), 0.25);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.beat-season-banner i { color: var(--color-warning); flex-shrink: 0; }
.beat-season-banner strong { color: var(--color-warning); margin-right: 0.25rem; }

/* === Flash Messages === */
.flash-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.flash-notice i { color: var(--accent); flex-shrink: 0; }
.flash-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid rgba(var(--color-danger-rgb), 0.2);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--color-danger);
}
.flash-alert i { flex-shrink: 0; }
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.6;
}
.flash-close:hover { opacity: 1; }

/* === Main Footer === */
.main-footer {
  margin-top: auto;
  padding: 1.5rem 0 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}
.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 2rem;
  max-width: 980px;
  margin: 0 auto 0.75rem;
  padding: 0 1rem;
  align-items: start;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  text-align: left;
}
.footer-brand__logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.footer-brand__logo:hover { color: var(--accent); }
.footer-brand__desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
.footer-brand__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.footer-brand__cta:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.footer-brand__cta:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.footer-brand__cta:focus:not(:focus-visible) { outline: none; }
.footer-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem 2rem;
  text-align: left;
}
.footer-col { overflow-wrap: break-word; }
.footer-col-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { line-height: 1.8; }
.footer-col a,
.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  display: block;
  padding: 0.125rem 0;
}
.footer-nav a:hover { color: var(--accent); }
.footer-nav a:focus,
.footer-cookie-btn:focus,
.footer-lang-btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.footer-nav a:focus:not(:focus-visible),
.footer-cookie-btn:focus:not(:focus-visible),
.footer-lang-btn:focus:not(:focus-visible) { outline: none; }
.footer-legal a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-legal a:hover { color: var(--accent); }
.footer-legal a:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.footer-legal a:focus:not(:focus-visible) { outline: none; }
.footer-cookie-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-muted);
  cursor: pointer;
}
.footer-cookie-btn:hover { color: var(--accent); }
.footer-lang { margin-top: 0.5rem; }
.footer-lang-sep { color: var(--text-muted); }
.footer-lang-current { color: var(--text-primary); font-weight: 600; }
.footer-lang-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text-muted);
  cursor: pointer;
}
.footer-lang-btn:hover { color: var(--accent); }
@media (max-width: 768px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .footer-brand { align-items: flex-start; }
  .footer-nav { grid-template-columns: repeat(2, 1fr); }
  /* Touch-friendly footer links */
  .footer-col a,
  .footer-nav a {
    padding: 0.375rem 0;
  }
  .footer-cookie-btn,
  .footer-lang-btn {
    padding: 0.375rem 0.25rem;
  }
}
@media (max-width: 480px) {
  .footer-nav { grid-template-columns: 1fr; text-align: center; }
  .footer-brand { align-items: center; text-align: center; }
}

/* === Cookie Consent Banner === */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1060;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: var(--player-menu-shadow);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.cookie-consent-banner.show {
  transform: translateY(0);
  pointer-events: auto;
}

.cookie-consent-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.cookie-consent-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cookie-consent-text i {
  font-size: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cookie-consent-btn {
  padding: 0.375rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.cookie-consent-btn:hover {
  opacity: 0.85;
}

.cookie-consent-btn--accept {
  background: var(--accent);
  color: var(--text-on-accent);
}

.cookie-consent-btn--essential {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* === Ad Block Notice Footer === */
.ad-block-notice {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1059;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: var(--player-float-shadow);
  transform: translateY(100%);
  transition: transform 0.35s ease;
  pointer-events: none;
}

.ad-block-notice.show {
  transform: translateY(0);
  pointer-events: auto;
}

.ad-block-notice-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 2rem 1.5rem;
}

.ad-block-notice-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.625rem;
}

.ad-block-notice-header i {
  font-size: 1.2rem;
  color: var(--accent);
}

.ad-block-notice-message {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ad-block-notice-steps {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.ad-block-notice-steps-label {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.ad-block-notice-steps-label i {
  font-size: 1rem;
  color: var(--accent);
}

.ad-block-notice-steps-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: decimal;
}

.ad-block-notice-steps-list li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 0.25rem;
}

.ad-block-notice-actions {
  text-align: center;
}

.ad-block-notice-btn {
  padding: 0.5rem 2rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  transition: opacity 0.15s;
}

.ad-block-notice-btn:hover {
  opacity: 0.85;
}

@media (max-width: 640px) {
  .ad-block-notice-inner {
    padding: 1.5rem 1.25rem 1.25rem;
  }

  .ad-block-notice-header {
    font-size: 0.95rem;
  }

  .ad-block-notice-steps {
    padding: 0.75rem 1rem;
  }
}

/* === Topbar Hamburger (mobile only) === */
.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  margin-right: 0.5rem;
}

/* === Topbar Sidebar Collapse Button (PC only) === */
.topbar-collapse-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0.3rem;
  margin-right: 0.5rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.topbar-collapse-btn:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

/* === Sidebar Collapsed (PC) === */
body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}
body.sidebar-collapsed .main {
  margin-left: 0;
}
body.sidebar-collapsed .topbar {
  left: 0;
}

/* === Sidebar Overlay === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3); /* design-allow: color-literal */
  z-index: 1035;
}
.sidebar-overlay.show { display: block; }

/* === Mobile Responsive === */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  /* PC で折り畳んだ状態 (body.sidebar-collapsed) のままモバイル幅へ遷移したとき、
     詳細度の高い body.sidebar-collapsed .sidebar が .sidebar.show を上書きして
     ハンバーガーから開けなくなるのを防ぐ */
  body.sidebar-collapsed .sidebar.show {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .topbar {
    left: 0;
  }
  .topbar-hamburger {
    display: flex;
    align-items: center;
  }
  .topbar-collapse-btn {
    display: none;
  }
  .cookie-consent-content {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  .cookie-consent-text {
    justify-content: center;
  }
  /* iOS Safari auto-zoom prevention: inputs < 16px trigger zoom on focus */
  .topbar-search-input {
    font-size: 1rem;
  }
  /* Touch target: 44px for easier tapping */
  .topbar-user-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .main {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-bottom: 1.25rem;
  }
  /* 広告をコンテンツ余白の外まで広げる */
  .main .pub-ad {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }
}

@media (max-width: 480px) {
  .main {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  .main .pub-ad {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
  }
}

/* === Play Later Panel === */

.play-later-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  background: var(--card-bg);
  border-left: 1px solid var(--border-color);
  z-index: 1050;
  transform: translate3d(330px, 0, 0);
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.play-later-panel.open {
  transform: translate3d(0, 0, 0);
}

.pl-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.pl-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pl-panel-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pl-panel-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.25rem;
  transition: color 0.15s;
}

.pl-panel-close:hover {
  color: var(--text-primary);
}

/* Toolbar (sort + clear) */
.pl-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.pl-sort-group {
  display: flex;
  gap: 0.25rem;
}

.pl-sort-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pl-sort-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.pl-sort-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

.pl-clear-all-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.6875rem;
  cursor: pointer;
  padding: 0.25rem 0.375rem;
  border-radius: 0.25rem;
  transition: color 0.15s;
}

.pl-clear-all-btn:hover {
  color: var(--danger);
}

/* Card list */
.pl-panel-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.pl-card {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}

.pl-card:hover {
  background: var(--hover-bg);
}

.pl-card-link {
  display: flex;
  gap: 0.625rem;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

.pl-card-thumb {
  position: relative;
  width: 80px;
  flex-shrink: 0;
}

.pl-card-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.25rem;
  display: block;
}

.pl-card-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 0.5rem;
  padding: 0.0625rem 0.25rem;
  border-radius: 0.125rem;
  line-height: 1.3;
}

/* サムネイル画像の上のバッジ（play_later_controller.js:205）。
   forestgreen(34,139,34) は白サムネに重ねると #fff で 3.46 だったので、
   .detail-pv-badge.official と同じ濃緑に揃える（同ケース 5.03） */
.pl-badge-official {
  background: rgba(22, 101, 52, 0.85); /* design-allow: color-literal */  color: #fff; /* design-allow: color-literal */
  border: 1px solid rgba(255,255,255,0.15); /* design-allow: color-literal */
}

.pl-badge-cover {
  background: rgba(30, 90, 180, 0.85); /* design-allow: color-literal */  color: #fff; /* design-allow: color-literal */
  border: 1px solid rgba(255,255,255,0.15); /* design-allow: color-literal */
}

.pl-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.pl-card-channel {
  font-size: 0.625rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-card-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pl-card-stats {
  display: flex;
  gap: 0.375rem;
  font-size: 0.5625rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.pl-stat {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.pl-stat-star {
  color: var(--star-fg); /* ★は fg トークン（--star-active は light 面で 1.32） */
}

.pl-card-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: color 0.15s;
  margin-top: 0.125rem;
}

.pl-card-remove:hover {
  color: var(--danger);
}

/* Empty state */
.pl-empty-msg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
  gap: 0.75rem;
}

.pl-empty-msg i {
  font-size: 2rem;
}

.pl-empty-msg p {
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0;
}

/* Overlay */
.play-later-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3); /* design-allow: color-literal */
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.play-later-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Badge in user menu */
.play-later-badge {
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 1rem;
  height: 1rem;
  line-height: 1rem;
  text-align: center;
  border-radius: 0.5rem;
  padding: 0 0.25rem;
  margin-left: auto;
}

/* Add button on movie detail page */
.play-later-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8125rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.play-later-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.play-later-add-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.play-later-add-btn.active i {
  color: var(--accent);
}

/* Mobile: full-width panel */
@media (max-width: 480px) {
  .play-later-panel {
    width: 100%;
    transform: translate3d(100%, 0, 0);
  }
}

/* ===== Locale Selector ===== */
.locale-selector {
  position: relative;
}
.locale-trigger {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: background-color 0.15s;
}
.locale-trigger:hover {
  background-color: var(--bg-hover);
}
.locale-trigger i {
  font-size: 1.125rem;
}
.locale-current {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .locale-current { display: none; }
}
.locale-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 160px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: var(--player-menu-shadow);
  z-index: 1000;
  padding: 0.25rem 0;
  margin-top: 0.25rem;
}
.locale-option {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: background-color 0.15s;
}
.locale-option:hover {
  background-color: var(--bg-hover);
}
.locale-option.active {
  color: var(--color-primary);
  font-weight: 600;
}

/* === Sidebar: 開発記事の面（計画 212 §7b） ===
   記事ページでは歌詞・単語帳のナビを出さず、ここに差し替える（一方通行）。
   目次は 20 本を超えるので、項目はアイコンなし・2 段（回次 + 題）で詰める。 */

/* 連載の見出し（計画 213 段取り 9）。項目は回次しか出さないので、
   連載が 2 つ以上あるとここが無いと「第1回」が並んで区別が付かない。
   ⚠️ 連載名は長いので、区切り用の一般見出しより字間を詰めて折り返しを許す */
.sidebar-section--series {
  text-transform: none;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.sidebar-item--article {
  align-items: flex-start;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.sidebar-article-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-article-label__eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--sidebar-color-dim);
}

/* ⚠️ 題は長いので 2 行で切る。省略せずに折り返すと 1 項目が 4 行になり目次が読めない */
.sidebar-article-label__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.45;
}
/* application.css */
/* === Global Reset === */
*, *::before, *::after { box-sizing: border-box; }

/* medal-* / youtube-red / success-green / trophy-* / badge-* / medal-gold-shadow は theme.css に集約済み */

/* --- Breadcrumb --- */
.pub-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.pub-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  padding: 4px 2px;
}

.pub-breadcrumb a:hover {
  color: var(--accent);
}

.pub-breadcrumb .breadcrumb-sep {
  font-size: 0.6rem;
}

.pub-breadcrumb .breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* --- Section Header (border-left accent) --- */
.pub-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  padding-left: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  border-left: 3px solid var(--accent);
}

.pub-section-header i {
  color: var(--accent);
  font-size: 1.1rem;
}

.pub-section-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.pub-section-header .section-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* --- Ad Slot --- */
/* 広告の箱の高さ（計画 251 §2-3-4）。⚠️⚠️ **幅は器に追従させ、高さだけをここで固定する** ——
   器の幅は置き場所ごとに違う（全幅 / 検索結果の列の中 / 一覧の列の中）ので、固定サイズ（728×90 等）の箱は入らない。
   280px の根拠: MicroAd のバナーが PC / SP とも 250px 前後（計画 201 §4.5）で、AdSense の需要の多い
   300×250 / 336×280 が入る。画面幅で変える根拠が無いので全幅で 1 つの値にしている。
   ⚠️⚠️ 中身（広告・ハウス広告・ライブ予告）が何でも枠の高さは動かない = 広告による CLS が 0。
   **それより大きい広告が来ても枠は伸ばさず、箱で切る**（2026-10-31 著者確定: 高さを指定しているのに
   それを超える広告を配信するのは配信側の不備で、こちらが合わせる必要は無い。CLS に影響しないほうを取る） */
.pub-ad {
  --ad-box-h: 280px;
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  position: relative;
  text-align: center;
}

/* AdSense の箱。中身は ins か、埋まらなかったときにそれと置き換えたハウス広告（.adsense-house-ad）の
   どちらか 1 つ。⚠️ ins の大きさは CSS で決める（data-ad-format="auto" を付けない = AdSense ヘルプ 9183363）
   ⚠️⚠️ ins とハウス広告を同時に入れて重ねないこと —— 遅れて届いた広告が下に隠れる（規約違反。ad_helpers.js の showAdsenseHouseAd）
   ⚠️⚠️ **高さは min-height と max-height でも挟む。** AdSense は埋まらなかった枠を自分で畳み、
   ins とその親（この箱）に `style="height: 0px"` を直接書き込む（2026-10-31 開発環境のテスト広告で観測）。
   height だけだとインラインに負けて 280px → 0 のずれになる。min / max-height はインラインの height より優先される
   （!important を使わずに済む）。
   ⚠️⚠️ **overflow: hidden を外さないこと。** 指定より大きい広告が来たときに、伸ばさず切るための歯止め
   （上の --ad-box-h の説明。外すと、はみ出した広告が後続の本文に重なる） */
.pub-ad-box {
  display: grid;
  height: var(--ad-box-h);
  min-height: var(--ad-box-h);
  max-height: var(--ad-box-h);
  overflow: hidden;
}

.pub-ad-box > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.pub-ad-box > ins {
  display: block;
  width: 100%;
  height: var(--ad-box-h);
}

/* 埋まらなかった / 応答が無かった枠のハウス広告（ins と置き換えたもの）。箱の上下の中ほどに置く */
.pub-ad-box > .adsense-house-ad {
  align-self: center;
}

.pub-ad-box > .pub-ad-space {
  height: 100%;
}

.pub-ad::before {
  content: '';
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 1px;
  background: var(--border-color);
  opacity: 0.4;
}

.pub-ad-label {
  text-align: center;
  font-size: 0.65rem;
  /* ⚠️ opacity 0.5 だと実効 2.05。「スポンサー」は出す義務のある表示なので読める必要がある */
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  letter-spacing: 0.05em;
}

.pub-ad-space {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1.5rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--card-radius);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  min-height: 90px;
}

.pub-ad-space i {
  font-size: 1.25rem;
}

.pub-ad-space-sm {
  min-height: 80px;
}

/* MicroAd 枠の重ね（計画 201 §4.5）。
   ⚠️ MicroAd は data-ad-status 相当を持たないので「埋まらなかった」が検知できない。
   → 背面にハウス広告を最初から敷き、埋まったら前面が覆う。
   ⚠️ JS で display を切り替えないので CLS も検知も要らない（feedback_cls.md）。

   ⚠️⚠️ **重ねは grid で行う。背面を position: absolute にしないこと。**
   absolute だと背面ハウス広告の高さが親に伝わらず、`min-height`（100px）を超えたぶんが
   枠の外へはみ出して**後続セクションに重なる**（2026-09-03 の本番。ライブ予告カードは
   ヘッダ + 16:9 サムネ + body で 320px 前後あり、200px 以上が枠外に出ていた）。
   `display: grid` + `grid-area: 1 / 1` なら、枠の高さが背面と前面の高いほうに追従する。

   ⚠️⚠️ **`align-self: start` を外さないこと。** grid item は既定で stretch するので、
   前面（埋まらなければ高さ 0 であってほしい div）が行いっぱいに伸びて背面を覆う。

   ⚠️ 高さは AdSense の箱と同じ --ad-box-h に固定する（計画 251 §2-3-4）。背面のライブ予告は
   その高さに収まる作り（下の .pub-ad-stack / .pub-ad-box の中の予告カード）にしてある。
   ⚠️⚠️ 指定より大きい広告が来ても伸ばさず切る（.pub-ad の --ad-box-h の説明。2026-10-31 著者確定）。
   min / max-height も同じ値にするのは、広告のスクリプトがインラインの height を書いても負けないため（.pub-ad-box と同じ） */
.pub-ad-stack {
    position: relative;
    display: grid;
    height: var(--ad-box-h);
    min-height: var(--ad-box-h);
    max-height: var(--ad-box-h);
    overflow: hidden;
}

.pub-ad-house,
.pub-ad-front {
    grid-area: 1 / 1;
    align-self: start;
    min-width: 0;
}

/* 背面は箱の上下の中ほどに置く（前面と違い、伸びても覆うものが無い） */
.pub-ad-house {
    align-self: center;
}

.pub-ad-front {
    z-index: 1;
}

/* 埋まったら背面を引っ込める。判定は旧実装（§9.2）と同じ「iframe / img が入ったか」。
   ⚠️ 背面は grid item なので、消さないと**広告より高いぶんが下にはみ出して見える**
   （バナーは 250px 前後 < ライブ予告 320px 前後）。計画 201 リスク #2（MicroAd が
   透明 iframe を返す場合）も、背面ごと消えるのでここで一緒に塞がる。
   ⚠️ **iframe だけにしないこと** —— COMPASS は img で返す枠もあり、
   取りこぼすと「広告の下にライブ予告がはみ出す」状態に戻る。
   ⚠️ **逆に `:has(*)` まで広げないこと** —— COMPASS は未配信でも空の div を
   置いていくので、**埋まっていないのに背面まで消えて枠が空になる**。
   ⚠️ CSS の :has() であって JS の display トグルではないので feedback_cls.md に抵触しない。
      背面は絶対配置をやめても行の高さを決めるだけで、消しても前面の位置は動かない。
   ⚠️ :has() 非対応ブラウザ（Safari 15.3 以下等）では背面が残るが、grid なので
      **はみ出しは起きず「広告の下に予告が続く」だけ**に劣化する。 */
.pub-ad-stack:has(.pub-ad-front :is(iframe, img)) .pub-ad-house {
    display: none;
}

/* --- ライブイベントのピックアップ / 予告カード --- */
/* home の app/views/home/_pickup_events.html.erb と、広告フォールバックの
   app/javascript/helpers/ad_helpers.js が同じ形を描く。二重定義を避けて 1 か所に置く。

   ⚠️ 広告版は載る面が 2 つの世界にまたがる（計画書 182 Phase 2 で DOM を確認済み）:
     ・themed ページの .pub-ad（home / discover / guide / landing / battle ルーム / profile）
     ・.player-ad-slot 経由の暗面 = .typing-replay-summary (rgba(0,0,0,.85)) /
       .area-tap-result (rgba(10,10,15,.95))
   親の面に依存する配色にすると必ずどちらかが壊れるので、**広告ブロック側で
   --card-bg の面を敷いて**文字色と面を同じ世界に閉じ込める（.house-ad-link と同じ手）。
   実測（10 テーマ × 3 面）: バッジ 5.05 / 参加費 4.61 / タイトル 10.30 / メタ 5.05 。 */

.pickup-event-card,
.upcoming-event-card {
  flex-shrink: 0;
  width: 280px;
  text-decoration: none;
  color: inherit;
}

.pickup-event-card__frame {
  border: 1px solid rgba(var(--lh-warning-rgb), 0.4);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(var(--lh-warning-rgb), 0.05);
}

.upcoming-event-card__frame {
  border: 1px solid rgba(var(--lh-upcoming-rgb), 0.4);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(var(--lh-upcoming-rgb), 0.06);
}

.pickup-event-card__body {
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.pickup-event-card__badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}

/* バッジの地は中立の --tag-bg で揃え、意味は文字色で示す。
   同系色の薄い tint（rgba(--lh-*-rgb, .1)）を地にすると同じ色相の文字と近づき、
   light-classic / dark-hacker などで 3.35〜4.46 と AA を割っていた */
.pickup-event-card__badge {
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  background: var(--tag-bg);
  color: var(--text-primary);
}

.pickup-event-card__badge--pr {
  color: var(--lh-warning);
}

.pickup-event-card__badge--upcoming {
  color: var(--lh-upcoming);
}

/* 参加費だけは --tag-bg 上で 4.01（dark-hacker / dark-viper）に落ちるので専用の地を敷く */
.pickup-event-card__badge--fee {
  background: var(--error-bg);
  color: var(--lh-danger);
}

/* 主催の別。自前の不透明地を持つので載る面に依存しない（実測 5.92 / 5.36） */
.pickup-event-card__badge--official {
  background: var(--lh-official-bg);
  color: var(--lh-official-fg);
}

.pickup-event-card__badge--user {
  background: var(--lh-user-bg);
  color: var(--lh-user-fg);
}

.pickup-event-card__badge--challenge,
.pickup-event-card__badge--daily {
  color: var(--lh-warning);
}

.pickup-event-card__badge--reward {
  color: var(--lh-success);
}

.pickup-event-card__title {
  font-weight: bold;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.pickup-event-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  /* --text-muted はカードの薄い地の上で 3.79 まで落ちる（7/10 テーマで AA 割れ） */
  color: var(--text-secondary);
}

.pickup-event-card__meta--between {
  justify-content: space-between;
}

.pickup-event-card__count {
  flex-shrink: 0;
}

.pickup-event-card__host {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 参加状況バー。すべて非テキスト（3:1 基準） */
.pickup-event-card__gauge {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--lh-track-bg);
  overflow: visible;
  position: relative;
}

.pickup-event-card__gauge-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--lh-warning-alt);
}

.pickup-event-card__gauge-fill--success {
  background: var(--lh-success);
}

.pickup-event-card__gauge-fill--full {
  background: var(--lh-warning);
}

.pickup-event-card__gauge-marker {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  border-radius: 1px;
  z-index: 1;
  background: var(--lh-marker-color);
}

.pickup-event-card__gauge-marker--success {
  background: var(--lh-success);
}

/* 予告カードのサムネ。自前の不透明な暗地を持つので、上に載る文字はテーマに依存しない
   （#e0b0ff on #0a0e1a = 10.84。全 10 テーマ・全ホスト面で同値） */
/* design-allow-start: color-literal */
/* 予告カードのサムネは自前の暗地で完結する固定色（ライブ会場の夜景表現） */
.upcoming-event-card__thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
  background: #0a0e1a;
}

.upcoming-event-card__countdown-icon {
  font-size: 1.8rem;
  color: #e0b0ff; /* design-allow: contrast-context — 直上の .upcoming-event-card__thumb が #0a0e1a を敷く（実測 10.84） */
  text-shadow: 0 0 12px rgba(138, 43, 226, 0.8);
}

.upcoming-event-card__countdown {
  font-size: 0.75rem;
  font-weight: bold;
  color: #e0b0ff; /* design-allow: contrast-context — 同上（#0a0e1a の上で 10.84） */
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
/* design-allow-end: color-literal */

/* サムネ画像。home.css から移設（広告フォールバックはどのページにも出るので
   home.css では届かない）。 */
.pickup-event-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* UPCOMING カード: 予告イベントは img のみ暗く表示する演出。
   helper が class を img にも常に付ける仕様に依存し、img 直指定で fallback_picture の
   <picture> 経路 / <img> 単体経路の双方に対応する (picture > img 子セレクタを使うと
   <img> 単体フォールバック時に効かなくなるため使わない)。 */
img.pickup-event-thumb--dim {
  filter: brightness(0.6);
}

.upcoming-event-card__thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
}

/* デイリーチャレンジのサムネ枠（会場プレビューを持たないので固定高さ） */
.pickup-event-card__daily-thumb {
  position: relative;
  height: 158px;
}

/* 「ライブを開く」導線カード。空枠があるときだけ 1 枚出る */
.pickup-event-cta {
  height: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 1rem;
  text-align: center;
  border: 1px dashed rgba(var(--lh-warning-rgb), 0.5);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(var(--lh-warning-rgb), 0.03);
}

.pickup-event-cta__icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: var(--lh-warning);
}

.pickup-event-cta__title {
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.pickup-event-cta__body {
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  /* 淡い地の上では --text-muted が 3.79 まで落ちる */
  color: var(--text-secondary);
}

.pickup-event-cta__link {
  font-size: 0.8rem;
  color: var(--lh-warning);
}

/* --- 広告フォールバックとして出すときのブロック --- */
/* 暗面のプレイヤー内にも出るので、ここで --card-bg の面を確定させる */
.ad-events {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  /* 面を敷いたら文字色も同じ世界で宣言する。ここを省くとカードの color: inherit が
     ホスト（暗面のプレイヤー等）の世界を拾ってしまう */
  color: var(--text-primary);
}

.ad-events__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.ad-events__head-icon--pickup {
  color: var(--lh-warning);
}

.ad-events__head-icon--upcoming {
  color: var(--lh-upcoming);
}

.ad-events__scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

/* 広告の箱の中に出すライブ予告（ハウス広告）は、箱の高さ（--ad-box-h）に収める（計画 251 §2-3-4）。
   ⚠️ サムネを 16:9 のままにすると、カード幅 280px でサムネだけで 158px、ブロック全体で 320px 前後になり
   箱に入らない。サムネの高さを決め打ちにして、上下の余白を詰める。
   ピックアップ（.pub-pickup-event）は箱の外（枠の上）にサーバが描くので、ここには掛からない */
:is(.pub-ad-box, .pub-ad-stack) .ad-events {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

:is(.pub-ad-box, .pub-ad-stack) .upcoming-event-card__thumb {
  aspect-ratio: auto;
  height: 96px;
}

/* 広告枠の上のピックアップ（shared/_ad_pickup_events。計画 251 §2-3-3）。
   サーバは画面幅を知らないので最大 5 枚を出し、見せる枚数はここで決める
   （モバイル 2 / タブレット 3 / それ以上は全部 = JS で組み立てていたころと同じ） */
@media (max-width: 900px) {
  .pub-pickup-event .pickup-event-card:nth-child(n+4) { display: none; }
}
@media (max-width: 600px) {
  .pub-pickup-event .pickup-event-card:nth-child(n+3) { display: none; }
}

/* --- House Ad (GPT入札不調時のフォールバック) --- */
.house-ad { width: 100%; }

.house-ad-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  text-decoration: none;
  color: inherit;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* House Ad（GPT入札不調時のフォールバック）の赤。⚠️ CTA は #fff on 赤グラデで 2.74 だった。
   同じカードの .house-ad-icon は Phase 3-3 で --color-danger に移っていて赤が 2 種類並んでいた */
.house-ad-link:hover {
  border-color: var(--color-danger);
  box-shadow: 0 2px 8px rgba(var(--color-danger-rgb), 0.15);
}

.house-ad-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  /* ハートは typing_videos.css の .tv-like-icon と同じ --color-danger
     （固定の #ff4757 は light テーマの同系 tint 上で 2.27。計画書 182 Phase 3-3） */
  color: var(--color-danger);
  background: rgba(var(--color-danger-rgb), 0.1);
  border-radius: 50%;
}

.house-ad-body { flex: 1; min-width: 0; }

.house-ad-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.house-ad-desc {
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.house-ad-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-on-accent);
  background: var(--color-danger);
  border-radius: 6px;
  white-space: nowrap;
}

/* --- Share Section --- */
.pub-share {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  margin-bottom: 1.5rem;
}

.pub-share-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pub-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  cursor: pointer;
}

.pub-share-btn:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--accent);
}

.pub-share-url {
  flex: 1;
  min-width: 0;
  padding: 0.375rem 0.5rem;
  font-size: 0.72rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--body-bg);
  color: var(--text-muted);
  font-family: monospace;
}

/* --- Guest CTA --- */
.pub-guest-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg,
    rgba(var(--accent-rgb), 0.08) 0%,
    rgba(var(--accent-rgb), 0.02) 100%
  );
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: var(--card-radius);
  margin-bottom: 1.5rem;
}

.pub-guest-cta-icon {
  font-size: 2rem;
  color: var(--accent);
  flex-shrink: 0;
}

.pub-guest-cta-body {
  flex: 1;
  min-width: 0;
}

.pub-guest-cta-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.pub-guest-cta-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.pub-guest-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.pub-guest-cta-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
  color: var(--text-on-accent);
  text-decoration: none;
}

/* --- Keyboard Pagination (Shared) --- */
.pagination-keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  padding: 2rem 0 1rem;
}

.pagination-plate {
  position: relative;
  background: var(--plate-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--plate-border);
  border-radius: 0.875rem;
  padding: 0.75rem 1rem;
  box-shadow: var(--plate-shadow);
  transition: box-shadow 0.4s;
}

.pagination-plate::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: var(--plate-led-gradient);
  opacity: var(--plate-led-opacity);
  border-radius: 0 0 1px 1px;
  filter: blur(1px);
}

.pagination-plate .pagination {
  display: flex;
  gap: 0.375rem;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

/* design-allow-start: color-literal */
/* キーキャップ装飾の多層 box-shadow（外影/内影/凹み）。元から --keycap-shadow / --keycap-shine 等の token と組み合わせる装飾固定値（テーマ依存しない 3D ボタン表現） */
.pagination-plate .page-item .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.5rem;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--keycap-border);
  border-radius: 0.375rem;
  position: relative;
  cursor: pointer;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.12s ease,
              border-color 0.15s ease;
  background: var(--keycap-bg);
  color: var(--keycap-color);
  box-shadow:
    0 3px 0 var(--keycap-shadow),
    0 4px 4px rgba(0,0,0,0.15),
    inset 0 1px 0 var(--keycap-shine),
    inset 0 -1px 0 rgba(0,0,0,0.1);
  text-shadow: none;
}

.pagination-plate .page-item:first-child {
  margin-right: 0.25rem;
}

.pagination-plate .page-item:last-child {
  margin-left: 0.25rem;
}

.pagination-plate .page-item:first-child .page-link,
.pagination-plate .page-item:last-child .page-link {
  min-width: 2.75rem;
  font-size: 0.9375rem;
}

.pagination-plate .page-item .page-link:hover {
  transform: translateY(-2px);
  border-color: var(--keycap-active-border);
  box-shadow:
    0 5px 0 var(--keycap-shadow),
    0 6px 8px rgba(0,0,0,0.2),
    inset 0 1px 0 var(--keycap-shine),
    inset 0 -1px 0 rgba(0,0,0,0.1);
}

.pagination-plate .page-item .page-link:active {
  transform: translateY(2px);
  box-shadow:
    0 0 0 var(--keycap-shadow),
    0 1px 2px rgba(0,0,0,0.15),
    inset 0 1px 0 var(--keycap-shine),
    inset 0 -1px 0 rgba(0,0,0,0.1);
  transition-duration: 0.06s;
}

.pagination-plate .page-item.active .page-link {
  transform: translateY(1px);
  background: var(--keycap-active-bg);
  color: var(--keycap-active-color);
  border-color: var(--keycap-active-border);
  box-shadow:
    0 1px 0 var(--keycap-shadow),
    0 2px 4px rgba(0,0,0,0.15),
    var(--keycap-active-glow),
    inset 0 1px 0 var(--keycap-shine),
    inset 0 -1px 0 rgba(0,0,0,0.1);
  text-shadow: var(--keycap-active-text-glow);
  animation: key-led-pulse 2.5s ease-in-out infinite;
}

@keyframes key-led-pulse {
  0%, 100% {
    box-shadow:
      0 1px 0 var(--keycap-shadow),
      0 2px 4px rgba(0,0,0,0.15),
      var(--keycap-active-glow),
      inset 0 1px 0 var(--keycap-shine),
      inset 0 -1px 0 rgba(0,0,0,0.1);
    text-shadow: var(--keycap-active-text-glow);
  }
  50% {
    box-shadow:
      0 1px 0 var(--keycap-shadow),
      0 2px 4px rgba(0,0,0,0.15),
      var(--keycap-active-glow),
      inset 0 1px 0 var(--keycap-shine),
      inset 0 -1px 0 rgba(0,0,0,0.1);
    text-shadow: var(--keycap-active-text-glow);
  }
}
/* design-allow-end: color-literal */

.pagination-plate .page-item.disabled .page-link {
  opacity: 0.3;
  cursor: default;
  transform: none;
  text-shadow: none;
  box-shadow:
    0 2px 0 var(--keycap-shadow),
    inset 0 1px 0 var(--keycap-shine);
}

.pagination-plate .page-item.disabled .page-link:hover {
  transform: none;
  border-color: var(--keycap-border);
  box-shadow:
    0 2px 0 var(--keycap-shadow),
    inset 0 1px 0 var(--keycap-shine);
  color: var(--keycap-color);
  text-shadow: none;
}

.pagination-counter {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Pagination: narrow screen overflow prevention */
@media (max-width: 480px) {
  .pagination-plate {
    max-width: 100%;
  }
  /* Scroll inside the list to preserve plate's border-radius and ::after LED effect */
  .pagination-plate .pagination {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pagination-plate .pagination::-webkit-scrollbar {
    display: none;
  }
  .pagination-plate .page-item .page-link {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }
  .pagination-plate .page-item:first-child .page-link,
  .pagination-plate .page-item:last-child .page-link {
    min-width: 2.25rem;
    font-size: 0.8125rem;
  }
}

/* --- Visually Hidden (Accessibility) --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .pub-ad {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    padding-top: 1rem;
  }

  .pub-ad-space {
    min-height: 50px;
    padding: 1rem;
    font-size: 0.7rem;
  }

  .house-ad-link {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .house-ad-cta {
    width: 100%;
    justify-content: center;
  }

  .pub-share {
    flex-wrap: wrap;
  }

  .pub-share-btn {
    width: 44px;
    height: 44px;
  }

  .pub-guest-cta {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  .pub-guest-cta-btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- ツールチップ（機能説明用・全ページ共通） --- */
.rich-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: var(--text-muted);
  font-size: 0.8rem;
  vertical-align: middle;
  margin-left: 0.25rem;
}
.rich-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-overlay-bg);
  color: var(--card-overlay-fg);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  font-weight: 400;
}
.rich-tip:hover::after {
  opacity: 1;
}
@media (max-width: 600px) {
  .rich-tip::after {
    left: auto;
    right: 0;
    transform: none;
    max-width: 240px;
  }
}

/* ===================================================
   共有モーダル (tv-modal)

   もとは typing_videos.css / guide.css に**同じ内容が二重に**置かれていて、
   対戦の待機画面（battle/show・battle/vocab_show）はクラスだけ借りて CSS を
   読み込んでいなかった。結果、モーダルが素の DOM として展開され、閉じるボタンが
   ブラウザ既定の淡色ボタンで出ていた（ダークテーマで白い箱に見える）。
   読み込み忘れが再発しないよう、レイアウトが常に読む application.css に集約する。
   クラス名の tv- 接頭辞は出自（typing_videos）の名残で、参照側が多いため据え置き。
   =================================================== */
.tv-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6); /* design-allow: color-literal */ /* モーダル backdrop */
  backdrop-filter: blur(4px);
}

.tv-modal-content {
  position: relative;
  width: 90%;
  max-width: 520px;
  background: var(--card-bg);
  border-radius: var(--card-radius);
  box-shadow: var(--modal-panel-shadow);
  overflow: hidden;
}

.tv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
}

.tv-modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

/* min-width / min-height 44px はタップ領域の下限（guide.css 側にあった定義を採用） */
.tv-modal-close {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tv-modal-close:hover {
  color: var(--text-primary);
}

.tv-modal-body {
  padding: 1.2rem;
}

.tv-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 480px) {
  .tv-modal-content {
    width: 95%;
  }
}

/* ===================================================
   ルーム参加中バー (battle-room-bar)

   layouts/shared/_battle_room_bar.html.erb は**レイアウトが全ページで描画する**
   （対戦部屋に入っている間ずっと画面下部に出る）のに、CSS は battle.css にしかなく、
   対戦以外のページでは position: fixed も効かずページ末尾に素の HTML が並んでいた。
   「この曲を提案する」「このデッキを提案する」が出るのは動画詳細・デッキ詳細
   —— どちらも battle.css を読まないページなので、提案ボタンは常に素の button だった。
   描画がレイアウト常時なら CSS も常時読むファイルに置く、で揃える。
   =================================================== */
.battle-room-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 2px solid var(--accent);
  padding: 0.6rem 1rem;
  z-index: 1000;
  box-shadow: var(--player-float-shadow);
}
.battle-room-bar-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.battle-room-bar-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.battle-room-bar-info > i {
  color: var(--accent);
  font-size: 1.1rem;
}
.battle-room-bar-name {
  font-weight: 600;
}
.battle-room-bar-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.battle-room-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.battle-room-bar-propose-btn {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.battle-room-bar-propose-btn:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.battle-room-bar-propose-btn.proposed {
  background: rgba(var(--lh-success-rgb), 0.15);
  color: var(--lh-success);
  border-color: rgba(var(--lh-success-rgb), 0.3);
  cursor: default;
}
.battle-room-bar-back-btn {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.battle-room-bar-back-btn:hover {
  opacity: 0.85;
  color: var(--text-on-accent); /* ⚠️ #fff 固定は accent 面で dark 5 テーマ 2.13。base と同じトークンにする */
}

/* 参加中バーがある場合の body 下部余白 */
body:has(.battle-room-bar) main {
  padding-bottom: 60px;
}

@media (max-width: 640px) {
  .battle-room-bar-content {
    flex-direction: column;
    gap: 0.5rem;
  }
  .battle-room-bar-actions {
    width: 100%;
    justify-content: center;
  }
}
/* mini_venue.css */
/* ===========================
   Mini Venue Preview (Ad Cards)
   =========================== */
/* design-allow-start: color-literal */
/* mini venue は live event カードのプレビュー領域。固定ダーク前提でテーマ非依存。
   ⚠️ バッジの地に --color-danger / --lh-success のような**テーマで反転するトークン**を使うと、
   文字色が #fff 固定なのでダーク 5 テーマで沈む（計画書 182 Phase 2 で実測 1.61〜3.22）。
   この面はユーザーの会場画像の上なので、地の色もテーマ非依存の固定値にすること。 */

.mini-venue {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

/* ステージ背景 */
.mini-venue-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0a0e1a 0%, #141a2e 40%, #1a1228 100%);
}
.mini-venue-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 60%;
  background: radial-gradient(ellipse at 50% 30%, rgba(var(--warning-soft-bg-rgb), 0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* スクリーン（サムネイル） */
.mini-venue-screen {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 45%;
  max-width: 130px;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(var(--warning-soft-bg-rgb), 0.3);
  box-shadow: 0 0 12px rgba(var(--warning-soft-bg-rgb), 0.15), 0 0 30px rgba(var(--warning-soft-bg-rgb), 0.05);
  z-index: 1;
}
.mini-venue-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.85) saturate(1.1);
}
.mini-venue-screen picture {
  display: block;
  width: 100%;
  height: 100%;
}
.mini-venue-screen-fallback {
  width: 100%;
  height: 100%;
  background: #2d2d44;
  display: flex;
  align-items: center;
  justify-content: center;
  /* ⚠️ 0.4 だと #2d2d44 の上で 2.52 で、非テキスト 3:1 にも届いていなかった */
  color: rgba(var(--warning-soft-bg-rgb), 0.75);
  font-size: 1rem;
}

/* リアクションデコレーション散布 */
.mini-venue-decos {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.mini-venue-icon {
  position: absolute;
  font-size: 0.6rem;
  filter: drop-shadow(0 0 3px currentColor);
  visibility: hidden;
  opacity: 0.8;
  animation: mini-venue-twinkle 2.5s ease-in-out infinite;
}
.mini-venue-icon.mini-venue-placed {
  visibility: visible;
}
.mini-venue-icon:nth-child(2n) { animation-delay: 0.8s; }
.mini-venue-icon:nth-child(3n) { animation-delay: 1.6s; }
.mini-venue-icon:nth-child(5n) { animation-delay: 0.4s; }

.mini-venue-pixel {
  position: absolute;
  display: inline-flex;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
  visibility: hidden;
  opacity: 0.85;
  animation: mini-venue-twinkle 3s ease-in-out infinite;
}
.mini-venue-pixel.mini-venue-placed {
  visibility: visible;
}
.mini-venue-pixel:nth-child(2n) { animation-delay: 1s; }
.mini-venue-pixel:nth-child(3n) { animation-delay: 2s; }

@keyframes mini-venue-twinkle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* タイマー */
.mini-venue-timer {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  z-index: 3;
}

/* LIVEバッジ。地は light テーマの --color-danger と同値の固定赤。
   テーマ追従のままだとダーク 5 テーマで #fff on 明赤 = 2.51 だった（→ 5.58） */
.mini-venue-live-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(185, 28, 28, 0.9);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  z-index: 3;
  letter-spacing: 0.5px;
}

/* --- Mini Venue Compact (play_typing recommend) --- */
.mini-venue-compact {
  position: relative;
  width: 56px;
  height: 42px;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, #0a0e1a 0%, #1a1228 100%);
  flex-shrink: 0;
}
.mini-venue-compact-bg {
  position: absolute;
  inset: 0;
  opacity: 0.4;
}
.mini-venue-compact-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mini-venue-compact-icon {
  position: absolute;
  font-size: 0.45rem;
  bottom: 4px;
  filter: drop-shadow(0 0 2px currentColor);
  opacity: 0.9;
  animation: mini-venue-twinkle 2.5s ease-in-out infinite;
}
.mini-venue-compact-icon:nth-child(2) { left: 8px; bottom: 6px; animation-delay: 0.5s; }
.mini-venue-compact-icon:nth-child(3) { left: 24px; bottom: 3px; animation-delay: 1.2s; }
.mini-venue-compact-icon:nth-child(4) { right: 8px; bottom: 7px; animation-delay: 0.8s; }
.mini-venue-compact-pixel {
  position: absolute;
  bottom: 3px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
  opacity: 0.85;
}
.mini-venue-compact-pixel:nth-child(2) { left: 6px; }
.mini-venue-compact-pixel:nth-child(3) { left: 22px; }
.mini-venue-compact-pixel:nth-child(4) { right: 6px; }
/* 開催中を示す装飾ドット（テキストなし・周囲の情報と重複）。
   地は .mini-venue-compact の暗グラデにユーザー画像が opacity .4 で重なるため、
   どの単色でも非テキスト 3:1 を保証できない（達成できるのは #ffc9c9 級の淡色だけで
   「開催中の赤」に見えなくなる）。世界だけダーク固定に揃え、視認は glow で担保する。 */
.mini-venue-compact-live {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.45rem;
  color: #ef4444; /* design-allow: contrast-context — 会場画像の上の装飾ドット。単色では面が決まらない */
  filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.6));
}

/* ===========================
   Host Event History Cards
   =========================== */

.my-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.my-event-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.my-event-card:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  box-shadow: var(--card-shadow-hover);
  text-decoration: none;
  color: inherit;
}

/* ミニ会場プレビュー（カード用） */
.mini-venue-compact-card {
  position: relative;
  height: 100px;
  overflow: hidden;
  background: linear-gradient(180deg, #0a0e1a 0%, #141a2e 60%, #1a1228 100%);
}
.mini-venue-compact-card-bg {
  position: absolute;
  inset: 0;
  opacity: 0.25;
}
.mini-venue-compact-card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(2px);
}
.mini-venue-compact-card-stage {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 40%;
  background: radial-gradient(ellipse at 50% 20%, rgba(var(--warning-soft-bg-rgb), 0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* リアクションアイコン散布 */
.mini-venue-compact-card-icon {
  position: absolute;
  font-size: 0.55rem;
  filter: drop-shadow(0 0 3px currentColor);
  opacity: 0.85;
  animation: mini-venue-twinkle 2.5s ease-in-out infinite;
}
.mini-venue-compact-card-icon:nth-of-type(1) { bottom: 20px; left: 12%; animation-delay: 0s; }
.mini-venue-compact-card-icon:nth-of-type(2) { bottom: 28px; left: 30%; animation-delay: 0.7s; }
.mini-venue-compact-card-icon:nth-of-type(3) { bottom: 16px; left: 50%; animation-delay: 1.4s; }
.mini-venue-compact-card-icon:nth-of-type(4) { bottom: 24px; left: 65%; animation-delay: 0.3s; }
.mini-venue-compact-card-icon:nth-of-type(5) { bottom: 30px; left: 80%; animation-delay: 1.1s; }
.mini-venue-compact-card-icon:nth-of-type(6) { bottom: 18px; right: 8%; animation-delay: 0.5s; }

.mini-venue-compact-card-pixel {
  position: absolute;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
  opacity: 0.85;
  animation: mini-venue-twinkle 3s ease-in-out infinite;
}
.mini-venue-compact-card-pixel:nth-of-type(1) { bottom: 20px; left: 15%; animation-delay: 0.2s; }
.mini-venue-compact-card-pixel:nth-of-type(2) { bottom: 26px; left: 35%; animation-delay: 1s; }
.mini-venue-compact-card-pixel:nth-of-type(3) { bottom: 14px; left: 55%; animation-delay: 1.8s; }
.mini-venue-compact-card-pixel:nth-of-type(4) { bottom: 22px; left: 72%; animation-delay: 0.6s; }
.mini-venue-compact-card-pixel:nth-of-type(5) { bottom: 30px; right: 10%; animation-delay: 1.3s; }
.mini-venue-compact-card-pixel:nth-of-type(6) { bottom: 18px; right: 25%; animation-delay: 0.8s; }

/* ステータスバッジ */
.my-event-status-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
/* .mini-venue-compact-card（暗グラデ + 画像 opacity .25）の上に載るバッジ。
   地はテーマ非依存の固定値。テーマ追従だと #fff との組が反転して割れる。
   実測（10 テーマ × グラデ 3 停止 × 画像の明暗端）: success 7.26 / failed 7.05 /
   settling 7.71 / open 6.93。修正前は 1.61 / 3.22 / 7.71 / 3.12 だった */
.my-event-status-success { background: rgba(22, 101, 52, 0.9); color: #fff; }
.my-event-status-failed  { background: rgba(185, 28, 28, 0.85); color: #fff; }
.my-event-status-settling { background: rgba(var(--warning-soft-bg-rgb), 0.9); color: #212529; }
.my-event-status-open { background: rgba(29, 78, 216, 0.9); color: #fff; }

/* 充填率バー */
.my-event-fill-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.1);
}
.my-event-fill-bar-inner {
  height: 100%;
  border-radius: 0 1px 0 0;
  transition: width 0.3s;
}

/* カード下部テキスト */
.my-event-card-body {
  padding: 0.5rem 0.6rem;
}
.my-event-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.my-event-card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
}
.my-event-card-meta i {
  font-size: 0.65rem;
  margin-right: 0.1rem;
}
.my-event-card-beat {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--lh-success);
}
.my-event-card-beat i {
  /* ⚠️ .my-event-card はテーマ追従面（会場アートの上ではない）。#d4a017 は light で 1.79 */
  color: var(--color-warning);
  font-size: 0.7rem;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .mini-venue-icon,
  .mini-venue-pixel,
  .mini-venue-compact-icon,
  .mini-venue-compact-card-icon,
  .mini-venue-compact-card-pixel {
    animation: none;
    opacity: 0.8;
  }
}

/* design-allow-end: color-literal */
