@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,500;6..72,700&family=Space+Mono:wght@400;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --bg-soft: #efe8dc;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #fffdf8;
  --line: rgba(32, 34, 29, 0.1);
  --line-strong: rgba(32, 34, 29, 0.16);
  --text: #1e1e1a;
  --muted: #6e6a62;
  --brand: #5d6f52;
  --brand-hover: #506044;
  --brand-soft: rgba(93, 111, 82, 0.12);
  --danger: #8d5b52;
  --danger-soft: rgba(141, 91, 82, 0.1);
  --success: #5f7a57;
  --track: #ddd6ca;
  --track-fill: #7b8f6d;
  --shadow: 0 24px 68px rgba(39, 41, 35, 0.08);
  --shadow-soft: 0 12px 28px rgba(39, 41, 35, 0.05);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(93, 111, 82, 0.18);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(219, 204, 177, 0.38), transparent 28%),
    radial-gradient(circle at top right, rgba(93, 111, 82, 0.1), transparent 24%),
    linear-gradient(180deg, #fbf8f2 0%, #f6f1e8 48%, #efe7dc 100%);
}

button,
input,
textarea,
progress {
  font: inherit;
}

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}

.site-header__brand,
.site-header__meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.site-header__brand {
  color: var(--text);
  font-size: 0.82rem;
}

.site-header__meta {
  display: none;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero,
.command-card,
.info-grid {
  animation: riseIn 0.45s ease-out both;
}

.hero {
  text-align: center;
  margin: 0 auto 34px;
  max-width: 900px;
}

.hero h1 {
  margin: 0;
  font-family: "Space Mono", "SF Mono", "JetBrains Mono", monospace;
  font-size: clamp(2.8rem, 5.5vw, 4rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.lead {
  margin: 18px auto 0;
  max-width: 600px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.command-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.merge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(320px, 0.92fr);
  gap: 28px;
}

.mode-panel,
.status-strip,
.info-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow-soft);
}

.mode-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.mode-panel--primary {
  min-width: 0;
}

.panel-head {
  margin-bottom: 4px;
}

.panel-head--with-help {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-copy {
  margin-bottom: 16px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-head h2 {
  margin: 0;
  font-family: "Space Mono", "SF Mono", "JetBrains Mono", monospace;
  font-size: 1.65rem;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.tooltip {
  position: relative;
  flex: 0 0 auto;
}

.help-badge {
  min-width: 0;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--muted);
  border: 1px solid rgba(32, 34, 29, 0.08);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  box-shadow: none;
}

.help-badge:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.tooltip__content {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 4;
  width: min(280px, calc(100vw - 48px));
  padding: 12px 14px;
  border: 1px solid rgba(32, 34, 29, 0.14);
  border-radius: 16px;
  background: rgba(33, 35, 31, 0.92);
  color: rgba(255, 252, 246, 0.96);
  font-size: 0.8rem;
  line-height: 1.6;
  box-shadow: 0 16px 34px rgba(21, 22, 18, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.tooltip:hover .tooltip__content,
.tooltip:focus-within .tooltip__content {
  opacity: 1;
  transform: translateY(0);
}

.url-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.compact-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.compact-field span {
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(30, 30, 26, 0.88);
}

.compact-field--full {
  margin-top: 16px;
}

.field-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 52px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.field-shell--plain {
  padding-right: 12px;
}

.field-shell:focus-within {
  border-color: rgba(93, 111, 82, 0.52);
  box-shadow: 0 0 0 4px rgba(93, 111, 82, 0.12);
  transform: translateY(-1px);
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 6px 4px 6px 6px;
  font-size: 0.98rem;
  outline: none;
}

#videoUrl,
#audioUrl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input::placeholder {
  color: rgba(110, 106, 98, 0.62);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: 22px;
}

.button-row--single {
  padding-top: 22px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

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

button:active:not(:disabled) {
  transform: translateY(0);
}

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

.primary-button {
  background: var(--brand);
  color: #fdfbf6;
  box-shadow: 0 12px 26px rgba(93, 111, 82, 0.18);
}

.primary-button:hover:not(:disabled) {
  background: var(--brand-hover);
}

.secondary-button,
.subtle-button,
.quiet-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.secondary-button:hover:not(:disabled),
.subtle-button:hover:not(:disabled),
.quiet-button:hover:not(:disabled) {
  background: rgba(93, 111, 82, 0.08);
  border-color: rgba(93, 111, 82, 0.34);
}

.quiet-button:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: rgba(141, 91, 82, 0.34);
}

.subtle-button {
  flex: 0 0 auto;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.44);
  border-color: rgba(32, 34, 29, 0.08);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.drop-zone {
  min-height: 164px;
  padding: 18px;
  border: 1px dashed rgba(93, 111, 82, 0.36);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.drop-zone:hover {
  border-color: rgba(93, 111, 82, 0.56);
  background: rgba(93, 111, 82, 0.06);
}

.drop-zone.dragover {
  border-color: var(--brand);
  background: rgba(93, 111, 82, 0.08);
  transform: translateY(-1px);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: rgba(93, 111, 82, 0.5);
  background: rgba(93, 111, 82, 0.08);
}

.drop-zone-label {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.drop-zone-hint,
.drop-zone-file {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.drop-zone-file {
  color: var(--text);
  font-weight: 700;
}

.status-strip {
  grid-column: 1 / -1;
  padding: 18px 22px;
  display: grid;
  gap: 16px;
}

.status-strip__headline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}

.status-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-cluster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.progress-group {
  display: grid;
  gap: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

progress {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
}

progress::-webkit-progress-bar {
  background: var(--track);
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--track-fill) 0%, #95a786 100%);
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--track-fill) 0%, #95a786 100%);
  border-radius: 999px;
}

progress[value="100"]::-webkit-progress-value {
  background: linear-gradient(90deg, var(--success) 0%, #7c9a70 100%);
}

progress[value="100"]::-moz-progress-bar {
  background: linear-gradient(90deg, var(--success) 0%, #7c9a70 100%);
}

.info-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 18px;
}

.info-panel {
  padding: 22px;
}

.info-panel h2 {
  margin: 0 0 12px;
  font-family: "Space Mono", "SF Mono", "JetBrains Mono", monospace;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.info-panel ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.72;
}

#logOutput {
  margin: 0;
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(32, 34, 29, 0.08);
  border-radius: var(--radius-md);
  background: #f4efe5;
  color: #3d3a35;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

#logOutput::-webkit-scrollbar {
  width: 6px;
}

#logOutput::-webkit-scrollbar-thumb {
  background: rgba(61, 58, 53, 0.18);
  border-radius: 999px;
}

.memory-card {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  min-width: 188px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(28, 30, 34, 0.2);
  color: rgba(250, 248, 242, 0.96);
  box-shadow: 0 14px 34px rgba(18, 17, 21, 0.12);
  backdrop-filter: blur(18px);
  transform-origin: bottom right;
}

.memory-card[hidden] {
  display: none;
}

.memory-card__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(250, 248, 242, 0.92);
  box-shadow: none;
}

.memory-card__toggle-title,
.memory-card__toggle-meta {
  display: block;
}

.memory-card__toggle-title {
  font-size: 0.84rem;
  font-weight: 800;
}

.memory-card__toggle-meta {
  color: rgba(250, 248, 242, 0.72);
  font-size: 0.72rem;
  font-weight: 600;
}

.memory-card__body {
  overflow: hidden;
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 180ms ease,
    opacity 180ms ease,
    transform 180ms ease,
    margin-top 180ms ease;
}

.memory-card--collapsed .memory-card__body {
  max-height: 0;
  opacity: 0;
  transform: translateY(8px);
  margin-top: 0;
  pointer-events: none;
}

.memory-card:not(.memory-card--collapsed) .memory-card__body {
  margin-top: 10px;
}

.memory-card__title {
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 800;
}

.memory-card__stats {
  margin: 0;
  display: grid;
  gap: 7px;
}

.memory-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.memory-card__row dt {
  color: rgba(250, 248, 242, 0.72);
  font-size: 0.76rem;
}

.memory-card__row dd {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.memory-card__note {
  margin: 10px 0 0;
  color: rgba(250, 248, 242, 0.62);
  font-size: 0.72rem;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .merge-grid {
    grid-template-columns: 1fr;
  }

  .status-strip {
    grid-column: auto;
  }

  .progress-cluster,
  .info-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .memory-card {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 720px) {
  .site-header,
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .site-header {
    padding-top: 16px;
  }

  .site-header__meta {
    display: none;
  }

  .shell {
    padding: 28px 0 40px;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 12vw, 4rem);
  }

  .panel-head--with-help {
    align-items: center;
  }

  .command-card,
  .mode-panel,
  .status-strip,
  .info-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }

  .memory-card {
    left: 10px;
    right: 10px;
    bottom: 10px;
    min-width: 0;
  }
}
