/* ============================================================
   justchathere — styles.css
   Clean, modern styling with a tiny retro nod (the logo).
   No frameworks, no preprocessors — plain CSS a beginner
   can read top to bottom.
   ============================================================ */

/* A few shared colors, defined once so they're easy to tweak. */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #8a90a3;
  --accent: #5b5bd6;        /* friendly indigo */
  --accent-dark: #4848b8;
  --border: #e2e6f0;
  --system: #9aa0b5;        /* gray-blue for join/leave notices */
}

/* The box-sizing rule makes width/height include padding and border,
   which keeps layout math predictable. A classic must-have. */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* `.screen` sections fill the viewport; we toggle `hidden` to swap
   between the lobby and the chat view. */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* The `hidden` attribute alone does NOT hide these sections: the
   `display: flex` above outranks the browser's built-in
   `[hidden] { display: none }` rule, so a "hidden" lobby stayed
   visible with the chat shoved below it. This rule restores the
   meaning of hidden — class + attribute beats class alone.
   (Found in the Layout A build QA, 2026-10-30; the bug predates
   it — earlier tests exercised the server, not the browser.) */
.screen[hidden] { display: none; }

/* ------------------------- LOBBY ------------------------- */

/* The lobby screen is now a full page (top nav + content row),
   not a lone centered card — see the Layout A section below. */
#lobby-screen {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.lobby-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  box-shadow: 0 8px 30px rgba(31, 36, 48, 0.08);
}

.logo {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
/* The accent-colored middle word gives the logo its little retro-pop. */
.logo span { color: var(--accent); }
.logo.small { font-size: 1.25rem; }

.tagline {
  color: var(--muted);
  margin: 0.5rem 0 1.75rem;
}

.field { display: block; margin-bottom: 1.25rem; font-weight: 600; }
.field-label { display: block; margin-bottom: 0.5rem; }

/* Scoped to the nickname box by ID on purpose: a broad `.field input`
   rule also catches the room picker's radio buttons (they live inside
   a .field too) and stretches them full-width, detaching each radio
   from its room name. That bug showed up in the Layout A build QA. */
#nickname-input {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* The categorized room list, built by app.js. */
.room-list {
  margin-top: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: normal;
}
.room-category { margin: 0.5rem 0 0.25rem; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
/* Each room row is a flex line — radio first, then the room name —
   so the two can never drift apart. */
.room-option { display: flex; align-items: center; gap: 0.5rem; margin: 0.15rem 0; padding: 0.35rem 0.5rem; border-radius: 6px; cursor: pointer; font-size: 1.02rem; }
.room-option:hover { background: #f4f6ff; }
.room-option input { margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.hint { color: var(--muted); font-size: 0.9rem; }

.error {
  color: #c0392b;
  background: #fdecea;
  border: 1px solid #f5c6c2;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }

/* ------------------------- CHAT ------------------------- */

.chat-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
}

.chat-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.room-badge {
  background: #eef0ff;
  color: var(--accent-dark);
  font-weight: 700;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

#room-switcher {
  margin-left: auto;          /* pushes the dropdown to the right edge */
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Support (donate) spots — the site is AD-FREE (Robert's ruling
   2026-10-30). Instead of an ad banner there is one slim support
   bar under the chat header, plus a matching note in the lobby.
   Both link to the same Stripe "chip in for hosting" payment link. */
.support-bar {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.support-note {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
.support-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.support-link:hover { text-decoration: underline; }

/* Support BUTTONS (Robert, 2026-10-31): the lobby note's link became
   a real button at the bottom of the card, the chat header's became
   a small pill, and the nav link matches the pill. The support ask is
   this ad-free site's only revenue surface, so it should read as a
   button, not a footnote. Gold, deliberately apart from the indigo
   action buttons so the two never get confused. */
.support-btn {
  display: block;
  margin-top: 0.6rem;
  padding: 0.7rem 1rem;
  border: 2px solid #E9B44C;
  border-radius: 10px;
  background: #e9b44c1f;
  color: #7a5410;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
}
.support-btn:hover { background: #E9B44C; color: #231a05; }
.support-pill {
  display: inline-block;
  padding: 0.14rem 0.7rem;
  border: 1.5px solid #E9B44C;
  border-radius: 999px;
  background: #e9b44c1f;
  color: #7a5410;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.support-pill:hover { background: #E9B44C; color: #231a05; }

/* Main area: messages take the free space (flex: 1), sidebar fixed. */
.chat-main {
  flex: 1;
  display: flex;
  min-height: 0;              /* lets the message pane scroll properly */
}

.message-pane {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: var(--panel);
}

.message { margin-bottom: 0.65rem; line-height: 1.45; }
.message .meta { color: var(--muted); font-size: 0.8rem; margin-right: 0.5rem; }
.message .nick { font-weight: 700; color: var(--accent-dark); }
/* System messages (join/leave notices) are quieter by design. */
.message.system { color: var(--system); font-style: italic; font-size: 0.9rem; }

.user-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--panel);
  padding: 1rem;
  overflow-y: auto;
}
.user-sidebar h2 { font-size: 0.95rem; margin: 0 0 0.6rem; }
#user-list { list-style: none; margin: 0; padding: 0; }
#user-list li { padding: 0.3rem 0; border-bottom: 1px solid #f0f2f8; font-size: 0.92rem; }
/* Highlight your own name in the list so you can spot yourself. */
#user-list li.me { font-weight: 700; color: var(--accent-dark); }

.composer {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.composer input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#chat-error { margin: 0 1rem 0.8rem; }

/* On narrow screens the sidebar drops below the messages so the
   layout still works on phones. */
@media (max-width: 700px) {
  .chat-main { flex-direction: column; }
  .user-sidebar { width: auto; border-left: none; border-top: 1px solid var(--border); max-height: 140px; }
}

/* ------------------------------------------------------------
   LAYOUT A v2 (Robert's pick, 2026-10-30): top nav + big chat
   lobby with a slimmer games sidebar on desktop; on phones the
   sidebar and nav tabs hide and a Chat | Games switcher swaps
   between the lobby and the games catalog page instead.
   ------------------------------------------------------------ */

/* Top navigation bar (lobby + games catalog pages). */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.topbar-logo { width: 44px; height: 44px; }
.nav-tabs { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; }
.nav-tabs a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 999px;
}
.nav-tabs a:hover { background: #eef0ff; }
.nav-tabs a.active { background: var(--accent); color: #fff; }

/* The mobile Chat | Games switcher. `display: none` on desktop —
   the media query at the bottom of this section turns it on for
   phones, where it replaces the nav tabs + sidebar. */
.switcher { display: none; gap: 0.5rem; padding: 0.7rem 0.8rem 0; }
.switcher a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.75rem 0;
  border-radius: 10px;
  border: 2px solid var(--accent);
  color: var(--accent);
  background: var(--panel);
}
.switcher a.active { background: var(--accent); color: #fff; }

/* The lobby content row: chat card grows to fill (1fr), games
   panel fixed at a slimmer 350px. Page is wide (1380px) so the
   chat clearly runs the show — the "v2" in Layout A v2. */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 1.6rem;
  max-width: 1380px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1rem;
  align-items: start;
}
/* Bigger lobby type on desktop, to match the bigger card. */
.lobby-card .logo { font-size: 2.7rem; }
.lobby-card { padding: 2.8rem 3.2rem; }
.lobby-card .btn-primary { padding: 1rem 1.4rem; font-size: 1.1rem; width: 100%; }
.room-list { max-height: none; }

/* The games sidebar panel and the catalog page share card styles. */
.games-panel, .catalog-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem;
  box-shadow: 0 8px 30px rgba(31, 36, 48, 0.08);
}
.games-panel h2 { margin: 0 0 0.3rem; font-size: 1.25rem; }
.panel-sub { color: var(--muted); font-size: 0.93rem; margin: 0 0 1rem; }
.panel-foot { color: var(--muted); font-size: 0.88rem; text-align: center; margin: 1rem 0 0; }

.game-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.7rem; }
.game-card h3 { margin: 0.6rem 0 0.25rem; }
.game-card p { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.8rem; }
.game-art { width: 100%; border-radius: 8px; display: block; }
.chip-new {
  background: #eef0ff;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  vertical-align: 2px;
}
.btn-block { display: block; text-align: center; text-decoration: none; }
.coming-soon {
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.92rem;
}
.coming-soon.tall { margin-top: 0; padding: 2.2rem 1rem; }

/* Games catalog page (games.html). */
.catalog-wrap { max-width: 1020px; margin: 2rem auto; padding: 0 1rem; }
.catalog-card h1 { margin: 0 0 0.3rem; font-size: 1.7rem; }
.catalog-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.1rem; }
.soon-col { display: grid; gap: 1.1rem; align-content: start; }

/* Games link inside the chat header (next to the room switcher). */
.games-link {
  margin-left: auto;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.games-link:hover { text-decoration: underline; }
.games-link + #room-switcher { margin-left: 0; }

/* Phones (≤760px): one column, chat only. The nav tabs and the
   games sidebar hide; the switcher appears and does their job —
   Games swaps the whole screen to games.html. */
@media (max-width: 760px) {
  .nav-tabs { display: none; }
  .switcher { display: flex; }
  .home-grid { grid-template-columns: 1fr; margin: 1rem auto; padding: 0 0.8rem; }
  .games-panel { display: none; }
  .lobby-card { padding: 1.4rem 1.1rem; }
  .lobby-card .logo { font-size: 2rem; }
  /* On phones the room list scrolls inside its box instead of
     pushing Enter chat far down the screen. */
  .room-list { max-height: 300px; }
  .catalog-grid { grid-template-columns: 1fr; }
  .soon-col { grid-template-columns: 1fr 1fr; }
  .catalog-wrap { margin: 1rem auto; padding: 0 0.8rem; }
}

/* ------------------------------------------------------------
   Footer links (About / Rules / Privacy / Contact) shown on the
   lobby, the chat screen, and the static pages themselves.
   ------------------------------------------------------------ */
.site-footer {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  text-align: center;
  color: var(--muted);
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  margin: 0 0.15rem;
}
.site-footer a:hover { text-decoration: underline; }

/* ------------------------------------------------------------
   Static content pages (about, rules, privacy, contact).
   Simple centered column of readable prose.
   ------------------------------------------------------------ */
.static-page {
  max-width: 640px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  line-height: 1.6;
}
.static-page h1 { margin: 1rem 0; font-size: 1.6rem; }
.static-page h2 { margin: 1.4rem 0 0.6rem; font-size: 1.15rem; }
.static-page p, .static-page li { margin-bottom: 0.6rem; }
.static-page ul, .static-page ol { padding-left: 1.4rem; }

/* ------------------------------------------------------------
   chaibot messages: a subtle tint + BOT badge so it's always
   clear the bot isn't a human chatter.
   ------------------------------------------------------------ */
.message.bot {
  background: #eef0ff;
  border-left: 3px solid var(--accent);
  padding-left: 0.6rem;
  border-radius: 0 8px 8px 0;
}
.bot-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 0.08rem 0.35rem;
  vertical-align: 1px;
}

/* SEO blurb: the plain-words section under the lobby. Search engines
   rank words, not chat boxes — this gives them honest words. */
.seo-blurb {
  max-width: 880px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.seo-blurb h2 { font-size: 1.15rem; margin-bottom: 0.4rem; }
