:root {
  --bg: #0a1628;
  --card: #0e1f3a;
  --card-border: #1a2e50;
  --accent: #2e86de;
  --accent-light: rgba(46,134,222,0.12);
  --red: #e94560;
  --amber: #e6a817;
  --green: #2d7d46;
  --text: #e0e8f0;
  --muted: #7a8a9e;
  --section-bg: #0b1930;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────── */

header {
  background: linear-gradient(135deg, #0e1f3a 0%, #162d55 100%);
  border-bottom: 1px solid var(--card-border);
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.hero-banner {
  width: 100%;
  max-height: 280px;
  overflow: hidden;
  position: relative;
}
.hero-banner img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}
.hero-banner::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

h1 { font-size: 22px; font-weight: 800; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

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

#searchInput {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  width: 260px;
  outline: none;
  transition: border-color 0.2s;
}
#searchInput:focus { border-color: var(--accent); }

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Dashboard ──────────────────────── */

#dashboard {
  max-width: 1300px;
  margin: 28px auto;
  padding: 0 28px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 280px 320px 1fr;
  gap: 20px;
}

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

.score-card, .radar-card, .summary-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
}

.main-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.score-ring svg { width: 140px; height: 140px; }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke 0.3s;
}
.ring-value { fill: var(--text); font-size: 28px; font-weight: 800; text-anchor: middle; }
.ring-label { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.score-meta { margin-top: 14px; }
.score-meta strong { font-size: 14px; }
.score-meta p { font-size: 12px; }

.radar-card { display: flex; align-items: center; justify-content: center; }

.summary-card h3 { font-size: 16px; margin-bottom: 14px; }
.summary-stats { display: flex; gap: 16px; margin-bottom: 16px; }
.stat { text-align: center; }
.stat-value { display: block; font-size: 26px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--muted); }
.critical-text { color: var(--red); }
.warning-text { color: var(--amber); }
.summary-detail { font-size: 13px; }
.summary-detail p { margin-bottom: 6px; }

/* ── Lens Section ───────────────────── */

#lensSection {
  max-width: 1300px;
  margin: 0 auto 28px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

@media (max-width: 800px) {
  #lensSection { grid-template-columns: 1fr; }
}

#lens-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lens-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  transition: all 0.2s;
}
.lens-tab:hover { border-color: var(--accent); }
.lens-tab.active {
  border-color: var(--accent);
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}
.lens-tab-icon { font-size: 18px; }
.lens-tab-title { flex: 1; font-weight: 600; }
.lens-tab-score { font-weight: 800; font-size: 14px; }

#lens-detail {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 28px;
}

.lens-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.lens-icon-large { font-size: 36px; }
.lens-header h2 { font-size: 22px; margin-bottom: 2px; }
.lens-question { color: var(--accent); font-size: 14px; font-style: italic; }
.lens-score-display { margin-left: auto; font-size: 42px; font-weight: 800; }
.lens-score-display small { font-size: 16px; opacity: 0.5; }

.lens-score-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  margin-bottom: 18px;
  overflow: hidden;
}
.lens-score-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }

.lens-desc { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.7; }

#lens-detail h3 {
  font-size: 16px;
  margin: 24px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--card-border);
}

/* Law blocks */
.law-block {
  background: var(--section-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 14px;
}

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

.law-name {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.law-name:hover { text-decoration: underline; }

.strength-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}
.strength-strong { background: rgba(45,125,70,0.2); color: #4cd97b; }
.strength-moderate { background: rgba(230,168,23,0.2); color: #f0c040; }
.strength-weak { background: rgba(233,69,96,0.2); color: #f07080; }

.law-note { font-size: 13px; color: var(--muted); margin-bottom: 12px; line-height: 1.6; }

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.section-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 12px 14px;
}
.section-ref { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.section-title { font-size: 13px; font-weight: 700; margin: 4px 0; }
.section-text { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* Gaps */
.gap-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.gap-critical { background: rgba(233,69,96,0.08); border-left: 3px solid var(--red); }
.gap-high { background: rgba(230,168,23,0.08); border-left: 3px solid var(--amber); }
.gap-medium { background: rgba(46,134,222,0.08); border-left: 3px solid var(--accent); }

.gap-severity {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.gap-critical .gap-severity { background: var(--red); color: #fff; }
.gap-high .gap-severity { background: var(--amber); color: #000; }
.gap-medium .gap-severity { background: var(--accent); color: #fff; }

/* Recommendations */
.rec-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(45,125,70,0.06);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.rec-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
}

/* Cross-references */
.cross-refs { margin-top: 18px; }
.cross-refs h4 { font-size: 14px; margin-bottom: 10px; }
.cross-ref-link {
  display: inline-block;
  padding: 6px 14px;
  background: var(--accent-light);
  border: 1px solid rgba(46,134,222,0.3);
  border-radius: 20px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 0 6px 6px 0;
  transition: all 0.2s;
}
.cross-ref-link:hover { background: rgba(46,134,222,0.25); }

/* ── Cross-Reference Matrix ─────────── */

#crossRefSection {
  max-width: 1300px;
  margin: 0 auto 28px;
  padding: 0 28px;
}
#crossRefSection h2 { font-size: 18px; margin-bottom: 4px; }

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 14px;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
}
.matrix th, .matrix td {
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  text-align: center;
}
.matrix th { background: var(--section-bg); font-size: 16px; }
.matrix-law { text-align: left; font-weight: 600; white-space: nowrap; }
.matrix-law a { color: var(--accent); text-decoration: none; }
.matrix-law a:hover { text-decoration: underline; }
.matrix-cell { font-weight: 700; }
.matrix-strong { color: #4cd97b; background: rgba(45,125,70,0.1); }
.matrix-moderate { color: #f0c040; background: rgba(230,168,23,0.1); }
.matrix-weak { color: #f07080; background: rgba(233,69,96,0.1); }
.matrix-none { color: rgba(255,255,255,0.15); }

/* ── Search ─────────────────────────── */

#searchResults {
  max-width: 1300px;
  margin: 0 auto 28px;
  padding: 0 28px;
}
#searchResults h2 { font-size: 18px; margin-bottom: 14px; }
.hidden { display: none !important; }

.search-hit {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 10px;
}
.search-hit strong { display: block; margin-bottom: 6px; }
.search-hit p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.hit-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}
mark { background: rgba(46,134,222,0.3); color: var(--text); padding: 1px 3px; border-radius: 2px; }

/* ── Footer ─────────────────────────── */

footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  border-top: 1px solid var(--card-border);
  margin-top: 20px;
}

/* ── Methodology ───────────────────── */

#methodologySection {
  max-width: 1300px;
  margin: 0 auto 28px;
  padding: 0 28px;
}
#methodologySection h2 { font-size: 18px; margin-bottom: 18px; }

.method-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .method-content { grid-template-columns: 1fr; }
}

.method-block {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
}
.method-block h3 { font-size: 15px; margin-bottom: 12px; color: var(--accent); }
.method-block p, .method-block li { font-size: 13px; line-height: 1.7; color: var(--text); }
.method-block ol, .method-block ul { padding-left: 20px; margin: 10px 0; }
.method-block li { margin-bottom: 8px; }

.method-lenses {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.method-lens {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.method-lens em { color: var(--muted); }
.ml-icon { font-size: 18px; flex-shrink: 0; }

.colour-key {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.colour-key > div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.ck-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Disclaimer ────────────────────── */

#disclaimerSection {
  max-width: 1300px;
  margin: 0 auto 28px;
  padding: 0 28px;
}

.disclaimer-box {
  background: rgba(233,69,96,0.05);
  border: 1px solid rgba(233,69,96,0.2);
  border-radius: 12px;
  padding: 28px;
}
.disclaimer-box h3 { font-size: 16px; margin-bottom: 14px; color: var(--red); }
.disclaimer-box p { font-size: 13px; line-height: 1.7; margin-bottom: 10px; }
.disclaimer-box ul { padding-left: 20px; margin: 10px 0; }
.disclaimer-box li { font-size: 13px; line-height: 1.7; margin-bottom: 6px; }

/* ── Animations ─────────────────────── */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.score-card, .radar-card, .summary-card {
  animation: fadeInUp 0.5s ease both;
}
.radar-card { animation-delay: 0.1s; }
.summary-card { animation-delay: 0.2s; }

.lens-tab { animation: fadeIn 0.3s ease both; }
.lens-tab:nth-child(1) { animation-delay: 0.05s; }
.lens-tab:nth-child(2) { animation-delay: 0.1s; }
.lens-tab:nth-child(3) { animation-delay: 0.15s; }
.lens-tab:nth-child(4) { animation-delay: 0.2s; }
.lens-tab:nth-child(5) { animation-delay: 0.25s; }
.lens-tab:nth-child(6) { animation-delay: 0.3s; }
.lens-tab:nth-child(7) { animation-delay: 0.35s; }

.hero-banner img {
  animation: fadeIn 0.8s ease both;
}

.law-block {
  transition: border-color 0.2s, transform 0.2s;
}
.law-block:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.gap-item {
  transition: transform 0.2s;
}
.gap-item:hover {
  transform: translateX(4px);
}

.rec-item {
  transition: transform 0.2s;
}
.rec-item:hover {
  transform: translateX(4px);
}

/* ── Mobile Responsive ─────────────── */

@media (max-width: 600px) {
  header { padding: 12px 16px; }
  h1 { font-size: 18px; }
  .subtitle { font-size: 11px; }

  .header-actions { width: 100%; }
  #searchInput { width: 100%; }

  .hero-banner img { height: 160px; }

  #dashboard { padding: 0 16px; margin: 16px auto; }
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .score-ring svg { width: 110px; height: 110px; }
  .radar-card canvas { width: 260px !important; height: 260px !important; }

  #lensSection {
    grid-template-columns: 1fr;
    padding: 0 16px;
    gap: 14px;
  }

  #lens-tabs {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 8px;
  }

  .lens-tab {
    flex-shrink: 0;
    padding: 10px 12px;
    min-width: auto;
  }

  .lens-tab-title {
    display: none;
  }

  .lens-tab-icon { font-size: 20px; }

  #lens-detail { padding: 18px; }
  .lens-header { flex-wrap: wrap; gap: 10px; }
  .lens-header h2 { font-size: 18px; }
  .lens-score-display { font-size: 32px; }
  .lens-score-display small { font-size: 14px; }

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

  #crossRefSection { padding: 0 16px; overflow-x: auto; }
  .matrix { font-size: 10px; min-width: 600px; }
  .matrix th, .matrix td { padding: 6px 8px; }

  #methodologySection { padding: 0 16px; }
  .method-content { grid-template-columns: 1fr; }
  .method-block { padding: 18px; }

  #disclaimerSection { padding: 0 16px; }
  .disclaimer-box { padding: 18px; }

  #searchResults { padding: 0 16px; }

  footer { padding: 16px; }
  footer small { font-size: 11px; }
}

@media (max-width: 400px) {
  .hero-banner img { height: 120px; }
  .summary-stats { flex-direction: column; gap: 8px; }
  .stat-value { font-size: 22px; }
  .lens-score-display { font-size: 26px; }
}

/* ── Utilities ──────────────────────── */

.muted { color: var(--muted); }
p { margin-bottom: 8px; }
a { color: var(--accent); }
