:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #0f9f6e;
  --danger: #d92d20;
  --warning: #b7791f;
  --shadow: 0 18px 55px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

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

.page-shell {
  width: min(1040px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.status-pill,
.ghost-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  text-decoration: none;
}

.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.language-switcher a {
  color: var(--muted);
  padding: 9px 12px;
  font-size: 14px;
  text-decoration: none;
}

.language-switcher a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 750;
}

.tool-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 26px;
}

.footer-contact {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px 20px;
}

.footer-contact p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.footer-contact a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

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

.download-item {
  display: grid;
  align-content: space-between;
  gap: 22px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
}

.download-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.download-item h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 24px;
}

.download-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.download-item .version-line {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 750;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.content-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 28px;
}

.content-panel h2 {
  margin: 26px 0 10px;
  font-size: 22px;
  line-height: 1.25;
}

.content-panel h2:first-child {
  margin-top: 0;
}

.content-panel p,
.content-panel li {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.content-panel p {
  margin: 0 0 12px;
}

.content-panel ul {
  margin: 0;
  padding-left: 22px;
}

.content-panel a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.tool-form {
  display: grid;
  gap: 22px;
}

.form-block {
  display: grid;
  gap: 9px;
}

.upload-block {
  padding-bottom: 4px;
}

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

.compact-grid {
  margin-top: 16px;
}

.field,
.check-field {
  display: grid;
  gap: 8px;
}

.field-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 13px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.16);
  border-color: var(--primary);
}

.file-input {
  padding: 10px 13px;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.check-field {
  grid-template-columns: 18px auto;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--text);
}

.check-field input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
}

.advanced {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.advanced summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.progress-box {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  background: #f9fafb;
}

.status-box {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f9fafb;
  padding: 14px;
}

.status-label {
  color: var(--muted);
  font-size: 14px;
}

.status-box strong {
  color: var(--text);
  font-size: 18px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

progress {
  width: 100%;
  height: 12px;
  accent-color: var(--primary);
}

.inline-error {
  margin: 0;
  color: var(--danger);
  line-height: 1.5;
}

.left-actions {
  justify-content: flex-start;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 750;
  padding: 0 22px;
  text-decoration: none;
  cursor: pointer;
}

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

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary-button.disabled-link,
.primary-button.disabled-link:hover,
.primary-button.disabled-link:focus {
  background: #cbd5e1 !important;
  color: #64748b !important;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
}

.result-shell {
  max-width: 880px;
}

.result-panel {
  display: grid;
  gap: 20px;
}

.result-message {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
}

.success-text {
  color: var(--success);
}

.error-text {
  color: var(--danger);
}

.logs pre {
  overflow: auto;
  max-height: 430px;
  margin: 16px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111827;
  color: #e5e7eb;
  line-height: 1.55;
  white-space: pre-wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow);
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1;
}

.stats-panel {
  margin-top: 18px;
}

.stats-panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 24px, 1040px);
    padding: 24px 0;
  }

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

  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .status-pill,
  .ghost-link,
  .language-switcher {
    text-align: center;
  }

  .language-switcher {
    justify-content: center;
  }

  .tool-panel {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }

  .actions,
  .left-actions {
    justify-content: stretch;
  }

  .primary-button {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
