:root {
  --pink: #ff86c8;
  --red: #9f1e1e;
  --black: #000000;
  --cream: #fff3ef;
  --mustard: #eaa93d;
  --blue: #6e96b3;
  --font: "Helvetica Neue", Arial, sans-serif;
  --navbar-height: 68px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--cream);
  color: var(--black);
  line-height: 1.5;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

/* ---------- Sticky nav bar ----------
   Sits in normal flow right after the hero; once scrolling would carry it
   off the top of the viewport, `position: sticky` pins it there instead.
   One element, no duplication. See conversation notes on the Canva draft. */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
  min-height: var(--navbar-height);
}

.navbar .brand { font-weight: 700; }

/* .navbar-left grows to claim whatever space .navbar-right doesn't need,
   then space-between spreads brand/Lore/Rules/Characters out across
   whatever width that ends up being. No item is singled out or given a
   fixed size; the gaps are just whatever's left after .navbar-right takes
   its own space. gap sets a floor so they never crowd together even if
   the window gets narrow. */
.navbar-left {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  justify-content: space-between;
  gap: clamp(1rem, 2.5vw, 2.5rem);
}

.navbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(1rem, 2.5vw, 2.5rem);
  flex-wrap: wrap;
  /* Aims for a third of .navbar's width (flex-basis, not width, so it
     plays correctly with .navbar-left's flex: 1 1 auto alongside it).
     flex-grow: 0 means it never takes MORE than a third even if
     .navbar-left doesn't need its own share. flex-shrink: 1 means that
     when the screen's too narrow for both to fit at their full size, this
     gives space back and shrinks below a third rather than overflowing,
     landing on whatever room is actually left. */
  flex: 0 1 33%;
}

/* Logged-in state carries more (Dashboard, Admin, username, Logout), so
   it gets a bigger share: 40% instead of the logged-out 33%. Same
   grow/shrink behavior otherwise. */
.navbar-right.navbar-right-auth {
  flex-basis: 40%;
}

.navbar a.nav-link {
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}
.navbar a.nav-link:hover { text-decoration: underline; }

.navbar .login-btn {
  background: var(--black);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}

.navbar .user-tag { font-size: 0.85rem; opacity: 0.9; }

/* ---------- Hero ---------- */
.hero {
  background: var(--pink);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--navbar-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero .hero-text { max-width: 900px; }
.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  margin: 0 0 0.5rem;
  line-height: 0.95;
  font-weight: 800;
}
.hero .tagline { font-weight: 600; margin-bottom: 1rem; }
.hero .discord-link {
  font-weight: 700;
  font-size: 1.1rem;
  display: inline-block;
  margin-top: 1rem;
}
.hero .splatter-deco {
  position: absolute;
  width: 320px;
  opacity: 0.9;
  pointer-events: none;
}
.hero .splatter-deco.top-right { top: -60px; right: -40px; }

/* ---------- Sections ---------- */
section { padding: 3rem 1.5rem; }
.section-black { background: var(--black); color: var(--cream); }
.section-cream { background: var(--cream); }

.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 800px) { .about-grid { grid-template-columns: 1fr; } }

.about-grid p { color: var(--pink); }
.about-photo {
  width: 100%;
  min-height: 360px;
  object-fit: cover;
  border-radius: 6px;
  border: 3px solid var(--pink);
}

.img-placeholder {
  background: repeating-linear-gradient(45deg, #1b7a1b, #1b7a1b 10px, #249124 10px, #249124 20px);
  border: 3px dashed #0c4a0c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-align: center;
  min-height: 220px;
  width: 100%;
  border-radius: 6px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 300px));
  justify-content: center;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 2rem auto 0;
}
.staff-card .staff-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--black);
  margin-bottom: 0.5rem;
}
.staff-card .name { font-weight: 700; }
.staff-card .role { font-size: 0.85rem; opacity: 0.8; }
.staff-card .extra { font-size: 0.8rem; opacity: 0.6; font-style: italic; }

/* ---------- Online widget ---------- */
.widgets-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 2rem auto 0;
}
.online-widget {
  background: #fff;
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  width: 100%;
  max-width: 420px;
  margin: 0;
}
.online-widget h3 { margin: 0 0 0.5rem; }
.online-widget ul { list-style: none; padding: 0; margin: 0; }
.online-widget li { padding: 0.2rem 0; }
.online-widget .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; margin-right: 0.4rem;
}
.online-widget .empty { opacity: 0.6; font-size: 0.9rem; }
.stats-widget {
  background: #fff;
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  width: 100%;
  max-width: 200px;
  margin: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.stats-widget .stat-number { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.stats-widget .stat-label { font-size: 0.85rem; opacity: 0.7; margin-top: 0.4rem; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn:hover { opacity: 0.9; }
.btn.secondary { background: var(--black); }
.btn.owner { background: var(--mustard); color: var(--black); }

form.stacked label { display: block; font-weight: 600; margin: 1rem 0 0.3rem; }
form.stacked input[type=text],
form.stacked input[type=number],
form.stacked input[type=url],
form.stacked textarea,
form.stacked select {
  width: 100%;
  padding: 0.6rem;
  border: 2px solid var(--black);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
}
form.stacked textarea { min-height: 140px; }
.card {
  background: #fff;
  border: 2px solid var(--black);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 700px;
  margin: 2rem auto;
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-pending_approval { background: var(--mustard); color: var(--black); }
.badge-requires_revision { background: var(--blue); color: #fff; }
.badge-rejected { background: #6b7280; color: #fff; }
.badge-alive { background: #22c55e; color: #fff; }
.badge-dead { background: var(--black); color: #fff; }
.badge-sunset { background: var(--pink); color: var(--black); }
.badge-graveyard { background: #4b2e2e; color: #fff; margin-left: 0.3rem; }

/* ---------- Season tabs ---------- */
.season-tabs { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; }
.season-tab {
  text-decoration: none;
  color: var(--black);
  background: #fff;
  border: 2px solid var(--black);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.season-tab.active { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
table th, table td { text-align: left; padding: 0.6rem; border-bottom: 1px solid #0003; }
table th { font-size: 0.8rem; text-transform: uppercase; opacity: 0.7; }
table th .sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
table th .sort-link.active { text-decoration: underline; }

/* ---------- Search / filter bar (admin list, public gallery) ---------- */
.filter-bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0.75rem 0; }
.filter-bar input[type=search],
.filter-bar select {
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--black);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
}
.filter-bar input[type=search] { min-width: 240px; flex: 1 1 240px; max-width: 360px; }
.filter-bar .btn { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.dob-warning { color: var(--red); font-size: 0.75rem; font-weight: 700; margin-top: 0.25rem; }

/* ---------- Admin character status form ---------- */
.admin-status-form { display: flex; flex-direction: column; gap: 0.5rem; max-width: 420px; }
.admin-status-form .row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.admin-status-form input[type=text],
.admin-status-form select {
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--black);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
}
.admin-status-form input[type=text] { width: 100%; }
.obit-dialog {
  border: 3px solid var(--black);
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 420px;
  width: 90vw;
  color: var(--black);
  background: #fff;
}
.obit-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.obit-dialog h3 { margin-top: 0; }
.obit-dialog p { font-size: 0.85rem; opacity: 0.8; }
.obit-dialog textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.6rem;
  border: 2px solid var(--black);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.char-card {
  background: #fff;
  border: 2px solid var(--black);
  border-radius: 10px;
  overflow: hidden;
  color: var(--black);
}
.char-card-link { display: block; text-decoration: none; color: inherit; }
.char-card .img-placeholder { border-radius: 0; border-width: 0 0 3px; min-height: 160px; }
.char-card .body { padding: 0.9rem; }
.char-card img.char-photo { width: 100%; height: 160px; object-fit: cover; }
.char-card-player {
  padding: 0 0.9rem 0.9rem;
  font-size: 0.8rem;
  opacity: 0.7;
}
.char-card-player a { color: var(--black); font-weight: 600; }

.quiz-q { margin-bottom: 1.75rem; }
.quiz-q p.prompt { font-weight: 700; font-size: 1.15rem; }
.quiz-q label { display: block; font-weight: 400; margin: 0; padding: 0.15rem 0; }

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

.page-content { max-width: 800px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.page-content h1 { font-size: 2.5rem; }
.revision-list { max-width: 800px; margin: 2rem auto; }
.revision-list li { padding: 0.5rem 0; border-bottom: 1px solid #0002; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* ---------- Player-written HTML (bio, obituary) ----------
   Content is already sanitised (app/sanitize.py); this just keeps it in
   its box: line breaks as typed, nothing wider than the page, and paint
   containment so nothing can draw outside its own area. */
.user-html { white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; contain: content; }
.user-html img { max-width: 100%; height: auto; }
.user-html table { width: auto; max-width: 100%; }

/* ---------- Staff quiz attempt review ---------- */
.quiz-review { border: 2px solid var(--black); border-left-width: 8px; border-radius: 8px; padding: 0.75rem 1rem; margin: 1rem 0; background: #fff; }
.quiz-review.right { border-left-color: #22c55e; }
.quiz-review.wrong { border-left-color: var(--red); }
.quiz-review-head .badge { margin-left: 0.5rem; }
.quiz-review ul { list-style: none; padding-left: 0.5rem; margin: 0.5rem 0 0; }
.quiz-review li { padding: 0.15rem 0; opacity: 0.6; }
.quiz-review li.picked, .quiz-review li.answer { opacity: 1; }
.quiz-review li.picked:not(.answer) { color: var(--red); font-weight: 700; }
.quiz-review li.answer em { color: #15803d; font-style: normal; font-weight: 700; }
.quiz-ref { background: #fff; border: 2px dashed var(--black); border-radius: 8px; padding: 0.6rem 0.9rem; }
