:root {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #f4f6fb;
  background: #0f172a;
  --card-bg: #16213d;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #4ade80;
  --accent-dark: #059669;
  --ghost: rgba(255, 255, 255, 0.25);
  --text-dim: rgba(244, 246, 251, 0.7);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1f2937, #0f172a);
  color: inherit;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1.5rem;
}

.noscript-warning {
  padding: 0.75rem 1rem;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 0.5rem;
  text-align: center;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.app-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.app-header p {
  margin: 0.25rem 0 0;
  color: var(--text-dim);
}

.header-status {
  font-size: 0.95rem;
  color: var(--accent);
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  flex: 1;
}

.primary-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 20px 45px rgba(10, 10, 20, 0.4);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.preset-row {
  justify-content: space-between;
}

.file-name {
  flex: 1;
  min-width: 200px;
  font-size: 0.95rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #0f172a;
  background: #e2e8f0;
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
}

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

.button.primary {
  background: var(--ghost);
  color: #f8fafc;
  position: relative;
  overflow: hidden;
}

.button.primary input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.button.accent {
  background: linear-gradient(120deg, var(--accent), var(--accent-dark));
  color: #03131d;
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--ghost);
  color: #f8fafc;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

select {
  width: 260px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 999px;
  border: 1px solid var(--border);
  color: #f8fafc;
  padding: 0.45rem 0.85rem;
  font-size: 0.95rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.progress {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #10b981);
  transition: width 0.25s ease;
}

.status-message {
  min-height: 1.25rem;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.video-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.video-pane video {
  width: 100%;
  min-height: 260px;
  background: #0f172a;
  border-radius: 0.75rem;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pane-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.pane-header p {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.gallery-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - 180px);
}

.gallery-empty {
  text-align: center;
  padding: 0.75rem;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  color: var(--text-dim);
}

.gallery-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

.gallery-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 0.75rem;
  padding: 0.65rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border 0.15s ease, background 0.15s ease;
}

.gallery-item:hover {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.05);
}

.gallery-item.active {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.08);
}

.gallery-thumb {
  width: 72px;
  height: 48px;
  border-radius: 0.4rem;
  object-fit: cover;
  background: #020617;
}

.gallery-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gallery-actions {
  display: flex;
  align-items: flex-start;
}

.gallery-delete {
  border: none;
  background: transparent;
  color: rgba(248, 250, 252, 0.7);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 0.45rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.gallery-delete:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
}

.gallery-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.gallery-detail {
  font-size: 0.8rem;
  color: var(--text-dim);
}

@media (max-width: 1024px) {
  body {
    padding: 1rem;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .gallery-panel {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
