:root {
  --bg-0: #071018;
  --bg-1: #0d1b2a;
  --ink: #e8f1f8;
  --muted: #8fa6b8;
  --line: rgba(232, 241, 248, 0.12);
  --up: #2dd4a8;
  --up-soft: rgba(45, 212, 168, 0.14);
  --down: #ff6b6b;
  --down-soft: rgba(255, 107, 107, 0.14);
  --unknown: #c9a227;
  --unknown-soft: rgba(201, 162, 39, 0.14);
  --accent: #3ec6ff;
  --accent-2: #1f9fd6;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Sora", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(62, 198, 255, 0.22), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(45, 212, 168, 0.12), transparent 50%),
    linear-gradient(165deg, var(--bg-0), var(--bg-1) 45%, #0a1622 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(232, 241, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 241, 248, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 85%);
}

.shell {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: calc(2.5rem + env(safe-area-inset-top)) 0
    calc(3rem + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: rise 0.7s ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(62, 198, 255, 0.28);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #041018;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-sub {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.pill {
  flex: none;
  appearance: none;
  cursor: pointer;
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  border: 1px solid rgba(62, 198, 255, 0.45);
  background: rgba(62, 198, 255, 0.12);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 650;
  transition: background 0.2s ease, transform 0.15s ease;
}

.pill:hover {
  background: rgba(62, 198, 255, 0.2);
}

.pill:active {
  transform: translateY(1px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  animation: rise 0.75s ease 0.05s both;
}

.stat {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(13, 27, 42, 0.55);
  backdrop-filter: blur(10px);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

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

.panel {
  background: linear-gradient(180deg, rgba(18, 48, 71, 0.55), rgba(13, 27, 42, 0.72));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  animation: rise 0.85s ease 0.1s both;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

.link-btn {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.88rem;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn:disabled {
  opacity: 0.5;
  cursor: progress;
  text-decoration: none;
}

.site-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.site-item:last-child {
  border-bottom: none;
}

.site-main {
  min-width: 0;
}

.site-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-url {
  margin-top: 0.2rem;
  font-size: 0.86rem;
  word-break: break-all;
}

.site-url a {
  color: var(--muted);
  text-decoration: none;
}

.site-url a:hover {
  color: var(--accent);
}

.site-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-meta .sep {
  opacity: 0.45;
  padding: 0 0.4rem;
}

.site-meta .fail {
  color: var(--down);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 5.5rem;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 2s ease infinite;
}

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

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

.badge.unknown {
  color: var(--unknown);
  background: var(--unknown-soft);
}

.actions {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.75rem;
  animation: rise 0.9s ease 0.15s both;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 100%;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 650;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #041018;
  background: linear-gradient(135deg, var(--accent), #6ad7ff 45%, var(--accent-2));
  box-shadow: 0 14px 34px rgba(62, 198, 255, 0.28);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: rgba(62, 198, 255, 0.45);
}

.status-line {
  margin: 0.25rem 0 0;
  min-height: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.status-line.ok {
  color: var(--up);
}

.status-line.err {
  color: var(--down);
}

.foot {
  margin-top: 1.75rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 12, 20, 0.72);
  backdrop-filter: blur(6px);
}

.sheet.is-open {
  display: grid;
  animation: fade 0.2s ease both;
}

/* Ensure [hidden] always wins over display utilities */
.sheet[hidden] {
  display: none !important;
}

.sheet-card {
  width: min(460px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #10283c, #0b1a28);
  box-shadow: var(--shadow);
  animation: rise 0.3s ease both;
}

.sheet-card h3 {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.steps {
  margin-bottom: 1.1rem;
}

.steps-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--accent);
}

.steps ol {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.steps strong {
  color: var(--ink);
  font-weight: 600;
}

.note {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--unknown-soft);
  color: var(--unknown);
  font-size: 0.84rem;
  line-height: 1.5;
}

.skeleton .site-name,
.skeleton .site-url,
.skeleton .site-meta,
.skeleton .badge {
  color: transparent !important;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 8px;
}

.skeleton .badge::before {
  display: none;
}

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 currentColor;
    opacity: 1;
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
    opacity: 0.85;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
    opacity: 1;
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 560px) {
  .shell {
    padding-top: calc(1.75rem + env(safe-area-inset-top));
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .site-item {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}
