:root {
  color-scheme: light;

  --background: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;

  --text: #172033;
  --text-soft: #5f6b7a;

  --primary: #173b6c;
  --primary-soft: #eaf1fb;

  --success: #17633a;
  --success-soft: #eaf7ef;

  --warning: #875900;
  --warning-soft: #fff6dc;

  --danger: #9f2f2f;
  --danger-soft: #fff0f0;

  --border: #dfe5ec;

  --shadow:
    0 10px 30px
    rgba(22, 38, 61, 0.08);

  --radius: 16px;
}


* {
  box-sizing: border-box;
}


html {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}


body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}


button,
textarea {
  font: inherit;
}


.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}


.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 20px;

  display: flex;
  align-items: center;
  gap: 12px;
}


.brand-mark {
  width: 44px;
  height: 44px;

  display: grid;
  place-items: center;

  border-radius: 12px;

  background: var(--primary);
  color: white;

  font-weight: 800;
  letter-spacing: -0.04em;
}


.brand-name {
  font-size: 1.05rem;
  font-weight: 750;
}


.brand-subtitle {
  margin-top: 2px;

  color: var(--text-soft);
  font-size: 0.82rem;
}


.page {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;

  padding:
    44px
    0
    70px;
}


.hero {
  margin-bottom: 28px;
}


.eyebrow {
  margin:
    0
    0
    8px;

  color: var(--primary);

  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}


.hero h1 {
  margin:
    0
    0
    12px;

  font-size:
    clamp(
      1.8rem,
      5vw,
      2.7rem
    );

  line-height: 1.08;
  letter-spacing: -0.035em;
}


.hero-text {
  max-width: 680px;

  margin: 0;

  color: var(--text-soft);
  line-height: 1.6;
}


.search-card,
.result,
.status-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);

  background: var(--surface);

  box-shadow: var(--shadow);
}


.search-card {
  padding: 22px;
}


.search-card h2,
.result h2 {
  margin:
    0
    0
    16px;

  font-size: 1.05rem;
}


textarea {
  width: 100%;
  min-height: 112px;

  padding: 15px 16px;

  resize: vertical;

  border: 1px solid #cbd5e1;
  border-radius: 12px;

  outline: none;

  color: var(--text);
  background: var(--surface);
  line-height: 1.5;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}


textarea:focus {
  border-color: var(--primary);

  box-shadow:
    0 0 0 3px
    rgba(23, 59, 108, 0.12);
}


.search-actions {
  margin-top: 12px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}


.char-counter {
  color: var(--text-soft);
  font-size: 0.78rem;
}


button {
  min-width: 112px;

  border: 0;
  border-radius: 10px;

  padding: 11px 20px;

  background: var(--primary);
  color: white;

  cursor: pointer;
  font-weight: 700;
}


button:hover {
  filter: brightness(1.06);
}


button:disabled {
  opacity: 0.6;
  cursor: wait;
}


.status-box {
  margin-top: 20px;
  padding: 16px 18px;

  color: var(--text-soft);
  line-height: 1.5;
}


.status-box.error {
  border-color: #e8b4b4;
  background: var(--danger-soft);
  color: var(--danger);
}


.result {
  margin-top: 22px;
  padding: 24px;
}


.result-badge {
  display: inline-block;

  margin-bottom: 14px;

  padding: 5px 9px;

  border-radius: 999px;

  background: var(--success-soft);
  color: var(--success);

  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.035em;
}


.result-badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}


.answer {
  font-size:
    clamp(
      1.1rem,
      3vw,
      1.3rem
    );

  line-height: 1.6;
  font-weight: 650;
}


.explanation {
  margin-top: 16px;

  padding: 15px 16px;

  border-left: 3px solid var(--primary);
  border-radius: 6px;

  background: var(--primary-soft);

  line-height: 1.6;
}


.sources-section {
  margin-top: 30px;
}


.sources-section h3 {
  margin:
    0
    0
    12px;

  font-size: 0.95rem;
}


.source {
  overflow: hidden;

  margin-top: 10px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: var(--surface-soft);
}


.source summary {
  padding: 15px 16px;

  cursor: pointer;
  list-style: none;
}


.source summary::-webkit-details-marker {
  display: none;
}


.source-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}


.source-reference {
  font-weight: 750;
}


.source-title {
  margin-top: 3px;

  color: var(--text-soft);
  font-size: 0.88rem;
}


.source-page {
  flex: 0 0 auto;

  color: var(--text-soft);
  font-size: 0.82rem;
}


.source-body {
  padding:
    0
    16px
    16px;

  border-top: 1px solid var(--border);
}


.source-document {
  margin:
    14px
    0
    10px;

  color: var(--text-soft);
  font-size: 0.83rem;
}


.official-label {
  margin-bottom: 6px;

  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}


.official-text {
  white-space: pre-wrap;

  line-height: 1.65;
}


.footer-note {
  margin-top: 26px;

  color: var(--text-soft);

  text-align: center;
  font-size: 0.78rem;
  line-height: 1.5;
}


.sr-only {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;
  clip: rect(0, 0, 0, 0);

  white-space: nowrap;
  border: 0;
}


@media (max-width: 600px) {

  .page {
    width:
      min(
        100% - 24px,
        860px
      );

    padding-top: 28px;
  }


  .search-card,
  .result {
    padding: 18px;
  }


  .source-summary {
    display: block;
  }


  .source-page {
    margin-top: 7px;
  }

}
