:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #17211c;
  --muted: #617069;
  --line: #d9e0dc;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #d9f3ef;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(23, 33, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(45, 65, 92, 0.08), transparent 32%),
    var(--bg);
}

.page-shell {
  width: min(1040px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 40px 0;
}

.tool-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(320px, 1.14fr);
  gap: 36px;
  align-items: start;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.heading {
  display: grid;
  gap: 14px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.16;
}

.summary {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.converter-form {
  display: grid;
  gap: 18px;
}

.file-drop {
  display: grid;
  gap: 8px;
  min-height: 152px;
  align-content: center;
  justify-items: center;
  padding: 24px;
  border: 1px dashed #8da39b;
  border-radius: 8px;
  background: #f8fbfa;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-drop-title {
  font-size: 18px;
  font-weight: 700;
}

.file-drop-meta {
  max-width: 100%;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.control-grid,
.effect-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  align-items: end;
}

.effect-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.range-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.field input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  background: #fff;
}

.field input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  background: #fff;
}

.field input[type="number"]:focus,
.field input[type="text"]:focus,
.range-field input:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.range-field input {
  width: 100%;
  min-height: 44px;
  accent-color: var(--accent);
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mode-group legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.mode-group label {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.mode-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.mode-group label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.actions {
  display: grid;
  grid-template-columns: 150px minmax(180px, auto) 1fr;
  gap: 16px;
  align-items: center;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  background: #8da39b;
}

.download-link {
  min-height: 46px;
  display: inline-grid;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.download-link[hidden] {
  display: none;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.error-message {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 8px;
  color: var(--danger);
  background: #fff4f2;
  font-size: 14px;
  line-height: 1.6;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.notice strong {
  color: var(--ink);
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 560px);
    align-content: start;
    padding: 16px 0;
  }

  .tool-panel {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 24px;
  }

  h1 {
    font-size: 28px;
  }

  .summary {
    max-width: none;
  }

  .control-grid,
  .effect-grid,
  .actions {
    grid-template-columns: 1fr;
  }

  .notice {
    align-items: flex-start;
    flex-direction: column;
  }
}
