* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: #f5f7fb;
  color: #0f172a;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  height: 64px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: #0f172a;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
  flex: 0 0 auto;
}

nav {
  display: flex;
  gap: 6px;
  color: #475569;
  font-size: 14px;
}

nav a {
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 650;
  transition: color 0.18s ease, background 0.18s ease;
}

nav a:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.eyebrow {
  color: #2563eb;
  font-weight: 800;
  margin: 0 0 8px;
}

h1 {
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 14px;
}

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

.lead {
  font-size: 17px;
  line-height: 1.8;
  color: #475569;
  margin: 0 0 18px;
}

.notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.7;
}

.hero-card,
.panel,
.pay-card,
.legal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

.hero-card {
  padding: 22px;
  display: grid;
  gap: 12px;
  align-content: center;
}

.stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  font-weight: 800;
  color: #1e3a8a;
}

.step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 3px 12px;
  align-items: center;
}

.step span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.step strong {
  color: #0f172a;
  line-height: 1.2;
}

.step small {
  color: #64748b;
  font-weight: 600;
  line-height: 1.4;
}

.tool-card {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  padding: 22px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 0 12px;
  font-size: 15px;
}

input[type="file"] {
  padding: 10px;
  height: auto;
}

.btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  background: #1e3a8a;
  color: #ffffff;
}

.btn.primary:hover {
  background: #2563eb;
}

.btn.disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
}

.status {
  margin-top: 14px;
  min-height: 44px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 12px;
  line-height: 1.5;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.preview-title {
  margin: 0 0 10px;
  color: #475569;
  font-weight: 800;
}

.image-box {
  height: 460px;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-box img {
  max-width: 100%;
  max-height: 100%;
  display: none;
}

.canvas-box canvas {
  width: auto;
  height: min(360px, 88%);
  max-width: 100%;
  max-height: 100%;
  display: none;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
}

.result-info {
  margin-top: 16px;
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px;
  font-weight: 800;
  text-align: center;
}

.pay-card,
.legal-card {
  padding: 22px;
  margin-bottom: 20px;
}

.pay-card p,
.legal-card li {
  color: #475569;
  line-height: 1.8;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.plan {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.plan.recommended {
  border-color: #2563eb;
  background: #eff6ff;
}

.plan strong {
  color: #1e3a8a;
}

.footer {
  padding: 28px 20px 34px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.footer-brand {
  margin-bottom: 10px;
}

.footer-beian {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}

.footer a {
  color: #475569;
}

.footer-police {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-police img {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    padding: 14px 16px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .page {
    padding: 22px 14px 36px;
  }

  .hero,
  .tool-card,
  .preview-grid,
  .plans {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 30px;
  }

  .image-box {
    height: 340px;
  }
}

.detail-actions {
  margin-top: 14px;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.btn.secondary {
  background: #ffffff;
  color: #1e3a8a;
  border: 1px solid #93c5fd;
}

.btn.secondary:hover:not(:disabled) {
  background: #eff6ff;
}

.detail-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.detail-hint {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
}

.detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
}

.detail-modal-panel {
  position: relative;
  width: min(920px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
  padding: 22px;
}

.detail-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.detail-modal-header h3 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 22px;
}

.detail-modal-header p {
  margin: 0;
  color: #64748b;
  line-height: 1.6;
}

.detail-close {
  border: 0;
  background: #f1f5f9;
  color: #334155;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 24px;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.detail-item {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.detail-item span {
  font-weight: 800;
  color: #1e293b;
}

.detail-item img {
  max-width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
}

.detail-policy {
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  line-height: 1.6;
  font-weight: 700;
}

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

.export-actions {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.balance-info {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  text-align: center;
}

.export-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.export-hint {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.plan-buy-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.plan-buy-btn.selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.pay-modal[hidden] {
  display: none;
}

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.pay-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
}

.pay-modal-panel {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.26);
  overflow: hidden;
}

.pay-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.pay-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.pay-modal-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 14px;
}

.pay-modal-body {
  padding: 18px 20px;
}

.pay-selected-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 14px;
}

.pay-qr-box {
  min-height: 244px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: #ffffff;
  color: #64748b;
  text-align: center;
  padding: 12px;
}

.pay-qr-box canvas,
.pay-qr-box img,
.pay-qr-box svg {
  max-width: 220px;
  max-height: 220px;
}

.pay-code-url {
  word-break: break-all;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
}

.pay-status {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 14px;
}

.pay-status.ok {
  color: #166534;
  font-weight: 700;
}

.pay-status.error {
  color: #991b1b;
  font-weight: 700;
}

.pay-status.pending {
  color: #1d4ed8;
  font-weight: 700;
}

.pay-modal-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
}

.pay-modal-actions .btn {
  flex: 1;
}

/* P5-Logo-2C: unified Gutools brand mark for id-photo header */
.brand-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: block;
  flex: 0 0 auto;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

/* P5-UI-1A: visual lighten and Gutools card style alignment */
.hero,
.tool-card,
.pay-card,
.legal-card {
  max-width: 1060px;
  margin-left: auto;
  margin-right: auto;
}

.hero {
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: stretch;
  margin-top: 34px;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  color: #0f172a;
}

.hero .eyebrow {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #2563eb;
}

.hero p {
  line-height: 1.75;
}

.hero-card,
.panel,
.pay-card,
.legal-card {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.055);
}

.hero-card.steps-card {
  padding: 16px;
}

.hero-card.steps-card > div {
  min-height: 56px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.92);
}

.tool-card {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 16px;
}

.panel {
  padding: 22px;
}

.panel h2,
.pay-card h2,
.legal-card h2 {
  margin-top: 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.controls {
  align-self: start;
}

.preview-grid {
  gap: 14px;
}

.result-info {
  border-radius: 12px;
}

.btn.primary {
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.btn.primary:hover:not(:disabled) {
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.20);
}

.pay-card {
  margin-top: 18px;
  padding: 22px;
}

.pay-card > div:first-child {
  gap: 10px;
}

.balance-info {
  border-radius: 12px;
}

.export-button-group {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.legal-card {
  margin-top: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.90);
}

.legal-card h2 {
  font-size: 17px;
}

.legal-card li {
  line-height: 1.8;
}

@media (max-width: 900px) {
  .hero,
  .tool-card {
    grid-template-columns: 1fr;
  }

  .hero {
    margin-top: 22px;
  }

  .hero-card.steps-card {
    padding: 14px;
  }

  .panel,
  .pay-card,
  .legal-card {
    padding: 18px;
    border-radius: 16px;
  }

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

/* P0_RECOVERY_4B_RESUME_CARD_UI: cross-browser resume notice card, hidden by default and controlled by app.js later. */
.resume-card[hidden] {
  display: none;
}

.resume-card {
  margin: 16px 0 18px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: #eff6ff;
  color: #1e3a8a;
  display: grid;
  gap: 12px;
}

.resume-card-main {
  display: grid;
  gap: 6px;
}

.resume-card-main strong {
  font-size: 15px;
  line-height: 1.45;
  color: #1e3a8a;
}

.resume-card-main p,
.resume-tip,
.resume-url {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
}

.resume-tip {
  color: #475569;
}

.resume-url {
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px dashed #93c5fd;
  color: #1e3a8a;
  word-break: break-all;
  user-select: all;
}

.resume-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.resume-btn {
  width: 100%;
  font-size: 14px;
  padding: 11px 12px;
}

.resume-card.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.resume-card.is-error .resume-card-main strong {
  color: #991b1b;
}

.resume-card.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.resume-card.is-ok .resume-card-main strong {
  color: #166534;
}

@media (max-width: 640px) {
  .resume-actions {
    grid-template-columns: 1fr;
  }
}

/* P0_SAVE_1A_MOBILE_SAVE_MODAL_UI: mobile paid export image preview, hidden by default. */
.mobile-save-modal[hidden] {
  display: none;
}

.mobile-save-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}

.mobile-save-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
}

.mobile-save-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: 94vh;
  overflow: auto;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.34);
}

.mobile-save-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.mobile-save-modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
}

.mobile-save-modal-header p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

.mobile-save-modal-body {
  padding: 16px 18px 12px;
  display: grid;
  gap: 12px;
}

.mobile-save-image-wrap {
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 12px;
}

.mobile-save-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 64vh;
  height: auto;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  -webkit-touch-callout: default;
  user-select: auto;
}

.mobile-save-tip {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #f0fdf4;
  color: #166534;
  font-weight: 800;
  line-height: 1.6;
  text-align: center;
}

.mobile-save-fallback {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.mobile-save-modal-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 18px 18px;
}

.mobile-save-modal-actions .btn {
  width: 100%;
}

@media (max-width: 640px) {
  .mobile-save-modal {
    padding: 10px;
    align-items: end;
  }

  .mobile-save-modal-panel {
    width: 100%;
    max-height: 96vh;
    border-radius: 20px 20px 0 0;
  }

  .mobile-save-image-wrap img {
    max-height: 58vh;
  }
}


/* P0_SAVE_2_1_MOBILE_SAVE_HIDDEN_FALLBACK: mobile save fallback is hidden until the user taps "保存不了？". */
.mobile-save-help-btn {
  font-weight: 700;
  background: #f8fafc;
  color: #475569;
}

.mobile-save-help-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.mobile-save-fallback[hidden] {
  display: none;
}

.mobile-save-fallback.is-error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.mobile-save-fallback.is-ok {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}


/* P0_SAVE_2_3_CLEAN_RECOVERY_SAVE_PAGE
   浏览器恢复保存专用页：只承载已付费高清图 + 长按保存提示，避免露出完整工具页造成干扰。 */
html.clean-recovery-active,
body.clean-recovery-active {
  min-height: 100%;
  overflow: hidden;
  background: #f8fafc;
}

.clean-recovery-save-page {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #f8fafc;
  color: #0f172a;
  box-sizing: border-box;
}

.clean-recovery-card {
  width: min(100%, 560px);
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.clean-recovery-image-card {
  justify-content: center;
}

.clean-recovery-image-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.clean-recovery-image {
  display: block;
  max-width: min(92vw, 520px);
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
  touch-action: manipulation;
}

.clean-recovery-tip {
  width: min(92vw, 520px);
  border-radius: 16px;
  padding: 14px 16px;
  background: #ecfdf5;
  color: #166534;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
}

.clean-recovery-loading h1,
.clean-recovery-error h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.clean-recovery-loading p,
.clean-recovery-error p {
  margin: 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.7;
}

.clean-recovery-muted {
  color: #64748b;
  font-size: 13px;
}

.clean-recovery-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 4px solid #dbeafe;
  border-top-color: #1d4ed8;
  animation: cleanRecoverySpin 0.8s linear infinite;
}

@keyframes cleanRecoverySpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .clean-recovery-save-page {
    align-items: center;
    padding: 14px;
  }

  .clean-recovery-image {
    max-width: 94vw;
    max-height: 74vh;
    border-radius: 14px;
  }

  .clean-recovery-tip {
    width: 94vw;
    font-size: 16px;
    border-radius: 14px;
  }
}
