:root {
  --n-paper: #f8f4ea;
  --n-surface: #fffdf7;
  --n-ink: #22241f;
  --n-muted: #686c61;
  --n-line: #d8d4c8;
  --n-accent: #cb3d2f;
  --n-accent-dark: #8e201b;
  --n-yellow: #e5aa31;
  --n-green: #3b7561;
  --n-shadow: #b8b1a1;
}

.theme-dark {
  --n-paper: #20231f;
  --n-surface: #2a2e28;
  --n-ink: #f2eee3;
  --n-muted: #b9b8aa;
  --n-line: #52584e;
  --n-accent: #f07c68;
  --n-accent-dark: #ffad93;
  --n-yellow: #edc35b;
  --n-green: #84c8a7;
  --n-shadow: #11130f;
}

.pet-toxicity {
  --n-card: var(--n-surface);
  --n-card-strong: var(--n-paper);
  --n-danger-surface: #f7dfd6;
  --n-caution-surface: #f5edcf;
  --n-safe-surface: #dbece1;

  background: var(--n-paper);
  border: 1px solid var(--n-line);
  box-sizing: border-box;
  border-radius: 1.25rem;
  box-shadow: 0.4rem 0.4rem 0 var(--n-shadow);
  color: var(--n-ink);
  max-width: 70rem;
  min-width: 0;
  overflow: visible;
  padding: clamp(1rem, 3vw, 2rem);
}

.theme-dark .pet-toxicity {
  --n-danger-surface: #512d2a;
  --n-caution-surface: #4d4021;
  --n-safe-surface: #244035;
}

.pet-toxicity-journey {
  align-items: center;
  border-bottom: 1px solid var(--n-line);
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
}

.pet-toxicity-journey p {
  margin: 0;
  max-width: 52rem;
}

.pet-toxicity-journey-mark {
  align-items: center;
  background: var(--n-accent);
  border: 2px solid var(--n-ink);
  border-radius: 50%;
  color: var(--n-surface);
  display: inline-flex;
  flex: 0 0 2rem;
  font-size: 1.25rem;
  font-weight: 800;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.pet-toxicity-workbench {
  align-items: stretch;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(15rem, 0.7fr) minmax(20rem, 1.3fr);
}

.pet-toxicity-controls {
  background: var(--n-card);
  border: 1px solid var(--n-line);
  border-radius: 1rem;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.pet-toxicity-control {
  display: grid;
  gap: 0.45rem;
}

.pet-toxicity-label,
.pet-toxicity-eyebrow {
  color: var(--n-muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pet-toxicity-select {
  position: relative;
}

.pet-toxicity-select-trigger {
  align-items: center;
  background: var(--n-card-strong);
  border: 1px solid var(--n-line);
  border-radius: 0.7rem;
  color: var(--n-ink);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 700;
  justify-content: space-between;
  min-height: 3.2rem;
  padding: 0.7rem 0.8rem;
  text-align: left;
  width: 100%;
}

.pet-toxicity-select-trigger:focus-visible,
.pet-toxicity-menu-option:focus-visible {
  outline: 3px solid var(--n-yellow);
  outline-offset: 2px;
}

.pet-toxicity-chevron {
  border-bottom: 2px solid currentcolor;
  border-right: 2px solid currentcolor;
  height: 0.55rem;
  transform: rotate(45deg) translateY(-0.15rem);
  width: 0.55rem;
}

.pet-toxicity-menu {
  background: var(--n-card);
  border: 1px solid var(--n-line);
  border-radius: 0.7rem;
  box-shadow: 0.25rem 0.25rem 0 var(--n-shadow);
  display: grid;
  gap: 0.25rem;
  left: 0;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.35rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 3;
}

.pet-toxicity-menu[hidden] {
  display: none;
}

.pet-toxicity-menu-option {
  background: transparent;
  border: 0;
  border-radius: 0.5rem;
  color: var(--n-ink);
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem;
  text-align: left;
}

.pet-toxicity-menu-option:hover,
.pet-toxicity-menu-option[data-selected="true"] {
  background: var(--n-danger-surface);
}

.pet-toxicity-menu-option small,
.pet-toxicity-hint {
  color: var(--n-muted);
  font-size: 0.78rem;
}

.pet-toxicity-hint {
  line-height: 1.4;
}

.pet-toxicity-visual {
  min-width: 0;
}

.pet-toxicity-scene-card {
  background: var(--n-card);
  border: 1px solid var(--n-line);
  border-radius: 1rem;
  display: grid;
  grid-template-rows: auto auto;
  overflow: hidden;
}

.pet-toxicity-scene-copy {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  padding: 1rem 1rem 0.75rem;
}

.pet-toxicity-scene-copy strong {
  font-size: clamp(1.3rem, 3vw, 2rem);
  overflow-wrap: anywhere;
}

.pet-toxicity-scene-copy span:last-child {
  color: var(--n-muted);
  font-size: 0.85rem;
}

.pet-toxicity-scene {
  display: block;
  height: clamp(12rem, 23vw, 16rem);
  width: 100%;
}

.pet-toxicity-scene-paper {
  fill: var(--n-card-strong);
  stroke: var(--n-line);
  stroke-width: 1;
}

.pet-toxicity-scene-line {
  fill: none;
  stroke: var(--n-accent);
  stroke-linecap: round;
  stroke-width: 3;
}

.pet-toxicity-scene-line-thin {
  opacity: 0.55;
  stroke: var(--n-green);
  stroke-width: 2;
}

.pet-toxicity-marker {
  fill: var(--n-accent);
  stroke: var(--n-card);
  stroke-width: 3;
}

.pet-toxicity-marker-critical { fill: var(--n-accent-dark); }
.pet-toxicity-marker-caution { fill: var(--n-yellow); }
.pet-toxicity-marker-empty { fill: var(--n-line); }

.pet-toxicity-scene-seal {
  fill: var(--n-accent);
  stroke: var(--n-ink);
  stroke-width: 2;
}

.pet-toxicity-scene-seal-mark {
  fill: none;
  stroke: var(--n-surface);
  stroke-linecap: round;
  stroke-width: 2;
}

.pet-toxicity-scene-seal-dot {
  fill: var(--n-surface);
}

.pet-toxicity-result {
  margin-top: 1rem;
}

.pet-toxicity-result-card,
.pet-toxicity-result-empty,
.pet-toxicity-emergency,
.pet-toxicity-sources {
  background: var(--n-card);
  border: 1px solid var(--n-line);
  border-radius: 1rem;
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.pet-toxicity-result-card-critical,
.pet-toxicity-result-card-high {
  border-top: 0.35rem solid var(--n-accent);
}
.pet-toxicity-result-card-caution { border-top: 0.35rem solid var(--n-yellow); }

.pet-toxicity-result-head {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.pet-toxicity-risk-status {
  align-items: end;
  display: grid;
  gap: 0.35rem;
  justify-items: end;
}

.pet-toxicity-risk {
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.35rem 0.6rem;
  text-transform: uppercase;
}

.pet-toxicity-risk-critical,
.pet-toxicity-risk-high {
  background: var(--n-danger-surface);
  color: var(--n-accent-dark);
}
.pet-toxicity-risk-caution {
  background: var(--n-caution-surface);
  color: var(--n-ink);
}

.pet-toxicity-risk-meter {
  display: flex;
  gap: 0.2rem;
}

.pet-toxicity-risk-meter span {
  background: var(--n-line);
  border-radius: 99px;
  height: 0.28rem;
  width: 1.25rem;
}

.pet-toxicity-risk-meter span.is-active {
  background: var(--n-accent);
}

.pet-toxicity-result-card-caution .pet-toxicity-risk-meter span.is-active {
  background: var(--n-yellow);
}

.pet-toxicity-result-card h3 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0.7rem 0 0.3rem;
}

.pet-toxicity-summary {
  font-size: 1.05rem;
  margin: 0;
}

.pet-toxicity-result-grid {
  border-top: 1px solid var(--n-line);
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.pet-toxicity-result-grid p { margin: 0.45rem 0 0; }

.pet-toxicity-sign-list {
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
}

.pet-toxicity-sign-list li {
  align-items: center;
  background: var(--n-card-strong);
  border: 1px solid var(--n-line);
  border-radius: 0.65rem;
  display: flex;
  gap: 0.55rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.55rem;
}

.pet-toxicity-sign-icon {
  align-items: center;
  background: var(--n-danger-surface);
  border-radius: 50%;
  color: var(--n-accent-dark);
  display: inline-flex;
  flex: 0 0 1.55rem;
  height: 1.55rem;
  justify-content: center;
  width: 1.55rem;
}

.pet-toxicity-sign-icon svg {
  fill: none;
  height: 1rem;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  width: 1rem;
}

.pet-toxicity-sign-icon circle {
  fill: currentcolor;
  stroke: none;
}
.pet-toxicity-action { grid-column: 1 / -1; }

.pet-toxicity-callout,
.pet-toxicity-emergency {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
}

.pet-toxicity-callout {
  background: var(--n-danger-surface);
  border-radius: 0.7rem;
  padding: 0.8rem;
}
.pet-toxicity-emergency {
  background: var(--n-danger-surface);
  border-color: var(--n-accent);
}
.pet-toxicity-emergency strong { color: var(--n-accent-dark); }

.pet-toxicity-sources { margin-top: 1rem; }
.pet-toxicity-sources p { margin: 0.45rem 0 0; }

@media (max-width: 48rem) {
  .pet-toxicity {
    max-width: calc(100vw - 3rem);
    width: calc(100vw - 3rem);
  }

  .pet-toxicity-workbench,
  .pet-toxicity-result-grid { grid-template-columns: 1fr; }
  .pet-toxicity-action { grid-column: auto; }

  .pet-toxicity-result-head { align-items: start; }
  .pet-toxicity-risk-status { flex: 0 0 auto; }
}
