:root {
  color-scheme: light dark;
  --bg: #0b0f14;
  --panel: #131a22;
  --panel-border: #223041;
  --text: #e8eef4;
  --muted: #93a4b5;
  --accent: #4da3ff;
  --pass: #34c771;
  --fail: #ff5d5d;
  --input-bg: #0f151c;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --panel-border: #dce3eb;
    --text: #16202b;
    --muted: #5b6b7a;
    --accent: #1f6fd1;
    --pass: #1a9a54;
    --fail: #d63a3a;
    --input-bg: #ffffff;
  }
}
* { box-sizing: border-box; }

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

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 10;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 2.5rem 1.25rem 4rem;
}
.wrap { max-width: 880px; margin: 0 auto; }
header { margin-bottom: 1.75rem; }
h1 { font-size: 1.6rem; margin: 0 0 0.35rem; }
header p { margin: 0; color: var(--muted); font-size: 0.95rem; }

form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}
input[type="url"] {
  flex: 1;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--text);
}
input[type="url"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#results:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
button {
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: default; }

#status { min-height: 1.4rem; margin-bottom: 1rem; color: var(--muted); font-size: 0.9rem; }
#status.error { color: var(--fail); }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.1rem;
}
.card h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.summary-item { font-size: 0.9rem; }
.summary-item .label { color: var(--muted); display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.badge.pass { background: color-mix(in srgb, var(--pass) 18%, transparent); color: var(--pass); }
.badge.fail { background: color-mix(in srgb, var(--fail) 18%, transparent); color: var(--fail); }
.badge.neutral { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.tag {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.law-list { display: flex; flex-direction: column; gap: 0.6rem; }
.law {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}
.law-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.law-name { font-weight: 600; font-size: 0.95rem; }
.law-jurisdiction { color: var(--muted); font-size: 0.8rem; margin-top: 0.1rem; }
.law-reasons { margin: 0.6rem 0 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--text); }
.law-reasons li { margin-bottom: 0.2rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--panel-border); }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
.yn-yes { color: var(--pass); }
.yn-no { color: var(--fail); }

.muted-text { color: var(--muted); margin: 0; }

#results { display: none; }
#results.visible { display: block; }

.grade-card { display: flex; align-items: flex-start; gap: 1.1rem; }
.grade-badge {
  flex: 0 0 auto;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
}
.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0 0.3rem;
}
.grade-good { background: color-mix(in srgb, var(--pass) 18%, transparent); color: var(--pass); }
.grade-mid { background: color-mix(in srgb, #d8a021 22%, transparent); color: #d8a021; }
.grade-bad { background: color-mix(in srgb, var(--fail) 18%, transparent); color: var(--fail); }
.law-grade { display: inline-flex; align-items: center; gap: 0.45rem; }

.scan-screenshot {
  max-width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

#terms {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--panel-border);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}
#terms p { margin: 0 0 0.6rem; }
#terms p:last-child { margin-bottom: 0; }
#terms strong { color: var(--text); }
