:root {
  color-scheme: light;
  --ink: #151821;
  --muted: #697080;
  --line: #e4e6ee;
  --surface: #ffffff;
  --canvas: #f5f6fa;
  --blue: #1e79e7;
  --blue-dark: #155fbe;
  --red: #c73b3b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, .upload-tile:focus-within {
  outline: 3px solid rgba(30, 121, 231, .26);
  outline-offset: 2px;
}

.site-frame { min-height: 100vh; }
.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1100px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid #e8e9ef;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 16px; font-weight: 720; }
.brand-icon { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.topbar-right { display: flex; align-items: center; gap: 28px; }
.service-state { display: inline-flex; align-items: center; gap: 8px; color: #566071; font-size: 12px; white-space: nowrap; }
.service-state i, .notice-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #adb2bc; }
.service-state[data-state="ready"] i { background: #14a67d; box-shadow: 0 0 0 3px rgba(20, 166, 125, .12); }
.service-state[data-state="unavailable"] i { background: #d48a00; }
.quiet-link { color: #536071; font-size: 13px; text-decoration: none; }
.quiet-link:hover { color: var(--blue-dark); }

.page-shell { width: min(100% - 40px, 1040px); margin: 34px auto 0; }
.app-intro { display: flex; align-items: center; gap: 20px; padding: 4px 4px 28px; }
.app-icon { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; box-shadow: 0 5px 16px rgba(45, 48, 91, .13); }
.app-copy { flex: 1; min-width: 0; }
.kicker { color: #737b8b; font-size: 11px; font-weight: 700; }
.app-copy h1 { margin: 2px 0 3px; font-size: 27px; line-height: 1.25; font-weight: 730; }
.app-copy p { max-width: 590px; margin: 0; color: var(--muted); font-size: 14px; }
.app-version { align-self: flex-start; margin-top: 10px; padding: 5px 10px; border: 1px solid #dee1e8; border-radius: 5px; color: #656d7c; background: #fff; font-size: 12px; }

.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 295px; align-items: start; gap: 22px; }
.sign-panel { min-width: 0; padding: 26px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 18px rgba(38, 43, 64, .035); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 0; font-size: 21px; line-height: 1.3; }
.panel-icon { width: 32px; height: 32px; border-radius: 8px; }
.steps { display: flex; list-style: none; margin: 22px 0 24px; padding: 12px 14px; border-radius: 6px; background: #f0f6fc; }
.steps li { display: flex; flex: 1; align-items: center; gap: 8px; color: #7a8495; font-size: 12px; }
.steps li:not(:last-child)::after { content: ""; height: 1px; flex: 1; margin: 0 11px; background: #dce5ef; }
.steps li span { display: grid; width: 22px; height: 22px; flex: 0 0 22px; place-items: center; border: 1px solid #d2dbe6; border-radius: 50%; background: white; font-size: 9px; font-weight: 700; }
.steps li.active { color: #1768c5; font-weight: 700; }
.steps li.active span { color: white; border-color: var(--blue); background: var(--blue); }
.steps li.completed { color: #087b5e; }
.steps li.completed span { border-color: #a5d9c6; background: #eefaf5; }

.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.upload-tile {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 178px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 18px 14px;
  border: 1px dashed #cdd3df;
  border-radius: 7px;
  background: #fcfcfe;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.upload-tile:hover, .upload-tile.dragover { border-color: var(--blue); background: #f4f9ff; }
.upload-tile.has-file { border-style: solid; border-color: #70c2a6; background: #f7fcf9; }
.upload-tile input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.file-mark { position: relative; display: grid; width: 42px; height: 52px; place-items: end center; margin-bottom: 10px; border: 1px solid #dbe0e9; border-radius: 3px; background: #f3f6fa; box-shadow: 0 2px 4px rgba(26, 35, 55, .06); }
.file-mark::before { content: ""; position: absolute; top: -1px; right: -1px; width: 14px; height: 14px; border-left: 1px solid #dbe0e9; border-bottom: 1px solid #dbe0e9; background: #e4eaf2; clip-path: polygon(0 0, 100% 100%, 0 100%); }
.file-mark b { display: block; width: 100%; padding: 2px 0; color: white; font-size: 12px; font-weight: 650; line-height: 1.35; }
.p12-mark b { background: #18b69b; }
.mp-mark b { background: #438fd8; }
.upload-title { font-size: 14px; font-weight: 700; }
.upload-hint { max-width: 100%; overflow: hidden; margin-top: 2px; color: #747e8f; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.upload-meta { margin-top: 7px; color: #656e7e; font-size: 11px; }
.upload-tile.has-file .upload-hint { color: #087b5e; font-weight: 650; }

.field-row { margin-top: 22px; }
.field-label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.password-wrap { display: flex; align-items: center; border: 1px solid #cfd4df; border-radius: 6px; background: white; transition: border-color .15s ease; }
.password-wrap:focus-within { border-color: var(--blue); }
.password-wrap input { width: 100%; min-width: 0; height: 46px; padding: 0 13px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.password-wrap input::placeholder { color: #9aa1ad; }
.icon-button { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border: 0; border-radius: 5px; color: #747d8b; background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--blue-dark); }
.icon-button svg, .button-icon svg, .download-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field-help { margin: 5px 0 0; color: #656e7e; font-size: 11px; }
.inline-error { margin: 10px 0 0; color: var(--red); font-size: 12px; }
.submit-button { display: grid; grid-template-columns: 20px 1fr 20px; width: 100%; min-height: 52px; align-items: center; gap: 10px; margin-top: 16px; padding: 7px 16px; border: 0; border-radius: 7px; color: #362402; background: #ffc52e; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s ease; }
.submit-button:not(:disabled):hover { background: #f5b900; }
.submit-button:disabled { color: #6d5c32; background: #f5e9c7; cursor: not-allowed; }
.button-icon { display: inline-flex; }
.button-arrow { justify-self: end; font-size: 18px; font-weight: 500; }

.side-info { padding: 8px 3px; }
.info-section h2 { margin: 0 0 15px; font-size: 15px; }
.timeline { display: flex; flex-direction: column; gap: 16px; list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 11px; }
.timeline-number { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border: 1px solid #dce3ed; border-radius: 50%; color: #4b6987; background: white; font-size: 11px; font-weight: 700; }
.timeline li strong { display: block; font-size: 12px; }
.timeline li p { margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.server-notice { display: flex; gap: 9px; margin-bottom: 16px; padding: 11px 12px; border: 1px solid #eed7a1; border-radius: 6px; color: #775710; background: #fff9e8; }
.server-notice .notice-dot { flex: 0 0 8px; margin-top: 5px; background: #d49613; }
.server-notice p { margin: 0; font-size: 11px; line-height: 1.5; }

.job-panel { margin-top: 24px; padding-top: 18px; border-top: 1px solid #dfe8f0; scroll-margin: 16px; }
.job-heading { display: flex; align-items: center; gap: 11px; }
.job-heading .kicker { margin: 0 0 2px; color: #647589; }
.job-heading h3 { margin: 0; font-size: 15px; }
.job-percent { margin-left: auto; color: #1768c5; font-size: 13px; font-weight: 700; }
.job-spinner { width: 23px; height: 23px; flex: 0 0 23px; border: 2px solid #d5e4f4; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.job-spinner.done { border: 0; border-radius: 50%; background: #19a777; animation: none; }
.job-spinner.done::after { content: "✓"; display: block; color: white; font-size: 14px; line-height: 23px; text-align: center; }
.job-spinner.error { border-color: #f3d3d3; background: var(--red); animation: none; }
.job-spinner.error::after { content: "!"; display: block; color: white; font-weight: 700; line-height: 20px; text-align: center; }
.progress-track { display: block; width: 100%; height: 6px; overflow: hidden; margin: 16px 0 8px; appearance: none; border: 0; border-radius: 6px; background: #dde7f1; accent-color: var(--blue); }
.progress-track::-webkit-progress-bar { background: #dde7f1; }
.progress-track::-webkit-progress-value { border-radius: inherit; background: var(--blue); }
.progress-track::-moz-progress-bar { border-radius: inherit; background: var(--blue); }
.job-message, .job-expiry { margin: 0; color: #677286; font-size: 12px; }
.job-expiry { margin-top: 5px; color: #8790a0; font-size: 11px; }
.job-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 16px; }
.download-button, .install-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid var(--blue); border-radius: 5px; color: white; background: var(--blue); font-size: 12px; font-weight: 650; text-decoration: none; }
.download-button svg { width: 17px; height: 17px; }
.download-button:hover { background: var(--blue-dark); }
.install-button { color: var(--blue-dark); background: white; }
.text-button { padding: 8px; border: 0; color: #536c89; background: transparent; font-size: 12px; cursor: pointer; }
.text-button:hover { color: var(--blue-dark); text-decoration: underline; }
.retry-button { margin-top: 10px; padding-left: 0; }
.job-panel[hidden], [hidden] { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 35px; padding: 16px 4px 28px; border-top: 1px solid #e3e5ec; color: #7a8290; }
.footer-brand { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; color: #4f5868; font-size: 12px; font-weight: 650; }
.footer-brand img { width: 22px; height: 22px; border-radius: 6px; }
.footer p { max-width: 590px; margin: 0; font-size: 11px; text-align: right; }

@media (max-width: 760px) {
  .topbar { height: 58px; padding: 0 16px; }
  .brand { gap: 8px; font-size: 14px; }
  .brand-icon { width: 31px; height: 31px; }
  .topbar-right { gap: 14px; }
  .service-state { font-size: 11px; }
  .quiet-link { display: none; }
  .page-shell { width: min(100% - 28px, 560px); margin-top: 22px; }
  .app-intro { align-items: flex-start; gap: 14px; padding: 1px 0 20px; }
  .app-icon { width: 58px; height: 58px; border-radius: 14px; }
  .app-copy h1 { font-size: 21px; }
  .app-copy p { font-size: 12px; }
  .app-version { display: none; }
  .main-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sign-panel { padding: 19px 16px; }
  .panel-heading h2 { font-size: 18px; }
  .steps { gap: 3px; margin: 17px 0 19px; padding: 10px 8px; }
  .steps li { gap: 5px; font-size: 10px; white-space: nowrap; }
  .steps li:not(:last-child)::after { margin: 0 5px; }
  .steps li span { width: 19px; height: 19px; flex-basis: 19px; font-size: 8px; }
  .upload-grid { grid-template-columns: 1fr; gap: 9px; }
  .upload-tile { min-height: 144px; }
  .field-row { margin-top: 19px; }
  .side-info { padding: 0 3px; }
  .timeline { display: grid; grid-template-columns: 1fr; gap: 13px; }
  .footer { align-items: flex-start; flex-direction: column; gap: 8px; margin-top: 25px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .footer p { text-align: left; }
}

@media (max-width: 390px) {
  .page-shell { width: calc(100% - 22px); }
  .service-state { gap: 5px; }
  .steps li { font-size: 9px; }
  .steps li:not(:last-child)::after { margin: 0 3px; }
  .sign-panel { padding-right: 13px; padding-left: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
