/* ===== reset / base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #000;
  --fg: #fff;
  --dim: #9a9a9a;
  --line: rgba(255,255,255,.18);
  --gap: clamp(16px, 4vw, 36px);
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  letter-spacing: .02em;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ===== intro（黒背景にロゴ→フェードアウト） ===== */
.intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg);
  transition: opacity 1.2s ease;
}
.intro__logo { width: min(200px, 46vw); height: auto; animation: introLogo 1.7s ease both; }
@keyframes introLogo { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: scale(1); } }
/* ロゴ下のキャッチ（ロゴの少し後にフェードイン） */
.intro__tag {
  font-size: clamp(11px, 3vw, 14px); letter-spacing: .34em; text-transform: uppercase;
  color: rgba(255,255,255,.6); padding-left: .34em; /* 字間ぶんの光学センター補正 */
  animation: introTag 1.2s ease .9s both;
}
@keyframes introTag { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* バージョンお知らせ（小さく・ロゴの少し後にフェードイン・日英） */
.intro__note {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 14px; max-width: min(420px, 84vw); text-align: center;
  animation: introTag 1.4s ease 1.8s both;
}
.intro__note-label {
  font-size: 9px; letter-spacing: .3em; color: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 2px 9px;
}
.intro__note-jp { font-size: 12px; line-height: 1.6; color: rgba(255,255,255,.7); margin-top: 2px; }
.intro__note-en { font-size: 10px; letter-spacing: .04em; color: rgba(255,255,255,.4); }
.intro.is-out { opacity: 0; pointer-events: none; }

/* イントロ明け：UI(chrome)をフェードイン */
.chrome { opacity: 0; transition: opacity .7s ease; pointer-events: none; }
body.is-live .chrome { opacity: 1; pointer-events: auto; } /* 子はpointer-events継承でauto */
/* アイドル時：UIを消してMVだけ残す */
body.is-live.is-idle .chrome { opacity: 0; pointer-events: none; }
body.is-live.is-idle { cursor: none; }
body.is-live.is-idle .scrim { opacity: 0; transition: opacity .7s ease; }

/* ===== 映像：画面いっぱいに敷く（フルブリード／cover） ===== */
/* YT APIは <div id="yt"> を iframe に置換するため #yt 自体がiframe。直接サイズ指定する。 */
.video-bg { position: fixed; inset: 0; z-index: 0; background: #000; overflow: hidden; }
#yt {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 100vw; height: 56.25vw;            /* 16:9（幅基準） */
  min-height: 100vh; min-width: 177.78vh;   /* 16:9（高さ基準）→ 画面を覆う */
  border: 0; pointer-events: none;          /* 誤クリックで停止しないよう無効化 */
}

/* ===== UIレイヤー ===== */
.player { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

/* 上下のスクリム（文字を読みやすく） */
.scrim { position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none; }
.scrim--top { top: 0; height: 220px; background: linear-gradient(rgba(0,0,0,.65), transparent); }
.scrim--bottom { bottom: 0; height: 320px; background: linear-gradient(transparent, rgba(0,0,0,.8)); }

/* ===== brand（左上：ロゴ＋哲学＋ジャンル） ===== */
.brand {
  position: absolute; z-index: 1;
  top: calc(var(--gap) + env(safe-area-inset-top));
  left: calc(var(--gap) + env(safe-area-inset-left));
  display: flex; flex-direction: column; align-items: center; gap: 8px; /* ロゴとANTI-をセンター揃え */
}
.brand__logo { height: 192px; width: auto; }           /* 大きく見せる（4倍） */
.brand__tag {
  font-size: 13px; letter-spacing: .34em; text-transform: uppercase;
  color: rgba(255,255,255,.65); margin-top: 2px;
}
/* ピルUI（楽曲を追加 など） */
.pill {
  font-size: 13px; color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 18px; background: rgba(0,0,0,.4);
  backdrop-filter: blur(6px); transition: .15s;
}
.pill:hover { color: #000; background: var(--fg); border-color: var(--fg); }
.pill--primary { font-weight: 600; }

/* ===== CALM↔NOISE バランス・シークバー ===== */
.balance { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 7px; width: min(260px, 72vw); }
.balance__zone {
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(255,255,255,.85); min-height: 14px;
}
.balance__row { display: flex; align-items: center; gap: 10px; width: 100%; }
.balance__end { font-size: 9px; letter-spacing: .1em; color: rgba(255,255,255,.55); flex-shrink: 0; }
.balance__end--calm { color: #9ecbff; }
.balance__end--noise { color: #ff9d92; }
.balance__range {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px; border-radius: 999px;
  background: linear-gradient(90deg, #4aa3ff, rgba(255,255,255,.55) 50%, #ff5a4a); cursor: pointer;
}
.balance__range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid rgba(0,0,0,.5); box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; }
.balance__range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid rgba(0,0,0,.5); cursor: pointer; }
/* 投稿モーダル内のバランス（暗背景パネル用） */
.balance--form { width: 100%; flex-direction: row; align-items: center; gap: 10px; margin-top: 2px; }
.balance--form .balance__formval { font-size: 12px; color: var(--dim); flex: 0 0 64px; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== 右上：About（インフォアイコン） ===== */
.info-link {
  position: absolute; z-index: 2;
  top: calc(var(--gap) + env(safe-area-inset-top));
  right: calc(var(--gap) + env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg);
  background: rgba(0,0,0,.38); backdrop-filter: blur(4px);
  border: 1px solid var(--line); transition: background .15s;
}
.info-link:hover { background: rgba(0,0,0,.7); }
.info-link svg { display: block; }

/* ===== next / back（映像の左右） ===== */
.stage__nav {
  position: absolute; z-index: 1; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg);
  background: rgba(0,0,0,.38); backdrop-filter: blur(4px);
  transition: background .15s, opacity .7s;
}
.stage__nav svg { display: block; }
.stage__nav:hover { background: rgba(0,0,0,.7); }
.stage__nav.is-prev { left: clamp(8px, 2.5vw, 28px); }
.stage__nav.is-next { right: clamp(8px, 2.5vw, 28px); }
/* 中央：再生/一時停止（左右送りの間） */
.stage__nav.is-play { left: 50%; transform: translate(-50%, -50%); }
.stage__nav.is-play .ic-play { display: none; }     /* 既定＝再生中：一時停止アイコン */
.stage__nav.is-play.is-paused .ic-pause { display: none; }
.stage__nav.is-play.is-paused .ic-play { display: block; }  /* 停止中＝再生アイコン */
/* ===== dock（下部：曲情報＋追加＋報告） ===== */
.dock {
  position: absolute; z-index: 1; left: 0; right: 0;
  bottom: calc(var(--gap) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 0 var(--gap);
}
.meta { text-align: center; min-height: 68px; opacity: 0; transform: translateY(6px); transition: .4s ease; }
.meta.is-show { opacity: 1; transform: none; }
.meta__title { font-size: clamp(15px, 4vw, 20px); font-weight: 600; }
.meta__desc {
  margin-top: 6px; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.7;
  max-width: 620px; margin-inline: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta__foot { margin-top: 8px; display: flex; gap: 12px; justify-content: center; font-size: 11px; color: rgba(255,255,255,.5); }
.meta__genre { color: var(--fg); }

.actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.actions__row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.actions__links { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.report-link { font-size: 12px; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
.report-link:hover { color: var(--fg); }
/* ♡保存ボタン：保存済みは塗り */
.pill.is-fav { color: #000; background: var(--fg); border-color: var(--fg); }
/* お気に入り再生中インジケータ */
#favOpen.is-active { color: var(--fg); font-weight: 600; }
#favOpen.is-active::before { content: "▶ "; }

/* ===== unmute prompt（画面中央） ===== */
.unmute {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 35;
  display: flex; align-items: center; gap: 8px;
  background: var(--fg); color: #000; font-size: 13px; font-weight: 600;
  border-radius: 999px; padding: 12px 22px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); animation: pop .3s ease;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -42%); } }
.unmute__icon { font-size: 15px; }

/* ===== modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
}
.modal__panel {
  width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
  background: #111; border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 26px var(--gap) calc(26px + env(safe-area-inset-bottom));
  position: relative;
}
.modal__close { position: absolute; top: 14px; right: 18px; font-size: 24px; color: var(--dim); }
.modal__h { font-size: 18px; }
.modal__lead { margin-top: 6px; color: var(--dim); font-size: 13px; line-height: 1.6; }
.field { display: block; margin-top: 18px; }
.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: #000; color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font: inherit; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--fg); }
.preview { margin-top: 16px; display: flex; gap: 12px; align-items: center; background: #000; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.preview img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; }
.preview p { font-size: 13px; line-height: 1.5; }
.modal__submit { width: 100%; margin-top: 22px; background: var(--fg); color: #000; font-weight: 600; border-radius: 999px; padding: 13px; }
.modal__submit:disabled { opacity: .4; cursor: default; }
.modal__note { margin-top: 12px; color: #666; font-size: 11px; line-height: 1.6; }

/* ===== About オーバーレイ（TOPに黒背景で被せる） ===== */
.about-ov {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.62);                     /* 完全黒をやめ、後ろの映像をうっすら透かす */
  -webkit-backdrop-filter: blur(22px) saturate(1.1);
  backdrop-filter: blur(22px) saturate(1.1);       /* すりガラス（フロスト） */
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: clamp(44px, 9vw, 80px) clamp(22px, 7vw, 64px) 100px;
  animation: aboutIn .3s ease;
}
@keyframes aboutIn { from { opacity: 0; } }
.about-ov__inner { max-width: 680px; margin: 0 auto; line-height: 1.9; }
.about-ov__close {
  position: fixed; top: 14px; right: 16px; z-index: 61;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; color: var(--fg);
  background: rgba(255,255,255,.08); border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.about-ov__close:hover { background: rgba(255,255,255,.18); }
.about-ov .logo { width: min(150px, 42vw); height: auto; display: block; margin: 0 auto 10px; }
.about-ov .tag { font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: rgba(255,255,255,.55); text-align: center; padding-left: .34em; }
.about-ov h1 { font-size: clamp(22px, 6vw, 30px); font-weight: 800; margin: 36px 0 16px; letter-spacing: .01em; }
.about-ov h2 { font-size: clamp(15px, 4vw, 18px); font-weight: 700; margin: 40px 0 12px; }
.about-ov p { color: rgba(255,255,255,.82); margin-bottom: 14px; font-size: 15px; }
.about-ov .lead { font-size: clamp(16px, 4.4vw, 19px); color: var(--fg); line-height: 1.8; margin-top: 34px; }
.about-ov strong { color: #fff; font-weight: 700; }
.about-ov .calm { color: #4aa3ff; } .about-ov .noise { color: #ff5a4a; }
.about-ov ul { margin: 0 0 14px; padding-left: 1.1em; color: rgba(255,255,255,.82); font-size: 15px; }
.about-ov li { margin-bottom: 8px; }
.about-ov hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.about-ov .en { color: var(--dim); font-size: 14px; line-height: 1.85; }
.about-ov .en h2 { color: var(--fg); }
.about-ov .donate { margin-top: 40px; padding: clamp(20px, 5vw, 28px); border: 1px solid var(--line); border-radius: 16px; text-align: center; background: rgba(255,255,255,.03); }
.about-ov .donate__h { font-size: 13px; letter-spacing: .2em; color: var(--dim); text-transform: uppercase; margin-bottom: 10px; }
.about-ov .donate__lead { font-size: 14px; color: rgba(255,255,255,.82); line-height: 1.8; margin-bottom: 18px; }
.about-ov .donate__btn { display: inline-flex; align-items: center; gap: 8px; background: var(--fg); color: #000; font-weight: 700; font-size: 15px; border-radius: 999px; padding: 13px 28px; text-decoration: none; transition: .15s; }
.about-ov .donate__btn:hover { opacity: .85; }

/* ===== お気に入り一覧 ===== */
.fav-list { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.fav-item { display: flex; align-items: center; gap: 10px; background: #000; border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; transition: .12s; }
.fav-item:hover { border-color: rgba(255,255,255,.4); }
.fav-item__thumb { width: 72px; flex-shrink: 0; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; }
.fav-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fav-item__title { font-size: 13px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fav-item__sub { font-size: 11px; color: var(--dim); }
.fav-item__btn { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--dim); border: 1px solid var(--line); }
.fav-item__btn:hover { color: var(--fg); border-color: rgba(255,255,255,.4); }
.fav-item__del { font-size: 18px; }

@media (min-width: 720px) {
  .modal { align-items: center; }
  .modal__panel { border-radius: 18px; }
}

/* スマホ：ロゴと送りボタンを少し小さく */
@media (max-width: 540px) {
  .brand__logo { height: 120px; }
  .brand__tag { font-size: 11px; letter-spacing: .26em; }
  .stage__nav { width: 48px; height: 48px; }
  /* ロゴ＋哲学＋ジャンルUIを画面中央に（左寄りバランスを解消） */
  .brand {
    left: 50%; right: auto;
    transform: translateX(-50%);
    text-align: center;
  }
  /* 中央ボタンは left:50% + translateX で位置維持（縦中央のtranslateYも保持） */
  .stage__nav.is-play { transform: translate(-50%, -50%); }
}

/* ===== 横向きスマホ（縦が低い）：幅が540pxを超えPC用レイアウトになり崩れるので、画面の高さで判定して圧縮 ===== */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --gap: 10px; }

  /* ブランド：ロゴを左上に（縦向きの約2.5倍＝100px）。哲学コピーは隠す */
  .brand {
    top: calc(8px + env(safe-area-inset-top));
    left: calc(12px + env(safe-area-inset-left)); right: auto; transform: none;
    align-items: flex-start; text-align: left; gap: 0;
  }
  .brand__logo { height: 100px; }
  .brand__tag { display: none; }
  /* CALM↔NOISE スライダー：上部センターに独立配置（fixedでも親chromeのフェードは継承される） */
  .balance {
    position: fixed; z-index: 2;
    top: calc(10px + env(safe-area-inset-top));
    left: 50%; transform: translateX(-50%);
    margin-top: 0; width: min(280px, 56vw); align-items: center; gap: 4px;
  }
  .balance__zone { font-size: 10px; letter-spacing: .2em; }
  .balance__range { height: 3px; }

  /* 送り/再生ボタンは小さめに */
  .stage__nav { width: 38px; height: 38px; }
  .stage__nav svg { width: 20px; height: 20px; }
  .info-link { width: 34px; height: 34px; }
  .info-link svg { width: 18px; height: 18px; }

  /* 下部ドック：行間と文字を詰め、説明文は1行に */
  .dock { bottom: calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .meta { min-height: 0; }
  .meta__title { font-size: 14px; }
  .meta__desc { -webkit-line-clamp: 1; margin-top: 2px; font-size: 12px; }
  .meta__foot { margin-top: 4px; }
  .actions { gap: 8px; }
  .actions__row { gap: 8px; }
  /* テキストリンクは右下に固定（中央下を曲名に明け渡して画面効率UP） */
  .actions__links {
    position: fixed; z-index: 2;
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    flex-direction: column; align-items: flex-end; gap: 7px;
  }
  .pill { padding: 6px 13px; font-size: 12px; }
  .report-link { font-size: 11px; }
  /* 「タップで音を出す」を中央やや上に＝下部の曲名と被らせない */
  .unmute { top: 38%; padding: 9px 18px; font-size: 12px; }

  /* イントロも縮める（横向きで起動した時用） */
  .intro__logo { width: min(110px, 26vw); }
  .intro__tag { font-size: 10px; }
  .intro__note { margin-top: 8px; gap: 3px; }
  .intro__note-jp { font-size: 11px; line-height: 1.5; }
  .intro__note-en { font-size: 9px; }
}
