:root {
  --bg: #f4efe6;
  --bg-strong: #eadfce;
  --surface: rgba(255, 252, 247, 0.84);
  --surface-strong: #fffaf2;
  --ink: #1f1c1a;
  --muted: #6a625b;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --must: #c2410c;
  --should: #1d4ed8;
  --may: #6d28d9;
  --tag: #8b5e34;
  --attr: #0f766e;
  --value: #b45309;
  --line-highlight: rgba(15, 118, 110, 0.12);
  --shadow: 0 18px 40px rgba(68, 51, 34, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(194, 65, 12, 0.12), transparent 22%),
    linear-gradient(180deg, #fbf7f1 0%, var(--bg) 100%);
}

code,
pre,
.xml-viewer {
  font-family: "IBM Plex Mono", monospace;
}

.page-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-stats,
.viewer-panel,
.details-panel {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(126, 98, 63, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.eyebrow,
.panel-label,
.stat-label,
.detail-heading {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.lead {
  margin: 0;
  max-width: 64ch;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-stats {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.summary-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 250, 242, 0.9), rgba(234, 223, 206, 0.64));
  border: 1px solid rgba(126, 98, 63, 0.12);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
}

.summary-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 24px;
}

.viewer-panel,
.details-panel {
  padding: 22px;
}

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

.panel-header h2 {
  margin: 6px 0 0;
  font-size: 1.45rem;
}

.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  background: rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
  outline: none;
}

.legend,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend {
  margin-bottom: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(126, 98, 63, 0.14);
}

.chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.chip.must {
  color: var(--must);
}

.chip.should {
  color: var(--should);
}

.chip.may {
  color: var(--may);
}

.chip.neutral::before {
  background: var(--accent);
}

.xml-viewer {
  position: relative;
  overflow: auto;
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(32, 29, 24, 0.98), rgba(48, 43, 36, 0.98)),
    linear-gradient(135deg, rgba(255,255,255,0.04), transparent);
  color: #f7f1e9;
  min-height: 65vh;
}

.xml-line {
  display: block;
  padding: 1px 0;
  border-radius: 10px;
  transition: background 120ms ease;
}

.xml-line.is-highlighted {
  background: var(--line-highlight);
}

.indent {
  display: inline-block;
  width: calc(var(--depth) * 18px);
}

.token {
  border-radius: 7px;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.token:hover,
.token:focus-visible,
.token.is-active {
  background: rgba(255, 251, 235, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 251, 235, 0.12);
  outline: none;
}

.token.tag {
  color: #f8c892;
}

.token.attr-name {
  color: #8ce2d8;
}

.token.attr-value,
.token.text-value {
  color: #f4b56c;
}

.token.punctuation {
  color: rgba(255, 248, 238, 0.7);
}

.details-panel {
  position: sticky;
  top: 18px;
  align-self: start;
}

.detail-path,
.detail-why {
  color: var(--muted);
  line-height: 1.55;
}

.detail-path {
  margin: 0 0 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
}

.detail-why {
  margin: 0 0 20px;
}

.detail-block + .detail-block {
  margin-top: 20px;
}

.detail-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.detail-list li + li {
  margin-top: 8px;
}

.tooltip {
  position: fixed;
  inset: auto auto 24px 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(24, 21, 18, 0.92);
  color: #fffaf3;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24);
  pointer-events: none;
  z-index: 10;
}

.tooltip-title {
  margin: 0 0 6px;
  font-size: 0.96rem;
  font-weight: 700;
}

.tooltip-copy {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(255, 250, 243, 0.86);
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.08);
  color: rgba(255, 250, 242, 0.84);
}

@media (max-width: 1080px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .details-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1400px);
    padding-top: 20px;
  }

  .hero-copy,
  .hero-stats,
  .viewer-panel,
  .details-panel {
    padding: 18px;
    border-radius: 18px;
  }

  .panel-header {
    flex-direction: column;
  }

  .xml-viewer {
    min-height: 50vh;
    padding: 14px;
  }
}
