:root {
  --bg: #ffffff;
  --ink: #17171a;
  --soft: rgba(23, 23, 26, 0.55);
  --line: rgba(23, 23, 26, 0.1);
  --accent: #5b5bf0;
  --low: #e2623f;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.gb { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); width: min(352px, 100%); }
.gb__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; padding: 0 4px 10px; }
.gb__title { display: grid; gap: 2px; }
.gb__title strong { font-size: 17px; font-weight: 720; letter-spacing: -0.015em; white-space: nowrap; }
.gb__title span { font-size: 12px; color: var(--soft); }
.gb__class { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--soft); white-space: nowrap; }
.gb__roll { display: block; height: 19px; overflow: hidden; font-size: 16px; line-height: 19px; font-weight: 740; color: var(--ink); font-variant-numeric: tabular-nums; }
.gb__roll b { display: block; font-weight: inherit; }

/* the table: every row is the same five columns */
.gb__table { position: relative; border-radius: 18px; background: #f6f5f2; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.gb__row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 42px) 74px; align-items: center; height: clamp(34px, 9.400vh, 42px); padding: 0 8px 0 14px; border-top: 1px solid var(--line); }
.gb__row--head { height: 30px; border-top: 0; font-size: 10.5px; font-weight: 600; color: var(--soft); }
.gb__row--head span:not(:first-child) { text-align: center; }
.gb__row--head span:last-child { text-align: right; padding-right: 4px; }
.gb__name { font-size: 13px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb__cell { position: relative; z-index: 1; display: grid; place-items: center; justify-self: center; width: 38px; height: 30px; border-radius: 9px; font-size: 13.5px; font-weight: 620; font-variant-numeric: tabular-nums; overflow: hidden; }
.gb__cell b { display: block; font-weight: inherit; }
.gb__cell:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
@media (hover: hover) { .gb__cell:hover { background: rgba(23, 23, 26, 0.06); } }
.gb__avg { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 0 4px 0 6px; }
.gb__bar { display: block; height: 5px; border-radius: 3px; background: rgba(23, 23, 26, 0.1); overflow: hidden; }
.gb__bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: background-color 0.3s; }
.gb__row[data-low="true"] .gb__bar i { background: var(--low); }
.gb__num { display: block; width: 22px; height: 17px; overflow: hidden; font-size: 13px; line-height: 17px; font-weight: 740; text-align: right; font-variant-numeric: tabular-nums; }
.gb__num b { display: block; font-weight: inherit; }
.gb__row[data-low="true"] .gb__num { color: var(--low); }

/* one ring, moved onto the chosen cell */
.gb__ring { position: absolute; left: 0; top: 0; width: 38px; height: 30px; border-radius: 9px; background: #ffffff; box-shadow: 0 0 0 1.500px var(--accent), 0 8px 14px -8px var(--accent); opacity: 0; pointer-events: none; }

.gb__edit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 44px; margin-top: 8px; padding: 0 4px 0 6px; }
.gb__who { display: block; height: 17px; overflow: hidden; font-size: 12.5px; line-height: 17px; color: var(--soft); white-space: nowrap; }
.gb__who span { display: block; overflow: hidden; text-overflow: ellipsis; }
.gb__step { display: flex; gap: 6px; }
.gb__step button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: #ffffff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 14px -8px rgba(23, 23, 26, 0.7); transition: opacity 0.2s; }
.gb__step button:disabled { opacity: 0.22; cursor: default; box-shadow: none; }
.gb__step svg { display: block; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; }
.gb__step button:focus-visible { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--accent); }

.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #17171a; stroke: #ffffff; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)); z-index: 6; }

@media (prefers-reduced-motion: reduce) { .gb__bar i, .gb__step button { transition: none; } }
