:root {
  --bg: #0e0f13;
  --bg-card: #1a1c23;
  --bg-card-hover: #20232c;
  --border: #2a2d37;
  --text: #e7e8ec;
  --text-dim: #9a9ca6;
  --accent: #5865f2; /* discord blurple */
  --accent-hover: #4752c4;
  --green: #3ba55d;
  --red: #ed4245;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #15171f 0%, #0e0f13 60%);
  color: var(--text);
  line-height: 1.5;
}

.hero {
  text-align: center;
  padding: 64px 20px 40px;
}

.hero h1 {
  font-size: 2.6rem;
  margin: 0 0 8px;
  background: linear-gradient(90deg, #8ea1ff, #5865f2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--text-dim);
  margin: 0 0 24px;
}

.discord-cta {
  display: inline-block;
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 20px rgba(88,101,242,.35);
}

.discord-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(88,101,242,.5);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: background .15s ease, transform .15s ease;
  display: flex;
  flex-direction: column;
}

.card.available { border-left-color: var(--green); }

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Skeleton loading state — shown instantly on page load instead of a blank
   grid, so it never feels "stuck" while the API call is in flight. */
.card.skeleton {
  min-height: 168px;
  border-left-color: var(--border);
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

.card.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255,255,255,.04) 50%,
    transparent 70%
  );
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

.card-icon.available {
  background: rgba(59,165,93,.15);
  color: var(--green);
}

.card-icon.unavailable {
  background: rgba(237,66,69,.15);
  color: var(--red);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.status-pill {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill.unavailable {
  background: rgba(237,66,69,.15);
  color: var(--red);
}

.status-pill.available {
  background: rgba(59,165,93,.15);
  color: var(--green);
}

.card p.desc {
  color: var(--text-dim);
  font-size: .92rem;
  margin: 8px 0 14px;
  flex-grow: 1;
}

/* "Join / Open" — now a full, prominent button instead of a small text link */
.card a.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  font-size: 1rem;
  color: white;
  background: var(--accent);
  text-decoration: none;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: 10px;
  margin-top: auto;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 16px rgba(88,101,242,.3);
}

.card a.link-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(88,101,242,.45);
}

.card a.link-btn svg {
  width: 16px;
  height: 16px;
}

.card .unavailable-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--red);
  background: rgba(237,66,69,.1);
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 13px 18px;
  border-radius: 10px;
  margin-top: auto;
}

.info-banner {
  max-width: 800px;
  margin: 10px auto 50px;
  padding: 18px 24px;
  background: rgba(88,101,242,.08);
  border: 1px solid rgba(88,101,242,.25);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: .94rem;
  text-align: center;
}

.info-banner a { color: var(--accent); font-weight: 600; text-decoration: none; }
.info-banner a:hover { text-decoration: underline; }

.webhook-section {
  max-width: 600px;
  margin: 0 auto 70px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.webhook-section h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

.webhook-section > p {
  color: var(--text-dim);
  font-size: .92rem;
}

#webhookForm label {
  display: block;
  font-size: .82rem;
  color: var(--text-dim);
  margin: 14px 0 6px;
}

#webhookForm input,
#webhookForm select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #11131a;
  color: var(--text);
  font-size: .92rem;
}

#webhookForm input:focus,
#webhookForm select:focus {
  outline: none;
  border-color: var(--accent);
}

#webhookForm select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.form-actions button {
  flex: 1;
  padding: 11px 14px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: .9rem;
  transition: opacity .15s ease;
}

#webhookForm button[type="submit"] {
  background: var(--accent);
  color: white;
}

#testWebhookBtn {
  background: #2a2d37;
  color: var(--text);
}

.form-actions button:hover { opacity: .85; }

#watchList {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.watch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #11131a;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .85rem;
}

.watch-item button {
  background: transparent;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-weight: 700;
}

.fine-print {
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: 18px;
}

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: .8rem;
  padding: 20px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1c23;
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: .85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 100;
}

.toast.show { opacity: 1; }

/* Admin page extras */
.admin-current {
  font-size: .82rem;
  color: var(--text-dim);
  margin-top: -4px;
}

.admin-current .live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
}

.admin-current .live-dot.up { background: var(--green); }
.admin-current .live-dot.down { background: var(--red); }
