:root {
  --bg: #f1f2f4;
  --surface: #f8f8fa;
  --card: #ffffff;
  --text: #202428;
  --muted: #6c747d;
  --line: #d7dde3;
  --ink: #2a3138;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  font-family: "Avenir Next", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page {
  width: min(920px, 100% - 32px);
  margin: 28px auto 42px;
  display: grid;
  gap: 14px;
}

.gate-card h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 30px);
}

.gate-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
}

.gate-form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.gate-form input:focus {
  border-color: #aebbc9;
}

.gate-hint {
  margin: 10px 0 0;
  color: #3f474f;
  font-size: 14px;
  font-weight: 500;
}

.gate-hint strong {
  color: #1f2730;
  font-weight: 700;
}

.copy-btn {
  margin-left: 8px;
  border: 1px solid #bcc5cf;
  border-radius: 999px;
  background: #fff;
  color: #2b333b;
  font-size: 12px;
  padding: 3px 10px;
  cursor: pointer;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 28px rgba(21, 29, 37, 0.05);
}

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

.hero-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fbfcfd;
  flex: 0 0 auto;
}

.hero-mark svg {
  width: 22px;
  height: 22px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 9px;
  position: relative;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #596169;
  font-size: 14px;
  font-weight: 500;
}

.field-label svg {
  width: 18px;
  height: 18px;
}

.upload-tile {
  position: relative;
  width: min(160px, 100%);
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fb;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.upload-plus {
  font-size: 50px;
  line-height: 1;
  font-weight: 300;
  color: #8b949d;
}

.upload-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(28, 36, 44, 0.82);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
}

.remove-image:active {
  transform: scale(0.96);
}

.file-input {
  position: absolute;
  inset: 30px 0 0;
  width: min(160px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-tile.has-image {
  border-color: #c2cbd5;
}

.btn {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn:hover {
  background: #1e252c;
}

.btn-secondary {
  background: #eef1f4;
  color: #2b333b;
  border-color: #d2d9e0;
}

.btn-secondary:hover {
  background: #e4e9ee;
}

.btn:disabled {
  background: #9aa2ab;
  color: #edf0f2;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: #9aa2ab;
}

.detecting-tip {
  margin: 12px 0 0;
  font-size: 13px;
  color: #6f7780;
}

.status {
  font-size: 14px;
  font-weight: 600;
  color: #5f6871;
}

.result-card {
  display: grid;
  gap: 14px;
  border-width: 2px;
}

.result-banner {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: clamp(20px, 2.8vw, 38px);
  line-height: 1.2;
  font-weight: 700;
}

.score-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.score-value {
  font-size: clamp(34px, 5.2vw, 54px);
  line-height: 1;
  font-weight: 700;
}

.score-label {
  font-size: clamp(24px, 3.5vw, 44px);
  line-height: 1.1;
  color: #7a828a;
  text-align: right;
  font-weight: 600;
}

.progress-track {
  height: 16px;
  border-radius: 999px;
  background: #e7ecef;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}

.source-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.source-section h3 {
  margin: 0;
  font-size: 15px;
  color: #5f6871;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.source-name {
  font-size: 14px;
  color: var(--ink);
}

.source-value {
  font-size: 14px;
  font-weight: 700;
  color: #3a4047;
}

.source-empty {
  margin: 0;
  color: #6f7780;
  font-size: 14px;
}

.level-red {
  background: #f6e2e6;
  border-color: #eeb8c3;
}

.level-red .result-banner,
.level-red .score-value {
  color: #c8102e;
}

.level-red .progress-fill {
  background: linear-gradient(90deg, #d70f2f, #c60a26);
}

.level-orange {
  background: #faecd9;
  border-color: #efcd9d;
}

.level-orange .result-banner,
.level-orange .score-value {
  color: #c86500;
}

.level-orange .progress-fill {
  background: linear-gradient(90deg, #d77700, #c86500);
}

.level-yellow {
  background: #f7f2d8;
  border-color: #e7dca2;
}

.level-yellow .result-banner,
.level-yellow .score-value {
  color: #9f8600;
}

.level-yellow .progress-fill {
  background: linear-gradient(90deg, #bea314, #aa920d);
}

.level-gray {
  background: #dadbde;
  border-color: #d0d1d4;
}

.level-gray .result-banner,
.level-gray .score-value {
  color: #2f3337;
}

.level-gray .result-banner {
  background: rgba(255, 255, 255, 0.42);
}

.level-gray .progress-fill {
  background: linear-gradient(90deg, #2f3337, #2f3337);
}

.level-gray .progress-track {
  background: rgba(255, 255, 255, 0.62);
}

.level-gray .score-label {
  color: #767b81;
}

.hidden {
  display: none;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(25, 31, 38, 0.36);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 20px;
}

.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(15, 22, 29, 0.2);
}

.modal-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  color: #222a31;
}

.inline-input {
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #1f2730;
  font-size: 16px;
  line-height: 1.4;
  padding: 11px 12px;
  outline: none;
}

.inline-input:focus {
  border-color: #8d99a8;
  box-shadow: 0 0 0 3px rgba(89, 105, 123, 0.12);
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.guide-card {
  max-width: 520px;
}

.guide-list {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.guide-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fafbfc;
}

.guide-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.guide-icon svg {
  width: 30px;
  height: 30px;
}

.guide-ok .guide-icon {
  color: #149a4a;
}

.guide-bad .guide-icon {
  color: #da2f2f;
}

.guide-head strong {
  font-size: 15px;
  color: #1f2730;
}

.guide-note {
  font-size: 13px;
  color: #68717b;
}

.guide-example {
  border: 1px solid #d9dfe5;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.guide-example img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 760px) {
  .page {
    width: calc(100% - 18px);
    margin-top: 14px;
    gap: 10px;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  .hero {
    gap: 10px;
    align-items: flex-start;
  }

  .hero-mark {
    width: 36px;
    height: 36px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .gate-form {
    grid-template-columns: 1fr;
  }

  .upload-tile,
  .file-input {
    width: 100%;
    max-width: 220px;
  }

  .score-head {
    align-items: center;
  }

  .score-label {
    font-size: 20px;
  }

  .progress-track {
    height: 14px;
  }

  .guide-list {
    grid-template-columns: 1fr;
  }
}
