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

:root {
  --bg: #0a0a0a;
  --card: #1a1a1a;
  --accent: #fe2c55;
  --accent-hover: #ff4466;
  --text: #fff;
  --text-dim: #aaa;
  --border: #333;
  --success: #25d366;
  --audio-color: #25f4ee;
  --warn: #ffa726;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
  -webkit-tap-highlight-color: transparent;
}

.logo {
  font-size: 32px;
  font-weight: 800;
  margin-top: env(safe-area-inset-top, 20px);
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--accent), #25f4ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  max-width: 500px;
  margin-bottom: 20px;
  background: var(--card);
  border-radius: 12px;
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--accent);
  color: white;
}

/* Main tabs + panels */
.main-tabs {
  width: 100%;
  max-width: 860px;
}

.tab-panel {
  display: none;
  width: 100%;
  max-width: 860px;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Input */
.input-group {
  width: 100%;
  position: relative;
}

.input-group.small { margin-top: 8px; }

.input-group input, .input-group textarea {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  resize: vertical;
}

.input-group input:focus, .input-group textarea:focus { border-color: var(--accent); }
.input-group input::placeholder, .input-group textarea::placeholder { color: #555; }

.paste-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
}

.paste-btn.small { font-size: 18px; font-weight: bold; }

/* Platform hint */
.platform-hint {
  font-size: 12px;
  color: var(--audio-color);
  padding: 6px 12px;
  background: rgba(37, 244, 238, 0.08);
  border-radius: 8px;
  text-align: center;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 8px;
}

.action-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: white;
}

.action-btn:active { transform: scale(0.97); }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.video-btn { background: var(--accent); }
.video-btn:not(:disabled):hover { background: var(--accent-hover); }

.audio-btn { background: var(--audio-color); color: #000; }
.audio-btn:not(:disabled):hover { background: #4ff8f0; }

.action-btn:not(.video-btn):not(.audio-btn):not(.secondary) {
  background: var(--accent);
}

.action-btn.secondary {
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text-dim);
}

/* Status */
.status {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
}

.status.error { color: var(--accent); }
.status.success { color: var(--success); }

/* Result area */
.result, .merge-result { display: none; }
.result.show, .merge-result.show { display: flex; flex-direction: column; gap: 10px; }

.media-info {
  font-size: 13px;
  color: var(--text-dim);
  padding: 10px 14px;
  background: var(--card);
  border-radius: 10px;
}

.preview-area video, .preview-area audio {
  width: 100%;
  border-radius: 12px;
  background: var(--card);
}

.preview-area video { max-height: 55vh; }

.save-btn {
  display: block;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: white;
  transition: transform 0.1s;
}

.save-btn:active { transform: scale(0.97); }
.save-btn.video { background: var(--success); }
.save-btn.audio { background: var(--audio-color); color: #000; }

/* Options row */
.option-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.option-row select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 28px;
  background: var(--card);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #25f4ee);
  border-radius: 14px;
  width: 0%;
  transition: width 0.3s;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* Merge */
.merge-modes {
  display: flex;
  gap: 4px;
  background: var(--card);
  border-radius: 10px;
  padding: 3px;
}

.merge-panel { display: none; flex-direction: column; gap: 12px; }
.merge-panel.active { display: flex; }

.file-drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  transition: border-color 0.2s;
}

.file-drop.drag-over { border-color: var(--accent); background: rgba(254,44,85,0.05); }

.file-label {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.merge-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.merge-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 8px;
  font-size: 13px;
}

.merge-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merge-item .remove-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.merge-item .drag-handle {
  cursor: grab;
  color: var(--text-dim);
  font-size: 14px;
  user-select: none;
}

.hint { font-size: 13px; color: var(--text-dim); }

/* Backend indicator */
.backend-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 8px 16px;
  background: var(--card);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

/* Result list */
.result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.result-size { font-size: 11px; color: var(--text-dim); }

.result-actions { margin-left: auto; }

.result-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
}

/* Info */
.info {
  margin-top: 24px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  width: 100%;
  max-width: 860px;
}

.info h3 { font-size: 14px; margin-bottom: 10px; color: var(--text-dim); }
.info ol { padding-left: 18px; color: var(--text-dim); font-size: 13px; line-height: 1.8; }
.info ol ol { margin-top: 4px; }
.info code { background: #222; padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }

.code-block {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin-top: 8px;
}

.code-block code {
  background: none;
  padding: 0;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
  color: var(--audio-color);
}

/* Scan results */
.scan-results {
  width: 100%;
}

.scan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.scan-header .btn-row { gap: 4px; }

.small-btn {
  padding: 6px 10px !important;
  font-size: 11px !important;
  flex: none !important;
}

.scan-list {
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.scan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.scan-item:hover { background: #222; }

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

.scan-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Saved file indicator */
.saved-item { border-color: var(--success); }
.saved-icon { color: var(--success); font-weight: bold; margin-right: 4px; }

/* Copy button */
.code-block { position: relative; }
.copy-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
}
.copy-btn:hover { color: var(--text); }
.copy-btn.copied { color: var(--success); }

/* Progress pulse animation */
.progress-fill { animation: none; }
.progress-bar[style*="display: flex"] .progress-fill,
.progress-bar:not([style*="display:none"]):not([style*="display: none"]) .progress-fill {
  background: linear-gradient(90deg, var(--accent), #25f4ee, var(--accent));
  background-size: 200% 100%;
  animation: shimmer 2s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 680px) {
  .main-tabs .tab { font-size: 13px; }
}
