:root {
  --tool-ok: #166534;
  --tool-deny: #991b1b;
  --tool-warn: #92400e;
  --tool-panel: #faf9f7;
  --tool-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.tool-page {
  background: #f7f6f3;
  color: #1a1a1a;
  font-family: Inter, sans-serif;
}

.tool-page .page-hero {
  padding-top: var(--space-7);
  padding-bottom: var(--space-5);
}

.tool-lede,
.tool-prose p,
.tool-card > p,
.tool-note,
.tool-source {
  color: #5c5c5c;
  line-height: 1.6;
}

.tool-lede {
  max-width: 64ch;
  margin: 0;
  font-size: 1.125rem;
}

.tool-layout {
  display: grid;
  gap: 32px;
}

@media (min-width: 880px) {
  .tool-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    align-items: start;
  }
}

.tool-card,
.tool-aside,
.tool-source-card {
  background: #fff;
  border: 1px solid #e5e2dc;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.06);
}

@media (min-width: 700px) {
  .tool-card,
  .tool-aside,
  .tool-source-card {
    padding: 32px;
  }
}

.tool-card h2,
.tool-aside h2,
.tool-source-card h3 {
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tool-card > p,
.tool-aside > p,
.tool-source-card p {
  margin: 0 0 24px;
}

.tool-form {
  display: grid;
  gap: 16px;
}

.tool-form label,
.tool-form legend {
  font-size: 0.875rem;
  font-weight: 500;
}

.tool-form input,
.tool-form select {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid #e5e2dc;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
}

.tool-form input:focus,
.tool-form select:focus,
.scenario-button:focus {
  outline: 2px solid rgba(31, 75, 122, 0.4);
  outline-offset: 2px;
  border-color: #1f4b7a;
}

.tool-row {
  display: grid;
  gap: 16px;
}

@media (min-width: 600px) {
  .tool-row {
    grid-template-columns: 1fr 1fr;
  }
}

.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
}

.check-row label {
  line-height: 1.5;
}

.tool-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: #5c5c5c;
}

.tool-loading[hidden] {
  display: none;
}

.tool-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e2dc;
  border-top-color: #1f4b7a;
  border-radius: 50%;
  animation: tool-spin 0.7s linear infinite;
}

@keyframes tool-spin {
  to { transform: rotate(360deg); }
}

.tool-result {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid #e5e2dc;
  border-radius: 12px;
  background: #faf9f7;
}

.tool-result.is-reveal {
  animation: tool-in 0.3s var(--tool-ease);
}

@keyframes tool-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.tool-result.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.tool-result.is-deny {
  border-color: #fecaca;
  background: #fef2f2;
}

.tool-result.is-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.tool-result h3 {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 600;
}

.tool-result p {
  margin: 0;
  color: #5c5c5c;
  line-height: 1.55;
}

.status-grid,
.source-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 620px) {
  .status-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .source-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.status-panel {
  padding: 16px;
  border: 1px solid #e5e2dc;
  border-radius: 12px;
  background: #fff;
}

.status-panel span {
  display: block;
  color: #5c5c5c;
  font-size: 0.8125rem;
}

.status-panel strong {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.status-panel.is-ok strong { color: var(--tool-ok); }
.status-panel.is-deny strong { color: var(--tool-deny); }
.status-panel.is-warn strong { color: var(--tool-warn); }

.proof-line {
  margin-top: 16px !important;
  padding-top: 16px;
  border-top: 1px solid #e5e2dc;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.tool-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tool-aside ul {
  margin: 0;
  padding-left: 20px;
  color: #5c5c5c;
  line-height: 1.6;
}

.tool-aside li + li {
  margin-top: 8px;
}

.section-muted {
  background: #f1efe9;
}

.tool-note {
  margin: 24px 0 0;
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: reduce) {
  .tool-spinner,
  .tool-result.is-reveal {
    animation: none;
  }
}
