/* ============================================================
   THEME — edit these variables to change the whole site's look.
   This is the Persistent Wave palette: near-black background,
   GitHub-dark-style panels, blue accent, green/red for
   success/error. Change the hex values here and everything
   below updates automatically — you shouldn't need to touch
   colors anywhere else in this file.
============================================================= */
:root {
  --bg: #0d1117;          /* page background */
  --bg-panel: #161b22;    /* cards, header, panels */
  --bg-input: #0d1117;    /* form fields */
  --border: #30363d;      /* all borders/dividers */
  --text: #c9d1d9;        /* main text */
  --text-dim: #8b949e;    /* secondary/muted text */
  --accent: #58a6ff;      /* links, active states, buttons */
  --green: #3fb950;       /* success / "live" badge */
  --red: #f85149;         /* errors / destructive buttons */

  /* Fonts: a system sans for body copy, monospace for anything
     that should feel terminal-ish (brand, headings, badges). */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

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

/* ============================================================
   TOP BAR
============================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.brand {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand .accent { color: var(--accent); }

.tabs { display: flex; gap: 0.5rem; }

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: var(--font-body);
}
.tab-btn:hover { color: var(--text); background: #1c2128; }
.tab-btn.active { color: var(--accent); border-color: var(--border); background: #1c2128; }

.session-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.session-area button {
  background: var(--accent);
  color: #0d1117;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-body);
}
.session-area button:hover { opacity: 0.85; }

/* ============================================================
   LAYOUT / TABS
   Change --page-width below to make the site wider or narrower.
============================================================= */
main {
  --page-width: 960px;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

h1 { font-family: var(--font-mono); font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-family: var(--font-mono); font-size: 1.2rem; margin-top: 1.5rem; }
.lede { color: var(--text-dim); max-width: 640px; }
.muted { color: var(--text-dim); font-size: 0.9rem; }

/* ============================================================
   HOME TAB — the three cards
============================================================= */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ============================================================
   BOXES TAB — box cards (generated by app.js), flag form,
   leaderboard. These ids/classes are referenced directly in
   app.js — safe to restyle, risky to rename.
============================================================= */
.box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.box-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  position: relative;
}
.box-card h3 {
  margin: 0 0 0.3rem;
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
}
.box-card p { color: var(--text-dim); font-size: 0.9rem; }
.box-card ul { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--text-dim); }

/* status pill next to each box name — "live" vs "coming soon" */
.badge {
  font-family: var(--font-mono);
  background: var(--border);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  margin: 0 1rem;
}
.badge.live { color: var(--green); }
.badge.coming-soon { color: var(--text-dim); }

#flag-section, #leaderboard-section {
  background: var(--bg-panel);
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

#flag-form { display: grid; gap: 0.75rem; max-width: 420px; }
#flag-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--text-dim);
  gap: 0.25rem;
}
#flag-form input, #flag-form select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 6px;
  font-family: var(--font-mono);
}
#flag-form button {
  background: var(--accent);
  color: #0d1117;
  border: none;
  padding: 0.6rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

/* feedback line under the flag form — app.js toggles these classes */
#flag-result.success { color: var(--green); font-weight: bold; }
#flag-result.error { color: var(--red); }

#leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}
#leaderboard-table th, #leaderboard-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
#leaderboard-table th { color: var(--accent); }

/* ============================================================
   ADMIN TAB
============================================================= */
#admin-panel button {
  background: var(--red);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

/* ============================================================
   LOGIN MODAL
============================================================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  width: 320px;
}
.modal-content form { display: grid; gap: 0.75rem; }
.modal-content label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--text-dim);
  gap: 0.25rem;
}
.modal-content input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 6px;
}
.modal-content button {
  background: var(--accent);
  color: #0d1117;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
#login-cancel { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }

/* ============================================================
   UTILITY — used by app.js to show/hide things
============================================================= */
.error { color: var(--red); font-size: 0.85rem; }
.hidden { display: none !important; }


/* ===========================================================
IMAGE
=============================================================*/
.center-image {
    display: block;
    margin-left: auto;
    margin-right: auto;
    /* Optional: prevents the image from overflowing smaller screens */
    max-width: 100%; 
    height: auto;
}
