:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #d9e0ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #047857;
  --error: #b42318;
  --shadow: 0 18px 46px rgba(15, 23, 42, 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;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(217, 224, 236, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
}

.contact,
.qq-link,
.shop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.wrap {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.workspace {
  min-width: 0;
}

.hero,
.panel,
.side-card {
  border: 1px solid rgba(217, 224, 236, 0.92);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  margin-bottom: 16px;
}

.eyebrow,
.side-kicker {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2 {
  margin: 0;
  line-height: 1.24;
}

h1 {
  max-width: 760px;
  font-size: 38px;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

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

.panel {
  padding: 22px;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.mode-card {
  min-height: 104px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.mode-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.mode-card span {
  color: var(--muted);
  line-height: 1.5;
}

.mode-card.active,
.mode-card:hover {
  border-color: var(--primary);
  background: #eef5ff;
}

.option-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select,
input,
textarea,
pre {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--text);
  font: inherit;
}

select,
input {
  min-height: 42px;
  padding: 0 12px;
}

textarea,
pre {
  min-height: 300px;
  margin: 0;
  padding: 14px;
  font: 13px/1.55 Consolas, "SFMono-Regular", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

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

pre:empty::before {
  color: var(--muted);
  content: "转换结果会显示在这里。";
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 108px;
  margin: 14px 0;
  padding: 18px;
  border: 2px dashed #9bb8ee;
  border-radius: 8px;
  background: #f0f6ff;
  color: #1e3a8a;
  cursor: pointer;
  text-align: center;
}

.dropzone input {
  display: none;
}

.dropzone span {
  color: var(--muted);
}

.dropzone.dragging {
  border-color: var(--primary);
  background: #dbeafe;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

button:hover:not(:disabled),
.contact:hover,
.qq-link:hover,
.shop-link:hover {
  background: var(--primary-dark);
}

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

button.secondary,
button.plain {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.status {
  margin: 12px 0 0;
  line-height: 1.6;
}

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

.success {
  color: var(--success);
  font-weight: 800;
}

.warn {
  color: #b45309;
  font-weight: 800;
}

.error {
  color: var(--error);
  font-weight: 800;
}

.sidebar {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 14px;
}

.side-card {
  padding: 18px;
}

.side-card h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.qr {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 16px auto 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.ad-card {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ad-card .side-kicker {
  color: #c2410c;
}

@media (max-width: 920px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .wrap {
    width: min(100vw - 20px, 1280px);
    padding-top: 16px;
  }

  h1 {
    font-size: 30px;
  }

  .hero,
  .panel,
  .side-card {
    padding: 16px;
  }

  .mode-grid,
  .option-row,
  .sidebar {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  button,
  .contact,
  .qq-link,
  .shop-link {
    width: 100%;
  }
}
