:root {
  --bg-ink: #091c1f;
  --bg-deep: #071116;
  --panel: rgba(8, 27, 34, 0.76);
  --panel-line: rgba(110, 184, 172, 0.22);
  --mint: #8df7d7;
  --mint-strong: #4fd1b6;
  --ember: #ffb27e;
  --text-main: #ecfffa;
  --text-soft: #a4c8c1;
  --danger: #ff8975;
  --shadow: 0 14px 42px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(92, 219, 193, 0.18), transparent 45%),
    radial-gradient(1000px 600px at 110% 10%, rgba(255, 178, 126, 0.2), transparent 45%),
    linear-gradient(150deg, var(--bg-ink), var(--bg-deep));
  position: relative;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 82% 78%, rgba(141, 247, 215, 0.12), transparent 38%),
    radial-gradient(circle at 14% 28%, rgba(255, 178, 126, 0.09), transparent 40%);
  filter: blur(6px);
}

.layout {
  width: min(1180px, 95vw);
  margin: 24px auto 48px;
  display: grid;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--mint);
}

h1 {
  margin: 6px 0 6px;
  font-size: clamp(1.75rem, 2.8vw, 2.8rem);
  line-height: 1.08;
}

.subtitle {
  margin: 0;
  color: var(--text-soft);
  max-width: 700px;
}

.status-wrap {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.badge,
.clock {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(11, 35, 40, 0.75);
}

.badge.firebase {
  border-color: rgba(141, 247, 215, 0.4);
  color: var(--mint);
}

.badge.local {
  border-color: rgba(255, 178, 126, 0.5);
  color: var(--ember);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.form-panel {
  padding: 18px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-title-row h2,
.stat-card h3 {
  margin: 0;
}

.link-form label {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.form-row {
  display: flex;
  gap: 10px;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(149, 220, 207, 0.36);
  background: rgba(9, 32, 37, 0.9);
  color: var(--text-main);
  padding: 12px;
  outline: none;
}

input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(141, 247, 215, 0.2);
}

button {
  border: none;
  border-radius: 12px;
  padding: 0 16px;
  min-height: 44px;
  cursor: pointer;
  color: #04221f;
  font-weight: 700;
  background: linear-gradient(135deg, var(--mint), #57d8be);
  transition: transform 0.18s ease, filter 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

button.ghost {
  color: var(--text-main);
  background: rgba(19, 48, 55, 0.9);
  border: 1px solid rgba(123, 190, 178, 0.32);
}

button.mini {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

button.danger {
  color: #ffd8d1;
  background: rgba(79, 23, 27, 0.95);
  border: 1px solid rgba(255, 138, 120, 0.45);
}

button.danger:hover {
  filter: brightness(1.08);
}

.generated {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(111, 198, 179, 0.28);
  background: rgba(8, 38, 44, 0.7);
}

.generated p {
  margin: 0 0 8px;
  color: var(--text-soft);
}

.generated-block + .generated-block {
  margin-top: 12px;
}

.copy-row {
  display: flex;
  gap: 10px;
}

.hidden {
  display: none;
}

.message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(141, 247, 215, 0.35);
  background: rgba(6, 34, 38, 0.85);
}

.message.error {
  color: #ffd9d3;
  border-color: rgba(255, 137, 117, 0.6);
  background: rgba(50, 20, 22, 0.82);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 16px;
}

.stat-card h3 {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
}

.stat-card p {
  margin: 8px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  font-weight: 700;
}

.split {
  display: grid;
  grid-template-columns: 1.28fr 1fr;
  gap: 12px;
}

.split .panel {
  padding: 16px;
  min-height: 360px;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(114, 192, 177, 0.18);
  vertical-align: top;
}

th {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--mint);
  word-break: break-all;
}

.small {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
}

.action-grid {
  display: grid;
  gap: 8px;
}

.hits-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
}

.hit-item {
  border: 1px solid rgba(106, 176, 164, 0.26);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(8, 37, 41, 0.72);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.hit-item:hover {
  border-color: rgba(141, 247, 215, 0.42);
}

.hit-item:focus {
  outline: 2px solid rgba(141, 247, 215, 0.5);
  outline-offset: 2px;
}

.hit-item.active {
  border-color: rgba(141, 247, 215, 0.58);
  transform: translateY(-1px);
}

.hit-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.hit-title {
  margin: 0;
  font-size: 14px;
  color: var(--mint);
  font-family: "IBM Plex Mono", monospace;
}

.hit-time {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
}

.hit-agent {
  margin: 7px 0 0;
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.4;
}

.hit-details {
  margin-top: 12px;
  border: 1px solid rgba(117, 191, 177, 0.28);
  border-radius: 12px;
  padding: 12px;
  background: rgba(7, 35, 39, 0.72);
}

.hit-details h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.hit-details p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--text-soft);
}

.ua-pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid rgba(110, 184, 172, 0.26);
  border-radius: 10px;
  background: rgba(9, 32, 37, 0.82);
  color: var(--text-main);
  padding: 10px;
  font-size: 12px;
  line-height: 1.4;
  font-family: "IBM Plex Mono", monospace;
}

.fade-up {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 520ms ease forwards;
}

.fade-up.delay-1 {
  animation-delay: 70ms;
}

.fade-up.delay-2 {
  animation-delay: 130ms;
}

.fade-up.delay-3 {
  animation-delay: 170ms;
}

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

@media (max-width: 980px) {
  .hero {
    flex-direction: column;
  }

  .status-wrap {
    justify-items: start;
  }

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

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .layout {
    width: min(98vw, 760px);
    margin: 14px auto 28px;
  }

  .form-row,
  .copy-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
