:root {
  color-scheme: light;
  --bg: #f5f4f1;
  --panel: #fffdf8;
  --card: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --line: #111111;
  --accent: #e95f6d;
  --accent-strong: #d94d5d;
  --accent-soft: #ffe0e4;
  --blue-soft: #dcecff;
  --green-soft: #dff5ee;
  --yellow-soft: #fff2bc;
  --success: #219653;
  --warning: #8a6d00;
  --error: #d93025;
  --shadow: 6px 6px 0 #111111;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 10% -10%, #ffe0e4 0%, transparent 60%),
    radial-gradient(900px 500px at 105% 5%, #dcecff 0%, transparent 58%),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Segoe UI", Arial, sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.topbar > * {
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mouse {
  width: 90px;
  height: 76px;
  flex: none;
  object-fit: contain;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.diagnostics-button {
  min-height: 38px;
  padding: 7px 12px;
  white-space: nowrap;
}

.language-field {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.language-field select {
  width: auto;
  height: 38px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 0 28px 0 10px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.health {
  min-width: 190px;
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--success);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  border: 2px solid var(--line);
}

.credit-balance {
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--accent-strong);
  background: var(--paper-soft, #f4f1ea);
  border: 2px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.app-version {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
}

.update-status {
  display: inline-block;
  max-width: 260px;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--paper-soft, #f4f1ea);
  border: 2px solid var(--line);
  color: var(--text);
}

.update-status.update-ok {
  color: var(--success);
  background: var(--green-soft);
}

.update-status.update-error {
  color: var(--danger);
  background: var(--red-soft, #fdeaea);
}

.workflow-steps {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.workflow-step {
  flex: 1;
  min-width: 110px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f5f8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.workflow-step.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: stretch;
}

.drop-panel,
.controls {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.drop-panel {
  min-height: 420px;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  width: 100%;
  min-height: 392px;
  border: 0;
  border-radius: 0;
  padding: 26px 24px 30px;
  color: var(--ink);
  background: linear-gradient(170deg, #fff6d8, #fffdf8);
  text-align: center;
}

.drop-zone.dragging {
  outline: 3px dashed var(--accent);
  outline-offset: -10px;
  background: #ffe9ec;
}

.mouse-stage {
  display: grid;
  place-items: center;
  min-height: 224px;
  margin-bottom: 8px;
}

.mouse-mascot {
  width: min(340px, 72vw);
  height: 242px;
  object-fit: contain;
  filter: drop-shadow(5px 5px 0 rgba(17, 17, 17, 0.22));
}

.drop-main {
  display: block;
  max-width: 520px;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.drop-sub {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.file-strip > div {
  min-width: 0;
}

.file-name {
  margin: 0 0 3px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.batch-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.batch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 10px;
}

.batch-item.success {
  background: var(--green-soft);
}

.batch-item.error {
  background: #fdecec;
}

.batch-main {
  min-width: 0;
}

.batch-name,
.batch-detail {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.batch-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.batch-detail {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.batch-item.error .batch-detail {
  color: var(--error);
}

.batch-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 72px;
}

.batch-status {
  max-width: 120px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: right;
}

.batch-item.success .batch-status {
  color: var(--success);
}

.batch-item.error .batch-status {
  color: var(--error);
}

.mini-button {
  min-height: 30px;
  max-width: 120px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--ink);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
  white-space: normal;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.format-hint {
  margin: -4px 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(151, 111, 50, 0.22);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 248, 225, 0.72);
  font-size: 12px;
  line-height: 1.55;
}

select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
}

.primary-button,
.ghost-button,
.download-button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 16px;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: center;
}

.primary-button,
.download-button {
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 3px 3px 0 #111111;
}

.primary-button:hover,
.download-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #d5d8de;
  box-shadow: none;
  color: #ffffff;
}

.ghost-button {
  background: var(--card);
  color: var(--muted);
}

.progress-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 12px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-header span {
  overflow-wrap: anywhere;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef0f4;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffb28a);
  transition: width 180ms ease, background-color 180ms ease;
}

.progress-panel.success .progress-fill {
  background: var(--success);
}

.progress-panel.error .progress-fill {
  background: var(--error);
}

.status-box {
  min-height: 116px;
  border-radius: 12px;
  background: #f5f6f9;
  padding: 13px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-box.error {
  color: var(--error);
  background: #fdecec;
}

.status-box.success {
  color: var(--success);
  background: var(--green-soft);
}

.matrix {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.matrix-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.matrix h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.matrix p {
  margin-bottom: 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.format-table {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.format-item {
  min-height: 124px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 12px;
  overflow-wrap: anywhere;
  transition: box-shadow 0.15s ease;
}

.format-item:hover {
  box-shadow: 0 6px 16px rgba(43, 47, 54, 0.07);
}

.format-item:nth-child(3n + 1) {
  background: var(--green-soft);
}

.format-item:nth-child(3n + 2) {
  background: var(--blue-soft);
}

.format-item:nth-child(3n + 3) {
  background: var(--yellow-soft);
}

.format-item h3 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.25;
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.format-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.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;
}

.sponsor-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.sponsor-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #f59e0b;
  box-shadow: 3px 3px 0 #111111;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: 0.88;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.sponsor-toggle:hover {
  opacity: 1;
  transform: scale(1.06);
}

.sponsor-mouse {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.sponsor-panel {
  position: relative;
  width: 240px;
  background: #fffdf6;
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 5px 5px 0 #111111;
  padding: 14px 14px 16px;
  text-align: center;
  animation: sponsor-pop 0.18s ease-out;
}

@keyframes sponsor-pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sponsor-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: none;
  font-size: 18px;
  color: #b08d4f;
  padding: 2px 6px;
  border-radius: 6px;
}

.sponsor-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
  color: #5b4318;
}

.sponsor-sub {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #8a7248;
}

.sponsor-qr {
  width: 190px;
  height: auto;
  border-radius: 8px;
  border: 1px solid #eee2c8;
}

@media (max-width: 860px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .matrix-header {
    display: grid;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .converter-grid {
    grid-template-columns: 1fr;
  }

  .format-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health {
    width: 100%;
    text-align: left;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding: 10px 0;
  }

  .workspace {
    padding: 12px;
    box-shadow: 0 6px 18px rgba(43, 47, 54, 0.08);
  }

  .brand-lockup {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .brand-mouse {
    width: 70px;
    height: 62px;
  }

  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 330px;
    padding: 20px 14px 24px;
  }

  .mouse-mascot {
    width: min(280px, 78vw);
    height: 205px;
  }

  .format-table {
    grid-template-columns: 1fr;
  }

  .file-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-item {
    grid-template-columns: 1fr;
  }

  .batch-actions {
    justify-items: stretch;
  }

  .batch-status {
    max-width: none;
    text-align: left;
  }
}
