:root {
  color-scheme: light;
  --ink: #24342f;
  --ink-2: #edf5ef;
  --paper: #ffffff;
  --paper-2: #f4f8f2;
  --line: rgba(66, 92, 84, 0.18);
  --muted: #708079;
  --text: #24342f;
  --cyan: #78b9bd;
  --orange: #dba27e;
  --red: #ce807c;
  --green: #8fb592;
  --lavender: #b5abc9;
  --butter: #d8c978;
  --shadow: 0 22px 70px rgba(71, 91, 84, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 16%, rgba(120, 185, 189, 0.28), transparent 28rem),
    radial-gradient(circle at 84% 18%, rgba(181, 171, 201, 0.3), transparent 22rem),
    radial-gradient(circle at 78% 82%, rgba(219, 162, 126, 0.24), transparent 24rem),
    linear-gradient(135deg, #f7fbf6 0%, #eef6f3 44%, #f8f3ec 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    "Aptos",
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(66, 92, 84, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 92, 84, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.dropzone:focus-within {
  outline: 3px solid rgba(120, 185, 189, 0.68);
  outline-offset: 3px;
}

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

.masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 128px;
  padding-bottom: 22px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family:
    "Georgia",
    "Noto Serif SC",
    serif;
  font-weight: 800;
}

h1 {
  font-size: clamp(3.2rem, 7vw, 7.4rem);
  line-height: 0.86;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 3.35rem);
  line-height: 0.94;
  color: var(--text);
}

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 20px rgba(143, 181, 146, 0.62);
}

.tool-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
}

.mode-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
  position: sticky;
  top: 20px;
}

.mode-button {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mode-button:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 185, 189, 0.58);
}

.mode-button.is-active {
  color: var(--text);
  border-color: transparent;
  background: linear-gradient(135deg, #ffffff, #e8f3ef 58%, #f4eadf);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-left: 8px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0;
}

.workbench {
  min-width: 0;
}

.converter-panel {
  position: relative;
  display: none;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(66, 92, 84, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(120, 185, 189, 0.14), transparent 34%),
    linear-gradient(220deg, rgba(181, 171, 201, 0.13), transparent 36%),
    rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.converter-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  content: "";
  background: linear-gradient(
    90deg,
    var(--cyan),
    var(--green),
    var(--butter),
    var(--orange),
    var(--lavender)
  );
}

.converter-panel.is-active {
  display: block;
  animation: panelIn 360ms ease both;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-note {
  max-width: 280px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 230px;
  padding: 26px;
  border: 1px dashed rgba(120, 185, 189, 0.74);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(120, 185, 189, 0.16), transparent 46%),
    linear-gradient(230deg, rgba(216, 201, 120, 0.16), transparent 48%),
    rgba(255, 255, 255, 0.5);
  text-align: center;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.dropzone.is-dragging,
.dropzone:hover {
  transform: translateY(-2px);
  border-color: var(--orange);
  background:
    linear-gradient(135deg, rgba(219, 162, 126, 0.2), transparent 46%),
    linear-gradient(230deg, rgba(143, 181, 146, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.66);
}

.dropzone-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(36, 52, 47, 0.28);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 2.5rem;
  line-height: 1;
}

.dropzone-title {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
}

.dropzone-subtitle,
.file-meta,
.download-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.video-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.field span {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(66, 92, 84, 0.22);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
}

.range-field {
  padding: 10px 12px;
  border: 1px solid rgba(66, 92, 84, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
}

input[type="range"] {
  accent-color: var(--orange);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.primary-action,
.ghost-action {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 6px;
  font-weight: 900;
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

.primary-action {
  border: 0;
  color: #26322e;
  background: var(--orange);
}

.ghost-action {
  border: 1px solid rgba(66, 92, 84, 0.22);
  color: var(--text);
  background: rgba(255, 255, 255, 0.54);
}

.primary-action:hover:not(:disabled),
.ghost-action:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

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

.status-card {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(66, 92, 84, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.status-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(66, 92, 84, 0.12);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--butter), var(--orange));
  transition: width 220ms ease;
}

.file-list,
.download-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.file-item,
.download-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(66, 92, 84, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.file-name,
.download-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-item a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 6px;
  color: #26322e;
  background: var(--cyan);
  font-weight: 900;
  text-decoration: none;
}

.error-message {
  border-color: rgba(206, 128, 124, 0.52);
  color: #7d3e3a;
}

.log-window {
  min-height: 112px;
  max-height: 220px;
  margin: 16px 0 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(120, 185, 189, 0.34);
  border-radius: 8px;
  color: #376d70;
  background: rgba(239, 248, 246, 0.76);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 880px) {
  .masthead,
  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .panel-note {
    max-width: none;
    text-align: left;
  }

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

  .mode-rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-grid,
  .video-controls {
    grid-template-columns: 1fr;
  }
}

.document-controls {
  grid-template-columns: minmax(280px, 1fr) minmax(180px, 260px);
  align-items: start;
}

.document-view-field,
.document-format-field {
  padding: 10px 12px;
  border: 1px solid rgba(66, 92, 84, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
}

.view-strip,
.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-tab {
  display: grid;
  gap: 4px;
  min-width: 138px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid rgba(66, 92, 84, 0.14);
  border-radius: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.58);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.view-tab:hover,
.view-tab.is-active {
  transform: translateY(-1px);
  border-color: rgba(120, 185, 189, 0.58);
  background: rgba(239, 248, 246, 0.86);
}

.view-tab span {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-tab small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-switch {
  display: inline-flex;
  width: fit-content;
  padding: 4px;
  border: 1px solid rgba(66, 92, 84, 0.14);
  border-radius: 6px;
  background: rgba(239, 248, 246, 0.72);
}

.format-switch button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.format-switch button.is-selected {
  color: var(--text);
  background: #fff;
}

.document-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.document-box {
  min-width: 0;
  border: 1px solid rgba(66, 92, 84, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.mini-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(66, 92, 84, 0.12);
  color: var(--text);
}

.mini-heading span {
  color: var(--muted);
  font-size: 0.86rem;
}

.document-output {
  display: block;
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 0;
  padding: 14px;
  color: var(--text);
  background: transparent;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.document-output:focus {
  outline: none;
}

.document-preview {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  color: var(--text);
  line-height: 1.68;
}

.document-preview h1,
.document-preview h2,
.document-preview h3,
.document-preview h4,
.document-preview h5,
.document-preview h6 {
  margin: 0 0 10px;
  color: var(--text);
}

.document-preview p,
.document-preview ul,
.document-preview pre {
  margin: 0 0 12px;
}

.document-preview pre {
  overflow: auto;
  padding: 12px;
  border-radius: 6px;
  background: rgba(239, 248, 246, 0.9);
}

.document-preview table {
  width: 100%;
  margin: 0 0 14px;
  overflow: hidden;
  border-collapse: collapse;
  border: 1px solid rgba(66, 92, 84, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.document-preview th,
.document-preview td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(66, 92, 84, 0.12);
  text-align: left;
  vertical-align: top;
}

.document-preview th {
  color: var(--text);
  background: rgba(239, 248, 246, 0.92);
  font-weight: 900;
}

.document-preview tr:last-child td {
  border-bottom: 0;
}

.document-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(66, 92, 84, 0.14);
}

.status-divider {
  color: var(--muted);
}

.empty {
  color: var(--muted);
}

@media (max-width: 880px) {
  .document-controls,
  .document-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  .privacy-chip {
    white-space: normal;
  }

  .mode-button {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 86px;
    text-align: center;
  }

  .mode-icon {
    margin: 8px 0 0;
  }

  .converter-panel {
    padding: 16px;
  }

  .dropzone {
    min-height: 190px;
  }

  .file-item,
  .download-item,
  .status-topline {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
