:root {
  --bg: #ececec;
  --text: #121418;
  --muted: #7a8088;
  --line: #ccd1d7;
  --accent: #ff5000;
  --ok: #5f6772;
  --error: #bf2d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #f1f2f6;
}

.layout {
  min-height: 100vh;
  padding: 84px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.hero {
  width: 117px;
  height: 58px;
  margin: 0 0 75px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  width: 117px;
  height: 58px;
  object-fit: contain;
}

.logo-top {
  width: 117px;
  height: 58px;
}

.workspace {
  width: 626px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mode-switch {
  width: 400px;
  height: 48px;
  margin: 50px 0 40px;
  background: #d1d7dd;
  border-radius: 16px;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  position: relative;
  overflow: hidden;
}

.mode-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 12px;
  background: #ffffff;
  transform: translateX(0);
  will-change: transform;
}

.mode-switch.mode-dynamic::before {
  transform: translateX(100%);
}

.mode-switch.mode-switch-hidden {
  visibility: hidden;
}

.mode-btn {
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: #40474d;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  padding: 0 14px;
  min-width: 0;
  height: auto;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.mode-btn-active {
  color: #20262d;
}

.drop-zone {
  width: 626px;
  max-width: 100%;
  height: 257px;
  margin: 0 0 40px;
  border: 0;
  border-radius: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 42px;
  background: #f6f6f8;
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 52px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 626 257' preserveAspectRatio='none'%3E%3Crect x='1' y='1' width='624' height='255' rx='52' ry='52' fill='none' stroke='%23FF5D15' stroke-width='2' stroke-dasharray='7 6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.drop-zone.drop-zone-error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 626 257' preserveAspectRatio='none'%3E%3Crect x='1' y='1' width='624' height='255' rx='52' ry='52' fill='none' stroke='%23D64747' stroke-width='2' stroke-dasharray='7 6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.drop-zone.dragover {
  background: linear-gradient(135deg, #ff5d00 0%, #ff9659 100%);
  box-shadow: none;
}

.drop-zone.dragover::before {
  opacity: 0;
}

.drop-zone.dragover::after {
  content: 'Drop files here';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
  z-index: 3;
  opacity: 0;
  transform: translateY(12px);
  animation: drop-message-rise 0.2s cubic-bezier(0, 0, 0.2, 1) forwards;
}

.drop-zone.dragover .file-list,
.drop-zone.dragover .drop-title,
.drop-zone.dragover .drop-hint {
  opacity: 0;
}

.drop-zone.is-processing::before,
.drop-zone.is-done::before {
  opacity: 0;
}

.drop-zone.is-processing {
  align-items: center;
  justify-content: center;
}

.drop-title {
  margin: 0;
  font-size: 21px;
  font-weight: 500;
  color: #40474d;
}

.drop-hint {
  margin: 0;
  color: #979ea6;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
}

.file-list {
  margin-top: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  justify-content: stretch;
  padding: 0 12px;
  max-height: 146px;
  overflow-y: auto;
  overflow-x: hidden;
}

.file-list-shell {
  width: 100%;
  max-height: 170px;
  padding: 12px 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.file-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 24px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
}

.file-fade-top {
  top: 0;
  background: linear-gradient(to bottom, rgba(246, 246, 248, 1) 0%, rgba(246, 246, 248, 0.94) 35%, rgba(246, 246, 248, 0) 100%);
}

.file-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, rgba(246, 246, 248, 1) 0%, rgba(246, 246, 248, 0.94) 35%, rgba(246, 246, 248, 0) 100%);
}

.file-list-shell.fade-top .file-fade-top {
  opacity: 1;
}

.file-list-shell.fade-bottom .file-fade-bottom {
  opacity: 1;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid #cfd4da;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  padding: 10px;
  font-size: 13px;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.file-name {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  color: #1a1d22;
  flex: 1 1 auto;
  min-width: 0;
}

.remove-file {
  border: 0;
  border-radius: 999px;
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  background: #d1d7dd;
  color: #29303a;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  margin-left: auto;
}

.remove-file:hover {
  background: #c6cdd6;
}

.summary {
  display: block;
  width: 100%;
  max-width: 626px;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  color: #3f4752;
  text-align: center;
  font-size: 13px;
  line-height: 1.25;
}

.summary.summary-error {
  color: #b42323;
  background: transparent;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  min-height: 56px;
}

.done-actions {
  width: 100%;
  display: grid;
  gap: 8px;
  justify-content: center;
  justify-items: center;
}

.actions button,
.actions .download {
  border: 0;
  border-radius: 10px;
  min-width: 141px;
  height: 45px;
  padding: 0 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.actions button {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

#convert-btn {
  min-width: 141px;
}

#convert-btn.hidden {
  display: none;
}

.actions button:disabled {
  background: #d1d7dd;
  color: #40474d;
  cursor: not-allowed;
}

.download {
  background: #ff5d15;
  color: #fff;
  font-weight: 500;
}

.progress-wrap {
  margin-top: 6px;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #d7dce2;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ff5d00 0%, #ff9659 100%);
}

.progress-text {
  margin: 8px 0 0;
  color: var(--muted);
  text-align: center;
}

.processing-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: 100%;
}

.processing-track {
  width: min(560px, 100%);
}

.processing-text {
  margin: 0;
  color: #979ea6;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.done-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.done-gif {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 30px;
}

.reset-btn {
  background: transparent;
  border: 0;
  color: #40474d;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  padding: 0;
  min-width: 0;
  height: auto;
  line-height: 1.2;
  border-radius: 0;
  margin-top: 4px;
  cursor: pointer;
  font-size: 15px;
}

.status-zone {
  width: 626px;
  max-width: 100%;
  height: 257px;
  margin: 0 0 40px;
  display: grid;
  place-items: center;
}

@keyframes drop-message-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

.drop-zone.has-files {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}

.drop-zone.has-files .drop-title,
.drop-zone.has-files .drop-hint {
  display: none;
}

.drop-zone.is-processing .drop-title,
.drop-zone.is-processing .drop-hint,
.drop-zone.is-processing .file-list,
.drop-zone.is-processing .summary,
.drop-zone.is-done .drop-title,
.drop-zone.is-done .drop-hint,
.drop-zone.is-done .file-list,
.drop-zone.is-done .summary,
.drop-zone.is-done .processing-panel {
  display: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.92em;
  background: rgba(18, 20, 24, 0.08);
  color: #121418;
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
}

@media (max-width: 760px) {
  .layout {
    padding: 16px;
    justify-content: flex-start;
    transform: none;
  }

  .hero {
    margin-bottom: 24px;
  }

  .workspace {
    width: 100%;
  }

  .mode-switch {
    width: 100%;
    max-width: 400px;
    margin-bottom: 24px;
  }

  .drop-zone {
    width: 100%;
    min-height: 220px;
    margin-bottom: 24px;
    border-radius: 26px;
    height: auto;
    padding: 32px 20px;
  }

  .file-list {
    grid-template-columns: 1fr;
    max-height: 134px;
    padding: 0 8px;
  }

  .file-list-shell {
    max-height: 150px;
    padding: 8px 0;
  }

  .status-zone {
    width: 100%;
    height: 220px;
    margin-bottom: 24px;
  }

  .done-gif {
    height: 220px;
  }

  .drop-zone::before {
    border-radius: 26px;
  }

  #convert-btn {
    min-width: 156px;
    height: 50px;
    font-size: 13px;
  }
}
