* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
  background: #f5f5f5;
  padding: 10px;
  overflow-x: hidden;
}

.mat-analysis-app-container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 20px;
}

.mat-analysis-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 3px solid #4CAF50;
}

.mat-analysis-header h1 {
  font-size: 24px;
  color: #333;
  margin-bottom: 5px;
}

.mat-analysis-header .mat-analysis-subtitle {
  font-size: 14px;
  color: #666;
}

/* レイアウト切替と表示オプション */
.mat-analysis-top-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.mat-analysis-layout-switch {
  display: flex;
  gap: 10px;
}

.mat-analysis-display-options {
  display: flex;
  gap: 10px;
}

.mat-analysis-layout-btn {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid #4CAF50;
  background: white;
  color: #4CAF50;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.mat-analysis-layout-btn.active {
  background: #4CAF50;
  color: white;
}

.mat-analysis-layout-btn:hover:not(.active) {
  background: #e8f5e9;
}

/* æ¯"è¼ƒã‚¨ãƒªã‚¢ */
.mat-analysis-comparison-area {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.mat-analysis-comparison-area.vertical {
  flex-direction: column;
}

/* å‹•ç"»ã‚¹ãƒ­ãƒƒãƒˆ */
.mat-analysis-video-slot {
  flex: 1;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  background: #fafafa;
}

.mat-analysis-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 70px;
}

.mat-analysis-slot-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
}

.mat-analysis-load-buttons {
  display: flex;
  gap: 8px;
}

.mat-analysis-slot-title.example {
  color: #2196F3;
}

.mat-analysis-slot-title.student {
  color: #FF9800;
}

.mat-analysis-load-btn {
  padding: 8px 16px;
  font-size: 14px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.mat-analysis-load-btn:hover {
  background: #45a049;
}

.mat-analysis-video-preview {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.mat-analysis-video-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mat-analysis-video-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  text-align: center;
  font-size: 14px;
}

/* ã‚¿ã‚¤ãƒ ãƒ©ã‚¤ãƒ³ */
.mat-analysis-timeline-area {
  margin-bottom: 12px;
}

.mat-analysis-timeline-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  min-height: 18px;
  align-items: center;
}

.mat-analysis-timeline {
  position: relative;
  height: 40px;
  background: #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
}

.mat-analysis-timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #2196F3 0%, #64B5F6 100%);
  width: 0%;
  transition: width 0.1s linear;
}

.mat-analysis-timeline-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: white;
  border: 3px solid #2196F3;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  pointer-events: none;
}

.mat-analysis-timeline-points {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.mat-analysis-timeline-point {
  position: absolute;
  top: 0;
  height: 100%;
  width: 3px;
  cursor: pointer;
}

.mat-analysis-timeline-point.mat-analysis-base {
  background: #4CAF50;
  width: 4px;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.8);
  z-index: 10;
}

.mat-analysis-timeline-point.mat-analysis-base::before {
  content: 'ðŸŽ¯';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
}

/* ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ« */
.mat-analysis-controls-horizontal {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0;
  min-height: 48px;
}

.mat-analysis-control-group {
  margin-bottom: 12px;
}

.mat-analysis-control-group:last-child {
  margin-bottom: 0;
}

.mat-analysis-control-label {
  font-size: 13px;
  font-weight: bold;
  color: #555;
  margin-bottom: 5px;
  padding-left: 3px;
  min-height: 20px;
  display: flex;
  align-items: center;
}

.mat-analysis-video-controls {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.mat-analysis-control-btn {
  padding: 10px 16px;
  font-size: 14px;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  white-space: nowrap;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mat-analysis-control-btn:hover {
  background: #1976D2;
}

.mat-analysis-control-btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.mat-analysis-control-btn.danger {
  background: #F44336;
}

.mat-analysis-control-btn.danger:hover {
  background: #D32F2F;
}

.mat-analysis-control-btn.success {
  background: #4CAF50;
}

.mat-analysis-control-btn.success:hover {
  background: #45a049;
}

.mat-analysis-control-btn.info {
  background: #2196F3;
}

.mat-analysis-control-btn.info:hover {
  background: #1976D2;
}

.mat-analysis-control-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.mat-analysis-speed-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mat-analysis-speed-control-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 200px;
  height: 40px;
}

.mat-analysis-speed-control-compact .mat-analysis-speed-value {
  font-size: 16px;
  font-weight: bold;
  color: #2196F3;
  min-width: 50px;
  text-align: center;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mat-analysis-speed-control-compact .mat-analysis-speed-slider {
  flex: 1;
  height: 8px;
}

.mat-analysis-speed-value {
  font-size: 18px;
  font-weight: bold;
  color: #2196F3;
  text-align: center;
}

.mat-analysis-speed-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #FF9800 0%, #4CAF50 50%, #2196F3 100%);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.mat-analysis-speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #2196F3;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.mat-analysis-speed-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #2196F3;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.mat-analysis-speed-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
}

/* æ¯"è¼ƒã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ« */
.mat-analysis-comparison-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  background: #f9f9f9;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
}

.mat-analysis-toggle-btn {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid #666;
  background: white;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.mat-analysis-toggle-btn.active {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.mat-analysis-toggle-btn:hover:not(.active) {
  background: #f0f0f0;
}

.mat-analysis-action-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #FF5722 0%, #E64A19 100%);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: all 0.3s;
}

.mat-analysis-action-btn:hover {
  background: linear-gradient(135deg, #E64A19 0%, #D84315 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.mat-analysis-action-btn.mat-analysis-stop {
  background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
}

.mat-analysis-action-btn.mat-analysis-stop:hover {
  background: linear-gradient(135deg, #D32F2F 0%, #C62828 100%);
}

.mat-analysis-skip-btn {
  padding: 10px 16px;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s;
  flex: 1;
}

.mat-analysis-skip-btn:hover {
  background: #1976D2;
  transform: translateY(-2px);
}

.mat-analysis-reset-btn {
  padding: 10px 16px;
  background: #9E9E9E;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s;
  flex: 1;
}

.mat-analysis-reset-btn:hover {
  background: #757575;
  transform: translateY(-2px);
}

.mat-analysis-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* ãƒ¬ã‚¹ãƒãƒ³ã‚·ãƒ– */
@media (max-width: 768px) {
  .mat-analysis-comparison-area {
    flex-direction: column;
  }
  
  .mat-analysis-control-row {
    flex-direction: column;
  }
  
  .mat-analysis-header h1 {
    font-size: 20px;
  }
}

/* èª­ã¿è¾¼ã¿ãƒœã‚¿ãƒ³æ¨ªä¸¦ã³ */
.mat-analysis-load-buttons {
  display: flex;
  gap: 8px;
}

.mat-analysis-load-btn.camera {
  background: linear-gradient(135deg, #FF5722 0%, #E64A19 100%);
}

.mat-analysis-load-btn.camera:hover {
  background: linear-gradient(135deg, #E64A19 0%, #D84315 100%);
}

/* ã‚«ãƒ¡ãƒ©ã‚³ãƒ³ãƒˆãƒ­ãƒ¼ãƒ« */
.mat-analysis-camera-controls {
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  margin-bottom: 10px;
}

.mat-analysis-camera-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mat-analysis-camera-switch-btn {
  padding: 8px 12px;
  background: #2196F3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.mat-analysis-camera-switch-btn:hover {
  background: #1976D2;
}

.mat-analysis-camera-mode {
  font-size: 14px;
  font-weight: bold;
  color: #666;
}

.mat-analysis-recording-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mat-analysis-record-btn {
  padding: 10px 16px;
  background: #F44336;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
}

.mat-analysis-record-btn:hover {
  background: #D32F2F;
}

.mat-analysis-record-btn.recording {
  background: #757575;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.mat-analysis-recording-time {
  font-size: 16px;
  font-weight: bold;
  color: #F44336;
  font-family: monospace;
}

#cameraPreviewA, #cameraPreviewB {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ãƒ¢ãƒ¼ãƒ‰åˆ‡ã‚Šæ›¿ãˆ */
.mat-analysis-mode-switch {
  display: flex;
  gap: 15px;
  margin-bottom: 10px;
  padding: 10px;
  background: #f0f0f0;
  border-radius: 4px;
}

.mat-analysis-mode-option {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

.mat-analysis-mode-option input[type="radio"] {
  cursor: pointer;
}

.mat-analysis-mode-option span {
  cursor: pointer;
}

/* YouTubeé¸æŠž */
.mat-analysis-youtube-selector {
  margin-bottom: 10px;
}

.mat-analysis-video-embed-area {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.mat-analysis-video-embed-area h4 {
  font-size: 16px;
  color: #333;
  margin-bottom: 10px;
}

.mat-analysis-video-note {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.5;
}

.mat-analysis-video-select {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  border: 2px solid #FF0000;
  border-radius: 4px;
  background: white;
  margin-bottom: 10px;
  cursor: pointer;
}

.mat-analysis-embed-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.mat-analysis-embed-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 4px;
}

.mat-analysis-embed-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  text-align: center;
  font-size: 14px;
  padding: 20px;
}

.mat-analysis-youtube-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.mat-analysis-youtube-link-item {
  width: 100%;
}

.mat-analysis-youtube-link-btn {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  background: linear-gradient(135deg, #0066CC 0%, #004999 100%);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.3s;
  border: 2px solid #004999;
}

.mat-analysis-youtube-link-btn:hover {
  background: linear-gradient(135deg, #004999 0%, #003366 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.mat-analysis-youtube-notice {
  font-size: 12px;
  color: #F57C00;
  background: #FFF3E0;
  padding: 10px;
  border-radius: 4px;
  border-left: 4px solid #FF9800;
  line-height: 1.5;
}

/* ãƒ•ã‚¡ã‚¤ãƒ«èª­ã¿è¾¼ã¿ã‚¨ãƒªã‚¢ */
.mat-analysis-file-loader {
  margin-bottom: 10px;
}

/* YouTubeãƒ—ãƒ¬ã‚¤ãƒ¤ãƒ¼ã‚³ãƒ³ãƒ†ãƒŠ */
#youtubePlayerA {
  width: 100%;
  height: 100%;
}

#youtubePlayerA iframe {
  width: 100%;
  height: 100%;
}

/* A: YouTube 参考動画（iframe） */
.mat-analysis-youtube-wrap{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  z-index:5; /* グリッド(10)より下 */
}

.mat-analysis-youtube-wrap iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
}

/* A: YouTubeプルダウンの余白 */
.mat-analysis-youtube-selector{
  margin: 0;
  flex: 1;
  max-width: 300px;
}

/* 出典（ボタンの下に表示） */
.mat-analysis-source-note{
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 11px;
  color: #666;
  line-height: 1.4;
  text-align: left;
}
.mat-analysis-source-note a{
  color: #0066cc;
  text-decoration: underline;
}

/* Aヘッダー：ボタンとプルダウンを横並び */
.mat-analysis-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* レスポンシブ：狭い画面では縦並び */
@media (max-width: 640px) {
  .mat-analysis-header-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .mat-analysis-youtube-selector {
    max-width: 100%;
  }
}