* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(29, 203, 255, 0.14), transparent 34rem),
    linear-gradient(145deg, #061017, #0b1a20 52%, #071116);
  color: #e8fbff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.75;
  overflow-x: hidden;
}

a {
  color: #74e8ff;
}

.lab-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.hero {
  padding: clamp(26px, 7vw, 70px) 0 clamp(18px, 5vw, 46px);
}

.series-label,
.panel-kicker,
.section-kicker {
  margin: 0 0 0.6rem;
  color: #6ee9ff;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.lead {
  width: min(760px, 100%);
  margin: 1rem 0 0;
  color: rgba(232, 251, 255, 0.78);
  font-size: clamp(1rem, 2.8vw, 1.25rem);
}

.intent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

.intent-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.28rem 0.72rem;
  border: 1px solid rgba(116, 232, 255, 0.22);
  border-radius: 999px;
  background: rgba(7, 18, 24, 0.74);
  color: rgba(232, 251, 255, 0.82);
  font-size: 0.86rem;
}

.tool-panel,
.info-card,
.network-series,
.comments-section,
.site-return-link,
.mothership-link {
  border: 1px solid rgba(116, 232, 255, 0.18);
  border-radius: 10px;
  background: rgba(7, 18, 24, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.tool-panel {
  padding: clamp(18px, 4vw, 30px);
}

.tool-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.tool-head h2,
.info-card h2,
.network-series h2 {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  letter-spacing: 0;
}

.state-badge {
  flex: 0 0 auto;
  padding: 0.32rem 0.65rem;
  border: 1px solid rgba(116, 232, 255, 0.28);
  border-radius: 6px;
  color: #82efff;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.state-badge.running {
  border-color: rgba(77, 255, 190, 0.45);
  color: #8fffd3;
}

.state-badge.warning {
  border-color: rgba(255, 210, 106, 0.55);
  color: #ffd26a;
}

.state-badge.danger {
  border-color: rgba(255, 106, 106, 0.58);
  color: #ff8c8c;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
  margin-top: 1.25rem;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0.78rem 1rem;
  background: linear-gradient(135deg, #19c8ff, #72ffd7);
  color: #031014;
  font-weight: 800;
  cursor: pointer;
}

button.ghost {
  border: 1px solid rgba(116, 232, 255, 0.28);
  background: rgba(6, 18, 24, 0.88);
  color: #e8fbff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.control-note {
  margin: 0.9rem 0 0;
  color: rgba(232, 251, 255, 0.68);
  font-size: 0.92rem;
}

.meter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.meter-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid rgba(116, 232, 255, 0.15);
  border-radius: 8px;
  background: rgba(1, 10, 14, 0.66);
}

.meter-card.primary {
  grid-column: span 2;
}

.meter-card span {
  display: block;
  color: rgba(116, 232, 255, 0.76);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.meter-card strong {
  display: block;
  margin-top: 0.28rem;
  color: #ffffff;
  font-size: clamp(1.4rem, 5vw, 2.25rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.meter-card small {
  display: block;
  margin-top: 0.35rem;
  color: rgba(232, 251, 255, 0.64);
}

.graph-wrap {
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid rgba(116, 232, 255, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(3, 11, 16, 0.86), rgba(4, 18, 24, 0.86));
}

canvas {
  display: block;
  width: 100%;
  height: 220px;
}

.result-note {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid rgba(116, 232, 255, 0.68);
  background: rgba(116, 232, 255, 0.08);
  color: rgba(232, 251, 255, 0.82);
}

.event-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(0, 6, 9, 0.55);
}

.event-panel h3 {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: #77ebff;
  letter-spacing: 0.08em;
}

.event-panel ul {
  display: grid;
  gap: 0.34rem;
  max-height: 10rem;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  color: rgba(232, 251, 255, 0.76);
  font-size: 0.9rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.info-card {
  padding: clamp(16px, 3vw, 24px);
}

.info-card.wide {
  grid-column: 1 / -1;
}

.info-card p,
.info-card li {
  color: rgba(232, 251, 255, 0.76);
}

.info-card ol,
.info-card ul {
  padding-left: 1.2rem;
}

.network-series {
  margin-top: 1rem;
  padding: clamp(16px, 3vw, 24px);
}

.network-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.network-link {
  display: block;
  min-width: 0;
  min-height: 5rem;
  padding: 0.85rem;
  border: 1px solid rgba(116, 232, 255, 0.16);
  border-radius: 8px;
  background: rgba(0, 8, 12, 0.56);
  text-decoration: none;
}

.network-link.current {
  border-color: rgba(255, 210, 106, 0.34);
  color: rgba(232, 251, 255, 0.8);
}

.network-link strong,
.network-link small {
  display: block;
  overflow-wrap: anywhere;
}

.network-link strong {
  color: #ffffff;
}

.network-link small {
  margin-top: 0.2rem;
  color: rgba(232, 251, 255, 0.62);
}

.comments-section {
  margin-top: 1rem;
  padding: clamp(14px, 3vw, 22px);
}

.comments-section #app-comments,
.comments-section .app-comments,
.comments-section .app-comment-form-section {
  background: rgba(5, 16, 21, 0.96);
  border-color: rgba(116, 232, 255, 0.18);
  color: #e8fbff;
}

.comments-section input,
.comments-section textarea,
.comments-section select {
  max-width: 100%;
}

.site-return-link,
.mothership-link {
  width: min(520px, 100%);
  margin: 1rem auto 0;
  padding: 1rem;
  text-align: center;
}

.site-return-link span,
.mothership-link span {
  display: block;
  color: rgba(116, 232, 255, 0.74);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.site-return-link a,
.mothership-link a {
  display: inline-block;
  margin-top: 0.18rem;
  font-weight: 800;
}

.site-return-link p,
.mothership-link p,
.lab-footer p {
  margin: 0.2rem 0 0;
  color: rgba(232, 251, 255, 0.62);
  font-size: 0.84rem;
}

.lab-footer {
  margin-top: 1.3rem;
  text-align: center;
}

@media (max-width: 760px) {
  .lab-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 22px;
  }

  .tool-head {
    display: block;
  }

  .state-badge {
    display: inline-flex;
    margin-top: 0.8rem;
  }

  .meter-grid,
  .info-grid,
  .network-links {
    grid-template-columns: 1fr;
  }

  .meter-card.primary {
    grid-column: auto;
  }

  button {
    flex: 1 1 9rem;
  }

  canvas {
    height: 190px;
  }
}
