:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1b1f2a;
  --muted: #5d6475;
  --border: #dde1ea;
  --accent: #1f6feb;
  --accent-hover: #1a5fd0;
  --accent-text: #ffffff;
  --error: #c62828;
  --error-bg: #fdecea;
  --track: #e7eaf1;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --text: #e6e8ee;
    --muted: #9aa1b2;
    --border: #2a303c;
    --accent: #4c8dff;
    --accent-hover: #6aa0ff;
    --accent-text: #0b0e14;
    --error: #ff8a80;
    --error-bg: #3a1d1d;
    --track: #262c38;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 16px 32px;
}

.hero { text-align: center; margin-bottom: 28px; }
.logo { border-radius: 14px; }
.hero h1 { margin: 12px 0 4px; font-size: 1.9rem; letter-spacing: -0.01em; }
.tagline { margin: 0; color: var(--muted); }

.lookup { display: flex; gap: 8px; }

.lookup input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.lookup input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: progress; }

.status {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.status.is-error { background: var(--error-bg); border-color: transparent; color: var(--error); }

.score {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.score__body { flex: 1; min-width: 0; }
.score__title { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.score__meta { margin: 4px 0 16px; color: var(--muted); }
.score__hint { margin: 16px 0 0; color: var(--muted); font-size: 0.85rem; }

.card {
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 8px; font-size: 1.15rem; }

.problems { margin-top: 14px; }
.problems summary { color: var(--error); }
.problems ul { margin: 0; padding-left: 1.2em; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.steps { margin: 0; padding-left: 1.3em; }
.steps > li { margin: 14px 0; }
.steps > li::marker { font-weight: 700; color: var(--accent); }
.steps p { margin: 0 0 8px; }

.bookmarklet {
  display: inline-block;
  padding: 10px 18px;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: grab;
}

details { margin-top: 4px; }
summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; }
details[open] summary { margin-bottom: 8px; }

.code {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

button.secondary {
  margin-top: 8px;
  padding: 8px 14px;
  background: var(--track);
  color: var(--text);
  font-weight: 500;
}

button.secondary:hover:not(:disabled) { background: var(--border); }

.small { color: var(--muted); font-size: 0.88rem; }
.why { margin: 12px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions span { opacity: 0.75; font-weight: 500; font-size: 0.85em; margin-left: 4px; }

.progress { margin-top: 16px; }
.progress__bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
.progress__fill.is-indeterminate { width: 35%; animation: slide 1.2s ease-in-out infinite; }
.progress__text { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }

@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(290%); }
}

.link-btn {
  padding: 0;
  margin-top: 4px;
  background: none;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.92rem;
}

.link-btn:hover:not(:disabled) { background: none; text-decoration: underline; }

.footer { margin-top: 40px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.footer p { margin: 6px 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 540px) {
  .container { padding-top: 32px; }
  .lookup { flex-direction: column; }
  .score { text-align: center; }
  .card { padding: 16px; }
  .actions { justify-content: center; }
  .actions button { flex: 1 1 100%; }
}
