:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --text: #1a1f16;
  --muted: #5c6358;
  --border: #d8ddd3;
  --accent: #2d6a4f;
  --accent-hover: #1b4332;
  --primary: #28a745;
  --primary-hover: #218838;
  --primary-disabled: #b8c4bb;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(26, 31, 22, 0.06), 0 8px 24px rgba(26, 31, 22, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brandmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 1rem;
}

.brandmark span {
  font-size: 0.75rem;
  margin-left: 1px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-weight: 650;
  font-size: 0.95rem;
}

.brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.help-trigger {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}

.help-trigger:hover {
  border-color: var(--accent);
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.tiny-square {
  width: 6px;
  height: 6px;
  background: var(--accent);
  display: inline-block;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.message {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #f5c2c0;
  background: #fff5f5;
  color: var(--danger);
  font-size: 0.9rem;
}

.message[data-type='info'] {
  border-color: #b6d4c9;
  background: #edf7f2;
  color: var(--accent-hover);
}

.workspace {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  #result-panel {
    grid-column: 1 / -1;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.panel-head {
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.step {
  color: var(--muted);
  font-weight: 500;
  margin-right: 0.35rem;
}

.drop-zone {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: #fafbf9;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: #f4faf7;
}

.upload-symbol {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
}

.upload-hint,
.file-limit {
  font-size: 0.82rem;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.video-meta {
  margin-top: 0.85rem;
  white-space: pre-line;
  font-size: 0.88rem;
}

.field-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field.span-2 {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.82rem;
  font-weight: 550;
}

.field input[type='number'] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.field input:disabled {
  background: #f0f2ee;
  color: var(--muted);
}

.field-note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.time-range {
  display: grid;
  grid-template-columns: auto 1fr auto auto 1fr auto;
  gap: 0.4rem 0.5rem;
  align-items: center;
}

.time-range label {
  grid-column: span 1;
}

.time-range input {
  grid-column: span 1;
}

.time-hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.range-sep {
  color: var(--muted);
}

.time-range .field-note {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .time-range {
    grid-template-columns: 1fr 1fr;
  }

  .range-sep {
    display: none;
  }
}

.progress-block {
  margin: 1rem 0 0.75rem;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e8ece5;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.2s ease;
}

.progress-text {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

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

.primary:disabled {
  background: var(--primary-disabled);
  cursor: not-allowed;
}

.download-link {
  max-width: 280px;
}

.result-preview {
  display: flex;
  justify-content: center;
  padding: 0.5rem;
  background: #f7f8f6;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.result-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.trust-grid {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 640px) {
  .trust-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.trust-grid article {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.trust-grid h3 {
  margin: 0.35rem 0;
  font-size: 0.95rem;
}

.trust-grid p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.feature-icon {
  font-size: 1.1rem;
  color: var(--accent);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
  padding: 2rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.help-drawer:not([hidden]) {
  display: block;
}

.help-drawer[hidden] {
  display: none;
}

.help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 18, 0.35);
  z-index: 40;
}

.help-sheet {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(100%, 420px);
  background: var(--surface);
  z-index: 50;
  padding: 1.25rem;
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
}

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

.help-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.help-body {
  font-size: 0.9rem;
  color: var(--text);
}

.help-body p {
  margin: 0 0 0.85rem;
}

.help-body code {
  font-size: 0.82em;
  background: #eef1eb;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.text-button {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0.25rem 0.5rem;
}
