@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-gradient: none;
  --panel: #ffffff;
  --panel-2: #f1f4f9;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #64748b;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  --accent: #4a90e2;
  --accent-strong: #2563eb;
  --accent-soft: rgba(74, 144, 226, 0.16);
  --danger: #d92d20;
  --success: #12b981;
  --focus: rgba(37, 99, 235, 0.55);
  --radius-sm: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --overlay: rgba(15, 23, 42, 0.6);
  --scorebar-bg: #e2e8f0;
  --input-bg: #ffffff;
  --chip-good: rgba(16, 185, 129, 0.12);
  --chip-bad: rgba(244, 63, 94, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-gradient: none;
  --panel: #121a24;
  --panel-2: #0f1722;
  --text: #e2e8f0;
  --muted: #a3b1c6;
  --muted-2: #7b879a;
  --border: rgba(226, 232, 240, 0.16);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
  --accent: #4a90e2;
  --accent-strong: #60a5fa;
  --accent-soft: rgba(74, 144, 226, 0.24);
  --danger: #f97066;
  --success: #3ccf91;
  --focus: rgba(96, 165, 250, 0.6);
  --overlay: rgba(6, 10, 16, 0.82);
  --scorebar-bg: #1e293b;
  --input-bg: #0f1722;
  --chip-good: rgba(16, 185, 129, 0.2);
  --chip-bad: rgba(244, 63, 94, 0.2);
}

.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 50;
}

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

.loading-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.loading-text {
  color: var(--text);
  font-weight: 600;
  font-family: "Sora", "Manrope", sans-serif;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

* {
  box-sizing: border-box;
}

*:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-gradient);
  min-height: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", "Courier New", monospace;
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.container {
  width: min(1120px, calc(100% - 48px));
  margin: 32px auto 64px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.theme-switch-text {
  font-weight: 600;
  color: var(--muted-2);
}

.theme-switch-status {
  font-weight: 600;
  color: var(--text);
}

.theme-switch input {
  appearance: none;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-switch input::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--text);
  transform: translateY(-50%);
  transition: transform 0.2s ease, background 0.2s ease;
}

.theme-switch input:checked {
  background: var(--accent);
  border-color: transparent;
}

.theme-switch input:checked::before {
  transform: translate(20px, -50%);
  background: #ffffff;
}

h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.02em;
  font-family: "Sora", "Manrope", sans-serif;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.muted {
  color: var(--muted-2);
}

.github-link {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  font-weight: 600;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.github-link:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

main .card {
  animation: fadeUp 0.6s ease both;
}

main .card:nth-of-type(1) {
  animation-delay: 0.05s;
}

main .card:nth-of-type(2) {
  animation-delay: 0.12s;
}

main .card:nth-of-type(3) {
  animation-delay: 0.2s;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--text);
  font-family: "Sora", "Manrope", sans-serif;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-header h2 {
  margin: 0;
}

.card h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  font-family: "Sora", "Manrope", sans-serif;
}

.grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}

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

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

  .two-col {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.hint {
  color: var(--muted-2);
  font-size: 12px;
}

.subblock {
  margin-top: 10px;
}

.subblock-title {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="url"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  width: 100%;
  min-height: 260px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  resize: vertical;
  line-height: 1.45;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.file {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.file-btn:hover {
  border-color: var(--accent);
  background: var(--panel);
  transform: translateY(-1px);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-out {
  min-width: 28px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}

.options {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-top: 10px;
}

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

.field.checkbox {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.field.checkbox span {
  font-size: 12px;
}

.field.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.field.checkbox .hint {
  display: none;
}

.meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--muted-2);
}

.btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
  .scorebar-fill,
  .section-scorebar-fill {
    transition: none;
  }
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.3);
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.btn.secondary {
  border-color: var(--border);
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  box-shadow: none;
}

.btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--panel);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.status.error {
  color: var(--danger);
}

.explain {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.explain-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.recommend {
  margin-top: 12px;
}

.recommend-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 10px;
}

@media (max-width: 820px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .actions {
    flex-direction: column;
  }

  .actions .btn {
    width: 100%;
  }
}

.scorebar {
  height: 10px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: var(--scorebar-bg);
  border: 1px solid var(--border);
  margin: 12px 0 8px;
}

.scorebar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  transition: width 220ms ease;
}

.metric {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  font-size: 22px;
  font-weight: 750;
  margin-top: 6px;
  font-family: "Sora", "Manrope", sans-serif;
}

.metric-value.small {
  font-size: 16px;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
  padding-top: 8px;
}

.checklist-meta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 12px;
}

.checklist-list {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--panel-2);
}

.check-indicator {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--panel);
}

.check-indicator.checked {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.check-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.tip {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.tip-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.tip-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.chip[role="button"] {
  cursor: pointer;
}

.chip[role="button"]:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.chip.good {
  border-color: transparent;
  background: var(--chip-good);
  color: var(--success);
}

.chip.bad {
  border-color: transparent;
  background: var(--chip-bad);
  color: var(--danger);
}

.section-scores {
  padding-top: 8px;
  min-height: 22px;
}

.section-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  flex-wrap: wrap;
  background: var(--panel-2);
}

.section-score-label {
  font-size: 12px;
  color: var(--muted);
}

.section-score-value {
  font-size: 12px;
  font-weight: 700;
}

.section-scorebar {
  width: 100%;
  height: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--scorebar-bg);
}

.section-scorebar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  transition: width 220ms ease;
}

.footer {
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
