:root {
  --pitch: #131922;
  --indigo: #7e51ff;
  --lime: #b6ff00;
  --white: #ffffff;
  --panel: rgba(19, 25, 34, 0.84);
  --line: rgba(126, 81, 255, 0.5);
  --danger: #ff4f7e;
}

* { box-sizing: border-box; }

body {
  position: relative;
  overflow-x: hidden;
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at 85% -5%, rgba(182, 255, 0, 0.14), transparent 36%),
    radial-gradient(circle at 0% 35%, rgba(126, 81, 255, 0.24), transparent 42%),
    linear-gradient(150deg, var(--pitch), #181f2b 72%, #111722);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0.34;
  background:
    linear-gradient(90deg, transparent 96%, rgba(126, 81, 255, 0.42) 96%),
    linear-gradient(180deg, transparent 96%, rgba(182, 255, 0, 0.24) 96%);
  background-size: 72px 72px;
  background-position: 0 0, 0 0;
  animation: gridflow 14s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
  background:
    radial-gradient(circle at 24px 24px, rgba(182, 255, 0, 0.78) 0 2px, transparent 3px),
    radial-gradient(circle at 160px 112px, rgba(126, 81, 255, 0.72) 0 2px, transparent 3px),
    linear-gradient(90deg, transparent 0 42%, rgba(126, 81, 255, 0.33) 48% 52%, transparent 58% 100%),
    linear-gradient(0deg, transparent 0 42%, rgba(182, 255, 0, 0.3) 48% 52%, transparent 58% 100%),
    linear-gradient(45deg, transparent 0 46%, rgba(126, 81, 255, 0.22) 49% 51%, transparent 54% 100%);
  background-size: 240px 240px, 240px 240px, 240px 240px, 240px 240px, 240px 240px;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  animation: dataflow 18s linear infinite;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(760px, 92vw);
  margin: 1.2rem auto 2.4rem;
  display: grid;
  gap: 1rem;
}

.stats-shell {
  width: min(1220px, 94vw);
}

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

.stats-panel-full {
  grid-column: 1 / -1;
}

.stats-panel-half {
  grid-column: span 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: rise 420ms ease both;
}

.glow {
  box-shadow: 0 0 30px rgba(126, 81, 255, 0.3);
}

h1, h2 {
  margin: 0 0 0.7rem;
  font-family: "Gabarito", sans-serif;
  letter-spacing: 0.03em;
  color: var(--white);
}

h1 { font-size: clamp(1.1rem, 4.4vw, 1.7rem); }
h2 { font-size: clamp(1rem, 3.8vw, 1.3rem); }

.eyebrow {
  margin: 0 0 0.45rem;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--indigo);
}

.brand-logo {
  display: block;
  width: 68px;
  height: auto;
  margin: 0 0 0.65rem;
}

label {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
  font-weight: 600;
  color: var(--lime);
}

input {
  border: 1px solid var(--line);
  background: rgba(9, 13, 19, 0.95);
  color: var(--white);
  padding: 0.6rem;
  border-radius: 10px;
}

button {
  background: linear-gradient(90deg, var(--indigo), #a768ff 56%, var(--lime));
  border: none;
  color: var(--pitch);
  font-weight: 700;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.06em;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid rgba(126, 81, 255, 0.3);
  padding: 0.42rem 0.24rem;
  text-align: left;
}

th {
  color: var(--lime);
  font-family: "Inter", sans-serif;
  font-weight: 600;
}

.status { color: var(--indigo); }
.error { color: var(--danger); min-height: 1.2rem; }
.hidden { display: none; }

.stats-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.stats-controls select {
  border: 1px solid var(--line);
  background: rgba(9, 13, 19, 0.95);
  color: var(--white);
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.stats-card {
  border: 1px solid rgba(126, 81, 255, 0.35);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(10, 14, 22, 0.7);
}

.stats-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--lime);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.result-code-legend {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.legend-chip {
  border: 1px solid;
  border-radius: 999px;
  padding: 0.24rem 0.58rem;
  background: rgba(8, 12, 20, 0.7);
  color: var(--white);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.legend-chip-inactive {
  opacity: 0.42;
}

.legend-chip-clear {
  border-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.92);
}

.trend-chart {
  width: 100%;
  height: 220px;
  border: 1px solid rgba(126, 81, 255, 0.28);
  border-radius: 10px;
  background: rgba(5, 9, 16, 0.6);
}

.cookie-notice {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 24px));
  z-index: 9999;
  background: rgba(11, 15, 24, 0.96);
  border: 1px solid rgba(126, 81, 255, 0.45);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
  padding: 0.8rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.cookie-notice.hidden {
  display: none;
}

.cookie-notice p {
  margin: 0;
  color: var(--white);
  font-size: 0.92rem;
  line-height: 1.3;
}

.cookie-notice button {
  white-space: nowrap;
}

@media (max-width: 620px) {
  .cookie-notice {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 920px) {
  .stats-shell {
    width: min(760px, 92vw);
  }

  .stats-panels {
    grid-template-columns: 1fr;
  }

  .stats-panel-full,
  .stats-panel-half {
    grid-column: 1;
  }
}

@keyframes rise {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes gridflow {
  from { background-position: 0 0, 0 0; }
  to { background-position: -72px 0, 0 -72px; }
}

@keyframes dataflow {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: -240px 0, 0 -240px, -240px 0, 0 -240px, -240px -240px; }
}
