/* =================================================================
   酔澄觸° 歌枠アーカイブ  スタイル

   デザインはこのフェーズでは作り込まない（指示書 第9章）。
   ここで守っているのは以下だけ:
     - 基調は淡い水色と白、差し色に黒
     - 装飾なし。素の状態で読みやすいこと
     - スマホ優先。片手で押せる行の高さ
     - フォーカスが見えること / prefers-reduced-motion を尊重
     - 色と余白は CSS 変数にまとめ、あとで差し替えやすくする
   配信者のイメージ（青い狼・絆創膏・グリッチ）は次フェーズで反映する。
   ================================================================= */

:root{
  /* ---- 色 ---- */
  --accent:        #A8CDEB;   /* 淡い水色（基調） */
  --accent-weak:   #E8F1F9;   /* 水色の薄いほう（ハイライト背景など） */
  --accent-deep:   #3E7CB1;   /* 水色の濃いほう（フォーカス枠・強調文字） */
  --bg:            #FFFFFF;
  --bg-2:          #F4F8FC;   /* 面をわずかに沈めるとき */
  --ink:           #121212;   /* 差し色の黒（本文） */
  --ink-soft:      #59616B;   /* 補助テキスト */
  --ink-weak:      #9AA3AD;   /* さらに弱いテキスト */
  --rule:          #DCE7F1;   /* 罫線 */
  --danger:        #B23B3B;   /* エラー文字 */

  /* ---- 余白 ---- */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 28px;

  /* ---- その他 ---- */
  --row-min-h: 56px;         /* 片手で押せる行の高さ */
  --radius: 4px;
  --maxw-right: 640px;       /* 右カラムの読みやすい幅 */
  --font: system-ui, -apple-system, "Hiragino Kaku Gothic ProN",
          "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }

/* hidden 属性を必ず効かせる（.poster などに display:flex を当てているため、
   これがないと hidden にしても消えない） */
[hidden]{ display: none !important; }

body{
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* フォーカスは常に見える形で（キーボード操作のため） */
:focus-visible{
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

button{ font-family: inherit; }

/* -----------------------------------------------------------------
   レイアウト
   スマホ: 縦一列。左カラム（映像）を画面上部に固定。
   PC:     左右二分割。左右は独立してスクロール。
   ----------------------------------------------------------------- */
.app{
  display: block;
}

.col-left{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: var(--s2) var(--s4) var(--s2);
}

.col-right{
  padding: var(--s4) var(--s4) 25vh;   /* 下に余白。最終行までスクロールで届くように */
  max-width: var(--maxw-right);
  margin: 0 auto;
}

@media (min-width: 860px){
  body{ overflow: hidden; }              /* ページ自体はスクロールさせない */

  .app{
    display: flex;
    align-items: stretch;
    height: 100vh;
  }

  /* 左カラム: 画面幅に応じて素直に大きくする。ただし 60vw で頭打ち。 */
  .col-left{
    position: static;
    flex: 3 1 0;
    max-width: 60vw;
    overflow-y: auto;
    border-right: 1px solid var(--rule);
    border-bottom: 0;
    padding: var(--s5);
  }

  .col-right{
    flex: 2 1 360px;
    min-width: 0;
    overflow-y: auto;
    margin: 0;
    padding: var(--s5) var(--s5) 40vh;
  }
}

/* -----------------------------------------------------------------
   プレイヤー
   ----------------------------------------------------------------- */
.player-wrap{ }

.frame{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  /* 角丸や overflow:hidden は Android Chrome で動画レイヤーが
     出なくなる原因になりやすいので付けない */
}
.frame #player,
.frame iframe{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.frame-msg{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s5);
  color: #E8EEF4;
  background: #0B0B0B;
  font-size: 14px;
  line-height: 1.7;
}

/* 再生前のサムネイル + 再生ボタン */
.poster{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.poster-play{
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 再生コントロール */
.transport{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  padding: var(--s3) 0 var(--s1);
}
.tp-btn{
  font-size: 15px;
  line-height: 1;
  width: 40px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.tp-btn.tp-play{
  width: 52px;
  border-color: var(--accent-deep);
  color: var(--accent-deep);
}
.tp-btn:disabled{
  color: var(--ink-weak);
  border-color: var(--rule);
  cursor: not-allowed;
}
.yt-link-row{
  margin: 0;
  text-align: center;
  padding-bottom: var(--s1);
}
.yt-link-row a{
  font-size: 12px;
  color: var(--ink-soft);
}

/* 再生中の曲 + 投票ボタン */
.nowbar{
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s1) var(--s1);
  min-height: 52px;
}
.nowbar .now-info{ flex: 1 1 auto; min-width: 0; }
.now-title{
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.now-artist{
  font-size: 13px;
  color: var(--ink-soft);
}
.nowbar.idle .now-title{
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
}

.now-vote{
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s1);
}
.vote-btn{
  font-size: 14px;
  line-height: 1;
  padding: 10px 14px;
  border: 1px solid var(--accent-deep);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--accent-deep);
  cursor: pointer;
  white-space: nowrap;
}
.vote-btn.voted{
  background: var(--accent-deep);
  color: #fff;
}
.vote-btn:disabled{
  border-color: var(--rule);
  color: var(--ink-weak);
  cursor: not-allowed;
}
.vote-msg{
  font-size: 12px;
  color: var(--danger);
  max-width: 40vw;
  text-align: right;
}

/* -----------------------------------------------------------------
   見出し・タブ
   ----------------------------------------------------------------- */
.site-head h1{
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
.site-sub{
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.tabs{
  display: flex;
  gap: var(--s1);
  margin: var(--s4) 0 var(--s3);
  border-bottom: 1px solid var(--rule);
}
.tabs button{
  flex: 1 1 auto;
  font-size: 14px;
  padding: 10px 4px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.tabs button[aria-selected="true"]{
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--accent-deep);
}

/* -----------------------------------------------------------------
   パネル共通
   ----------------------------------------------------------------- */
.panel{ }

.controls{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  margin-bottom: var(--s2);
}

/* 配信の切り替えチップ */
.chips{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
  margin-bottom: var(--s3);
}
.chip{
  font-size: 13px;
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
}
.chip[aria-pressed="true"]{
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip.dead{
  color: var(--ink-weak);
  text-decoration: line-through;
}

/* 検索 / 並び替え */
.search{
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px var(--s2);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  margin-bottom: var(--s2);
}
.search::placeholder{ color: var(--ink-weak); }

.sort-select{
  font: inherit;
  font-size: 13px;
  padding: 7px var(--s2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
}

.list-meta{
  font-size: 12px;
  color: var(--ink-soft);
  padding: var(--s1) var(--s1) var(--s3);
}

/* -----------------------------------------------------------------
   行（曲・歌唱）
   ----------------------------------------------------------------- */
.list{ list-style: none; margin: 0; padding: 0; }

.row{
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: var(--row-min-h);
  text-align: left;
  font: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: var(--s3) var(--s1);
  color: inherit;
  cursor: pointer;
}
.row:hover{ background: var(--bg-2); }

.row-time{
  flex: none;
  width: 60px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-soft);
}
.row-main{ flex: 1 1 auto; min-width: 0; }
.row-title{
  display: block;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.row-sub{
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 1px;
}
.row-votes{
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-soft);
}

/* 再生中の行 */
.row.is-playing{ background: var(--accent-weak); }
.row.is-playing .row-time{ color: var(--accent-deep); font-weight: 700; }
.row.is-playing .row-title{ font-weight: 700; }

/* 配信が非公開だった場合、その配信の行を沈める */
.row.dead .row-title{ color: var(--ink-weak); }

/* ぷれそんぐ: 曲を開いたときの歌唱一覧 */
.song{ border-bottom: 1px solid var(--rule); }
.song > .row{ border-bottom: 0; }
.song-perfs{ padding: 0 0 var(--s2) var(--s4); }
.song-perfs .row{
  min-height: 44px;
  border-bottom: 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.song-head .caret{
  flex: none;
  font-size: 11px;
  color: var(--ink-weak);
  transition: none;
}
@media (prefers-reduced-motion: no-preference){
  .song-head .caret{ transition: transform .12s ease; }
  .row, .chip{ transition: background-color .12s ease; }
}
.song-head[aria-expanded="true"] .caret{ transform: rotate(90deg); }

/* ぷれべすと: 順位 */
.rank{ list-style: none; margin: 0; padding: 0; }
.rank .row-no{
  flex: none;
  width: 34px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-deep);
}

/* お知らせ・空状態 */
.notice,
.empty{
  padding: var(--s6) var(--s1);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

/* ぷれべすとの連続再生トグル */
.autoplay-toggle{
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 13px;
  color: var(--ink-soft);
  padding: var(--s2) var(--s1) var(--s3);
}

/* ぷれそんぐ: アーティスト別 */
.artist-group{ margin-bottom: var(--s4); }
.artist-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2) var(--s1) var(--s1);
  border-bottom: 2px solid var(--accent);
  background: var(--bg);
}
.artist-name{ font-size: 14px; font-weight: 700; }
.artist-count{ font-size: 12px; color: var(--ink-soft); flex: none; }
.artist-group .song:last-child{ border-bottom: 0; }

/* このサイトについて */
.about{
  margin-top: var(--s6);
  border-top: 1px solid var(--rule);
  padding-top: var(--s3);
  font-size: 13px;
}
.about summary{
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13px;
}
.about-body{ padding-top: var(--s2); color: var(--ink-soft); line-height: 1.8; }
.about-body p{ margin: 0 0 var(--s3); }
.about-body a{ color: var(--accent-deep); }
