:root {
  font-family: Inter, "Noto Sans SC", system-ui, sans-serif;
  font-size: 18px;
  color: #183b3a;
  background: #f4faf8;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

header {
  min-height: 84px;
  padding: 0 max(24px, calc((100% - 1040px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #cfe1dc;
  background: #fff;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand strong {
  font-size: 25px;
  line-height: 1.1;
}

.language-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid #cfe1dc; border-radius: 10px; flex-shrink: 0; }
.language-switch button { padding: 7px 12px; border-radius: 7px; background: transparent; color: #637c77; font: inherit; font-size: 16px; }
.language-switch button[aria-pressed="true"] { background: #176f67; color: #fff; }
.language-switch button:focus-visible, #choose-file:focus-visible { outline: 2px solid #176f67; outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px !important; height: 1px; min-height: 0 !important; padding: 0 !important; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#file-input-panel { position: relative; }
.file-picker { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px; border: 1px solid #bfd4cf; border-radius: 10px; }
.file-picker button { padding: 6px 10px; }
#file-name { font-size: 16px; overflow-wrap: anywhere; min-width: 0; }
.title-en { display: none; }
html[lang="en"] h1 { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.2; }
html[lang="en"] .title-zh { display: none; }
html[lang="en"] .title-en { display: inline; }
@media (max-width: 600px) {
  header { height: auto; min-height: 84px; padding: 16px 24px; gap: 14px; flex-wrap: wrap; }
  .language-switch { margin-left: auto; }
  .form-heading { flex-wrap: wrap; }
}

.brand strong,
.brand small {
  display: block;
}

.brand > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.brand small {
  color: #66807a;
  font-size: 14px;
  line-height: 1.35;
}

.logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #176f67;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

main {
  max-width: 1040px;
  margin: auto;
  padding: 32px 24px 64px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.intro-copy {
  min-width: 0;
}

.intro-copy > p:last-child {
  white-space: nowrap;
  font-size: 16px;
  margin: 24px 0 0;
}

.hero-mosquito-frame {
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  justify-self: end;
  transform: translateX(-140px);
  border-radius: 50%;
  background: #e3f1ec;
  border: 3px solid #176f67;
  overflow: hidden;
}

html[lang="en"] .hero-mosquito-frame {
  transform: translateX(-40px);
}

.hero-mosquito {
  display: block;
  width: 158px;
  height: auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .13em;
  color: #18756a;
  font-weight: 750;
  font-size: 14px;
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(36px, 5vw, 48px);
  line-height: 1.12;
  margin: 0 0 14px;
}

h2 {
  font-size: 24px;
  margin: 0 0 4px;
}

.panel-head p,
#status-message {
  color: #637c77;
}

.panel {
  width: calc(100% + 120px);
  margin-left: -60px;
  background: #fff;
  border: 1px solid #cfe1dc;
  border-radius: 18px;
  box-shadow: 0 24px 55px -42px #0c4f48;
  overflow: hidden;
}

#job-form {
  margin-top: 40px;
}

.panel-head {
  padding: 26px 30px;
  border-bottom: 1px solid #dbe8e4;
  background: #f8fcfb;
}

.panel-head p {
  margin: 0;
}

.form-grid {
  padding: 30px 30px 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 24px;
}

.form-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-heading h2 { margin: 0; }
button.secondary-button { padding: 10px 17px; color: #176f67; background: #e9f5f1; border: 1px solid #bfd4cf; font: inherit; font-size: 18px; font-weight: 800; white-space: nowrap; }
button.secondary-button:hover:not(:disabled) { background: #dceee7; }
.sequence-source { min-width: 0; margin: 0; padding: 0; border: 0; }
.sequence-source legend { padding: 0; margin-bottom: 8px; font-weight: 700; }
.sequence-modes { position: relative; top: 12px; display: flex; flex-wrap: wrap; gap: 14px 32px; margin-bottom: 22px; }
.sequence-modes label { display: inline-flex; flex-direction: row; align-items: center; gap: 9px; font-size: 20px; font-weight: 500; cursor: pointer; }
.sequence-modes input { accent-color: #176f67; margin: 0; }
.sequence-source small { display: block; color: #708781; margin-top: 8px; }
.sequence-input-panel small { font-size: 17px; line-height: 1.45; }
.sequence-input-panel { grid-column: 1 / -1; min-width: 0; }
textarea { display: block; width: 100%; min-height: 230px; resize: vertical; border: 1px solid #bfd4cf; border-radius: 10px; padding: 14px; color: #183b3a; background: #fff; font: 17px/1.7 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
textarea:focus { outline: 2px solid #a7d8cb; outline-offset: 1px; }
.input-message { margin: 0; padding: 0 26px 18px; color: #637c77; font-size: 17px; line-height: 1.45; }
.input-message.is-error { color: #9b4630; }

label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

label small {
  font-weight: 400;
  color: #708781;
}

select,
input[type="file"],
input[type="text"] {
  width: 100%;
  min-height: 52px;
  border: 1px solid #bfd4cf;
  border-radius: 10px;
  background: #fff;
  padding: 11px 13px;
  color: #183b3a;
  font: inherit;
  font-size: 17px;
}

input::placeholder,
textarea::placeholder {
  color: #829793;
  opacity: 1;
  font-size: 16px;
}

input[type="file"] {
  padding: 8px;
}

.actions {
  border-top: 1px solid #dbe8e4;
  padding: 24px 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

button,
.download {
  border: 0;
  border-radius: 10px;
  background: #176f67;
  color: #fff;
  padding: 13px 21px;
  font-weight: 750;
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

.status {
  margin-top: 24px;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.status p {
  margin: 6px 0;
}

.status code {
  font-size: 17px;
  color: #708781;
}

.status-content { flex: 1; min-width: 0; }
#status-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.progress-panel { margin-top: 20px; }
.progress-heading { display: flex; justify-content: space-between; gap: 16px; font-size: 18px; }
.progress-heading strong { color: #176f67; font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; margin-top: 9px; border-radius: 20px; background: #e8f1ee; overflow: hidden; }
.progress-fill { width: 0; height: 100%; background: #176f67; border-radius: inherit; transition: width .6s ease; }
.progress-panel.is-failed .progress-fill { background: #af654b; }
.status .progress-time, .status .progress-note { color: #708781; font-size: 17px; margin-top: 8px; }
.progress-time { font-variant-numeric: tabular-nums; }
.result-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.result-heading .download { white-space: nowrap; font-size: 15px; }
.download-options { display: flex; flex-direction: column; align-items: center; gap: 10px; flex-shrink: 0; }
.status .download-options { min-width: 172px; }
.full-download { color: #176f67; font-size: 17px; text-underline-offset: 3px; }
.panel-head .risk-note { margin-top: 6px; font-size: 17px; }
#mapping-records { list-style: none; padding: 12px 26px; margin: 0; }
#mapping-records li { padding: 10px 0; overflow-wrap: anywhere; }
#mapping-records small { display: block; color: #637c77; margin-top: 4px; }
#on-target-panel table { min-width: 520px; }
#table-panel th { white-space: normal; min-width: 82px; }
#table-panel th:nth-child(n+5) { min-width: 145px; max-width: 220px; }
.table-error { display: flex; align-items: center; gap: 12px; padding: 16px 26px; color: #8c533e; }
.table-error button { font-size: 17px; padding: 8px 12px; }
.table-wrap { max-height: 480px; }
.task-link-panel { margin-top: 16px; }
.task-link-panel label { margin-bottom: 6px; font-size: 17px; }
.task-link-row { display: flex; align-items: flex-start; gap: 10px; }
.task-link-row input { min-width: 0; flex: 1; font-size: 17px; }
.task-link-row button { flex-shrink: 0; min-width: 128px; font-size: 17px; }
.task-link-row .download-options { align-self: flex-start; }
.task-link-panel small { display: block; margin-top: 6px; color: #708781; }
.queue-panel { margin-top: 22px; padding: 18px; border: 1px solid #dbe8e4; border-radius: 12px; background: #f8fcfb; }
.queue-panel .progress-heading { flex-wrap: wrap; }
.queue-panel p, #queue-count { color: #637c77; font-size: 17px; }
#queue-wait { font-weight: 700; color: #176f67; margin-top: 12px; }
.queue-panel #queue-time { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}

.hidden {
  display: none !important;
}

.result-table {
  margin-top: 24px;
}

.table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 760px;
  font-size: 16px;
}

th {
  background: #183b3a;
  color: #fff;
  text-align: left;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #dbe8e4;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f4faf8;
}

@media (max-width: 700px) {
  .panel {
    width: 100%;
    margin-left: 0;
  }

  #job-form {
    width: 100%;
    margin-top: 24px;
    margin-left: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
  .intro { grid-template-columns: 1fr; gap: 18px; margin-bottom: 14px; }
  .intro-copy > p:last-child { white-space: normal; }
  .hero-mosquito-frame,
  html[lang="en"] .hero-mosquito-frame { width: 166px; height: 166px; justify-self: start; margin-right: 0; transform: none; }
  .hero-mosquito { width: 154px; }

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

  .result-heading, .table-error { flex-direction: column; align-items: stretch; }
  .task-link-row { flex-direction: column; }

  .actions button,
  .download {
    text-align: center;
    width: 100%;
  }
}

.hero-mosquito {
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.hero-mosquito.is-loaded {
  opacity: 1;
}
