:root {
  --bg: #0a0a0f;
  --bg-subtle: #0f0f16;
  --surface: #14141f;
  --surface-hover: #1a1a28;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f0f5;
  --text-muted: #8888a0;
  --accent: #5b7fff;
  --accent-hover: #7b9aff;
  --accent-dim: rgba(91, 127, 255, 0.2);
  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-dim: rgba(239, 68, 68, 0.15);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(91, 127, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(91, 127, 255, 0.06), transparent),
    var(--bg);
}

.main {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card-head {
  margin-bottom: 1.25rem;
}

.card-head h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-subtle);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone.dragover .drop-zone-icon {
  color: var(--accent);
}

.drop-zone-icon {
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: color 0.2s;
}

.drop-zone-icon svg {
  display: block;
  margin: 0 auto;
}

.drop-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.drop-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.file-list-wrap {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.file-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.btn-text:hover {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.file-list {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item.file-error {
  background: var(--error-dim);
}

.file-item .file-info {
  flex: 1;
  min-width: 0;
}

.file-item .file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item .file-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.file-item .file-progress {
  flex: 0 0 100px;
  height: 6px;
  background: var(--surface-hover);
  border-radius: 3px;
  overflow: hidden;
}

.file-item .file-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.15s;
}

.file-item.file-done .file-progress-fill {
  width: 100%;
  background: var(--success);
}

.file-item .file-status {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.file-status.pending {
  color: var(--text-muted);
  background: var(--surface-hover);
}

.file-status.uploading {
  color: var(--accent);
  background: var(--accent-dim);
}

.file-status.done {
  color: var(--success);
  background: var(--success-dim);
}

.file-status.error {
  color: var(--error);
  background: var(--error-dim);
}

.file-item .file-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-item .file-remove:hover {
  background: var(--error-dim);
  color: var(--error);
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.upload-actions .error {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--error);
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: background 0.2s, opacity 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  color: white;
  box-shadow: 0 4px 14px rgba(91, 127, 255, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), #7c3aed);
  box-shadow: 0 6px 20px rgba(91, 127, 255, 0.4);
}

.btn-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.results-section {
  margin-bottom: 1.5rem;
}

.results-section .card-head {
  margin-bottom: 1rem;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.result-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.result-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.result-item-link {
  color: var(--accent);
  font-size: 0.85rem;
  word-break: break-all;
  display: block;
  margin-bottom: 0.5rem;
}

.result-item-embed {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.result-item-embed textarea {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  resize: vertical;
  min-height: 60px;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  align-self: flex-start;
}

.btn-small:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.clip-list {
  list-style: none;
}

.clip-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.clip-item:last-child {
  border-bottom: none;
}

.clip-item-thumb {
  flex-shrink: 0;
  width: 120px;
  height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-subtle);
}

.clip-item-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.clip-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.clip-item-actions .btn-small {
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

.clip-item-actions .btn-delete {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.4);
}

.clip-item-actions .btn-delete:hover {
  background: var(--error-dim);
  border-color: var(--error);
}

.clip-list-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
  text-align: center;
}

.help-card pre.code {
  background: var(--bg-subtle);
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.embed-body {
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9;
  max-height: 100vh;
  background: #000;
}

.video-player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.player-extra-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  pointer-events: none;
}

.player-extra-controls .player-ctrl-btn {
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 44px;
  padding: 0.4rem 0.6rem;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.player-extra-controls .player-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.player-extra-controls .ctrl-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-extra-controls .ctrl-icon svg {
  width: 20px;
  height: 20px;
}

.player-extra-controls .ctrl-icon-fwd svg {
  transform: scaleX(-1);
}

.player-extra-controls .ctrl-label {
  line-height: 1;
}

.player-extra-controls .player-ctrl-speed {
  min-width: 48px;
  font-size: 0.85rem;
}

.player-extra-controls .ctrl-icon-fullscreen svg {
  width: 18px;
  height: 18px;
}

.tap-to-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tap-to-play-overlay[hidden] {
  display: none !important;
}

.tap-to-play-overlay:before {
  content: '';
  width: 56px;
  height: 56px;
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  box-sizing: border-box;
}

.tap-to-play-overlay:after {
  content: '';
  position: absolute;
  border: 10px solid transparent;
  border-left-color: rgba(255,255,255,0.95);
  margin-left: 5px;
}

.tap-to-play-text {
  position: absolute;
  bottom: 20%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.95;
}

.loading,
.error-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  color: #fff;
  text-align: center;
  padding: 1rem;
}

.error-msg {
  color: #f87171;
}
