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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f1117;
  color: #e4e6eb;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

body.home {
  align-items: flex-start;
}

.container {
  width: 100%;
  max-width: 520px;
}

.home-container {
  max-width: 900px;
}

nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

nav a {
  color: #8b8fa3;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #2d3148;
  transition: color 0.2s, border-color 0.2s;
}

nav a:hover { color: #e4e6eb; border-color: #6c63ff; }
nav a.active { color: #6c63ff; border-color: #6c63ff; }

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #8b8fa3;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.tool-description {
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.description-heading {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c63ff;
  margin-bottom: 0.5rem;
}

.tool-description p {
  color: #c4c7d4;
  font-size: 0.95rem;
  line-height: 1.6;
}

.app-help {
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: #a0a4b8;
}

.app-help .help-tips summary {
  cursor: pointer;
  font-weight: 600;
  color: #e8eaef;
  margin-bottom: 0.35rem;
}

.app-help ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.app-help li {
  margin-bottom: 0.35rem;
  line-height: 1.45;
}

.drop-zone {
  border: 2px dashed #2d3148;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
  position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.05);
}

.drop-zone.has-file {
  border-color: #4ade80;
  border-style: solid;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone .label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.drop-zone .hint {
  font-size: 0.8rem;
  color: #8b8fa3;
}

.drop-zone .filename {
  font-size: 0.85rem;
  color: #4ade80;
  margin-top: 0.5rem;
  word-break: break-all;
}

.preview {
  margin-bottom: 1.5rem;
  border-radius: 12px;
  overflow: hidden;
  display: none;
  background: #1a1d2e;
}

.preview img, .preview video {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.media-players {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.media-player {
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
  overflow: hidden;
}

.media-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: #141622;
  border-bottom: 1px solid #2d3148;
  font-size: 0.8rem;
}

.media-player-label {
  font-weight: 600;
  color: #6c63ff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.media-player-filename,
.image-preview-filename {
  color: #8b8fa3;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.media-player-viewport {
  position: relative;
  background: #000;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-player--audio .media-player-viewport {
  aspect-ratio: auto;
  min-height: 100px;
  background: linear-gradient(135deg, #1a1d2e 0%, #0f1117 100%);
}

.media-player-viewport video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.media-player-audio-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
}

.audio-visual-icon {
  font-size: 2.5rem;
  color: #6c63ff;
  opacity: 0.8;
}

.audio-visual-bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 32px;
}

.audio-visual-bars span {
  width: 4px;
  background: #6c63ff;
  border-radius: 2px;
  animation: audioBar 0.8s ease-in-out infinite;
}

.media-player.is-playing .audio-visual-bars span {
  animation-play-state: running;
}

.media-player:not(.is-playing) .audio-visual-bars span {
  animation-play-state: paused;
  height: 8px !important;
}

.audio-visual-bars span:nth-child(1) { animation-delay: 0s; }
.audio-visual-bars span:nth-child(2) { animation-delay: 0.1s; }
.audio-visual-bars span:nth-child(3) { animation-delay: 0.2s; }
.audio-visual-bars span:nth-child(4) { animation-delay: 0.3s; }
.audio-visual-bars span:nth-child(5) { animation-delay: 0.4s; }

@keyframes audioBar {
  0%, 100% { height: 8px; }
  50% { height: 32px; }
}

.media-player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: #141622;
}

.mp-btn {
  width: auto;
  padding: 0.35rem 0.5rem;
  background: transparent;
  border: 1px solid #2d3148;
  border-radius: 6px;
  color: #e4e6eb;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.mp-btn:hover { background: #2d3148; }
.mp-btn.is-active { background: #6c63ff; border-color: #6c63ff; }

.mp-time {
  font-size: 0.75rem;
  color: #8b8fa3;
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  flex-shrink: 0;
}

.mp-seek {
  flex: 1;
  min-width: 80px;
  accent-color: #6c63ff;
  cursor: pointer;
}

.mp-volume-wrap {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mp-volume {
  width: 70px;
  accent-color: #6c63ff;
  cursor: pointer;
}

.mp-speed {
  padding: 0.3rem 0.4rem;
  background: #1a1d2e;
  color: #e4e6eb;
  border: 1px solid #2d3148;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.image-preview-wrap {
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
  overflow: hidden;
}

.image-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
  background: #000;
}

.merge-playlist {
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
  overflow: hidden;
}

.merge-playlist-items {
  display: flex;
  flex-direction: column;
  max-height: 160px;
  overflow-y: auto;
}

.merge-playlist-item {
  width: 100%;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid #2d3148;
  color: #c4c7d4;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}

.merge-playlist-item:hover {
  background: rgba(108, 99, 255, 0.1);
  color: #e4e6eb;
}

.output-notice {
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
  overflow: hidden;
}

.output-notice-text {
  padding: 1rem 1.25rem;
  color: #c4c7d4;
  font-size: 0.9rem;
  line-height: 1.5;
}

.output-actions {
  background: #1a1d2e;
  border: 1px solid #6c63ff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.output-ready-text {
  color: #8b8fa3;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.output-download-btn {
  width: auto;
  min-width: 200px;
  padding: 0.85rem 2rem;
  background: #4ade80;
  color: #0f1117;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.output-download-btn:hover {
  background: #22c55e;
}

button {
  width: 100%;
  padding: 0.85rem;
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

button:hover:not(:disabled) { background: #5a52e0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.status {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  min-height: 1.4em;
}

.status.error { color: #f87171; }
.status.success { color: #4ade80; }
.status.loading { color: #8b8fa3; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #8b8fa3;
  border-top-color: #6c63ff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tool-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.category {
  margin-bottom: 2rem;
}

.category-title {
  font-size: 1rem;
  font-weight: 600;
  color: #8b8fa3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.tool-card {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid #2d3148;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.tool-card:hover {
  border-color: #6c63ff;
  background: rgba(108, 99, 255, 0.05);
}

.tool-card h2, .tool-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.tool-card p {
  font-size: 0.85rem;
  color: #8b8fa3;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Media Mixer */
.mixer-body .container {
  max-width: 100%;
}

.mixer-container h1 {
  margin-bottom: 0.5rem;
}

.mixer-section {
  margin-bottom: 1.75rem;
}

.mixer-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.mixer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.mixer-section-head h2 {
  margin-bottom: 0;
}

.mixer-rack-wrap {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  align-items: stretch;
}

.mixer-rack {
  display: flex;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.mixer-channel {
  flex: 0 0 200px;
  background: linear-gradient(180deg, #1e2236 0%, #141622 100%);
  border: 1px solid #2d3148;
  border-radius: 10px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mixer-master {
  flex: 0 0 180px;
  background: linear-gradient(180deg, #252a45 0%, #1a1d2e 100%);
  border: 1px solid #6c63ff44;
  border-radius: 10px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mixer-master-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #6c63ff;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mixer-channel-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mixer-track-num {
  font-weight: 700;
  font-size: 0.75rem;
  color: #8b8fa3;
}

.mixer-track-type {
  font-size: 0.65rem;
  color: #6c63ff;
  background: rgba(108, 99, 255, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.mixer-btn-remove {
  margin-left: auto;
  width: auto;
  padding: 0.1rem 0.45rem;
  background: transparent;
  border: 1px solid #2d3148;
  border-radius: 4px;
  color: #8b8fa3;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.mixer-btn-remove:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

.mixer-drop-compact {
  padding: 0.5rem !important;
  min-height: auto !important;
}

.mixer-drop-compact .label {
  font-size: 0.75rem;
}

.mixer-drop-compact .filename {
  font-size: 0.7rem;
  word-break: break-all;
}

.mixer-ms-buttons {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}

.mixer-ms-btn {
  width: 2rem;
  height: 1.75rem;
  padding: 0;
  background: #141622;
  border: 1px solid #2d3148;
  border-radius: 4px;
  color: #8b8fa3;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.mixer-ms-btn.is-muted {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.mixer-ms-btn.is-solo {
  background: #f1c40f;
  border-color: #f1c40f;
  color: #1a1d2e;
}

.mixer-fader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0;
}

.mixer-fader-label {
  font-size: 0.65rem;
  color: #8b8fa3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mixer-fader {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 2rem;
  height: 100px;
  accent-color: #6c63ff;
  cursor: pointer;
}

.mixer-fader-wrap output {
  font-size: 0.7rem;
  color: #8b8fa3;
  font-variant-numeric: tabular-nums;
}

.mixer-knob {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: #8b8fa3;
}

.mixer-knob input[type="range"] {
  accent-color: #6c63ff;
  width: 100%;
}

.mixer-knob output {
  font-size: 0.7rem;
  text-align: center;
  color: #8b8fa3;
}

.mixer-details {
  border-top: 1px solid #2d3148;
  padding-top: 0.35rem;
}

.mixer-details summary {
  font-size: 0.7rem;
  font-weight: 600;
  color: #8b8fa3;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.mixer-mini {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: #8b8fa3;
  margin-bottom: 0.4rem;
}

.mixer-mini input[type="number"] {
  padding: 0.3rem 0.4rem;
  background: #141622;
  border: 1px solid #2d3148;
  border-radius: 4px;
  color: #e4e6eb;
  font-size: 0.75rem;
}

.mixer-mini input[type="range"] {
  accent-color: #6c63ff;
  width: 100%;
}

.mixer-mini output {
  font-size: 0.65rem;
  color: #6c63ff;
}

.mixer-check {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.mixer-check input {
  accent-color: #6c63ff;
}

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

.mixer-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #8b8fa3;
}

.mixer-field select {
  padding: 0.5rem 0.6rem;
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 8px;
  color: #e4e6eb;
  font-size: 0.9rem;
}

.mixer-btn-secondary {
  width: auto;
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: 1px solid #6c63ff;
  border-radius: 8px;
  color: #6c63ff;
  font-size: 0.85rem;
  cursor: pointer;
}

.mixer-btn-secondary:hover {
  background: rgba(108, 99, 255, 0.1);
}

.mixer-btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mixer-submit {
  width: 100%;
  max-width: 320px;
}

/* Timestamp Video */
.field-hint {
  font-size: 0.8rem;
  color: #8b8fa3;
  margin-top: 0.35rem;
  line-height: 1.4;
}

.ts-pairs-section {
  margin: 1.25rem 0;
  padding: 1rem;
  background: #1a1d2e;
  border: 1px solid #2d3148;
  border-radius: 12px;
}

.ts-pairs-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.ts-pairs-sub {
  font-size: 0.8rem;
  color: #8b8fa3;
  margin-bottom: 0.75rem;
}

.ts-pairs-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ts-pair-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  background: #141622;
  border: 1px solid #2d3148;
  border-radius: 8px;
}

.ts-pair-image {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.ts-pair-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: #000;
}

.ts-pair-name {
  font-size: 0.8rem;
  color: #e4e6eb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ts-pair-time {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
  width: 120px;
  font-size: 0.75rem;
  color: #8b8fa3;
}

.ts-time-input {
  padding: 0.4rem 0.5rem !important;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, 'Cascadia Code', monospace;
}

.ts-time-input.ts-input-invalid {
  border-color: #e74c3c;
}

.ts-audio-dur {
  font-size: 0.78rem;
  color: #6c63ff;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.ts-settings {
  margin: 1.25rem 0;
}

.select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #1a1d2e;
  color: #e4e6eb;
  border: 1px solid #2d3148;
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

.select:focus {
  outline: none;
  border-color: #6c63ff;
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #1a1d2e;
  color: #e4e6eb;
  border: 1px solid #2d3148;
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.input:focus {
  outline: none;
  border-color: #6c63ff;
}

.field-group {
  margin-bottom: 0.25rem;
}
