:root {
  /* Prodigy RP palette — lime-green on near-black (matches prodigyrp.net) */
  --bg: #0c0f14;
  --bg-soft: #11151b;
  --card: #161b24;
  --card-hover: #1c222d;
  --border: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --accent: #88e52b;          /* signature Prodigy lime */
  --accent-2: #aef25b;        /* lighter lime for gradients/highlights */
  --accent-deep: #50c878;     /* emerald, secondary */
  --accent-tint: rgba(46, 56, 39, 0.5); /* olive-tinted surface */
  --on-accent: #0c0f14;       /* text/icon color on green fills */
  --twitch: #9146ff;
  --kick: #53fc18;
  --live: #ff3b5c;
  --ok: #88e52b;
  --danger: #ff5a6e;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(900px 500px at 50% -15%, rgba(136, 229, 43, 0.12) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent-2); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  padding: 38px 0 18px;
  text-align: center;
}
.brand {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
  background: linear-gradient(90deg, #ffffff 0%, var(--accent-2) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 24px rgba(136, 229, 43, 0.25);
}
.tagline { color: var(--muted); margin: 8px 0 0; font-size: 1rem; }
.disclaimer { color: var(--muted); margin: 6px 0 0; font-size: 0.8rem; opacity: 0.8; }
.meta-row {
  margin-top: 14px;
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.live { background: var(--live); box-shadow: 0 0 8px var(--live); }
.dot.off { background: #4a4f60; }

/* ── Search ─────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  max-width: 560px;
  margin: 26px auto 4px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.7;
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 12px 40px 12px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
}
#search::placeholder { color: var(--muted); }
#search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(136, 229, 43, 0.15);
}
#search::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1;
}
.search-clear:hover { color: var(--text); }

/* ── Grid of streamers ──────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding: 22px 0 60px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--card-hover); }
.card.offline { opacity: 0.72; }

.thumb-wrap { position: relative; aspect-ratio: 16 / 9; background: var(--bg-soft); }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 800;
  color: rgba(136, 229, 43, 0.45);
  background: linear-gradient(135deg, var(--accent-tint), var(--bg-soft));
}

.badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge.live { background: var(--live); color: #fff; }
.badge.offline { background: rgba(0,0,0,0.6); color: var(--muted); }
.viewers {
  position: absolute;
  bottom: 10px; right: 10px;
  background: rgba(0,0,0,0.7);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.platform-tag {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}
.platform-tag.twitch { background: var(--twitch); color: #fff; }
.platform-tag.kick { background: var(--kick); color: #0a0a0a; }

.thumb-link { display: block; text-decoration: none; }
.card-body { padding: 14px 16px 16px; }
.card-name { font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }

/* Job / gang chips */
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.meta-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.meta-chip.job { color: #6fd0ff; background: rgba(111, 208, 255, 0.1); border-color: rgba(111, 208, 255, 0.3); }
.meta-chip.gang { color: #ffb454; background: rgba(255, 180, 84, 0.1); border-color: rgba(255, 180, 84, 0.3); }

/* RP character tags */
.card-characters { margin-top: 12px; }
.chars-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.char-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.char-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.char-entry:last-child { margin-bottom: 0; }
.char-tag {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(136, 229, 43, 0.1);
  border: 1px solid rgba(136, 229, 43, 0.3);
}

/* Per-platform buttons at the bottom of each card */
.card-platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.1s ease, filter 0.1s ease, box-shadow 0.1s ease;
}
.pbtn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.pbtn.twitch.is-live { background: var(--twitch); color: #fff; border-color: transparent; }
.pbtn.kick.is-live { background: var(--kick); color: #0a0a0a; border-color: transparent; }
.pbtn.twitch:not(.is-live) { border-color: rgba(145, 70, 255, 0.5); }
.pbtn.kick:not(.is-live) { border-color: rgba(83, 252, 24, 0.4); }
.pbtn-live { font-size: 0.72rem; opacity: 0.95; }
.pbtn.is-live { box-shadow: 0 0 12px rgba(0, 0, 0, 0.25); }
.card-title {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-game { color: var(--accent-2); font-size: 0.8rem; margin: 8px 0 0; font-weight: 600; }
.card-lastlive { color: var(--muted); font-size: 0.8rem; margin: 8px 0 0; font-weight: 600; }
.card-lastlive.warn { color: #ffb454; }

/* Section headers (Live now / Offline) span the full grid width */
.section-head {
  grid-column: 1 / -1;
  margin: 8px 0 2px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.section-head span { color: var(--accent); font-weight: 700; }

.empty, .loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px 0 40px; }
.footer a { color: var(--muted); }

/* ── Forms / admin ──────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.panel h1 { margin: 0 0 4px; font-size: 1.4rem; }
.panel .sub { color: var(--muted); margin: 0 0 20px; font-size: 0.9rem; }

label { display: block; font-size: 0.82rem; color: var(--muted); margin: 14px 0 6px; }
input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 0.95rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 18px rgba(136, 229, 43, 0.25);
  transition: filter 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 0 24px rgba(136, 229, 43, 0.4); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 0.8rem; }

.msg { margin-top: 14px; font-size: 0.85rem; min-height: 1.2em; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* ── Admin layout ───────────────────────────────────────── */
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 0; border-bottom: 1px solid var(--border); margin-bottom: 24px;
  gap: 12px; flex-wrap: wrap;
}
.admin-header h1 { margin: 0; font-size: 1.3rem; }
.admin-header .who { color: var(--muted); font-size: 0.85rem; }

.admin-grid { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
@media (max-width: 820px) { .admin-grid { grid-template-columns: 1fr; } }

.form-card, .list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.form-card h2, .list-card h2 { margin: 0 0 14px; font-size: 1.05rem; }

.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; color: var(--text); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }
.pill { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }
.pill.twitch { background: var(--twitch); color: #fff; }
.pill.kick { background: var(--kick); color: #0a0a0a; }
.pill.on { background: rgba(136,229,43,0.15); color: var(--accent); }
.pill.off { background: rgba(255,255,255,0.08); color: var(--muted); }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.muted { color: var(--muted); }
/* Admin: dynamic character rows (name / job / gang) */
#characters-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.char-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 6px; align-items: center; }
.char-row input { padding: 8px 10px; font-size: 0.85rem; }
.char-row .char-remove { padding: 6px 10px; }
.char-row-empty { color: var(--muted); font-size: 0.82rem; }

.chan-lines { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; }
.chan-line { font-size: 0.82rem; color: var(--muted); }
.chan-line .pill { margin-right: 6px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay .panel { max-width: 400px; }
