/* 키보드/스크린리더 본문 바로가기 링크 */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--accent, #4a9eff);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
}

:root {
  --bg: #0a0a0a;
  --bg-panel: #1a1a1a;
  --bg-card: #252525;
  --text: #e8e8e8;
  --text-muted: #888888;
  --accent: #e82127;
  --accent-hover: #ff3b3b;
  --border: #333333;
  --success: #00d26a;
  --warning: #ffc107;
  --chrome: rgba(12, 12, 14, 0.9);
  --chrome-strong: rgba(20, 20, 24, 0.96);
  --surface: rgba(255, 255, 255, 0.03);
  --surface-border: rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.38);
}

/* ===== GLOBAL PROGRESS BAR ===== */
.global-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s,
    height 0.3s;
}

.global-progress-bar.active {
  opacity: 1;
  height: 36px;
  pointer-events: auto;
}

.global-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00d26a, #00f5a0, #00d26a, #00b35e);
  background-size: 300% 100%;
  animation: progressShine 2s linear infinite;
  transition: width 0.2s ease-out;
}

.global-progress-bar.active .global-progress-fill {
  box-shadow: 0 0 15px rgba(0, 210, 106, 0.6);
}

.global-progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s;
}

.global-progress-bar.active .global-progress-text {
  opacity: 1;
}

@keyframes progressShine {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.global-progress-bar.complete .global-progress-fill {
  background: var(--success);
  animation: none;
}

.global-progress-cancel {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  height: 26px;
  border: none;
  border-radius: 13px;
  background: rgba(255, 70, 70, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 1;
  transition: background 0.15s;
  padding: 0 12px;
  white-space: nowrap;
}

.global-progress-cancel:hover {
  background: rgba(255, 40, 40, 0.85);
}

.global-progress-bar.active .global-progress-cancel {
  display: flex;
}

.global-progress-bar.complete .global-progress-cancel {
  display: none;
}

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

html,
body {
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(
      circle at top left,
      rgba(232, 33, 39, 0.16),
      transparent 28%
    ),
    radial-gradient(
      circle at top right,
      rgba(255, 255, 255, 0.06),
      transparent 22%
    ),
    linear-gradient(180deg, #08090c 0%, #0c0d12 40%, #08090c 100%);
}

/* ===== LAYOUT ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0.9rem;
  gap: 0.75rem;
  overflow: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--chrome);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  flex-shrink: 0;
}

/* 로고 링크 (홈으로) */
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.header-brand:hover {
  opacity: 0.8;
}

.header-logo {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
}

.header-brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.header-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.header-brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-version {
  width: fit-content;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.64rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  row-gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch span,
.lang-switch label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lang-toggle {
  display: flex;
  gap: 0.3rem;
}

.lang-btn {
  padding: 0.3rem 0.85rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.lang-btn:hover {
  color: var(--text);
  border-color: #555;
}

.lang-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232, 33, 39, 0.08);
}

/* ===== TAB STYLES ===== */
.tab-container {
  display: flex;
  gap: 0.5rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--chrome-strong);
  padding: 0.5rem;
  border-radius: 16px;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-lg);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  background: var(--bg-card);
  color: var(--text);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #ff4d4f);
  color: #fff;
  box-shadow: 0 12px 24px rgba(232, 33, 39, 0.26);
}

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.75rem;
  border-radius: 22px;
  border: 1px solid var(--surface-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    rgba(9, 10, 14, 0.9);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Main Content */
.main {
  flex: 1;
  display: flex;
  gap: 1rem;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

/* Video Section */
.video-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  min-height: 0;
  padding: 0.9rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(17, 18, 24, 0.78);
  overflow: hidden;
  max-height: 100%;
}

.video-container {
  flex: 1;
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: auto;
  max-height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.video-container canvas {
  max-width: 100%;
  max-height: 100%;
}

/* Drop Zone */
.drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 3px dashed var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone.hidden {
  display: none;
}

.drop-zone:hover,
.drop-zone.dragover {
  background: rgba(232, 33, 39, 0.1);
  border-color: var(--accent);
}

.drop-zone svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.drop-zone h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.drop-zone p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.drop-zone input {
  display: none;
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.controls button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.controls button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.controls button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.time-display {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 100px;
}

.controls input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
}

.controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.controls input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.controls input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.trim-controls {
  margin-top: 10px;
  width: 100%;
  flex-basis: 100%;
}

.trim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.trim-values {
  display: flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.trim-sep {
  opacity: 0.6;
}

.trim-bar {
  position: relative;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.trim-bar--seek {
  flex: 1;
  min-width: 140px;
}

.trim-values--inline {
  width: 100%;
  justify-content: flex-end;
  margin-top: 4px;
}

.trim-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #ff3b30;
  box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.25);
  pointer-events: none;
  z-index: 2;
}

.trim-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.trim-overlay.trim-left {
  left: 0;
}

.trim-overlay.trim-right {
  right: 0;
}

.trim-bar input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 26px;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
}

.trim-bar input[type="range"].trim-seek {
  left: 0;
  width: 100%;
  pointer-events: auto;
}

.trim-bar input[type="range"].trim-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0;
  height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.trim-bar input[type="range"].trim-seek::-moz-range-thumb {
  width: 0;
  height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.trim-bar input[type="range"]::-webkit-slider-runnable-track {
  height: 26px;
  background: transparent;
}

.trim-bar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px;
  width: 18px;
  margin-top: 4px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  pointer-events: auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.trim-bar input[type="range"]::-moz-range-track {
  height: 26px;
  background: transparent;
}

.trim-bar input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  pointer-events: auto;
}

/* Side Panel */
.side-panel {
  width: min(360px, 28vw);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.1rem;
}

.panel-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    rgba(20, 21, 28, 0.88);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: visible;
  flex-shrink: 0;
}

.panel-card.metadata-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-header-toggle {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.panel-header-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.panel-header-toggle svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.panel-card.is-collapsed .panel-header-toggle svg {
  transform: rotate(180deg);
}

.panel-content {
  padding: 1rem;
}

.panel-content.metadata-content {
  flex: 1;
  overflow: visible;
}

/* File Info */
.file-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-info .filename {
  font-weight: 600;
  word-break: break-all;
  color: var(--accent);
}

.file-info .detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* File List (for merge) */
.file-list-panel {
  background: var(--bg-panel);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-list-title {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.file-list-count {
  font-size: 0.78rem;
  opacity: 0.7;
}

.file-list-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.8rem;
}

.file-item .file-number {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.file-item .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .file-status {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.file-item .file-status.ready {
  color: var(--success);
}
.file-item .file-status.processing {
  color: var(--warning);
}
.file-item .file-status.done {
  color: var(--success);
}
.file-item .file-status.error {
  color: var(--accent);
}

.file-item .remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.file-item .remove-btn:hover {
  color: var(--accent);
}

.clear-btn {
  background: var(--bg-card);
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}

.clear-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Metadata Grid */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.meta-item {
  background: linear-gradient(135deg, #2a2a2a, #1f1f1f);
  padding: 0.75rem 0.875rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.meta-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.meta-item .label {
  font-size: 0.65rem;
  color: #aaaaaa;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.meta-item .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.meta-item .value.speed {
  color: #00ff88;
  font-size: 1.25rem;
}
.meta-item .value.gear {
  color: #4da6ff;
}
.meta-item .value.autopilot {
  color: #a78bfa;
}
.meta-item .value.brake-on {
  color: #ff4757;
}
.meta-item .value.brake-off {
  color: #888888;
}
.meta-item .value.blinker-on {
  color: #ffc107;
}
.meta-item .value.blinker-off {
  color: #888888;
}
.meta-item .value.accel {
  color: #00d26a;
}
.meta-item.full-width {
  grid-column: span 2;
}

.meta-item-coordinates .value {
  font-size: 1rem;
  color: var(--text);
}

/* Google Maps Button (standalone above export panel) */
.google-maps-btn-wrapper {
  margin-bottom: 0.75rem;
}

.google-maps-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(77, 166, 255, 0.35);
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    rgba(31, 111, 235, 0.18),
    rgba(14, 165, 233, 0.12)
  );
  color: #dbeafe;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
  cursor: pointer;
}

.google-maps-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.65);
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.3),
    rgba(14, 165, 233, 0.2)
  );
  color: #ffffff;
}

.google-maps-btn:disabled {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: not-allowed;
}

.google-maps-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Overlay Settings */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-row label {
  font-size: 0.85rem;
}

.select-input {
  min-width: 170px;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
}

.select-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.select-input option {
  background: var(--bg);
  color: var(--text);
}

.map-size-row {
  padding-left: 0.5rem;
  opacity: 0.9;
}
.map-size-row > label {
  font-size: 0.8rem !important;
  color: var(--text-muted);
}
.map-size-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.map-size-btn {
  padding: 0.25rem 0.6rem;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.map-size-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}
.map-size-btn.active {
  background: var(--accent);
  color: #fff;
}
.map-size-btn:hover:not(.active) {
  background: var(--bg-panel);
  color: var(--text);
}

.map-opacity-row {
  padding-left: 0.5rem;
  opacity: 0.9;
}
.map-opacity-row > label,
.cluster-opacity-row > label {
  font-size: 0.88rem !important;
  color: var(--text);
}
.map-opacity-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.map-opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.map-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
}
.map-opacity-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
}
.map-opacity-value {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
}

.hint-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle .slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .slider {
  background: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* Export Button */
.export-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.export-size-preview {
  margin-top: -0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.export-btn {
  width: 100%;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #ff4757);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.export-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(232, 33, 39, 0.4);
}

.export-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.export-btn svg {
  width: 18px;
  height: 18px;
}

.export-btn.processing {
  background: var(--warning);
}

.export-btn.secondary {
  background: var(--bg-card);
}

.export-btn.secondary:hover:not(:disabled) {
  background: var(--border);
  box-shadow: none;
}

/* Progress */
.progress-container {
  display: none;
}

.progress-container.visible {
  display: block;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.1s;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* Responsive (태블릿 이하) */
@media (max-width: 900px) {
  html {
    height: 100%;
  }

  body {
    height: auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
  }

  .app {
    flex: 1;
    height: auto;
    max-height: none;
    min-height: 100%;
    overflow: visible;
  }

  .tab-content.active {
    flex: none;
  }

  .main {
    flex: none;
    flex-direction: column;
  }

  .video-section {
    flex: none;
    max-height: none;
  }

  .side-panel {
    width: 100%;
    padding-right: 0;
  }

  .meta-grid {
    max-height: none;
  }

  .tab-btn {
    font-size: 0.8rem;
    padding: 0.6rem 0.75rem;
  }
}

/* ===== MOBILE (≤ 640px) ===== */
@media (max-width: 640px) {
  /* body를 flex 컨테이너로: 스크롤 허용 + footer 최하단 */
  html {
    height: 100%;
  }

  body {
    height: auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
  }

  /* app: 남은 공간 채우되 고정 높이 해제 */
  .app {
    flex: 1;
    height: auto;
    max-height: none;
    padding: 0.75rem;
    gap: 0.75rem;
    overflow: visible;
  }

  /* flex: 1 / min-height: 0 체인 해제 → 자연스러운 높이로 */
  .tab-content.active {
    flex: none;
  }

  .main {
    flex: none;
  }

  .video-section {
    flex: none;
    max-height: none;
  }

  /* 헤더 */
  .header h1 {
    font-size: 1.25rem;
  }

  .header-controls {
    gap: 0.75rem;
  }

  .lang-switch {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  .lang-btn {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
  }

  /* 탭 버튼: 이모지 숨기고 텍스트 축소 */
  .tab-container {
    padding: 0.35rem;
    gap: 0.3rem;
  }

  .tab-btn {
    font-size: 0.72rem;
    padding: 0.55rem 0.4rem;
    gap: 0.25rem;
  }

  /* 비디오 컨테이너 최소 높이 축소 */
  .video-container {
    min-height: 200px;
  }

  .header-brand-tagline {
    font-size: 0.66rem;
    letter-spacing: 0.05em;
  }

  /* 컨트롤 바 */
  .controls {
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }

  .time-display {
    font-size: 0.78rem;
    min-width: 80px;
  }

  .controls button {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  /* 트림 바 최소 너비 축소 */
  .trim-bar--seek {
    min-width: 80px;
  }

  /* 설정 행: select 오버플로우 방지 */
  .setting-row {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .select-input {
    min-width: 0;
    width: 100%;
    font-size: 0.8rem;
  }

  /* 메타 그리드 값 크기 축소 */
  .meta-item .value {
    font-size: 1rem;
  }

  /* 내보내기 버튼 */
  .export-btn {
    font-size: 0.85rem;
    padding: 0.75rem 0.75rem;
  }

  /* 드롭존 */
  .drop-zone svg {
    width: 48px;
    height: 48px;
  }

  .drop-zone h3 {
    font-size: 1rem;
  }

  /* 파일 아이템 */
  .file-item {
    font-size: 0.75rem;
  }

  .camera-name {
    min-width: 70px;
  }

  /* 푸터 */
  .site-footer {
    padding: 1rem 1rem 2rem;
  }

  .footer-inner {
    gap: 0.7rem;
  }

  .footer-title {
    font-size: 0.82rem;
  }

  .footer-desc {
    font-size: 0.72rem;
    line-height: 1.5;
  }

  /* 태그: 더 작게 */
  .footer-tags span {
    font-size: 0.66rem;
    padding: 0.1rem 0.4rem;
  }

  /* footer-copy: flex로 자연스럽게 줄바꿈 */
  .footer-copy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }

  /* footer-legal: 링크 간격 정리 */
  .footer-legal {
    gap: 0.3rem 0.4rem;
    font-size: 0.7rem;
  }

  .footer-legal a,
  .footer-cookie-btn {
    font-size: 0.7rem;
  }

  .footer-legal-sep {
    font-size: 0.65rem;
  }
}

/* ===== GRID LAYOUT STYLES ===== */
.grid-layout-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.radio-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.radio-option input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.radio-option span {
  font-size: 0.875rem;
  color: var(--text);
}

/* Grid File List */
.grid-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.grid-file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.camera-icon {
  font-size: 1rem;
}

.camera-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--accent);
  min-width: 90px;
}

.file-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-files {
  text-align: center;
  color: var(--text-muted);
  padding: 1rem;
  font-size: 0.875rem;
}

/* Form checkbox for grid options */
.form-row {
  margin-bottom: 0.75rem;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.form-checkbox span {
  font-size: 0.875rem;
  color: var(--text);
}

/* Radio label for grid layout */
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
}

.setting-row:has(.radio-label) {
  justify-content: flex-start;
}

.radio-label input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.radio-label span {
  color: var(--text);
}

/* 사이트 푸터 */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 1.5rem 1.5rem 2rem;
}
.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.footer-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 0.35rem;
}
.footer-desc {
  font-size: 0.78rem;
  line-height: 1.6;
  color: #555;
  margin: 0 0 0.2rem;
}

.footer-mobile-tip {
  color: #888;
  font-style: italic;
  margin-top: 0.4rem;
}

@media (min-width: 769px) {
  .footer-mobile-tip {
    display: none;
  }
}
.footer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.footer-tags span {
  font-size: 0.72rem;
  color: #444;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}
.footer-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.45rem;
  font-size: 0.75rem;
  color: #444;
  margin: 0;
}
.footer-version {
  color: #666;
  letter-spacing: 0.01em;
}
.footer-copy a {
  color: #555;
  text-decoration: none;
}
.footer-copy a:hover {
  color: var(--text-muted);
}
.footer-copy-sep {
  color: #3a3a3a;
  font-size: 0.7rem;
}
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  margin-top: 0.1rem;
}
.footer-legal a {
  color: #4a4a4a;
  text-decoration: none;
}
.footer-legal a:hover {
  color: var(--text-muted);
  text-decoration: underline;
}
.footer-legal-sep {
  color: #3a3a3a;
  font-size: 0.7rem;
}
.footer-cookie-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  color: #4a4a4a;
  cursor: pointer;
  font-family: inherit;
}
.footer-cookie-btn:hover {
  color: var(--text-muted);
  text-decoration: underline;
}
.legal-version {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0.45rem 0 0;
}

/* ===== COOKIE CONSENT BANNER ===== */
#cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: #1e1e1e;
  border-top: 1px solid #333;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#cookie-consent-banner.ccb-visible {
  transform: translateY(0);
}
#cookie-consent-banner.ccb-hiding {
  transform: translateY(100%);
}
.ccb-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.ccb-text {
  flex: 1;
  min-width: 220px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #999;
  margin: 0;
}
.ccb-text strong {
  color: #bbb;
}
.ccb-link {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.ccb-link:hover {
  text-decoration: underline;
}
.ccb-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.ccb-btn {
  padding: 0.45rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.ccb-btn-reject {
  background: transparent;
  border-color: #444;
  color: #888;
}
.ccb-btn-reject:hover {
  border-color: #666;
  color: #aaa;
}
.ccb-btn-accept {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.ccb-btn-accept:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
@media (max-width: 560px) {
  .ccb-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .ccb-actions {
    justify-content: flex-end;
  }
}

/* ===== PWA 설치 버튼 (헤더) ===== */
#pwaInstallBtn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(232, 33, 39, 0.5);
  background: rgba(232, 33, 39, 0.1);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.2s,
    border-color 0.2s;
}
#pwaInstallBtn:hover {
  background: rgba(232, 33, 39, 0.22);
  border-color: var(--accent);
}
#pwaInstallBtn svg {
  flex-shrink: 0;
}
#pwaInstallBtn.visible {
  display: flex;
}

/* ===== 북마크 토스트 ===== */
#bookmarkToast {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem 0.65rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  font-size: 0.82rem;
  color: var(--text);
  z-index: 900;
  white-space: nowrap;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  opacity: 0;
}
#bookmarkToast.show {
  bottom: 24px;
  opacity: 1;
  pointer-events: auto;
  transition:
    bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s;
}
#bookmarkToast.hide {
  bottom: -80px;
  opacity: 0;
  transition:
    bottom 0.35s ease-in,
    opacity 0.25s;
}
#bookmarkToast kbd {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
}
#bookmarkToastClose {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  line-height: 1;
  font-size: 1rem;
  margin-left: 0.25rem;
  border-radius: 4px;
}
#bookmarkToastClose:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
