/* ==========================================================================
   Drarm - Minimalist Borderless & Icon-First Stylesheet
   UI Design Rules: Complete borderless, icon-first, black & white, no emojis
   ========================================================================== */

:root {
  --bg-deep: #050505;
  --bg-surface: #121212;
  --bg-elevated: #1a1a1a;
  --bg-active: #2a2a2a;
  
  --text-primary: #f5f5f5;
  --text-secondary: #888888;
  --text-muted: #444444;

  --flash-cymbal: rgba(255, 255, 255, 0.22);
  --flash-drum: rgba(255, 255, 255, 0.28);

  --font-mono: "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none; /* 完全な枠線撤廃 */
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
}

/* --------------------------------------------------------------------------
   左右ドラムゾーン背景（完全ボーダーレス・面のトーン差）
   -------------------------------------------------------------------------- */
.drum-zones-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  pointer-events: none;
  z-index: 1;
}

.drum-zone {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 24px;
  transition: background-color 0.12s ease-out;
}

.left-zone {
  background-color: rgba(255, 255, 255, 0.015);
}

.right-zone {
  background-color: rgba(255, 255, 255, 0.035);
}

.left-zone.hit-flash {
  background-color: var(--flash-cymbal);
  transition: none;
}

.right-zone.hit-flash {
  background-color: var(--flash-drum);
  transition: none;
}

.zone-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--text-muted);
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   メイン映像コンテナ（ビデオとCanvasを自然比率で完全重畳・鏡像反転）
   -------------------------------------------------------------------------- */
.video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  overflow: hidden;
}

#webcam {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* インカメラ鏡像反転 */
  opacity: 0.72;
  filter: contrast(1.1) grayscale(0.2);
}

#output-canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* ビデオ座標と一致 */
  pointer-events: none;
}

/* 打鍵波紋・パーティクルCanvas（ビデオ/Canvas座標と完全一致） */
.effect-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* ビデオ座標と一致 */
  pointer-events: none;
  z-index: 3;
}

/* --------------------------------------------------------------------------
   右上ナビゲーション（完全ボーダーレス・アイコンファースト）
   -------------------------------------------------------------------------- */
.top-nav {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 10;
}

.nav-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.nav-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.16);
}

.nav-icon-btn:active {
  transform: scale(0.92);
  background-color: rgba(255, 255, 255, 0.24);
}

.nav-icon-btn.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.btn-svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   初回オーディオ有効化オーバーレイ（完全ボーダーレス・面のトーン差・中央配置）
   -------------------------------------------------------------------------- */
.audio-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.audio-start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.audio-start-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 48px;
  border-radius: 28px;
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
  animation: pulse-card 2.5s infinite ease-in-out;
}

.audio-start-card:hover {
  background-color: rgba(255, 255, 255, 0.18);
}

.audio-start-card:active {
  transform: scale(0.95);
}

.audio-overlay-icon {
  width: 48px;
  height: 48px;
  fill: currentColor;
}

.audio-overlay-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-primary);
}

@keyframes pulse-card {
  0%, 100% {
    background-color: rgba(255, 255, 255, 0.08);
  }
  50% {
    background-color: rgba(255, 255, 255, 0.18);
  }
}

/* --------------------------------------------------------------------------
   リアルタイムステータスHUD（左下・完全ボーダーレス・数値のみ）
   -------------------------------------------------------------------------- */
.status-hud {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: 9999px;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  z-index: 10;
  pointer-events: none;
}

.hud-item {
  display: inline-block;
  min-width: 44px;
  text-align: center;
  transition: color 0.12s ease, background-color 0.12s ease;
}

#hud-audio {
  font-weight: 700;
  color: #888888;
}

#hud-audio.ready {
  color: #ffffff;
}

.hit-badge {
  padding: 2px 10px;
  border-radius: 9999px;
  background-color: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.08em;
  min-width: 90px;
}

.hit-badge.flash-active {
  background-color: #ffffff;
  color: #000000;
  transform: scale(1.08);
}

/* --------------------------------------------------------------------------
   通知・エラーモーダル（完全ボーダーレス）
   -------------------------------------------------------------------------- */
.notice-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  transition: opacity 0.3s ease;
}

.notice-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.notice-card {
  padding: 24px 32px;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.notice-icon {
  width: 32px;
  height: 32px;
  fill: var(--text-primary);
  opacity: 0.8;
}

.notice-text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-primary);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   学習用データセット録画パネル（完全ボーダーレス・面のトーン差）
   -------------------------------------------------------------------------- */
.recorder-panel {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.recorder-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
}

.recorder-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border-radius: 9999px;
  background-color: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* セグメントボタングループ（枠線なし、面のトーン差のみ） */
.rec-segment-group {
  display: flex;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  padding: 3px;
  gap: 2px;
}

.rec-seg-btn {
  padding: 4px 10px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rec-seg-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.08);
}

.rec-seg-btn.active {
  background-color: #ffffff;
  color: #000000;
}

/* 録画アクションボタン（REC / STOP） */
.rec-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.rec-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ff3b30;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 録画中状態 */
.rec-action-btn.recording {
  background-color: rgba(255, 59, 48, 0.2);
}

.rec-action-btn.recording .rec-dot {
  border-radius: 3px;
  transform: scale(0.9);
  animation: pulse-rec 1.2s infinite ease-in-out;
}

@keyframes pulse-rec {
  0%, 100% {
    opacity: 1;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.75);
  }
}

/* 録画メトリクス */
.rec-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 4px;
}

.rec-stat-item {
  min-width: 42px;
  text-align: center;
}

#rec-hits.active-hit {
  color: #ffffff;
  font-weight: 700;
}

/* アイコンボタン（ダウンロード） */
.rec-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.rec-icon-btn:hover:not(.disabled) {
  background-color: rgba(255, 255, 255, 0.12);
}

.rec-icon-btn.disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.rec-icon-btn .btn-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   動画編集型 アノテーションスタジオ（完全ボーダーレス・面のトーン差・大画面）
   -------------------------------------------------------------------------- */
.annotation-studio {
  position: fixed;
  inset: 0;
  z-index: 120;
  background-color: var(--bg-deep);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.annotation-studio.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 上部ヘッダー */
.studio-header {
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-surface);
  flex-shrink: 0;
}

.studio-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  overflow: hidden;
}

.studio-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 240px;
}

.studio-timecode {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.studio-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.studio-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.studio-icon-btn.active {
  background-color: var(--bg-elevated);
  color: #ffffff;
}

.studio-icon-btn .btn-svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* 中央プレビューエリア（動画＋骨格 1:1同期キャンバス） */
.studio-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000;
  overflow: hidden;
}

.studio-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  transition: transform 0.15s ease;
}

.studio-canvas.flipped {
  transform: scaleX(-1);
}

.studio-flash {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.studio-flash.flash-active {
  opacity: 1;
  transition: none;
}

/* 下部タイムライン ＆ コントローラー */
.studio-footer {
  background-color: var(--bg-surface);
  padding: 12px 24px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

/* タイムライン */
.timeline-container {
  width: 100%;
  padding: 2px 0;
  cursor: pointer;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 32px;
  background-color: var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background-color: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 2px;
  background-color: #ffffff;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.timeline-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marker-pin {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 2px;
  background-color: #ffffff;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
}

/* コントロール行 */
.studio-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.ctrl-icon-btn:hover {
  background-color: var(--bg-active);
  transform: scale(1.06);
}

.ctrl-icon-btn .btn-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.ctrl-icon-btn.play-btn {
  width: 42px;
  height: 42px;
  background-color: #ffffff;
  color: #000000;
}

.ctrl-icon-btn.play-btn:hover {
  background-color: #e5e5e5;
}

.ctrl-icon-btn.export-btn {
  background-color: #ffffff;
  color: #000000;
}

.ctrl-icon-btn.export-btn:hover {
  background-color: #e5e5e5;
}

.studio-speed-group {
  display: flex;
  gap: 3px;
  background-color: var(--bg-elevated);
  padding: 3px;
  border-radius: 8px;
  margin-left: 6px;
}

.studio-speed-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.studio-speed-btn.active {
  background-color: var(--bg-active);
  color: var(--text-primary);
  font-weight: 700;
}

/* 中央: MARK HIT ボタン */
.marker-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-mark-btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 20px;
  background-color: #ffffff;
  color: #000000;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  transition: background-color 0.12s ease, transform 0.1s ease;
}

.studio-mark-btn:hover {
  background-color: #e5e5e5;
  transform: scale(1.04);
}

.studio-mark-btn:active {
  transform: scale(0.96);
}

.studio-mark-btn.is-marked {
  background-color: #ff3b30;
  color: #ffffff;
}

.mark-btn-inner {
  display: flex;
  align-items: center;
  gap: 7px;
}

.mark-circle {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: currentColor;
}

.studio-marker-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 60px;
}





