/* View 페이지 전용 스타일 */

@import url("../components/streaming.css");

/* CSS 변수 정의 - 라이트/다크 모드 */
:root {
  --primary-bg: #ffffff;
  --panel-background: #f8f9fa;
  --border-color: #dee2e6;
  --text-color: #212529;
  --interim-background: #e9ecef;
  --translation-bg: #f5f5f5;
  --header-color: #495057;
  --button-bg: #f8f9fa;
  --button-hover: #e9ecef;
  --gpt4-audio-bg: #f0f7fa;
  --gpt4-audio-border: #b0bec5;
  --gpt4-audio-highlight: #cfd8dc;
  --gpt4-audio-text: #37474f;
  --original-text-bg: #e8f5e9;
  --original-text-border: #66bb6a;
  --merge-source-color: #bbb;
  --merge-target-color: #90a4ae;
  --merge-flash-color: rgba(144, 164, 174, 0.3);
}

/* 다크 모드 */
[data-theme="dark"] {
  --primary-bg: #1a1a1a;
  --panel-background: #2d2d2d;
  --border-color: #404040;
  --text-color: #e0e0e0;
  --interim-background: #363636;
  --translation-bg: #3a3a3a;
  --header-color: #ffffff;
  --button-bg: #404040;
  --button-hover: #505050;
  --gpt4-audio-bg: #334155;
  --gpt4-audio-border: #64748b;
  --gpt4-audio-highlight: #475569;
  --gpt4-audio-text: #cbd5e1;
  --original-text-bg: #1b3a1d;
  --original-text-border: #4caf50;
  --merge-source-color: #6b7280;
  --merge-target-color: #4b5563;
  --merge-flash-color: rgba(75, 85, 99, 0.3);
}

/* icon-button 기본 스타일 (모든 버튼 통일) */
.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  color: var(--text-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.0);
}

.icon-button:hover {
  background: var(--button-hover);
  border: 1px solid var(--border-color);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.icon-button:active {
  background: var(--button-hover);
  border: 1px solid var(--border-color);
  transform: scale(0.95);
}

.icon-button i {
  color: var(--text-color);
  transition: all 0.2s ease;
}

/* 다크모드 토글 버튼 */
#themeToggle i {
  font-size: 1rem;
}

/* 기본 body 스타일 */
body {
  color: var(--text-color);
  background-color: var(--primary-bg);
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.header {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  margin: 0;
  position: relative;
  background: var(--panel-background);
  border-bottom: 1px solid var(--border-color);
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--header-color);
}

.transcription-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100% - 20px);
  margin-bottom: 20px;
  gap: 5px;
}

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  margin-bottom: 0.5rem;
  position: relative;
}

.panel:last-child {
  overflow: visible;
}

.panel:first-child {
  height: 45%;
}

.panel:last-child {
  height: 55%;
}

.panel-header {
  flex-shrink: 0;
  padding: 0.5rem 0 0.25rem 0;
  background: transparent;
  border-bottom: none;
}

.panel-header h2 {
  color: var(--header-color);
  font-weight: 500;
  font-size: 0.9rem;
  margin: 0;
  padding-left: 10px;
}

.text-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  position: relative;
}

.interim-content {
  color: #777777;
  flex-shrink: 0;
  padding: 0.25rem 0.5rem calc(0.5rem - 3px);
  background: none !important;
  background-color: transparent !important;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
  min-height: calc(1rem * 1.5 + 0.75rem - 3px);
  overflow-x: auto;
  overflow-y: hidden;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  position: relative;
  z-index: 10;
  word-break: keep-all;
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
}

.interim-content-wrapper {
  background: transparent !important;
  border: none !important;
}

.interim-content.fading {
  color: transparent;
  transition: color 4s ease-out;
}

.interim-text-truncated {
  color: #888888;
  opacity: 0.85;
  font-style: italic;
  letter-spacing: 0.3px;
}

[data-theme="dark"] .interim-text-truncated {
  color: #aaaaaa;
  opacity: 0.8;
}

#final-text p,
#final-translation p {
  background: var(--translation-bg);
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1.5;
  padding: 0.75rem;
  margin: 0 0 0.75rem 0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  word-break: break-word;
}

#final-translation p.final-translation {
  color: var(--text-color);
  opacity: 1;
  font-style: normal;
}

/* 스크롤바 스타일링 */
.text-content::-webkit-scrollbar {
  width: 3px;
}

.interim-content::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}

.text-content::-webkit-scrollbar-track,
.interim-content::-webkit-scrollbar-track {
  background: transparent;
}

.text-content::-webkit-scrollbar-thumb,
.interim-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* 번역 결과 스타일 */
#final-translation p {
  transition: all 0.3s ease;
  cursor: pointer;
}

#final-translation p.showing-original {
  background-color: var(--original-text-bg);
}

/* GPT-4 Audio 업데이트 스타일 */
#final-text p.gpt4-audio-updated {
  background: var(--gpt4-audio-bg);
  border-color: var(--gpt4-audio-border);
  color: var(--gpt4-audio-text);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes gpt4AudioUpdate {
  0% {
    background: var(--interim-background);
    border-color: var(--border-color);
    color: var(--text-color);
  }
  50% {
    background: var(--gpt4-audio-highlight);
    border-color: var(--gpt4-audio-border);
    color: var(--gpt4-audio-text);
  }
  100% {
    background: var(--gpt4-audio-bg);
    border-color: var(--gpt4-audio-border);
    color: var(--gpt4-audio-text);
  }
}

#final-text p.gpt4-audio-updated {
  animation: gpt4AudioUpdate 0.5s ease;
}

.language-select {
  position: static;
  transform: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.select-styled {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  background: var(--button-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  min-width: 100px;
  max-width: 120px;
  cursor: pointer;
  transition: background 0.2s, border 0.2s;
}

.select-styled:hover {
  background: var(--button-hover);
}

:root .select-styled {
  color: #212529;
}

[data-theme="dark"] .select-styled {
  color: #e0e0e0;
}

/* 병합 애니메이션 */
.bubble-merging,
.translation-merging {
  animation: floatUp 0.4s forwards;
  background-color: var(--preliminary-translation-bg) !important;
  border-color: var(--border-color) !important;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  position: relative;
  z-index: 10 !important;
  opacity: 0 !important;
  transform: translateY(-10px) !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

.bubble-receiving,
.translation-receiving {
  background-color: var(--preliminary-translation-bg) !important;
  border-color: var(--border-color) !important;
  position: relative;
  z-index: 5 !important;
  box-shadow: none !important;
}

.merged-bubble,
.merged-translation {
  color: var(--text-color) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 0.5;
  }
  100% {
    transform: translateY(-10px);
    opacity: 0;
  }
}

@keyframes highlight-pulse {
  0% {
    background-color: var(--original-text-bg);
    transform: scale(1);
  }
  50% {
    background-color: var(--original-text-bg);
    transform: scale(1.02);
    box-shadow: 0 0 10px rgba(102, 187, 106, 0.5);
  }
  100% {
    background-color: var(--preliminary-translation-bg);
    transform: scale(1);
  }
}

#final-text p.highlight-original {
  animation: highlight-pulse 1.5s ease;
}

/* 알림 스타일 */
.new-content-notification {
  background: var(--panel-background);
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: none;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  font-size: 100%;
  min-height: 42px;
  opacity: 0.96;
  pointer-events: auto;
  width: 100%;
  max-width: 80%;
  justify-content: flex-start;
  padding-left: 12px;
  z-index: 100;
  margin: 0;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

:root .new-content-notification {
  background: #e9ecef;
}

[data-theme="dark"] .new-content-notification {
  background: #353535;
}

.new-content-notification:hover {
  background: var(--button-hover);
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.new-content-notification i {
  font-size: 1rem;
  animation: bounce 2s infinite;
  flex-shrink: 0;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-3px);
  }
  60% {
    transform: translateY(-2px);
  }
}

.new-content-notification.show {
  display: flex;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 0.9;
  }
}

/* 메뉴 드롭다운 스타일 */
.menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 200px;
  background: var(--panel-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 8px;
  margin-top: 4px;
}

.menu-dropdown.show {
  display: block;
}

.menu-section {
  margin-bottom: 12px;
}

.menu-section h3 {
  color: var(--header-color);
  font-size: 0.85rem;
  margin: 0 0 6px 0;
  padding: 0 6px;
  font-weight: 500;
}

.menu-item {
  font-size: 1rem;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: none;
  color: var(--text-color);
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.menu-item:hover {
  background: var(--button-hover);
}

.menu-item i {
  width: 20px;
  margin-right: 8px;
  color: var(--text-color);
  opacity: 0.85;
}

/* 폰트 크기 컨트롤 */
.font-size-control {
  flex-direction: row;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
}

.font-size-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}

.font-size-percent {
  min-width: 42px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-color);
  font-weight: 500;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* fontSizePlus, fontSizeMinus 버튼에만 padding-left 적용 */
#fontSizePlus,
#fontSizeMinus {
  padding-left: 4px;
  position: relative;
}

/* 우측 상단에 작은 + 또는 - 표시 */
.font-size-symbol {
  position: absolute;
  top: 2px;
  right: 2px;
  padding-right: 0.2rem; 
  padding-top: 0.2rem;
  font-size: 0.6rem;
  font-weight: bold;
  line-height: 1;
  color: var(--text-color);
  pointer-events: none;
}

.menu-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0 16px 0;
  height: 0;
  width: 100%;
}

/* QR 모달 스타일 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--panel-background);
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--header-color);
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  text-align: center;
}

#qrCode {
  margin: 0 auto 16px;
  padding: 16px;
  background: white;
  border-radius: 8px;
  display: inline-block;
}

.share-url {
  word-break: break-all;
  margin: 12px 0;
  padding: 8px;
  background: var(--button-bg);
  border-radius: 4px;
  font-size: 0.9rem;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s;
}

.copy-button:hover {
  background: var(--button-hover);
}

.empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: #888;
  font-size: 1.1rem;
  text-align: center;
  margin: 2rem 0 1.5rem 0;
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.7rem;
  opacity: 0.7;
}

.empty-text {
  font-size: 1.08rem;
  line-height: 1.7;
  color: #888;
  opacity: 0.95;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--header-color);
  margin: 0 auto;
  text-align: center;
  letter-spacing: -0.5px;
}

/* settings-button은 icon-button 스타일 상속 */
.settings-button i {
  font-size: 1.1rem;
}

/* TTS 관련 스타일 */
.tts-playing {
  border-left: 4px solid rgba(33, 150, 243, 0.8) !important;
  animation: ttsPlayingBorder 2s ease-in-out infinite;
  position: relative;
}

@keyframes ttsPlayingBorder {
  0%, 100% {
    border-left-color: rgba(33, 150, 243, 0.8);
  }
  50% {
    border-left-color: rgba(33, 150, 243, 1);
  }
}

[data-theme="dark"] .tts-playing {
  border-left: 4px solid rgba(100, 181, 246, 0.8) !important;
  animation: ttsPlayingBorderDark 2s ease-in-out infinite;
}

@keyframes ttsPlayingBorderDark {
  0%, 100% {
    border-left-color: rgba(100, 181, 246, 0.8);
  }
  50% {
    border-left-color: rgba(100, 181, 246, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tts-playing {
    animation: none;
    border-left: 4px solid rgba(33, 150, 243, 0.8) !important;
  }
  [data-theme="dark"] .tts-playing {
    animation: none;
    border-left: 4px solid rgba(100, 181, 246, 0.8) !important;
  }
}

.tts-play-btn {
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-color);
  transition: background 0.2s, border 0.2s;
  vertical-align: middle;
}

.tts-play-btn:hover {
  background: var(--button-hover);
  color: #1976d2;
  border-color: #90caf9;
}

.tts-play-btn i {
  pointer-events: none;
}

/* TTS 컨트롤 그룹 스타일 */
.tts-control-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.tts-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tts-label {
  font-size: 0.95rem;
}

.tts-toggle-btn {
  padding: 4px 18px;
  border-radius: 18px;
  border: 1.5px solid var(--border-color);
  background: var(--button-bg);
  color: var(--text-color);
  font-size: 0.98rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border 0.2s, color 0.2s;
  margin-left: 2px;
}

.tts-toggle-btn.on {
  background: #e3f2fd;
  border-color: #2196f3;
  color: #1976d2;
}

.tts-toggle-btn.off {
  background: var(--button-bg);
  border-color: var(--border-color);
  color: var(--text-color);
}

.tts-speed-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-color);
  background: var(--button-bg);
  color: var(--text-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 500;
  transition: background 0.2s, border 0.2s;
}

.tts-speed-btn:hover {
  background: var(--button-hover);
}

.tts-speed-value {
  min-width: 36px;
  text-align: center;
  font-size: 1rem;
  color: var(--text-color);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* 폰트 크기 컨트롤 스타일 */
.font-size-controls {
  margin-left: -4px;
}

.font-size-label {
  margin-left: 4px;
  font-size: 1rem;
  white-space: nowrap;
  margin-right: 4px;
}

/* 인터림 콘텐츠 스타일 */
.interim-content-spacing {
  margin-bottom: 0px;
}

/* 빈 플레이스홀더 스타일 */
/* .empty-placeholder-hidden {
  display: none;
}

/* 아이콘 스타일 */
.icon-spacing {
  margin-right: 0.3em;
}

/* 알림 컨테이너 스타일 */
.notification-container {
  width: 100%;
  height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  pointer-events: none;
  z-index: 100;
}

/* 푸터 스타일 */
.footer-styled {
  text-align: center;
  color: #aaa;
  font-size: 0.95rem;
  padding: 0;
  background: var(--panel-background);
  border-top: 1px solid var(--border-color);
}

#layoutToggle {
  margin: 0;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

#layoutToggle:hover {
  background: var(--button-hover);
}

#layoutToggle i {
  font-size: 1.2rem;
  color: var(--text-color);
}

.deepl-input-controller {
  display: none;
}

/* 레이아웃 모드 */
.transcription-panel.translation-only {
  grid-template-columns: 1fr;
}

.transcription-panel.translation-only .panel:first-child {
  display: none;
}

.transcription-panel.translation-only .panel:last-child {
  height: calc(100vh - 120px);
  margin-bottom: max(20px, env(safe-area-inset-bottom));
}

/* 미디어 쿼리 - 가로 화면 */
@media (min-width: 768px) and (orientation: landscape) {
  .container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .transcription-panel {
    flex-direction: row;
    height: calc(100vh - 100px);
    gap: 15px;
    align-items: stretch;
    min-height: 300px;
    justify-content: space-between;
    margin-bottom: max(15px, env(safe-area-inset-bottom));
  }

  .transcription-panel:not(.translation-only) {
    height: calc(100vh - 140px);
    margin-bottom: max(35px, env(safe-area-inset-bottom) + 20px);
  }

  @media (-webkit-min-device-pixel-ratio: 1.5) {
    .container {
      padding-bottom: 0;
    }

    .transcription-panel {
      height: calc(100vh - 120px);
      margin-bottom: 25px;
    }

    .interim-content {
      color: #777777;
      max-height: 40px;
      min-height: 40px;
      margin-bottom: 0px;
      overflow-y: hidden;
      word-break: break-word;
    }
  }

  @media (-webkit-min-device-pixel-ratio: 1.5) and (max-width: 1280px) {
    .container {
      height: 100vh;
      padding-bottom: 0;
    }

    .transcription-panel {
      height: calc(100vh - 160px);
      margin-bottom: 35px;
    }

    .transcription-panel:not(.translation-only) {
      height: calc(100vh - 200px);
      margin-bottom: 55px;
    }

    .panel .text-content {
      padding-bottom: 25px;
    }

    .transcription-panel:not(.translation-only) .panel .text-content {
      padding-bottom: 35px;
    }

    .text-content {
      -webkit-overflow-scrolling: touch;
      overflow-y: auto;
      overflow-x: hidden;
      overscroll-behavior: contain;
    }
  }

  .panel:first-child,
  .panel:last-child {
    width: calc(50% - 8px);
    height: auto;
    flex: 1;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .panel .text-content {
    flex: 1;
    height: 0;
    overflow-y: auto;
    min-height: 100px;
  }

  .interim-content {
    color: #777777;
    max-height: 30px;
    min-height: 30px;
    overflow-y: hidden;
    word-break: break-word;
  }

  .header {
    height: 50px;
    padding: 0 15px;
    margin-bottom: 10px;
  }

  .panel:first-child,
  .panel:last-child {
    height: auto;
  }

  .text-content {
    padding: 1rem;
  }

  .panel-header {
    padding: 0.75rem 1rem;
  }

  .panel-header h2 {
    font-size: 1rem;
  }

  .transcription-panel.translation-only .panel:last-child {
    width: 100%;
    height: auto;
    flex: 1;
    margin: 0 0 max(15px, env(safe-area-inset-bottom)) 0;
  }

  @media (-webkit-min-device-pixel-ratio: 1.5) {
    .transcription-panel.translation-only .panel:last-child {
      margin: 0 0 25px 0;
    }
  }

  .transcription-panel.translation-only {
    flex-direction: row;
  }

  .transcription-panel.translation-only .panel:first-child {
    visibility: hidden;
    width: 0 !important;
    flex: 0 0 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }
}

/* 미디어 쿼리 - 모바일 */
@media (max-width: 600px) {
  .container {
    height: 100vh;
    padding-bottom: env(safe-area-inset-bottom, 80px);
    box-sizing: border-box;
  }

  .transcription-panel {
    height: calc(100vh - 130px);
    margin-bottom: 0;
  }

  .panel:last-child {
    height: 55%;
    margin-bottom: 0;
  }

  .interim-content {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .header {
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 10px;
  }

  .language-select {
    margin: 0 auto;
  }

  #layoutToggle {
    margin: 0;
  }

  .font-size-control {
    align-items: center;
    margin: 0;
    padding: 0;
  }

  .font-size-buttons {
    gap: 4px;
    margin: 0;
    align-items: center;
  }

  .font-size-btn .fa-font {
    font-size: 0.8rem !important;
  }

  .font-size-symbol {
    font-size: 0.6rem !important;
    top: 1px;
    right: 1px;
  }

  .font-size-percent {
    min-width: 36px;
    font-size: 0.8rem;
  }

  .select-styled {
    min-width: 90px;
    max-width: 100px;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .menu-dropdown {
    width: 180px;
    right: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 6px;
  }

  .menu-section {
    margin-bottom: 8px;
  }

  .menu-section h3 {
    font-size: 0.8rem;
    margin: 0 0 4px 0;
    padding: 0 4px;
  }

  .menu-item {
    padding: 5px 6px;
    font-size: 0.85rem;
  }

  .menu-item i {
    width: 16px;
    margin-right: 6px;
    font-size: 0.85rem;
  }

  .font-size-buttons {
    gap: 4px;
    margin: 0;
  }

  /* 모바일에서 모든 icon-button 크기 통일 */
  .icon-button {
    width: 28px;
    height: 28px;
  }

  .icon-button i {
    font-size: 0.9rem;
  }

  .modal-content {
    width: 95%;
    max-width: 320px;
  }
}

/* 삼성 인터넷 브라우저 */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 600px) {
    .container {
      height: 100vh;
      padding-bottom: max(80px, env(safe-area-inset-bottom) + 60px);
    }

    .transcription-panel {
      height: calc(100vh - 150px);
      margin-bottom: 0;
    }
  }
}

/* 태블릿 */
@media (min-width: 601px) and (max-width: 1024px) {
  .container {
    padding-bottom: 0;
  }

  .transcription-panel {
    margin-bottom: 25px;
    height: calc(100% - 30px);
  }

  .interim-content {
    margin-bottom: 15px;
    padding-bottom: 15px;
    min-height: 40px;
  }

  .panel:last-child {
    margin-bottom: 20px;
  }
}

/* 아이패드 태블릿 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .container {
    height: 100vh;
    padding-bottom: 0;
  }

  .transcription-panel {
    height: calc(100vh - 140px);
    margin-bottom: 30px;
  }

  .transcription-panel:not(.translation-only) {
    height: calc(100vh - 180px);
    margin-bottom: 50px;
  }

  .interim-content {
    max-height: 30px;
    min-height: 30px;
    margin-bottom: 0px;
    word-break: break-word;
  }

  .panel .text-content {
    padding-bottom: 20px;
  }

  .transcription-panel:not(.translation-only) .panel .text-content {
    padding-bottom: 30px;
  }
}

/* iOS 안전영역 */
@supports (padding: max(0px)) {
  .container {
    padding-bottom: max(20px, env(safe-area-inset-bottom) + 10px);
  }

  .transcription-panel {
    margin-bottom: max(15px, env(safe-area-inset-bottom));
  }

  .interim-content {
    margin-bottom: max(10px, env(safe-area-inset-bottom) / 2);
  }

  @supports (-webkit-touch-callout: none) {
    .container {
      height: -webkit-fill-available;
      padding-bottom: max(30px, env(safe-area-inset-bottom) + 20px);
    }

    .transcription-panel {
      height: calc(100vh - 140px);
      margin-bottom: max(20px, env(safe-area-inset-bottom) + 10px);
    }
  }

  .transcription-panel.translation-only .panel:last-child {
    margin-bottom: max(20px, env(safe-area-inset-bottom) + 10px);
  }
}

/* 폰트 크기 클래스 */
.font-size-small #final-text p,
.font-size-small #final-translation p,
.font-size-small .interim-content {
  font-size: 0.9rem;
}

.font-size-medium #final-text p,
.font-size-medium #final-translation p,
.font-size-medium .interim-content {
  font-size: 1rem;
}

.font-size-large #final-text p,
.font-size-large #final-translation p,
.font-size-large .interim-content {
  font-size: 1.1rem;
}
