/* アルバムジャケットQuiz : 音楽アプリ風のダークUI
   ジャケット画像が主役なので、背景は徹底して沈ませ、彩度は画像側に持たせる。 */

:root {
  --bg: #0a0a0f;
  --bg-elevated: #14141c;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f2f5;
  --text-dim: #8b8b99;
  --accent: #1ed760;
  --accent-dim: rgba(30, 215, 96, 0.15);
  --danger: #ff5a5f;
  --radius: 14px;
  --radius-lg: 22px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* 英語表示ではラテン文字を欧文書体で出す。
   和文フォントを先頭に置いたままだと、ラテン文字が和文書体のグリフで描かれ
   字間が間延びする。:root ではなく html[lang] に当てるのは、
   i18n.js が documentElement.lang を切り替えるため。 */
html[lang="en"] {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- 言語切り替え ---------- */

/* 画面の右上に固定する。どの画面からでも切り替えられるようにするため。
   結果リンクで来た人はタイトル画面を通らないので、置き場所は共通でなければならない。 */
.lang-switch {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 5;
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* 出題中は隠す。進捗バーと位置を取り合ううえ、解いている最中に触るものでもない。 */
body.on-quiz .lang-switch {
  display: none;
}

.lang-switch .lang {
  border: 0;
  border-radius: 999px;
  padding: 5px 10px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.lang-switch .lang:hover {
  color: var(--text);
}
.lang-switch .lang.is-active {
  color: var(--bg);
  background: var(--text);
}

/* 再生中のジャケットを巨大にぼかして敷く。音楽アプリらしさの中心。 */
#ambient {
  position: fixed;
  inset: -20%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(90px) saturate(1.6);
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 1.2s ease, background-image 0.6s ease;
  pointer-events: none;
}
#ambient.visible {
  opacity: 0.34;
}

#ambient-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
      ellipse at 50% 0%,
      transparent 0%,
      rgba(10, 10, 15, 0.55) 55%,
      var(--bg) 100%
    );
}

.app {
  position: relative;
  z-index: 2;
  max-width: 660px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 画面切り替え ---------- */
.screen {
  display: none;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  flex: 1;
  flex-direction: column;
}
.screen.active {
  display: flex;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- タイトル ---------- */
.brand {
  text-align: center;
  margin: 48px 0 8px;
}
.brand h1 {
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.25;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.brand p {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.8;
  margin: 0;
}

/* レコード盤 + 中心のラベル。
   盤だけを回し、「?」は止めておく。一緒に回すと読めなくなるため。 */
.logo {
  position: relative;
  width: 156px;
  height: 156px;
  margin: 0 auto 30px;
}
/* 同心円の溝と、円錐グラデーションの照り返しを重ねる。
   溝だけだと回転対称なので、回っていることが見た目に伝わらない。 */
.logo-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.03) 0 1px,
      rgba(255, 255, 255, 0) 1px 4px
    ),
    conic-gradient(from 0deg, #1a1a24, #2a2a38, #1a1a24, #33333f, #1a1a24);
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.62);
  animation: spin 14s linear infinite;
}
/* 中心の緑を盤に馴染ませるための光。盤と違って回さない */
.logo-glow {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 215, 96, 0.2), transparent 62%);
  pointer-events: none;
}
/* ベタ塗りだと暗い盤から浮くので、階調を付けて立体にする */
.logo-center {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2bd96b, #12994a);
  color: #06120a;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 2px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- ボタン ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 17px 22px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #06120a;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover:not(:disabled) {
  transform: scale(1.02);
  filter: brightness(1.08);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---------- 難易度 ---------- */
.difficulty {
  margin-top: 34px;
}
.difficulty-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 12px;
}
.difficulty-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
/* 5つ目だけ横幅いっぱいに置いて、段が崩れないようにする */
.difficulty-options .diff:last-child {
  grid-column: 1 / -1;
}
.diff {
  padding: 11px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.diff .name {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
.diff .desc {
  display: block;
  font-size: 11px;
  margin-top: 3px;
  opacity: 0.75;
}
.diff:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}
.diff.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}

/* 出題中に難易度を示す小さなバッジ */
.badge {
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.badge:empty {
  display: none;
}

/* ---------- 進捗 ---------- */
.progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.progress-track {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress-label {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

/* ---------- プレイヤー ---------- */
.player {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 24px;
  backdrop-filter: blur(24px);
}

.player-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.play-btn {
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #06120a;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}
.play-btn:hover {
  transform: scale(1.06);
}
.play-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.player-meta {
  flex: 1;
  min-width: 0;
}
.player-meta .title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.player-meta .sub {
  font-size: 12.5px;
  color: var(--text-dim);
}

/* 再生中を示す波形。実際の音量ではなく演出。 */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  margin-top: 8px;
}
.bars span {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  height: 20%;
  opacity: 0.35;
}
.bars.playing span {
  animation: bounce 0.9s ease-in-out infinite;
  opacity: 1;
}
.bars.playing span:nth-child(2) {
  animation-delay: 0.15s;
}
.bars.playing span:nth-child(3) {
  animation-delay: 0.3s;
}
.bars.playing span:nth-child(4) {
  animation-delay: 0.45s;
}
.bars.playing span:nth-child(5) {
  animation-delay: 0.6s;
}
@keyframes bounce {
  0%,
  100% {
    height: 20%;
  }
  50% {
    height: 100%;
  }
}

/* シークバーと音量を1行に並べる */
.player-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.seek {
  flex: 1;
  min-width: 0;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.seek-fill {
  height: 100%;
  width: 0;
  background: var(--text-dim);
  border-radius: 2px;
}

/* ---------- 音量 ----------
   シークバーの右に常に出しておく。 */
.volume {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* アイコンはミュートの切り替え。指で押せる大きさは確保しつつ、
   円形の下地は出さずシークバーの行に馴染ませる。 */
.volume-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.15s ease;
}
.volume-btn:hover {
  color: var(--text);
}
.volume-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.volume-range {
  -webkit-appearance: none;
  appearance: none;
  width: 76px;
  height: 3px;
  margin: 0;
  border-radius: 2px;
  cursor: pointer;
  /* --v は現在の音量(0-100)。JS から書き込む。 */
  background: linear-gradient(
    to right,
    var(--accent) calc(var(--v, 80) * 1%),
    var(--border) calc(var(--v, 80) * 1%)
  );
}

.volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.volume-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ---------- 選択肢 ---------- */
.question-label {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 18px;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
}

.option {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.option:hover:not(:disabled) {
  transform: translateY(-3px);
}
.option:disabled {
  cursor: default;
}
.option.selected {
  border-color: var(--accent);
}
.option.correct {
  border-color: var(--accent);
}
.option.wrong {
  border-color: var(--danger);
}
/* 答え合わせ時、選ばれなかった選択肢を沈ませる */
.option.faded img {
  opacity: 0.3;
  filter: grayscale(0.6);
}

.option .mark {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: none;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #06120a;
}
.option.correct .mark {
  display: grid;
  background: var(--accent);
}
.option.wrong .mark {
  display: grid;
  background: var(--danger);
  color: #fff;
}

/* ---------- 結果 ---------- */
.score-hero {
  text-align: center;
  padding: 16px 0 18px;
}
/* 共有リンクから開いたときだけ、誰の結果かを示す */
.result-owner {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.score-hero .num {
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}
.score-hero .num small {
  font-size: 26px;
  color: var(--text-dim);
  font-weight: 600;
}
.marks {
  margin-top: 12px;
  font-size: 20px;
  letter-spacing: 6px;
}
.mark-ok {
  color: var(--accent);
}
.mark-ng {
  color: var(--danger);
  opacity: 0.75;
}
.score-hero .comment {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 共有 ---------- */
.share {
  margin: 4px 0 22px;
}
.share-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-align: center;
  margin-bottom: 12px;
}
.share-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  margin: -6px 0 12px;
  opacity: 0.8;
  line-height: 1.5;
}
.share-icons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.share-icons.two {
  grid-template-columns: repeat(2, 1fr);
}
/* 2つだけのときは横いっぱいに広がると間延びするので、中央に寄せる */
.share-icons.center {
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- 友達を誘う ---------- */
.invite-box {
  margin: 8px 0 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}
.invite-label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
.invite-url {
  display: block;
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-all;
  background: var(--bg-elevated);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.invite-url:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 出題中にトップへ戻る小さなボタン。誤タップしにくいよう控えめにする */
/* 出題中にトップへ戻るボタン。
   小さすぎると存在に気づかれないので、ラベル付きのピルにする。 */
.quit-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.quit-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.quit-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 4px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.icon-btn span {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.icon-btn:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.icon-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.icon-btn.is-busy svg {
  animation: spin 0.9s linear infinite;
}

/* 文字ボタンの先頭に置くアイコン */
.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  vertical-align: -4px;
  margin-right: 8px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* 下は帰属表示が続く。行間と同じ間隔にして、曲リストに属して見えるようにする。 */
  margin: 0 0 10px;
}
/* 狭い画面では 2 行組み。ジャケットと正誤マークが左右で縦に通し、
   その間に「曲名/アーティスト」と Apple Music バッジを縦に積む。
   バッジは幅 112px 固定（規約で高さ 30px 未満に縮められない）なので、
   横一列に並べると曲名の幅が 60px ほどしか残らず読めなくなる。
   広い画面での 1 行組みは下の min-width クエリを参照。 */
.result-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "jacket info  judge"
    "jacket store judge";
  align-items: center;
  column-gap: 13px;
  /* 行間はバッジ側の margin-top が持つ */
  row-gap: 0;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.result-row .result-jacket {
  grid-area: jacket;
}
.result-row .info {
  grid-area: info;
}
.result-row .store {
  grid-area: store;
}
.result-row .judge {
  grid-area: judge;
}
/* 正解のジャケットと、そこに重ねる「選んだ方」をまとめる枠 */
.result-jacket {
  position: relative;
  flex-shrink: 0;
}

/* ジャケットを押すとその場でプレビューが鳴る */
.result-thumb {
  position: relative;
  /* button の既定は inline-block。ベースライン分の余白が下に付き、
     ジャケットが行の高さを決める広い画面で 5px ほど間延びする。 */
  display: block;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border: none;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-elevated);
}
.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.result-thumb .overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 15, 0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.result-thumb:hover .overlay,
.result-thumb.is-playing .overlay {
  opacity: 1;
}
.result-thumb .overlay svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}
.result-row .info {
  /* grid の 1fr 側に載る。0 にしないと中身が押し広げて省略記号が出ない */
  min-width: 0;
}
.result-row .info .t {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-row .info .a {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
/* Apple Music の該当曲へのリンク。
   Apple の利用条件でプレビューの近くにストアへの導線を置くことが求められている。
   詳細は docs/apis.md を参照。

   【重要】バッジ画像は Apple 配布のものをそのまま使うこと。
   色を変える・角度を付ける・影や光彩を足す・縦横比を崩すことは規約で禁止されている。
   filter や transform を当てないこと。 */
.result-row .store {
  /* 規約の最小サイズは高さ30px。クリアスペースは高さの1/10以上必要なので
     32px に対して 4px 空けている。 */
  margin: 6px 4px 0 0;
  line-height: 0;
  justify-self: start;
}
.result-row .store img {
  height: 32px;
  width: auto;
  display: block;
}
/* 幅に余裕があればバッジを曲名の右へ回し、行を 1 行に詰める。
   固定幅の合計は ジャケット64 + gap13×3 + バッジ112 + 正誤26 = 241px。
   520px あれば曲名に 210px 以上残るので、ここを境目にしている。
   これより狭い画面で 1 行にすると曲名が数文字で切れる。 */
@media (min-width: 520px) {
  .result-row {
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas: "jacket info store judge";
  }
  .result-row .store {
    /* 隣との間隔は column-gap の 13px が持つ。
       規約が求めるクリアスペース（高さの1/10 = 3.2px）は満たしている。 */
    margin: 0;
  }
}

/* プレビューの帰属表示。控えめでよいが、消してはいけない。 */
.itunes-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.75;
  margin: 14px 0 4px;
}
/* 結果画面では曲リストの直後に置く。手前の間隔は .result-list が持ち、
   代わりに次の共有セクションとの間を空ける。
   両方詰めると、どちらに属する表示なのか分からなくなる。 */
#screen-result .itunes-note {
  margin: 0 0 20px;
}

/* 出題画面では再生ボックスの中に納める。
   選択肢の下に置くと、ジャケット4枚と画面下端の間に文字列が挟まって
   視線が切れるうえ、何に対する表示なのかも分かりにくかった。
   音源に対する帰属なので、音源を鳴らしている箱の中にあるのが正しい。 */
.itunes-note.in-player {
  text-align: right;
  font-size: 10px;
  margin: 12px 0 0;
  opacity: 0.55;
}
/* 正誤は色で区別する。絵文字だと環境によって両方赤系に見えて判別できない。 */
.result-row .judge {
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.result-row .judge.ok {
  color: var(--accent);
  background: var(--accent-dim);
}
.result-row .judge.ng {
  color: var(--danger);
  background: rgba(255, 90, 95, 0.14);
}
/* 不正解の行は正解ジャケットを少し沈ませて、当たった問題を目立たせる。
   セレクタを .result-thumb に絞ること。img 全体に掛けると、
   重ねている「選んだジャケット」まで一緒に沈んで見えなくなる。 */
.result-row:has(.judge.ng) .result-thumb img {
  opacity: 0.55;
}

/* 自分が選んだジャケット。正解の右下に小さく重ねて、
   赤枠と背景色で「これを選んで外した」と分かるようにする。 */
.result-jacket .picked {
  position: absolute;
  /* ジャケットの内側に収める。はみ出させると隣の Apple Music バッジに重なり、
     規約が求めるバッジ周囲のクリアスペースを侵してしまう。 */
  right: 3px;
  bottom: 3px;
  width: 28px;
  height: 28px;
  object-fit: cover;
  display: block;
  border-radius: 6px;
  /* 背景色と同じ縁を挟んで、正解ジャケットから切り離して見せる */
  border: 2px solid var(--danger);
  outline: 2px solid var(--bg);
  /* ホバー時の再生オーバーレイより前に出す */
  z-index: 1;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* ---------- 状態表示 ---------- */
.state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-dim);
}
.state .spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 18px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
.state.error {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 380px) {
  .options {
    gap: 10px;
  }
  /* シークバーを潰しすぎない幅に留める */
  .volume-range {
    width: 62px;
  }
  .player-foot {
    gap: 10px;
  }
}
