*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --up: #4ade80;
  --up-dim: rgba(74, 222, 128, 0.15);
  --down: #f87171;
  --down-dim: rgba(248, 113, 113, 0.15);
  --card-bg: rgba(7, 7, 14, 0.87);
  --border: rgba(255, 255, 255, 0.07);
  --text: #e8e8f0;
  --muted: #8888a0;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: url('https://cdn.quietterminal.co.uk/misc/DarkBackground.png') center/cover fixed no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  color: var(--text);
}

a {
  color: #93c5fd;
  text-decoration: none;
}

a:hover {
  color: #bfdbfe;
  text-decoration: underline;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 740px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.creeper-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

.header-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.header-text p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.status-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 20px;
}

.status-hero.is-up {
  border-color: rgba(74, 222, 128, 0.25);
  background: var(--up-dim);
}

.status-hero.is-down {
  border-color: rgba(248, 113, 113, 0.25);
  background: var(--down-dim);
}

.pulse-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--up);
  opacity: 0;
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.pulse-ring.down::before {
  background: var(--down);
}

.pulse-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--up);
  position: relative;
  z-index: 1;
  box-shadow: 0 0 12px var(--up);
}

.pulse-dot.down {
  background: var(--down);
  box-shadow: 0 0 12px var(--down);
}

.pulse-ring.down::before {
  animation: none;
  opacity: 0.25;
}

@keyframes ping {

  75%,
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.status-label {
  flex: 1;
}

.status-label .main {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.status-label .sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}

.status-code-badge {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.stat-box:hover {
  background: var(--surface-hover);
}

.stat-box .val {
  font-size: 1.55rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-box .val.up {
  color: var(--up);
}

.stat-box .val.down {
  color: var(--down);
}

.stat-box .label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title span {
  font-size: 0.68rem;
}

.timeline-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.timeline-bars {
  display: flex;
  gap: 3px;
  height: 36px;
  align-items: stretch;
  overflow: hidden;
}

.t-bar {
  flex: 1;
  min-width: 4px;
  border-radius: 3px;
  background: #2a2a3a;
  cursor: pointer;
  position: relative;
}

.t-bar.up {
  background: var(--up);
}

.t-bar.down {
  background: var(--down);
}

.t-bar:hover {
  filter: brightness(1.3);
  transform: scaleY(1.08);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.timeline-labels span {
  font-size: 0.68rem;
  color: var(--muted);
}

#tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(10, 10, 20, 0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--text);
  z-index: 999;
  opacity: 0;
  white-space: nowrap;
}

#tooltip.show {
  opacity: 1;
}

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

#rt-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.checks-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.check-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.check-row:last-child {
  border-bottom: none;
}

.check-row:hover {
  background: var(--surface-hover);
}

.check-time {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.check-code {
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.check-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.check-badge.up {
  background: var(--up-dim);
  color: var(--up);
}

.check-badge.down {
  background: var(--down-dim);
  color: var(--down);
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.73rem;
  color: var(--muted);
}

.js-only {
  display: none;
}

.js .js-only {
  display: flex;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clock-toggle {
  font-size: 0.68rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.6;
}

.clock-toggle:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.refresh-timer {
  display: flex;
  align-items: center;
  gap: 6px;
}

.refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
  animation: pulse-slow 2s ease-in-out infinite;
}

.readme-button {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(17, 24, 39, 0.8);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.readme-button:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(30, 41, 59, 0.9);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(92vw, 420px);
  background: rgba(10, 12, 24, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 22px 20px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  z-index: 1;
}

.modal-card h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.modal-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.modal-card p:last-of-type {
  margin-bottom: 0;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

@keyframes pulse-slow {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .card {
    padding: 24px 18px;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-box .val {
    font-size: 1.2rem;
  }

  .stat-box {
    padding: 12px 8px;
  }

  .header-text h1 {
    font-size: 1rem;
  }

  .status-hero {
    padding: 16px;
  }

  .status-label .main {
    font-size: 1.05rem;
  }

  .check-row {
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }

  .check-time {
    font-size: 0.72rem;
  }

  .readme-button {
    right: 10px;
    padding: 8px 10px;
    font-size: 0.7rem;
  }
}
