/* ── play.html 頁面專屬樣式 ─────────────────────────────── */

/* 頁首標籤列 */
.play-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

/* ── 狀態訊息 → 彩色 badge 質感 ── */
#status { transition: color .18s var(--ease); }

#status:not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
#status.ok {
  border: 1px solid rgba(76,195,138,.30);
  color: var(--ok);
}
#status.ok::before {
  content: "";
  width: 6px; height: 6px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}
#status.err {
  border: 1px solid rgba(229,72,77,.30);
  color: var(--err);
}
#status.err::before {
  content: "";
  width: 6px; height: 6px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--err);
  display: inline-block;
}
#status.muted { color: var(--muted); font-size: .85rem; }

/* details / summary */
details summary {
  padding: 6px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: "›";
  font-size: 16px;
  color: var(--muted);
  line-height: 1;
  transition: transform .2s var(--ease);
}
details[open] summary::before { transform: rotate(90deg); }

/* .btn.small — 課程表裡的選難度按鈕 */
.btn.small {
  min-height: 28px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
}

/* 播放器容器：這頁的主角是譜面本身，外框保持安靜 */
.play-stage-card { padding: 16px !important; }

/* ── 結算畫面（手動遊玩到底時彈出） ───────────────────── */
.result-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 14, .72); backdrop-filter: blur(3px);
  border-radius: inherit; animation: r-fade .25s ease;
}
/* hidden 屬性一定要贏過上面的 display:flex，否則結算彈窗會一直蓋在
   播放器上、連遊戲都沒法玩（[hidden] 的 display:none 特異度輸給 class）。 */
.result-overlay[hidden] { display: none !important; }
@keyframes r-fade { from { opacity: 0 } to { opacity: 1 } }
.result-box {
  text-align: center; padding: 22px 26px; max-width: 340px; width: 88%;
  background: var(--card, #14151a);
  border: 1px solid rgba(255,122,53,.3); border-radius: 16px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.7);
}
.result-crown { font-size: 46px; line-height: 1; height: 40px; }
.result-crown.gold { }
.result-crown.silver { filter: grayscale(1) brightness(1.4); }
.result-title { font-size: 24px; font-weight: 600; margin: 6px 0 2px; }
.result-title.clear { color: #f6c945; }
.result-title.fail { color: var(--muted); }
.result-badges { min-height: 20px; margin-bottom: 6px; }
.result-badges span {
  display: inline-block; font-size: 12px; font-weight: 500;
  padding: .12em .6em; border-radius: 999px; margin: 0 3px;
  border: 1px solid currentColor;
}
.badge-allgood { color: #f6c945; }
.badge-fc { color: #e2892b; }
.result-score {
  font-size: 32px; font-weight: 600;
  font-variant-numeric: tabular-nums; margin: 2px 0 10px;
}
.result-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px;
  font-size: .9rem; margin: 0 auto 12px; max-width: 240px;
}
.result-grid > div {
  display: flex; justify-content: space-between;
  border-bottom: 1px dashed var(--line-soft, rgba(127,127,127,.2));
  padding: 2px 0;
}
.result-grid b { font-variant-numeric: tabular-nums; }
.result-gaugewrap { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.result-gauge {
  flex: 1; height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.1);
}
.result-gauge i { display: block; height: 100%; background: #e2892b; }
.result-gauge i.clear { background: #f6c945; }
.result-gnum { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.result-acts { display: flex; gap: 10px; justify-content: center; }

/* ── tja_player.js 注入樣式覆寫（對齊新主題） ─────────── */

/* 播放 / 暫停按鈕 */
.tjap-btn {
  background: var(--accent) !important;
  color: #1c0d03 !important;
  border: 0 !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 16px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
  transition: background-color .15s var(--ease), transform .12s var(--ease) !important;
}
.tjap-btn:hover { background: var(--accent-soft) !important; }
.tjap-btn:active { transform: scale(.98) !important; }
.tjap-btn:disabled { opacity: .38 !important; transform: none !important; }

/* 重啟按鈕（ghost）*/
.tjap-ghost {
  background: var(--panel2) !important;
  border: 1px solid var(--line) !important;
  color: var(--fg) !important;
}
.tjap-ghost:hover { background: var(--line) !important; }

/* 譜面舞台外框 */
.tjap-stage {
  border-radius: var(--radius) !important;
  border: 1px solid var(--line) !important;
  position: relative;
}
/* 時間數字 → mono */
.tjap-time {
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  color: var(--muted) !important;
  font-variant-numeric: tabular-nums !important;
}

/* 進度條顏色 */
.tjap-seek { accent-color: var(--accent) !important; }

/* 控制列標籤 */
.tjap-f {
  font-size: .82rem !important;
  color: var(--muted) !important;
  font-family: var(--font-body) !important;
}
.tjap-f select {
  background: var(--panel2) !important;
  color: var(--fg) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-body) !important;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease) !important;
}
.tjap-f select:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(255,122,53,.16) !important;
}

/* 鍵盤提示 kbd */
.tjap-keys kbd {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
  letter-spacing: .01em;
}

/* 曲目 meta 條 → mono 等寬讀數 */
.tjap-meta {
  font-family: var(--font-mono) !important;
  font-size: .79rem !important;
  color: var(--muted) !important;
  letter-spacing: .01em !important;
  border-top: 1px solid var(--line-soft) !important;
  padding-top: 10px !important;
  margin-top: 10px !important;
  line-height: 1.6 !important;
}
.tjap-meta strong {
  color: var(--fg) !important;
  font-weight: 600 !important;
}
.tjap-sep {
  margin: 0 5px !important;
  opacity: .35 !important;
}

/* 譜面總覽圖 canvas 圓角 */
#chartimg canvas {
  border-radius: var(--radius-sm);
  display: block;
}

/* ── 行動裝置適配 ─────────────────────────────────────────── */

/* 課程表：無論螢幕寬度，都允許橫向捲動（6 欄在手機必定溢出）*/
#courses {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 播放器是 tja_player.js 載完才 mount 進來的：先把實測高度留好（1350px 寬
   285px、手機 313px），不然整頁後面的內容會被往下推（CLS 0.04–0.05）。 */
#player { min-height: 285px; }
@media (max-width: 640px) { #player { min-height: 313px; } }
/* 同步預覽時主播放器的軌道收起來（見下方 .tjap-cmp-collapsed），不留空白 */
#player.tjap-cmp-collapsed { min-height: 0; }

/* 手機鍵盤提示：預設隱藏，窄螢幕才顯示 */
.play-mobile-notice { display: none; }

/* ≤640px：窄螢幕通用調整 */
@media (max-width: 640px) {
  /* 顯示鍵盤提示 */
  .play-mobile-notice { display: block; }

  /* 播放器卡片：縮小左右 padding，canvas 才能接近全寬 */
  .play-stage-card { padding: 12px 10px 10px !important; }

  /* 譜面總覽標題列：垂直堆疊 */
  #chartcard > div:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
}

/* ≤480px：極窄螢幕（Android small / iPhone SE）*/
@media (max-width: 480px) {
  /* 上傳面板格子：強制單欄（minmax(280px) 在 ~276px 容器會輕微溢出）*/
  .card .grid.c2 { grid-template-columns: 1fr !important; }

  /* Transport：縮小按鈕讓 seek bar 有足夠空間 */
  .tjap-btn { padding: 7px 12px !important; }

  /* 控制列間距收緊 */
  .tjap-controls { gap: 8px !important; }

  /* Volume sliders：稍縮以騰出空間給其他控制項 */
  .tjap-f input[type=range] { width: 68px !important; }
}
