/* The numbers page (stats/index.html, ko/stats/index.html), on its own and versioned in the
   page's link (?v=) rather than in styles.css: the site is cached for hours, and a page whose
   markup and styles change together must not be drawn with yesterday's half.

   The look is the home page's: its sky and pink glow over the hero, the wordmark's pink and
   white, gold for the headline numbers, panels in --bg-2 with the beta notice's chip as each
   one's kicker.

   Chart colours: made in gold and opened in teal, darker steps of the site's two accents
   chosen to clear the lightness band, the chroma floor and colour-blind separation on --bg-2
   (worst adjacent ΔE 14.3, deutan). Single-series charts are teal. */

.stats-page {
  --st-made: #b5891f;
  --st-opened: #2fa89c;
  --st-teal-hi: #4fd1c5;
  --st-track: rgba(255, 255, 255, 0.045);
  --st-pink: #ff5fa2;
}

/* ── hero ───────────────────────────────────────────────── */

.st-hero { padding: 64px 0 0; }

.st-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  border: 1px solid rgba(79, 209, 197, 0.45);
  border-radius: 999px;
  background: rgba(79, 209, 197, 0.08);
  color: var(--teal);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.st-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.6);
  animation: st-pulse 2.4s ease-out infinite;
}
@keyframes st-pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.55); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(79, 209, 197, 0); }
}

/* The wordmark's own colours and glow (.wordmark on the home page), at a page title's size. */
.st-title {
  margin: 18px 0 14px;
  font-size: clamp(34px, 6vw, 54px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
}
.st-mark { color: var(--st-pink); text-shadow: 0 0 30px rgba(255, 95, 162, 0.45); }
/* The home page's turning wireframe (globe.js), at the height of the letters beside it. */
.st-globe { display: inline-block; width: 1.05em; height: 1.05em; margin-right: 0.16em; vertical-align: -0.2em; }
.st-globe canvas, .st-globe img { display: block; width: 100%; height: 100%; }
.st-globe img { filter: drop-shadow(0 0 14px rgba(255, 95, 162, 0.35)); }

.st-lede {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 15.5px;
}
.st-status { margin: 28px 0 0; color: var(--text-faint); font-size: 14px; }

.st-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  margin: 28px 0 0;
  font-size: 13px;
}
.st-range { color: var(--text-faint); }
.st-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(18, 21, 27, 0.7);
}
.st-tab {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-dim);
  font: inherit;
  cursor: pointer;
}
.st-tab:hover { color: var(--text); }
.st-tab[aria-pressed="true"] { background: var(--gold); color: var(--text-inverse); font-weight: 600; }
.st-tab:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ── headline numbers ───────────────────────────────────── */

.st-heroes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 40px 0 0;
}
.st-hero-num {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  overflow: hidden;
}
/* A gold hairline across the top, brightest in the middle, as the hero's rule is. */
.st-hero-num::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230, 185, 92, 0.7), transparent);
}
.st-hero-value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(230, 185, 92, 0.25);
}
.st-hero-num.is-empty .st-hero-value { color: var(--text-faint); text-shadow: none; }
.st-hero-label { font-size: 12.5px; color: var(--text-dim); }

/* ── panels ─────────────────────────────────────────────── */

.stats-page section.st-card {
  margin: 20px 0 0;
  padding: 24px 26px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
}
#stats > .st-card:first-of-type { margin-top: 28px; }

.st-pair-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin: 20px 0 0;
}
.st-pair-cards section.st-card { margin: 0; }

/* The beta notice's chip as each panel's name, so the headline sentence under it carries the
   size rather than a heading saying what the panel is. */
.stats-page h2.st-kicker {
  display: inline-block;
  margin: 0 0 14px;
  padding: 2px 10px;
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  background: rgba(230, 185, 92, 0.08);
  color: var(--gold);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
html:lang(ko) .stats-page h2.st-kicker { letter-spacing: 0.04em; font-size: 11.5px; }

.st-line {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.005em;
}
.st-line:empty { display: none; }
.st-line strong { color: var(--gold); font-weight: 700; }
.st-card .note { margin: 0 0 18px; }
.st-card > div { margin-top: 18px; }
.stats-page .st-card h3 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.stats-page .st-card h3.st-h3-gap { margin-top: 26px; }
html:lang(ko) .stats-page .st-card h3 { letter-spacing: 0; font-size: 13px; }

.st-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px 40px; }
.st-empty { margin: 0; padding: 18px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-faint); font-size: 13.5px; text-align: center; }

#stats.is-redrawing { opacity: 0.6; }

/* ── bars ───────────────────────────────────────────────── */

.st-bars { display: flex; flex-direction: column; gap: 3px; }
.st-bars-rows { display: flex; flex-direction: column; gap: 3px; }
.st-bars-rows.is-two { display: grid; grid-auto-flow: column; grid-template-columns: 1fr 1fr; gap: 3px 40px; }
.st-bar-row {
  display: grid;
  grid-template-columns: 22px minmax(100px, 34%) 1fr;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: var(--radius);
  font-size: 13.5px;
}
.st-bars.no-rank .st-bar-row { grid-template-columns: minmax(100px, 34%) 1fr; }
.st-bar-row:hover { background: rgba(255, 255, 255, 0.03); }
.st-rank { color: var(--text-faint); font: 11px var(--font-mono); text-align: right; }
.st-bar-name { color: var(--text-dim); overflow-wrap: anywhere; }
.st-bar-row:hover .st-bar-name { color: var(--text); }
.st-bar-track {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.st-bar-rail { position: relative; flex: 1; height: 12px; border-radius: 999px; background: var(--st-track); }
.st-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--st-opened), var(--st-teal-hi));
  width: 0;
  transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.st-bar-value {
  min-width: 42px;
  color: var(--text);
  font: 12px var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.st-pair .st-bar-track { flex-direction: column; align-items: stretch; gap: 4px; }
.st-pair-line { display: flex; align-items: center; gap: 8px; }
.st-pair .st-bar-rail { height: 9px; }
.st-bar.is-made { background: var(--st-made); }
.st-bar.is-opened { background: var(--st-opened); }

.st-legend { display: flex; gap: 18px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-dim); }
.st-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.st-key { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.st-key-made { background: var(--st-made); }
.st-key-opened { background: var(--st-opened); }

/* ── map sizes, to scale ────────────────────────────────── */

.st-minimaps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 12px;
}
.st-minimap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}
.st-minimap svg { display: block; width: 100%; height: auto; }
.st-frame { fill: none; stroke: var(--border-strong); stroke-dasharray: 3 3; stroke-width: 1; }
.st-map { fill: rgba(79, 209, 197, 0.16); stroke: var(--st-teal-hi); stroke-width: 1.5; }
.st-map-grid { stroke: rgba(79, 209, 197, 0.16); stroke-width: 1; }
.st-minimap.is-top { border-color: rgba(79, 209, 197, 0.55); box-shadow: 0 0 24px rgba(79, 209, 197, 0.1); }
.st-minimap-size { font: 600 13px var(--font-mono); color: var(--text); }
.st-minimap-share { font-size: 22px; font-weight: 700; color: var(--teal); line-height: 1; font-variant-numeric: tabular-nums; }
.st-minimap-share small { margin-left: 4px; font-size: 11.5px; font-weight: 400; color: var(--text-faint); }
.st-minimap.is-other .st-map { fill: rgba(153, 162, 179, 0.1); stroke: var(--text-faint); stroke-dasharray: 2 3; }
.st-minimap.is-other .st-minimap-share { color: var(--text-dim); }
#st-sizes .st-tabs { margin-bottom: 16px; }

/* ── undo: a hundred edits ──────────────────────────────── */

.st-undo { display: flex; flex-wrap: wrap; align-items: center; gap: 22px 28px; }
.st-dots { display: grid; grid-template-columns: repeat(10, 12px); gap: 4px; }
.st-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--bg-4); transition: background 0.3s, box-shadow 0.3s; }
.st-dot.is-on { background: var(--st-teal-hi); box-shadow: 0 0 8px rgba(79, 209, 197, 0.55); }
.st-big { display: flex; flex-direction: column; gap: 2px; }
.st-big-value { font-size: 44px; font-weight: 800; line-height: 1; color: var(--gold); text-shadow: 0 0 24px rgba(230, 185, 92, 0.25); font-variant-numeric: tabular-nums; }
.st-big-value small { font-size: 16px; font-weight: 500; color: var(--text-faint); text-shadow: none; }
.st-big-label { font-size: 12.5px; color: var(--text-dim); max-width: 180px; }
.st-big.is-small .st-big-value { font-size: 26px; color: var(--text); text-shadow: none; }
.st-big.is-empty .st-big-value { color: var(--text-faint); text-shadow: none; }

/* ── keyboard: one bar split two ways, and the keys ──────── */

.st-split { display: flex; height: 14px; margin: 4px 0 8px; border-radius: 999px; overflow: hidden; background: var(--bg-4); }
.st-split-part { height: 100%; background: linear-gradient(90deg, var(--st-opened), var(--st-teal-hi)); width: 0; transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.st-split-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); margin-bottom: 18px; }
.st-split-legend strong { color: var(--text); font-weight: 600; }

.st-keycaps { display: flex; flex-direction: column; gap: 8px; }
.st-keyrow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; font-size: 13.5px; }
.st-combo { display: inline-flex; gap: 3px; min-width: 104px; }
.st-cap {
  display: inline-block;
  min-width: 24px;
  padding: 2px 7px 3px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 3px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--bg-4), var(--bg-3));
  color: var(--text);
  font: 600 11.5px var(--font-mono);
  text-align: center;
}
.st-keyrow-name { color: var(--text-dim); }
.st-keyrow-value { font: 12px var(--font-mono); color: var(--text); }

/* ── hours ──────────────────────────────────────────────── */

.st-hours {
  position: relative;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  align-items: end;
  height: 170px;
  padding: 0 0 0;
  border-bottom: 1px solid var(--border);
  /* Night, day, night: a faint band behind the UTC working day, for orientation only. */
  background: linear-gradient(90deg, transparent 0%, rgba(230, 185, 92, 0.035) 25%, rgba(230, 185, 92, 0.035) 75%, transparent 100%);
}
.st-hour { display: flex; align-items: flex-end; height: 100%; }
.st-hour-bar {
  display: block;
  width: 100%;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--st-teal-hi), rgba(47, 168, 156, 0.35));
  height: 0;
  transition: height 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.st-hour.is-top .st-hour-bar { background: linear-gradient(180deg, #f4d08a, rgba(181, 137, 31, 0.45)); box-shadow: 0 0 18px rgba(230, 185, 92, 0.3); }
.st-hour[tabindex]:hover .st-hour-bar, .st-hour[tabindex]:focus-visible .st-hour-bar { filter: brightness(1.2); }
.st-hour:focus-visible { outline: none; }
.st-hours-axis { position: relative; height: 20px; font: 11px var(--font-mono); color: var(--text-faint); }
.st-hours-axis span { position: absolute; transform: translateX(-50%); top: 4px; }
.st-hours-box .note { margin-top: 4px; }

/* ── plugins, when the counts say nothing ───────────────── */

.st-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st-chip { padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-1); color: var(--text-dim); font: 12px var(--font-mono); }
.st-chips + .note { margin-top: 10px; }

/* ── tooltip and tables ─────────────────────────────────── */

.st-tip {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font-size: 12.5px;
  pointer-events: none;
}
.st-tip strong { color: var(--text); font-size: 14px; }
.st-tip span { color: var(--text-dim); }

.st-table { margin-top: 14px; font-size: 13px; }
.st-table summary { display: inline-block; color: var(--text-faint); cursor: pointer; font-size: 12px; }
.st-table summary:hover { color: var(--text-dim); }
.st-table table { margin-top: 8px; border-collapse: collapse; }
.st-table th, .st-table td { padding: 3px 16px 3px 0; text-align: left; border-bottom: 1px solid var(--border); font-weight: 400; }
.st-table td { color: var(--text); font-variant-numeric: tabular-nums; }
.st-table th { color: var(--text-dim); }

/* ── how it is counted ──────────────────────────────────── */

.st-how { max-width: none; margin: 28px 0 0; }

/* ── small screens, and still ones ──────────────────────── */

@media (max-width: 620px) {
  .st-hero { padding-top: 40px; }
  .stats-page section.st-card { padding: 20px 16px 18px; }
  .st-pair-cards { grid-template-columns: 1fr; }
  .st-line { font-size: 17.5px; }
  .st-bar-row { grid-template-columns: 18px minmax(84px, 38%) 1fr; }
  .st-hours { height: 130px; gap: 2px; }
  .st-bars-rows.is-two { grid-auto-flow: row; grid-template-columns: 1fr; grid-template-rows: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .st-live-dot { animation: none; }
  .st-bar, .st-split-part, .st-hour-bar, .st-dot { transition: none; }
}
