@charset "utf-8";

/* ============================================
   Material Design 3 - 음성 녹음 UI
   디자인 토큰은 _md3-tokens.css 에 분리됨 (write/view 양쪽 공유)
   ============================================ */

/* ============================================
   토글 버튼 - Material Chip (체크박스 제거)
   ============================================ */
.voice-recorder-toggle {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

.voice-recorder-toggle input[type="checkbox"],
.voice-recorder-toggle input[type="checkbox"] + label span,
.voice-recorder-toggle input[type="checkbox"]::before,
.voice-recorder-toggle input[type="checkbox"]::after {
  display: none !important;
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
}

.voice-recorder-toggle label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  height: auto;
  line-height: 1.5;
  background: transparent;
  border: none;
  border-radius: var(--md-sys-shape-corner-small);
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  user-select: none;
  box-shadow: none;
  vertical-align: middle;
}

.voice-recorder-toggle label:hover {
  background: rgba(163, 196, 188, 0.1);
  color: var(--md-sys-color-primary);
}

.voice-recorder-toggle input[type="checkbox"]:checked + label {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.voice-recorder-toggle input[type="checkbox"]:checked + label:hover {
  background: #8fcfc4;
  box-shadow: var(--md-sys-elevation-2);
}

.voice-recorder-toggle label svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* 체크박스 관련 모든 요소 완전 제거 */
.voice-recorder-toggle .chk_box,
.voice-recorder-toggle label span:not(span:last-child) {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  position: absolute !important;
  pointer-events: none !important;
}

/* ============================================
   음성 녹음 컨테이너 - Material Surface
   ============================================ */
.voice-recorder-container {
  display: none;
  position: relative;
  min-height: 480px;
  background: linear-gradient(
    135deg,
    var(--bg-secondary) 0%,
    #E6E6E6 100%
  );
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 48px 24px;
  margin-top: 16px;
  box-shadow: var(--md-sys-elevation-2);
  overflow: hidden;
}

.voice-recorder-container.active,
#voice-recorder-container.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  animation: voice-container-enter var(--md-sys-motion-duration-long)
    var(--md-sys-motion-easing-emphasized);
}

@keyframes voice-container-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   헤더
   ============================================ */
.voice-recorder-header {
  text-align: center;
  margin-bottom: 40px;
}

.voice-recorder-header h3 {
  font-size: 28px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.voice-recorder-header p {
  font-size: 15px;
  font-weight: 400;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
  letter-spacing: 0;
}

/* ============================================
   마이크 영역
   ============================================ */
.voice-recorder-mic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 48px 0;
}

.voice-mic-icon-container {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 마이크 아이콘 - Material FAB */
.voice-mic-icon {
  width: 112px;
  height: 112px;
  background: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: all var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-emphasized);
  box-shadow: var(--md-sys-elevation-3);
  cursor: pointer;
  animation: float-idle 3s ease-in-out infinite;
  /* GPU 가속 최적화 */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.voice-mic-icon::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary);
  opacity: 0.1;
  z-index: -1;
  animation: glow-pulse 2s ease-in-out infinite;
}

.voice-mic-icon::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: var(--md-sys-shape-corner-full);
  background: radial-gradient(
    circle,
    var(--md-sys-color-primary) 0%,
    transparent 70%
  );
  opacity: 0;
  z-index: -2;
  animation: ambient-glow 4s ease-in-out infinite;
}

.voice-mic-icon svg {
  width: 56px;
  height: 56px;
  fill: var(--md-sys-color-on-primary);
  filter: drop-shadow(0 2px 4px var(--shadow-color));
  transition: transform var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-emphasized);
}

.voice-mic-icon:hover {
  transform: scale(1.1) translateY(-4px);
  box-shadow: 0 12px 32px rgba(231, 168, 157, 0.5);
  animation: float-hover 1.5s ease-in-out infinite;
}

.voice-mic-icon:hover svg {
  transform: scale(1.1) rotate(5deg);
}

.voice-mic-icon:active {
  transform: scale(0.95);
  box-shadow: var(--md-sys-elevation-2);
}

/* 기본 떠있는 애니메이션 */
@keyframes float-idle {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* 호버 시 더 빠른 떠있는 애니메이션 */
@keyframes float-hover {
  0%,
  100% {
    transform: scale(1.1) translateY(-4px);
  }
  50% {
    transform: scale(1.1) translateY(-12px);
  }
}

/* 글로우 펄스 효과 */
@keyframes glow-pulse {
  0%,
  100% {
    opacity: 0.1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }
}

/* 주변 글로우 효과 */
@keyframes ambient-glow {
  0%,
  100% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 0.2;
    transform: scale(1.3);
  }
}

/* 녹음 중 상태 */
.voice-mic-icon.recording {
  background: var(--md-sys-color-accent);
  animation: pulse-mic 1.5s ease-in-out infinite,
    recording-shake 0.15s ease-in-out infinite alternate;
  box-shadow: 0 8px 32px rgba(216, 163, 157, 0.6),
    0 0 60px rgba(216, 163, 157, 0.3);
  /* 애니메이션 성능 최적화 */
  will-change: transform, box-shadow;
}

.voice-mic-icon.recording::before {
  background: var(--md-sys-color-accent);
  animation: pulse-ring 2s ease-out infinite;
}

.voice-mic-icon.recording::after {
  background: radial-gradient(
    circle,
    var(--md-sys-color-accent) 0%,
    transparent 70%
  );
  animation: recording-glow 2s ease-in-out infinite;
}

.voice-mic-icon.recording svg {
  fill: var(--md-sys-color-on-accent);
  animation: mic-bounce 0.6s ease-in-out infinite;
}

@keyframes pulse-mic {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.2;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

@keyframes recording-shake {
  0% {
    transform: translateX(0) scale(1);
  }
  100% {
    transform: translateX(1px) scale(1.02);
  }
}

@keyframes recording-glow {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(1.2);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.5);
  }
}

@keyframes mic-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.05);
  }
}

/* 일시정지 상태 */
.voice-mic-icon.paused {
  background: var(--md-sys-color-primary);
  box-shadow: 0 8px 24px rgba(231, 168, 157, 0.4);
  animation: paused-breathe 3s ease-in-out infinite;
}

.voice-mic-icon.paused::before {
  background: var(--md-sys-color-primary);
  animation: paused-glow 3s ease-in-out infinite;
}

.voice-mic-icon.paused::after {
  background: radial-gradient(
    circle,
    var(--md-sys-color-primary) 0%,
    transparent 70%
  );
  animation: paused-ambient 4s ease-in-out infinite;
}

.voice-mic-icon.paused svg {
  fill: var(--md-sys-color-on-primary);
  animation: paused-fade 2s ease-in-out infinite;
}

@keyframes paused-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

@keyframes paused-glow {
  0%,
  100% {
    opacity: 0.1;
  }
  50% {
    opacity: 0.25;
  }
}

@keyframes paused-ambient {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 0.15;
  }
}

@keyframes paused-fade {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* 파동 효과 - Material Ripple */
.voice-wave {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--md-sys-shape-corner-full);
  border: 3px solid var(--md-sys-color-primary);
  opacity: 0;
  top: 0;
  left: 0;
}

.voice-mic-icon.recording ~ .voice-wave {
  animation: wave-animation 2.5s ease-out infinite;
  border-color: var(--md-sys-color-accent);
}

.voice-wave:nth-child(2) {
  animation-delay: 0.5s;
}

.voice-wave:nth-child(3) {
  animation-delay: 1s;
}

@keyframes wave-animation {
  0% {
    transform: scale(0.7);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* ============================================
   상태 표시
   ============================================ */
.voice-recorder-status {
  text-align: center;
  margin-top: 32px;
}

.voice-status-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

.voice-status-text.recording {
  color: var(--md-sys-color-accent);
}

.voice-status-text.paused {
  color: var(--md-sys-color-secondary);
}

/* 타이머 */
.voice-timer {
  font-size: 56px;
  font-weight: 300;
  color: var(--md-sys-color-on-surface);
  font-family: "Roboto Mono", "Courier New", monospace;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px var(--shadow-color);
  transition: color var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
}

/* 잔여 30초 이하 경고 — 자동 종료 임박 */
.voice-timer.voice-timer-warning {
  color: var(--md-sys-color-accent, #d9534f);
  animation: voice-timer-pulse 1s ease-in-out infinite;
}

@keyframes voice-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* 마이크 레벨 미터 — 녹음 중 실시간 dB 시각화 */
.voice-level-meter {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.voice-level-meter[hidden] { display: none; }
.voice-level-bar {
  width: 220px;
  height: 8px;
  border-radius: 4px;
  background: var(--md-sys-color-surface-variant, rgba(0,0,0,0.08));
  overflow: hidden;
  position: relative;
}
.voice-level-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4ade80 0%, #4ade80 60%, #facc15 80%, #ef4444 100%);
  transition: width 80ms linear;
}
.voice-level-hint {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant, #6b7280);
  min-height: 16px;
}
.voice-level-hint.warning-low { color: #d97706; }
.voice-level-hint.warning-clip { color: #ef4444; font-weight: 600; }

/* ============================================
   컨트롤 버튼 - Material Buttons
   ============================================ */
.voice-recorder-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  flex-wrap: wrap;
}

/* 버튼 공통 스타일 - Material Filled Button */
.voice-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  height: 48px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
  box-shadow: var(--md-sys-elevation-1);
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Ripple 효과 제거됨 */

.voice-control-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-3);
}

.voice-control-btn:active {
  transform: translateY(0);
  box-shadow: var(--md-sys-elevation-1);
}

.voice-control-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Ripple 효과 제거됨 */

.voice-control-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  position: relative;
  z-index: 1;
}

.voice-control-btn span {
  position: relative;
  z-index: 1;
}

.voice-primary-slot {
  display: inline-grid;
  grid-template-areas: "main";
}

.voice-primary-slot > .voice-control-btn {
  grid-area: main;
  min-width: 132px;
}

/* 녹음 시작 버튼 */
.voice-btn-start,
.voice-btn-resume {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.voice-btn-start:hover,
.voice-btn-resume:hover {
  background: #8fcfc4;
}

/* 일시정지 버튼 */
.voice-btn-pause {
  background: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
}

.voice-btn-pause:hover {
  background: #dec9af;
}

/* 녹음 종료 버튼 */
.voice-btn-stop {
  background: var(--md-sys-color-accent);
  color: var(--md-sys-color-on-accent);
}

.voice-btn-stop:hover {
  background: #e0afa9;
}

/* 취소 버튼 - Outlined Button */
.voice-btn-cancel {
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  border: 2px solid var(--md-sys-color-outline);
  box-shadow: none;
}

.voice-btn-cancel:hover {
  background: var(--md-sys-color-surface-variant);
  border-color: var(--md-sys-color-on-surface-variant);
}

/* 마이크 장치가 보이지 않을 때 사용하는 파일/기본 녹음 앱 선택 버튼 */
.voice-btn-pick-audio {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.voice-btn-pick-audio:hover {
  background: var(--md-sys-color-surface-container-highest);
}

.voice-btn-pick-audio.is-attention {
  box-shadow: 0 0 0 3px rgba(180, 125, 80, 0.22), var(--md-sys-elevation-2);
}

/* Ripple 효과 제거됨 */

/* ============================================
   오디오 플레이어 - Material Card
   ============================================ */
.voice-audio-player {
  display: none;
  margin-top: 32px;
  padding: 28px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-2);
}

.voice-audio-player.active {
  display: block;
  animation: fade-in var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.voice-audio-player h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin: 0 0 10px 0;
  letter-spacing: -0.2px;
}

.voice-privacy-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 14px 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 13px;
  font-weight: 700;
}

.voice-privacy-badge[hidden] {
  display: none;
}

/* ============================================
   믹서 패널 - 항상 표시
   ============================================ */
.voice-mixer-panel {
  margin-top: 32px;
  padding: 24px;
  background: linear-gradient(
    135deg,
    #f5d1c9 0%,
    var(--bg-secondary) 100%
  );
  border: 2px solid var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-3);
  animation: mixer-appear var(--md-sys-motion-duration-long)
    var(--md-sys-motion-easing-emphasized);
}

@keyframes mixer-appear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.voice-mixer-panel h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  margin: 0 0 16px 0;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-mixer-content {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.voice-effect-selector {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-effect-selector label {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.voice-effect-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
  box-shadow: var(--md-sys-elevation-1);
}

.voice-effect-select:hover {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface-container);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-2);
}

.voice-effect-select:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 4px rgba(163, 196, 188, 0.3);
  transform: translateY(-2px);
}

.voice-btn-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  height: 48px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
  box-shadow: var(--md-sys-elevation-2);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

/* Ripple 효과 제거됨 */

.voice-btn-preview svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  position: relative;
  z-index: 1;
}

.voice-btn-preview span {
  position: relative;
  z-index: 1;
}

.voice-btn-preview:hover {
  background: #8fcfc4;
  box-shadow: var(--md-sys-elevation-3);
  transform: translateY(-3px);
}

.voice-btn-preview:active {
  transform: translateY(-1px);
  box-shadow: var(--md-sys-elevation-1);
}

.voice-btn-preview:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--md-sys-elevation-1);
}

/* Ripple 효과 제거됨 */

.voice-audio-player audio {
  width: 100%;
  margin-bottom: 20px;
  border-radius: var(--md-sys-shape-corner-small);
}

.voice-audio-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.voice-audio-actions button {
  padding: 10px 24px;
  height: 44px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
  position: relative;
  overflow: hidden;
}

.voice-btn-use {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.voice-btn-use:hover {
  background: #8fcfc4;
  box-shadow: var(--md-sys-elevation-2);
  transform: translateY(-2px);
}

.voice-btn-rerecord {
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  border: 2px solid var(--md-sys-color-outline);
}

.voice-btn-rerecord:hover {
  background: var(--md-sys-color-surface-variant);
  border-color: var(--md-sys-color-on-surface-variant);
}

/* ============================================
   캐릭터 변형 토글 + 인라인 패널
   ============================================ */
.voice-filter-toggle-wrap {
  margin: 18px 0 8px;
  text-align: center;
}

.voice-filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1.5px dashed var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
}

.voice-filter-toggle-btn:hover {
  background: var(--md-sys-color-primary-container);
  border-style: solid;
}

.voice-filter-toggle-btn .voice-filter-toggle-arrow {
  transition: transform var(--md-sys-motion-duration-short) ease;
  display: inline-block;
}

.voice-filter-toggle-btn.is-open {
  background: var(--md-sys-color-primary-container);
  border-style: solid;
}

.voice-filter-toggle-btn.is-open .voice-filter-toggle-arrow {
  transform: rotate(180deg);
}

.voice-filter-toggle-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0;
}

.voice-filter-panel {
  margin: 12px 0 18px;
  padding: 18px 20px;
  background: var(--md-sys-color-primary-container);
  border-radius: var(--md-sys-shape-corner-large);
  border: 1px solid var(--md-sys-color-outline-variant);
  animation: fade-in var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.voice-filter-panel[hidden] {
  display: none !important;
}

.voice-filter-panel-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--md-sys-color-on-primary-container);
  line-height: 1.5;
}

.voice-filter-panel-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.voice-filter-select {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.voice-filter-select:focus {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 1px;
}

.voice-btn-preview-filter {
  flex: 0 0 auto;
  padding: 10px 16px;
  height: 42px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-primary);
  border: 1.5px solid var(--md-sys-color-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
}

.voice-btn-preview-filter:hover:not(:disabled) {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.voice-btn-preview-filter:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.voice-preview-audio {
  width: 100%;
  margin-top: 4px;
  border-radius: var(--md-sys-shape-corner-small);
}

/* ============================================
   에러 메시지 - Material Banner
   ============================================ */
.voice-error-message {
  display: none;
  padding: 20px 28px;
  background: var(--md-sys-color-error-container);
  border-left: 4px solid var(--md-sys-color-accent);
  border-radius: var(--md-sys-shape-corner-medium);
  color: var(--md-sys-color-on-error-container);
  margin-top: 24px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: var(--md-sys-elevation-1);
}

.voice-error-message.active {
  display: block;
  animation: slide-up var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-emphasized);
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   파일 정보 - Material Card
   ============================================ */
.voice-file-info {
  display: none;
  margin-top: 24px;
  padding: 24px 28px;
  background: var(--md-sys-color-primary-container);
  border-radius: var(--md-sys-shape-corner-large);
  text-align: center;
  box-shadow: var(--md-sys-elevation-1);
  border: 1px solid var(--md-sys-color-primary);
}

.voice-file-info.active {
  display: block;
  animation: fade-in var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-standard);
}

.voice-file-info p {
  margin: 8px 0;
  font-size: 15px;
  color: var(--md-sys-color-on-primary-container);
  letter-spacing: 0;
}

.voice-file-info strong {
  color: var(--md-sys-color-primary);
  font-weight: 700;
}

/* ============================================
   로딩 스피너 - Material Progress Indicator
   ============================================ */
.voice-loading {
  display: none;
  text-align: center;
  margin-top: 24px;
}

.voice-loading.active {
  display: block;
}

.voice-spinner {
  border: 4px solid var(--md-sys-color-surface-variant);
  border-top: 4px solid var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  width: 56px;
  height: 56px;
  animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.voice-loading p {
  font-size: 15px;
  color: var(--md-sys-color-on-surface-variant);
  letter-spacing: 0;
}

/* ============================================
   브라우저 호환성 폴백
   ============================================ */

/* gap 속성 미지원 브라우저 대응 */
@supports not (gap: 12px) {
  .voice-recorder-controls > * + * {
    margin-left: 12px;
  }
  
  .voice-mixer-content > * + * {
    margin-left: 16px;
  }
  
  .voice-audio-actions > * + * {
    margin-left: 12px;
  }
}

/* backdrop-filter 미지원 브라우저 대응 */
@supports not (backdrop-filter: blur(10px)) {
  .voice-recorder-container {
    background: var(--md-sys-color-surface);
  }
}

/* ============================================
   반응형 - Mobile
   ============================================ */
@media (max-width: 768px) {
  .voice-recorder-container {
    padding: 32px 20px;
    min-height: 420px;
    border-radius: var(--md-sys-shape-corner-large);
  }

  .voice-recorder-header h3 {
    font-size: 24px;
  }

  .voice-mic-icon-container {
    width: 160px;
    height: 160px;
  }

  .voice-mic-icon {
    width: 96px;
    height: 96px;
  }

  .voice-mic-icon svg {
    width: 48px;
    height: 48px;
  }

  .voice-timer {
    font-size: 42px;
  }

  .voice-recorder-controls {
    gap: 8px;
  }

  .voice-control-btn {
    padding: 10px 20px;
    height: 44px;
    font-size: 14px;
  }

  .voice-status-text {
    font-size: 16px;
  }

  .voice-mixer-panel {
    padding: 20px;
  }

  .voice-mixer-content {
    flex-direction: column;
    align-items: stretch;
  }

  .voice-effect-selector {
    min-width: 100%;
  }

  .voice-btn-preview {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .voice-recorder-container {
    padding: 24px 16px;
  }

  .voice-recorder-header h3 {
    font-size: 20px;
  }

  .voice-mic-icon-container {
    width: 140px;
    height: 140px;
  }

  .voice-mic-icon {
    width: 80px;
    height: 80px;
  }

  .voice-mic-icon svg {
    width: 40px;
    height: 40px;
  }

  .voice-timer {
    font-size: 36px;
  }

  .voice-control-btn {
    padding: 8px 16px;
    height: 40px;
    font-size: 13px;
  }

  .voice-mixer-panel {
    padding: 16px;
  }

  .voice-mixer-panel h4 {
    font-size: 16px;
  }

  .voice-btn-preview {
    padding: 10px 20px;
    height: 44px;
    font-size: 14px;
  }
}


/* ============================================
   AI 음성 인식 텍스트 표시
   ============================================ */
.voice-recognized-text {
  margin-top: 20px;
  padding: 20px 24px;
  background: linear-gradient(
    135deg,
    rgba(163, 196, 188, 0.1) 0%,
    rgba(163, 196, 188, 0.05) 100%
  );
  border-left: 4px solid var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-medium);
  animation: slide-in var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-emphasized);
}

.voice-recognized-text p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
}

.voice-recognized-text strong {
  color: var(--md-sys-color-primary);
  font-weight: 700;
}

.voice-recognized-text .text-content {
  font-size: 16px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  padding: 12px;
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-small);
  margin: 12px 0;
  line-height: 1.6;
}

.voice-recognized-text .confidence {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 600;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   API 상태 표시
   ============================================ */
.voice-api-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--md-sys-color-surface-variant);
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

.voice-api-status.active {
  background: rgba(163, 196, 188, 0.2);
  color: var(--md-sys-color-primary);
}

.voice-api-status.error {
  background: rgba(216, 163, 157, 0.2);
  color: var(--md-sys-color-accent);
}

.voice-api-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 로딩 상태 */
.voice-btn-preview.loading {
  pointer-events: none;
  opacity: 0.7;
}

.voice-btn-preview.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  right: 12px;
}


/* ============================================
   모바일 호환성 강화 - 최종 우선순위
   ============================================ */
body #voice-recorder-container.voice-recorder-container.active,
html body #voice-recorder-container.active,
#voice-recorder-container.voice-recorder-container.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 100 !important;
}

/* iOS Safari 전용 */
@supports (-webkit-touch-callout: none) {
  .voice-recorder-container.active {
    display: block !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* Android Chrome 전용 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  .voice-recorder-container.active {
    display: block !important;
  }
}

/* 체크박스 완전 제거 - 최종 */
.voice-recorder-toggle input[type="checkbox"].selec_chk,
.voice-recorder-toggle .selec_chk,
.voice-recorder-toggle input.selec_chk {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
}


/* ============================================
   음성 게시물 표시 스타일
   ============================================ */

/* 게시글 목록에서 음성 게시물 아이콘 */
.voice-post-icon {
    display: inline-block;
    margin-right: 6px;
    font-size: 1.1em;
    vertical-align: middle;
    animation: voice-pulse 2s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* 게시글 제목에 음성 배지 */
.voice-post-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    color: white;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* 게시글 목록 아이템에 음성 표시 */
.board-list .voice-post {
    position: relative;
}

.board-list .voice-post::before {
    content: '🎙️';
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    opacity: 0.8;
}

/* 게시글 상세보기 제목 스타일 */
.view-title .voice-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}

.view-title .voice-indicator::before {
    content: '🎙️';
    font-size: 1.2em;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .voice-post-icon {
        font-size: 1em;
        margin-right: 4px;
    }
    
    .voice-post-badge {
        font-size: 0.7em;
        padding: 2px 6px;
        margin-left: 4px;
    }
    
    .board-list .voice-post::before {
        left: -20px;
        font-size: 1em;
    }
}


/* ============================================
   텍스트 수정 UI 스타일
   ============================================ */

.voice-text-edit {
    background: var(--md-sys-color-surface);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.voice-text-editor {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid var(--md-sys-color-outline, var(--border-color));
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: all 0.2s ease;
    background: var(--md-sys-color-surface-variant, var(--bg-secondary));
}

.voice-text-editor:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(163, 196, 188, 0.1);
}

/* 버튼 그룹 */
.voice-button-group {
    display: flex !important;
    gap: 12px !important;
    margin-top: 16px !important;
    flex-wrap: wrap !important;
}

/* 기본 버튼 스타일 */
.voice-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 12px 24px !important;
    border: none !important;
    border-radius: 24px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 4px var(--shadow-color) !important;
    position: relative !important;
    overflow: hidden !important;
    text-decoration: none !important;
    line-height: 1.5 !important;
}

/* Ripple 효과 제거됨 */

.voice-btn svg {
    flex-shrink: 0;
}

/* Primary 버튼 (확인) */
.voice-btn-primary {
    background: linear-gradient(135deg, #E7A89D, #E7A89D) !important;
    color: white !important;
}

.voice-btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(163, 196, 188, 0.4) !important;
    background: linear-gradient(135deg, #d49a8a, #d49a8a) !important;
}

.voice-btn-primary:active {
    transform: translateY(0) !important;
}

.voice-btn-primary:disabled {
    background: var(--border-color) !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Secondary 버튼 (취소) */
.voice-btn-secondary {
    background: #e9ecef !important;
    color: #495057 !important;
}

.voice-btn-secondary:hover {
    background: #dee2e6 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px var(--shadow-color) !important;
}

.voice-btn-secondary:active {
    transform: translateY(0) !important;
}

/* 정보 박스 */
.voice-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    border-left: 4px solid var(--md-sys-color-primary);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #004085;
}

.voice-info-box svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--md-sys-color-primary);
}

.voice-info-box strong {
    color: var(--md-sys-color-primary);
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .voice-text-edit {
        padding: 16px;
    }
    
    .voice-text-editor {
        min-height: 100px;
        padding: 12px;
        font-size: 14px;
    }
    
    .voice-button-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .voice-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .voice-info-box {
        padding: 12px;
        font-size: 13px;
    }
}

/* 다크모드 지원 (선택사항) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --md-sys-color-surface: #121212;
        --md-sys-color-surface-variant: #1f1f1f;
        --md-sys-color-on-surface: #e0e0e0;
        --md-sys-color-on-surface-variant: #a0a0a0;
    }

    html:not([data-theme="light"]) .voice-recorder-container {
        background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    }

    html:not([data-theme="light"]) .voice-text-edit {
        background: #1e1e1e;
    }

    html:not([data-theme="light"]) .voice-text-editor {
        background: #2d2d2d;
        border-color: var(--text-primary);
        color: #e0e0e0;
    }

    html:not([data-theme="light"]) .voice-text-editor:focus {
        background: var(--text-secondary);
        border-color: var(--md-sys-color-primary);
    }

    html:not([data-theme="light"]) .voice-btn-secondary {
        background: #3a3a3a;
        color: #e0e0e0;
    }

    html:not([data-theme="light"]) .voice-btn-secondary:hover {
        background: #4a4a4a;
    }

    html:not([data-theme="light"]) .voice-info-box {
        background: linear-gradient(135deg, #1a3a4a 0%, #1e4555 100%);
        color: #a3d5ea;
    }

    html:not([data-theme="light"]) .voice-mixer-panel {
        background: linear-gradient(135deg, rgba(231, 168, 157, 0.1) 0%, rgba(168, 184, 160, 0.05) 100%);
        border-color: var(--md-sys-color-primary);
    }

    html:not([data-theme="light"]) .voice-audio-player {
        background: var(--md-sys-color-surface);
    }

    html:not([data-theme="light"]) .md3-voice-player {
        box-shadow:
            0 8px 32px rgba(231, 168, 157, 0.15),
            0 2px 8px var(--shadow-color);
    }
}

html[data-theme="dark"] {
    --md-sys-color-surface: #121212;
    --md-sys-color-surface-variant: #1f1f1f;
    --md-sys-color-on-surface: #e0e0e0;
    --md-sys-color-on-surface-variant: #a0a0a0;
}

html[data-theme="dark"] .voice-recorder-container {
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
}

html[data-theme="dark"] .voice-text-edit {
    background: #1e1e1e;
}

html[data-theme="dark"] .voice-text-editor {
    background: #2d2d2d;
    border-color: var(--text-primary);
    color: #e0e0e0;
}

html[data-theme="dark"] .voice-text-editor:focus {
    background: var(--text-secondary);
    border-color: var(--md-sys-color-primary);
}

html[data-theme="dark"] .voice-btn-secondary {
    background: #3a3a3a;
    color: #e0e0e0;
}

html[data-theme="dark"] .voice-btn-secondary:hover {
    background: #4a4a4a;
}

html[data-theme="dark"] .voice-info-box {
    background: linear-gradient(135deg, #1a3a4a 0%, #1e4555 100%);
    color: #a3d5ea;
}

html[data-theme="dark"] .voice-mixer-panel {
    background: linear-gradient(135deg, rgba(231, 168, 157, 0.1) 0%, rgba(168, 184, 160, 0.05) 100%);
    border-color: var(--md-sys-color-primary);
}

html[data-theme="dark"] .voice-audio-player {
    background: var(--md-sys-color-surface);
}

html[data-theme="dark"] .md3-voice-player {
    box-shadow:
        0 8px 32px rgba(231, 168, 157, 0.15),
        0 2px 8px var(--shadow-color);
}


/* ============================================
   Material Design 3 음성 플레이어
   ============================================ */

.voice-preview-container {
    background: var(--md-sys-color-surface);
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 16px var(--shadow-color);
}

/* 성공 메시지 */
.voice-success-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #d4f4dd 0%, #e8f5e9 100%);
    border-radius: 16px;
    color: #1b5e20;
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(27, 94, 32, 0.1);
}

.voice-success-message svg {
    flex-shrink: 0;
    color: #2e7d32;
}

/* 텍스트 미리보기 */
.voice-text-preview {
    background: var(--md-sys-color-surface-variant, var(--bg-secondary));
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--md-sys-color-outline, #e0e0e0);
}

.voice-text-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--md-sys-color-on-surface-variant, var(--text-secondary));
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.voice-text-preview-content {
    color: var(--md-sys-color-on-surface, var(--text-secondary));
    font-size: 15px;
    line-height: 1.7;
    padding: 12px;
    background: white;
    border-radius: 12px;
}

/* MD3 플레이어 */
.md3-voice-player {
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(163, 196, 188, 0.2);
    margin-bottom: 20px;
}

.md3-player-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.md3-player-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(163, 196, 188, 0.3);
    flex-shrink: 0;
}

.md3-player-info {
    flex: 1;
    min-width: 0;
}

.md3-player-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--md-sys-color-on-primary-container);
}

.md3-player-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--md-sys-color-on-primary-container);
    opacity: 0.8;
}

.md3-player-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* 플레이어 컨트롤 */
.md3-player-controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.md3-audio-element {
    display: none;
}

.md3-audio-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.md3-play-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(163, 196, 188, 0.4);
    flex-shrink: 0;
}

.md3-play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(163, 196, 188, 0.5);
}

.md3-play-button:active {
    transform: scale(0.95);
}

.md3-play-button svg {
    color: white;
}

.md3-play-button.playing {
    background: linear-gradient(135deg, var(--md-sys-color-accent), #e8a39d);
}

.md3-progress-container {
    flex: 1;
    min-width: 0;
}

.md3-time-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant, var(--text-secondary));
}

.md3-progress-bar {
    position: relative;
    height: 6px;
    background: var(--md-sys-color-surface-variant, #e0e0e0);
    border-radius: 3px;
    overflow: visible;
    cursor: pointer;
}

.md3-progress-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--md-sys-color-surface-variant, #e0e0e0);
    border-radius: 3px;
}

.md3-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--md-sys-color-primary), var(--md-sys-color-tertiary));
    border-radius: 3px;
    transition: width 0.1s linear;
}

.md3-progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid var(--md-sys-color-primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: left 0.1s linear;
}

.md3-volume-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--md-sys-color-surface-variant, #f0f0f0);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.md3-volume-button:hover {
    background: var(--md-sys-color-primary-container);
    transform: scale(1.05);
}

.md3-volume-button svg {
    color: var(--md-sys-color-on-surface-variant, var(--text-secondary));
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .voice-preview-container {
        padding: 16px;
        border-radius: 16px;
    }
    
    .md3-voice-player {
        padding: 16px;
    }
    
    .md3-player-header {
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .md3-player-icon {
        width: 48px;
        height: 48px;
    }
    
    .md3-player-title {
        font-size: 16px;
    }
    
    .md3-player-subtitle {
        font-size: 13px;
    }
    
    .md3-player-controls {
        padding: 16px;
    }
    
    .md3-play-button {
        width: 48px;
        height: 48px;
    }
    
    .md3-volume-button {
        width: 36px;
        height: 36px;
    }
    
    .md3-time-display {
        font-size: 11px;
    }
}

/* 애니메이션 */
@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.md3-play-button.playing::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--md-sys-color-accent);
    animation: pulse-ring 1.5s ease-out infinite;
}


/* ============================================
   게시글 조회용 MD3 플레이어
   ============================================ */

.md3-voice-player-view {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(163, 196, 188, 0.2);
    margin: 20px 0 30px 0;
    position: relative;
    z-index: 10;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .md3-voice-player-view {
        display: block !important;
        padding: 16px !important;
        border-radius: 16px !important;
        margin: 16px 0 24px 0 !important;
    }
}

/* iOS Safari 전용 */
@supports (-webkit-touch-callout: none) {
    .md3-voice-player-view {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}


/* ============================================
   [VOICE] 텍스트 마커 스타일링
   ============================================ */

/* 제목에서 [VOICE] 텍스트를 아이콘처럼 보이게 */
a[href*="wr_id"]:not(.voice-styled)::before,
.subject a:not(.voice-styled)::before,
.bo_v_title:not(.voice-styled)::before {
    content: '';
}

/* [VOICE] 텍스트가 포함된 링크 스타일 */
a[href*="wr_id"]:has-text("[VOICE]"),
a[href*="wr_id"] {
    position: relative;
}

/* JavaScript 없이 CSS만으로 [VOICE] 스타일링 */
.subject,
.bo_v_title,
.view-title,
h1.title {
    position: relative;
}

/* [VOICE] 텍스트를 배지처럼 표시 */
.subject:has-text("[VOICE]")::before,
.bo_v_title:has-text("[VOICE]")::before {
    content: '🎙️';
    display: inline-block;
    margin-right: 6px;
    font-size: 1.1em;
}

/* ============================================
   다이렉트 음성 필터 UI (MD3 스타일)
   ============================================ */
.voice-filter-selection-card {
    background: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 20px;
    margin-top: 15px;
    box-shadow: var(--md-sys-elevation-1);
}

.voice-filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--md-sys-color-on-surface);
}

.voice-filter-desc {
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.voice-filter-select-wrapper {
    margin-bottom: 20px;
}

.voice-filter-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    border: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-size: 0.95rem;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.voice-filter-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

.voice-filter-preview-area {
    margin-top: 20px;
    display: none;
    padding-top: 15px;
    border-top: 1px dashed var(--md-sys-color-outline-variant);
}

.voice-filter-preview-area.active {
    display: block;
    animation: fadeIn var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.voice-preview-audio {
    width: 100%;
    height: 40px;
    outline: none;
}

/* 공통 컨트롤 버튼 기반 (음성 제어 영역) */
.voice-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--md-sys-shape-corner-full);
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.voice-control-btn svg {
    width: 18px;
    height: 18px;
}

.voice-btn-start {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.voice-btn-start:hover:not(:disabled) {
    box-shadow: var(--md-sys-elevation-2);
    transform: translateY(-1px);
}

.voice-btn-start:disabled {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    cursor: not-allowed;
}

.voice-btn-cancel, .voice-btn-preview {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.voice-btn-cancel:hover:not(:disabled), .voice-btn-preview:hover:not(:disabled) {
    background-color: var(--md-sys-color-surface-container-highest);
}

.voice-error-box {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 15px;
    border-left: 4px solid var(--md-sys-color-error);
}

.voice-success-msg {
    color: var(--md-sys-color-primary);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--md-sys-color-primary-container);
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    margin-top: 15px;
}
