@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Atkinson Hyperlegible'), local('Atkinson Hyperlegible Regular');
}

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Open Sans'), local('OpenSans-Regular');
}

:root {
  color-scheme: dark;
  --bg: #05070b;
  --bg-alt: #070a10;
  --surface: #0f141c;
  --surface-hover: #151c27;
  --gridline: rgba(255, 255, 255, 0.035);
  --text-primary: #f3f6fb;
  --text-secondary: #8a94a7;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.2);
  --success: #3bceac;
  --danger: #ff8f8f;
}

body.theme-light {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-alt: #eef2f7;
  --surface: #ffffff;
  --surface-hover: #f4f6fb;
  --gridline: rgba(0, 0, 0, 0.05);
  --text-primary: #0b1020;
  --text-secondary: #5f6b7a;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.18);
  --success: #0d9488;
  --danger: #d14343;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(88, 166, 255, 0.08), transparent 55%),
              radial-gradient(circle at bottom left, rgba(59, 206, 172, 0.07), transparent 45%),
              var(--bg);
  color: var(--text-primary);
  font-family: 'Atkinson Hyperlegible', 'Open Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  padding: clamp(2rem, 5vw, 3.5rem);
  padding-top: 4.5rem;
}

.banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: linear-gradient(90deg, rgba(88, 166, 255, 0.16), rgba(37, 99, 235, 0.2));
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  align-items: center;
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.banner__link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.banner__link:hover {
  text-decoration: underline;
}

main {
  width: min(1000px, 100%);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2.25rem;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
      90deg,
      transparent,
      transparent 96px,
      var(--gridline) 96px,
      var(--gridline) 97px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 96px,
      var(--gridline) 96px,
      var(--gridline) 97px
    );
  mask: linear-gradient(180deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.2));
  pointer-events: none;
  z-index: 0;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.wordmark .mark {
  font-size: 1.75rem;
  color: var(--accent);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(88, 166, 255, 0.2);
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 3vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 580px;
}

.theme-toggle {
  border: 1px solid var(--accent-soft);
  background: var(--surface);
  color: var(--accent);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(-10deg) scale(1.05);
  border-color: rgba(88, 166, 255, 0.4);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.card {
  position: relative;
  background: linear-gradient(135deg, var(--surface), var(--surface-hover));
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: clamp(1.7rem, 3vw, 2.2rem);
  display: grid;
  gap: 1rem;
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  overflow: hidden;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.card::before {
  content: '';
  position: absolute;
  inset: -60% 30% auto -30%;
  background: radial-gradient(
    circle,
    rgba(88, 166, 255, 0.16) 0%,
    rgba(88, 166, 255, 0) 60%
  );
  opacity: 0;
  transition: opacity 200ms ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 28px 60px rgba(4, 12, 23, 0.6);
}

.card.error {
  border-color: rgba(255, 143, 143, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 143, 143, 0.12), 0 18px 40px rgba(37, 8, 8, 0.35);
}

.card.error .value {
  color: var(--danger);
}

.card:hover::before,
.card:focus-visible::before {
  opacity: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.card h2,
.card h3 {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 1.05rem;
  position: relative;
}

.card h2::after,
.card h3::after {
  content: '';
  display: block;
  margin-top: 0.55rem;
  width: 42px;
  height: 2px;
  background: linear-gradient(90deg, rgba(88, 166, 255, 0.8), transparent);
  border-radius: 999px;
}

.info {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: help;
}

.value {
  margin: 0;
  font-family: 'Open Sans', 'Atkinson Hyperlegible', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-feature-settings: "tnum" 1, "ss02" 1;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.delta {
  font-family: 'Open Sans', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  color: var(--accent);
  opacity: 0.85;
}

.timestamp,
.subtext {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-family: 'Open Sans', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.footer .meta {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.5s infinite ease-in-out;
}

.footer.error {
  color: var(--danger);
}

.footer.error .pulse {
  background: var(--danger);
}

.card.copied {
  box-shadow: 0 0 0 3px var(--accent-soft), 0 12px 40px rgba(88, 166, 255, 0.25);
}

.tooltip {
  position: fixed;
  max-width: 260px;
  background: rgba(10, 14, 20, 0.95);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
  z-index: 10;
}

.toast {
  position: fixed;
  bottom: clamp(1.5rem, 5vw, 2.5rem);
  right: clamp(1.5rem, 5vw, 2.5rem);
  background: rgba(8, 12, 18, 0.94);
  border: 1px solid rgba(88, 166, 255, 0.36);
  border-radius: 12px;
  padding: 0.85rem 1.2rem;
  font-size: 0.9rem;
  color: var(--accent);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.countdown__value {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.status__details {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}

.attempts {
  position: fixed;
  bottom: clamp(1rem, 4vw, 2rem);
  left: clamp(1rem, 4vw, 2rem);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  width: min(320px, 90vw);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  color: var(--text-primary);
  z-index: 15;
}

.attempts h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--accent);
}

.attempts ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.attempts li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.attempts li.ok {
  color: var(--text-primary);
}

.attempts li .source {
  font-weight: 600;
}

.attempts li .meta {
  font-family: 'Open Sans', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .pulse,
  .toast {
    transition: none;
    animation: none;
  }
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.pulse.flash {
  animation: flash 0.6s ease;
}

@keyframes flash {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}
