/**
 * practice.css
 * 練習画面のスタイル
 */

/* ── 全体レイアウト ── */
.practice-wrapper {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse at top, var(--key-accent, transparent) 0%, transparent 60%);
  transition: background-image 0.4s ease;
}

/* ── ヘッダーバー ── */
.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

.practice-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.meta-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.meta-value {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.practice-controls-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── メインコンテンツ（中央） ── */
.practice-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 20px;
}

/* ── 調号の個数（カード上部） ── */
.key-sig-top {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--key-sig-color, var(--text-muted));
  min-height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 調名カード：ボーダーなし、box-shadowで色を表現 ── */
.key-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: none;
  padding: 28px 40px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  /* box-shadowはJSから key色を込みで動的に設定 */
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  transition: box-shadow 0.4s ease;
  position: relative;
  overflow: hidden;
}

/* 調色の薄い背景 */
.key-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--key-color, transparent);
  opacity: 0.04;
  pointer-events: none;
  transition: background 0.4s ease;
}

.key-name {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-all;
}

.key-sub {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 1.2em;
  letter-spacing: 0.01em;
}


/* ── BPM 調整ウィジェット ── */
.bpm-adj-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bpm-adj-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 5px;
  background: var(--border);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

/* ── カウントダウン ── */
.countdown-display {
  font-size: 5rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.04em;
  transition: color 0.15s;
}

/* ── カウントダウンドット ── */
.countdown-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 340px;
  min-height: 22px;
}

.countdown-bar.hidden {
  display: none;
}

/* ── 演奏ビートインジケーター ── */
.beat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 340px;
  min-height: 22px;
}

.beat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.05s, transform 0.05s;
}

.beat-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.beat-dot.past {
  background: #c4c8cc;
}

/* カウントダウン専用ドット色 */
.countdown-bar .beat-dot {
  background: #d9cfc4;
}

.countdown-bar .beat-dot.active {
  background: #c07840;
  transform: scale(1.3);
}

.countdown-bar .beat-dot.past {
  background: #e0d5c8;
}

/* カードのグローは Web Animations API（practice.js）で制御 */

/* ── レビューパネル：ボーダーなし ── */
.review-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -6px 32px rgba(0,0,0,0.12);
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
}

.review-panel.hidden {
  display: none;
}

.review-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.review-actions {
  display: flex;
  gap: 12px;
}

.review-actions .btn {
  flex: 1;
}

/* ── ボタン（練習中） ── */
.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  padding: 0;
  font-size: 1.2rem;
}

/* ── フッターコントロール ── */
.practice-footer {
  padding: 16px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

/* ── iOS Safari 音声アンロック用オーバーレイ ── */
.start-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.start-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.start-overlay-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.start-overlay-btn {
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

/* ── タブレット以上（768px〜） ── */
@media (min-width: 768px) {
  .key-sig-top {
    font-size: 1.6rem;
  }
  .key-card {
    padding: 40px 60px;
    max-width: 480px;
  }
  .key-name {
    font-size: 5rem;
  }
  .key-sub {
    font-size: 1.2rem;
    margin-top: 10px;
  }
  .countdown-display {
    font-size: 6.5rem;
    min-height: 100px;
  }
}

/* ── ランドスケープ対応 ── */
@media (orientation: landscape) and (max-height: 500px) {
  .key-name {
    font-size: 2.4rem;
  }
  .countdown-display {
    font-size: 3.5rem;
    min-height: 56px;
  }
  .practice-main {
    gap: 12px;
  }
}
