/* =============================================================================
   GROUPS (groups.js, 27 September). Private leaderboards.

   Built from the site's own parts rather than new ones: the Stats panel
   (.st-panel, .st-head, .st-tiles, .st-chart), the leaderboard's rows
   (.lb-list, .lb-row, .lb-tag), the results page's two buttons (.res-btn) and
   the sign-in form's fields (.auth-*). What is here is only what Groups adds:
   the group tiles, the hub's rows, the period switch, your standing, and the
   two popups' contents.

   Loaded after app.css, so a rule here beats app.css's at equal specificity,
   its late 700px block included -- the trap CLAUDE.md describes does not reach
   this file. The phone rules are in the one block at the end.
   ============================================================================= */

.gr-panel { position: relative; }
.gr-panel.is-loading .gr-list,
.gr-panel.is-loading .gp-list,
.gr-panel.is-loading .gp-standing { opacity: 0.4; }

.gr-lede {
  margin-top: 8px;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 16px;
  color: var(--muted);
}

/* Create Group and Join Group: the results page's pair. */
.gr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.gr-form {
  margin-top: 14px;
  padding: 14px;
  background: var(--cream);
  border-radius: 14px;
}
.gr-form .auth-label { margin-top: 0; }
.gr-hint {
  margin-top: 4px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  color: var(--muted);
}
.gr-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.gr-form-actions .res-btn:disabled { opacity: 0.55; cursor: wait; }
#gj-form { background: none; padding: 0; margin-top: 0; }
.gr-code-input {
  font-family: 'Anton', sans-serif;
  font-size: 24px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
}

.gr-list-title { display: block; margin: 20px 0 8px; }
.gr-list {
  background: var(--cream);
  border-radius: 14px;
  overflow: hidden;
}

/* ---- A group's tile: its initials on one of the site's four colours ---- */
.gr-tile {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-family: 'Anton', sans-serif;
  font-size: 19px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.gr-tone-ink   { background: var(--ink);   color: var(--paper); }
.gr-tone-rust  { background: var(--rust);  color: var(--paper); }
.gr-tone-green { background: var(--green); color: var(--paper); }
.gr-tone-gold  { background: var(--gold);  color: var(--ink); }

/* ---- The hub's rows ---- */
.gr-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.gr-row + .gr-row { border-top: 1px solid rgba(var(--ink-rgb), 0.09); }
.gr-row:hover { background: var(--cream-hover); }
/* The name and the member count, larger, in the room three lines had until the
   week's rank came off the row (by request, 27 September). */
.gr-row-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.gr-row-name {
  font-family: 'Anton', sans-serif;
  font-size: 22.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gr-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  color: var(--muted);
}
/* OWNER: the leaderboard's first-place gold, translucent, ink on it. Two
   classes, so it beats .lb-tag's rust whatever the order. */
.lb-tag.gr-tag-owner { background: rgba(var(--gold-rgb), 0.40); color: var(--ink); }
/* 10% down from 10px on 27 September, with the name and the count. */
.gr-row-meta .gr-tag-owner { font-size: 9px; padding: 2.7px 6.3px; }

.gr-stack { display: flex; flex-shrink: 0; }
.gr-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  margin-left: -9px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
}
.gr-dot:first-child { margin-left: 0; }
.gr-dot-more { background: var(--paper); color: var(--muted); font-size: 13.5px; }
.gr-chev {
  flex-shrink: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  color: var(--muted);
}

/* The group a code opens, on the join screen. */
.gr-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--cream);
  border-radius: 14px;
}

/* ---- A group's page ---- */
.gp-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 0 16px;
}
.gp-tile { width: 56px; height: 56px; border-radius: 14px; font-size: 23px; }
.gp-head-mid { min-width: 0; }
.gp-name {
  font-family: 'Anton', sans-serif;
  font-size: 26px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.gp-head .st-meta { min-height: 0; }
.gp-invite {
  padding: 9px 16px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-family: 'Anton', sans-serif;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s;
}
.gp-invite:hover { background: var(--rust); border-color: var(--rust); }

/* Today / Week / Month / All Time: the Stats chart's 7d/30d switch, four across. */
.gp-periods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.gp-periods .st-range-btn { padding: 8px 4px; font-size: 14px; }
.gp-rule {
  /* Room under the four periods (by request, 27 September). */
  margin: 20px 0 12px;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Your standing: paper with an ink border, like the panel it sits in. Your
   place over everyone who played in the period, "1 / 7", centred above your
   three numbers. */
.gp-standing {
  padding: 16px 14px 14px;
  border-radius: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.gp-standing:empty { display: none; }
.gp-standing-big {
  margin: 0 0 14px;
  text-align: center;
  font-family: 'Anton', sans-serif;
  font-size: 60px;
  line-height: 1;
  color: var(--ink);
}
/* 2nd: the suffix at half size, as the results page sets a rank. */
.gp-standing-suffix { font-size: 0.5em; margin-left: 2px; }
.gp-standing-sub {
  margin: -6px 0 14px;
  text-align: center;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 15px;
  color: var(--muted);
}

/* LEADERBOARD over the hint, both centred. */
.gp-board-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 18px 0 8px;
  text-align: center;
}
.gp-tap { text-transform: none; letter-spacing: 0.02em; }

/* The rows are the leaderboard's, as buttons: a tap opens the player. */
.gp-row {
  width: 100%;
  border: none;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.gp-row:hover { background: var(--cream-hover); }
.gp-row.lb-row-first:hover { background: rgba(var(--gold-rgb), 0.55); }
.gp-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gp-sub {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.gp-row-none .lb-name { color: var(--muted); }
.gp-none { color: var(--muted); }
/* Scores / Trophies under the board: the results page's pair, the one showing in
   ink (by request, 27 September). */
.gp-views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
/* A Trophies score: the trophy and the days won, in the score's type. */
.gp-wins { display: inline-flex; align-items: center; gap: 6px; }
.gp-wins .lb-trophy { width: 17px; height: 17px; }
.gp-wins i { font-style: normal; min-width: 1ch; text-align: right; }

/* Leave or Delete: quiet, under the board -- not a thing to press by accident. */
.gp-leave {
  display: block;
  margin: 16px auto 2px;
  padding: 6px 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.gp-leave:hover { color: var(--red); }

/* ---- The invite popup ---- */
.gi-box { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 18px; }
.gi-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--cream);
  border-radius: 14px;
}
.gi-words { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gi-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.gi-code {
  font-family: 'Anton', sans-serif;
  font-size: 32px;
  letter-spacing: 0.18em;
  line-height: 1.05;
  color: var(--rust);
}
.gi-link {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gi-copy {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  font-family: 'Anton', sans-serif;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.gi-copy:hover { background: var(--cream-hover); }
.gi-share { width: 100%; }

/* ---- A member's popup ---- */
.gm-box { margin: 0 0 18px; }
.gm-meta {
  margin: -4px 0 12px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.gm-tiles { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gm-tiles .st-tile { padding: 12px 4px 10px; }
.gm-tiles .st-tile-value { font-size: 24px; }
.gm-tiles .st-tile-label { font-size: 9px; letter-spacing: 0.1em; }
.gm-box .st-chart-head { margin: 14px 0 6px; }
/* A day and its label, one column each. */
.gm-chart { height: 120px; gap: 4px; padding: 8px 10px 4px; }
.gm-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; gap: 4px; }
.gm-col .st-col { flex: 1 1 auto; height: auto; }
.gm-col > span {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
}
.gm-line { margin-top: 0; }

/* ---- Phones ---- */
@media (max-width: 700px) {
  .gr-lede { font-size: 15px; }
  .gr-row { padding: 11px 12px; gap: 10px; }
  .gr-tile { width: 42px; height: 42px; font-size: 17px; }
  .gr-row-name { font-size: 19.8px; }
  .gr-row-meta { font-size: 12.6px; }
  .gr-dot { width: 32px; height: 32px; margin-left: -9px; font-size: 13.5px; }
  .gp-head { gap: 10px; padding: 4px 0 12px; }
  .gp-tile { width: 48px; height: 48px; font-size: 20px; }
  .gp-name { font-size: 22px; }
  .gp-invite { padding: 8px 12px; font-size: 14px; }
  .gp-periods .st-range-btn { font-size: 13px; }
  /* One line at 375: "Average % of the best lineup · 3+ games to rank". */
  .gp-rule { font-size: 10px; letter-spacing: 0.04em; }
  .gp-standing-big { font-size: 52px; }
  .gp-board-head { margin-top: 16px; }
  .gi-code { font-size: 28px; }
  .gm-tiles .st-tile-value { font-size: 21px; }
}
@media (max-width: 470px) {
  /* The member dots go first: the name and the rank matter more at this width. */
  .gr-stack { display: none; }
  .gp-tap { display: none; }
  .gm-col > span { font-size: 8px; }
}
