/*
 * The stats page, from demo/stats.html.
 *
 * Copied from the design demo in public/demo/, unchanged. The demo is the
 * drawing; this is the same drawing served to players, and the only way to
 * keep those two the same over time is for one to be a copy of the other
 * rather than a reading of it.
 *
 * Edit the demo first, then copy it here.
 */

/* ===========================================================================
 * The stats page.
 * =========================================================================== */

.stats { padding: 20px 0 0; }
.stats .wrap { max-width: 50rem; }
.stack { display: grid; gap: 16px; }

/* --------------------------------------------------------------- identity */
.me {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 22px;
  background:
    linear-gradient(150deg, var(--accent-soft), var(--surface) 62%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.me__top { display: flex; align-items: center; gap: 14px; }

/* A player is given a name on their first visit and never chooses one, so a
   monogram is the only portrait this product can honestly offer. */
.me__mark {
  width: 58px;
  height: 58px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.5rem;
  font-weight: 800;
}

.me__name { font-size: clamp(1.25rem, 5vw, 1.6rem); font-weight: 800; overflow-wrap: anywhere; }
.me__where { font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); margin-top: 3px; }

/* Level, as a bar rather than a number nobody can place. */
.level__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .875rem; }
.level__name { font-weight: 700; }
.level__next { color: var(--ink-mute); }
.bar { height: 10px; border-radius: 999px; background: var(--bg-tint); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* ----------------------------------------------------------------- tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 10px; }
.tile { background: var(--bg-tint); border-radius: 14px; padding: 14px; }
.tile b { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile span { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.tile--warm b { color: var(--warm); }

/* -------------------------------------------------------------- by game  */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-tint);
  text-decoration: none;
  color: inherit;
}
.row:hover { background: var(--accent-soft); }
.row__icon {
  width: 38px; height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface);
  color: var(--accent);
}
.row__icon svg { width: 20px; height: 20px; }
.row__id { flex: 1; min-width: 0; }
.row__name { display: block; font-weight: 700; }
.row__sub { display: block; font-size: .8125rem; color: var(--ink-mute); margin-top: 1px; }
.row__score { text-align: right; flex: none; }
.row__score b { display: block; font-size: 1.0625rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.row__score span { font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.row--empty { opacity: .6; }

/* --------------------------------------------------------------- badges  */
.badges { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.badge {
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-tint);
  border-left: 3px solid var(--accent);
}
.badge b { display: block; font-size: .9375rem; }
.badge span { display: block; font-size: .75rem; color: var(--ink-mute); margin-top: 2px; }
.badge[data-locked] { border-left-color: var(--line); opacity: .55; }

/* ---------------------------------------------------------------- prose  */
/* Headings and the lists under them, spaced in CSS rather than inline, so
   the site can copy the rule instead of copying a style attribute. */
.stats .card h3 { font-size: .9375rem; margin-top: 18px; }
.stats .card h3:first-of-type { margin-top: 14px; }
.points { display: grid; gap: 12px; margin: 10px 0 0; }
.point dt { font-weight: 700; }
.point dd { margin: 2px 0 0; color: var(--ink-soft); font-size: .9375rem; }

.plain { margin: 10px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: .9375rem; display: grid; gap: 4px; }
.plain strong { color: var(--ink); }

/* ------------------------------------------------------------- account  */
.card--offer {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: linear-gradient(150deg, var(--accent-soft), var(--surface) 70%);
}
.field { display: grid; gap: 6px; margin-top: 12px; }
.field label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.field input {
  font: inherit;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.actions .btn { flex: 1 1 11rem; }

.danger { color: var(--bad); font-weight: 600; text-decoration: none; }

h2.card__title { font-size: 1.0625rem; }
.card > h2 + * { margin-top: 12px; }

@media (min-width: 620px) {
  .me { grid-template-columns: 1fr auto; align-items: center; }
  .me__level { min-width: 16rem; }
}

/* ===========================================================================
 * Translation.
 * ===========================================================================
 *
 * The demo writes a figure as <b> and <span>; the template writes the same
 * figure as a description list, because a label and its value are a term and
 * a description and a screen reader should hear them that way. Same look,
 * better markup - these rules are what makes the two agree.
 */
.tile dt, .tile dd { margin: 0; }
.tile dt {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  order: 2;
}
.tile dd {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  order: 1;
}
.tile { display: flex; flex-direction: column; }
.tile .stat__by { font-size: .75rem; font-weight: 600; color: var(--ink-mute); order: 3; }

.row__value {
  display: block;
  font-size: 1.0625rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.row__label {
  display: block;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.badge__name { display: block; font-size: .9375rem; font-weight: 700; }
.badge__what { display: block; margin-top: 2px; font-size: .75rem; color: var(--ink-mute); }

.stats__sub { font-size: .9375rem; margin-top: 18px; }
.stats__aside { margin-top: 14px; font-size: .875rem; color: var(--ink-mute); }
.stats__aside a { color: var(--accent); font-weight: 650; }

.point__title { font-weight: 700; }
.point__text { margin: 2px 0 0; color: var(--ink-soft); font-size: .9375rem; }

.device-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.device { padding: 12px; border-radius: 12px; background: var(--bg-tint); }
.device__name { font-weight: 700; }
.device__meta { font-size: .8125rem; color: var(--ink-mute); }
