/*
 * Square1 Studio: the admin portal, dressed like the game. Cream tile grid behind everything,
 * white surfaces with a soft darker lip along the bottom, coral for the one thing that matters
 * on each screen, and the game's font (Gabarito).
 */
:root {
  --bg: #fbf3e7;
  --grid: #f3e8d9;
  --ink: #5a4038;
  --muted: #8a6f64;
  --faint: #b9a294;
  --card: #ffffff;
  --lip: #e6d9c8;
  --line: #f1e6d7;
  --accent: #ee5140;
  --accent-lip: #c73a2b;
  --pink: #ff9db5;
  --pink-lip: #e0708d;
  --blue: #8ccbf2;
  --blue-lip: #5fa5d4;
  --yellow: #ffd15c;
  --yellow-lip: #e0a92e;
  --green: #8fddb8;
  --green-lip: #5fb98e;
  --bounce: #ff8a6b;
  --square: #ff6b5a;
  --square-lip: #d94a3b;
  --series-1: #e8503f;
  --series-2: #3e8fd0;
  --good: #2f9e6c;
  --warn: #b7791f;
  --bad: #c73a2b;
  --r: 16px;
  --r-lg: 20px;
  --lip-h: 6px;
  --side: 232px;
  --font: 'Gabarito', 'Nunito', system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body {
  /* The game's background: rounded tiles a seam apart. */
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='58' height='58'%3E%3Crect x='1.5' y='1.5' width='55' height='55' rx='9' fill='%23F3E8D9'/%3E%3C/svg%3E");
  background-size: 58px 58px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.3px;
}
a {
  color: inherit;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--grid);
  box-shadow: 0 2px 0 var(--lip);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
::selection {
  background: var(--yellow);
}

/* ------------------------------------------------------------ shell */

#app {
  min-height: 100%;
}
.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px;
  background: rgba(251, 243, 231, 0.92);
  border-right: 3px solid var(--grid);
  backdrop-filter: blur(6px);
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 16px;
}
.brand b {
  display: block;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1;
}
.brand small {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
/* The square, eyes only. */
.sq {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--square);
  box-shadow: inset 0 -4px 0 var(--square-lip);
}
.sq::before,
.sq::after {
  content: '';
  position: absolute;
  top: 10px;
  width: 5px;
  height: 9px;
  border-radius: 4px;
  background: #fff;
}
.sq::before {
  left: 10px;
}
.sq::after {
  right: 10px;
}
.sq.big {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  box-shadow: inset 0 -7px 0 var(--square-lip);
}
.sq.big::before,
.sq.big::after {
  top: 19px;
  width: 9px;
  height: 16px;
  border-radius: 6px;
}
.sq.big::before {
  left: 18px;
}
.sq.big::after {
  right: 18px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 16px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.nav button:hover {
  background: var(--grid);
}
.nav button.on {
  background: var(--card);
  box-shadow: 0 4px 0 var(--lip);
}
.nav button svg {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
}
.nav button.on svg {
  color: var(--accent);
}
.nav .badge {
  margin-left: auto;
}
.nav .soon {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.side .grow {
  flex: 1;
}
.env {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--lip);
  font-size: 13px;
  color: var(--muted);
}
.env b {
  color: var(--ink);
}
.env .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green-lip);
  vertical-align: 1px;
}
.content {
  min-width: 0;
  padding: 22px 26px 40px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.8px;
}
.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.page-head .lead {
  flex-basis: 100%;
  margin: 2px 0 0;
  max-width: 760px;
  color: var(--muted);
}
.page-head .spacer {
  flex: 1;
}
.mobile-bar {
  display: none;
}

/* ------------------------------------------------------------ surfaces */

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: 0 var(--lip-h) 0 var(--lip);
  padding: 18px;
  min-width: 0;
}
.card.flush {
  padding: 0;
}
.card > h2,
.card-head h2 {
  font-size: 19px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.card-head .spacer {
  flex: 1;
}
.card-head p,
.card .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid.tiles {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row .spacer {
  flex: 1;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  font-weight: 500;
}
.empty {
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
}
.empty .sq {
  margin: 0 auto 12px;
}

/* A stat tile: one number and what it means. */
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: 0 var(--lip-h) 0 var(--lip);
  text-align: left;
  min-width: 0;
}
button.tile {
  cursor: pointer;
}
button.tile:hover {
  transform: translateY(-1px);
}
.tile .n {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.05;
}
.tile .l {
  color: var(--muted);
  font-size: 14px;
}
.tile .d {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.tile.hot {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 var(--lip-h) 0 var(--accent-lip);
}
.tile.hot .l,
.tile.hot .d {
  color: rgba(255, 255, 255, 0.86);
}

/* ------------------------------------------------------------ controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: var(--card);
  box-shadow: 0 5px 0 var(--lip);
  border-radius: var(--r);
  padding: 9px 16px;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--lip);
}
.btn.ghost {
  background: var(--grid);
  box-shadow: 0 4px 0 var(--lip);
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 0 var(--accent-lip);
}
.btn.primary:active {
  box-shadow: 0 2px 0 var(--accent-lip);
}
.btn.good {
  background: var(--green);
  box-shadow: 0 5px 0 var(--green-lip);
}
.btn.good:active {
  box-shadow: 0 2px 0 var(--green-lip);
}
.btn.edit {
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--yellow-lip);
}
.btn.edit:active {
  box-shadow: 0 2px 0 var(--yellow-lip);
}
.btn.bad {
  background: var(--pink);
  box-shadow: 0 5px 0 var(--pink-lip);
}
.btn.bad:active {
  box-shadow: 0 2px 0 var(--pink-lip);
}
.btn.sm {
  padding: 6px 11px;
  font-size: 14px;
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--lip);
}
.btn.sm.primary {
  box-shadow: 0 4px 0 var(--accent-lip);
}
.btn.icon {
  padding: 7px;
  border-radius: 12px;
}
.btn.on {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 4px 0 #3b2924;
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn.wide {
  width: 100%;
}
.btn:focus-visible,
.nav button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
.seg {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 14px;
  background: var(--grid);
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  padding: 6px 11px;
  background: transparent;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
}
.seg button.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--lip);
}
.seg button .count {
  color: var(--faint);
  font-weight: 900;
}
.seg button.on .count {
  color: var(--accent);
}
input.text,
select,
textarea {
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--grid);
  padding: 9px 12px;
  font-weight: 700;
  min-width: 0;
}
select {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238A6F64' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
input.num {
  width: 92px;
  text-align: right;
}
textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
}
textarea.code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  font-weight: 500;
  min-height: 260px;
  tab-size: 2;
}
label.field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.search {
  position: relative;
  flex: 1;
  min-width: 140px;
}
.search input {
  width: 100%;
  padding-left: 34px;
}
.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--faint);
}
/* On and off, like the game's settings toggles. */
.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  border: 0;
  border-radius: 14px;
  background: var(--lip);
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 0 rgba(90, 64, 56, 0.18);
  transition: transform 0.15s;
}
.switch.on {
  background: var(--green-lip);
}
.switch.on::after {
  transform: translateX(18px);
}

/* Pills and badges. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--grid);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.pill.candidate {
  background: #fff1cc;
  color: #8a6512;
}
.pill.needs_edit {
  background: #ffe1c2;
  color: #94501a;
}
.pill.approved,
.pill.live {
  background: #d8f4e6;
  color: #23744f;
}
.pill.rejected,
.pill.retired {
  background: #ffe0e6;
  color: #a33c55;
}
.pill.hand {
  background: #e3f0fb;
  color: #2f6fa3;
}
.pill.studio {
  background: #efe7ff;
  color: #6a4fb5;
}
.badge {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.badge.quiet {
  background: var(--grid);
  color: var(--muted);
}
.meter {
  display: inline-block;
  position: relative;
  width: 54px;
  height: 7px;
  border-radius: 4px;
  background: var(--grid);
  overflow: hidden;
  vertical-align: middle;
}
.meter i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green-lip), var(--yellow-lip) 55%, var(--accent));
}
.chips {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.chip.moving {
  background: var(--blue);
}
.chip.bounce {
  background: var(--bounce);
}
.chip.breakable {
  background: var(--yellow);
}
.chip.platform {
  background: var(--pink);
}

/* ------------------------------------------------------------ tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
tbody tr:hover td {
  background: var(--bg);
}
tbody tr:last-child td {
  border-bottom: 0;
}
.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
}
td .warn,
.warn-text {
  color: var(--warn);
}
td .bad,
.bad-text {
  color: var(--bad);
}
.good-text {
  color: var(--good);
}

/* ------------------------------------------------------------ toasts and dialogs */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: var(--r);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 5px 0 #3b2924;
  z-index: 50;
  animation: pop 0.18s ease-out;
}
.toast.err {
  background: var(--accent);
  box-shadow: 0 5px 0 var(--accent-lip);
}
@keyframes pop {
  from {
    transform: translate(-50%, 12px);
    opacity: 0;
  }
}
.scrim {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(90, 64, 56, 0.35);
  z-index: 40;
  animation: fade 0.12s ease-out;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.dialog {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 7px 0 var(--lip);
}
.dialog h2 {
  font-size: 24px;
  margin-bottom: 6px;
}
.dialog p {
  margin: 0 0 14px;
  color: var(--muted);
}
.dialog .row {
  justify-content: flex-end;
  margin-top: 16px;
}
.diffbox {
  max-height: 260px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  font-weight: 500;
}
.diffbox div {
  white-space: pre-wrap;
  word-break: break-all;
}
.diffbox .add {
  color: var(--good);
}
.diffbox .del {
  color: var(--bad);
}

/* ------------------------------------------------------------ login */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
}
.login .card {
  width: min(400px, 100%);
  padding: 30px 26px;
  text-align: center;
}
.login h1 {
  font-size: 34px;
  margin: 16px 0 4px;
}
.login p {
  color: var(--muted);
  margin: 0 0 20px;
}
.login input {
  width: 100%;
  margin-bottom: 14px;
  text-align: center;
}
.login .sq {
  margin: 0 auto;
}

/* ------------------------------------------------------------ levels screen */

.levels {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 330px;
  gap: 18px;
  height: calc(100vh - 44px);
  min-height: 560px;
}
.levels > * {
  min-height: 0;
}
.queue {
  display: flex;
  flex-direction: column;
}
.queue .head {
  padding: 14px 14px 10px;
  border-bottom: 3px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.queue .head .seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.queue .head .seg button {
  flex-direction: column;
  gap: 0;
  padding: 6px 4px;
  font-size: 13px;
}
.queue .head .seg button .count {
  font-size: 15px;
}
.queue .list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.qrow {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 7px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.qrow:hover {
  background: var(--bg);
}
.qrow.sel {
  background: var(--grid);
}
.qrow canvas,
.thumb {
  width: 76px;
  height: 52px;
  flex: none;
  border-radius: 10px;
  background: var(--bg);
}
.qrow .meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.qrow .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}
.qrow .line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
}
.qrow .note {
  color: #94501a;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stage {
  position: relative;
  flex: 1;
  min-height: 280px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: 0 var(--lip-h) 0 var(--lip);
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.stage .hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.stage .hud > * {
  pointer-events: auto;
}
.hud-pill {
  padding: 7px 13px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 0 var(--lip);
  font-size: 18px;
  font-weight: 900;
}
.hud-pill small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.stage .banner {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: var(--r);
  background: var(--card);
  box-shadow: 0 5px 0 var(--lip);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}
.stage .banner.won {
  background: var(--green);
  box-shadow: 0 5px 0 var(--green-lip);
}
.stage .banner small {
  display: block;
  font-size: 13px;
  font-weight: 800;
  opacity: 0.75;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar .spacer {
  flex: 1;
}
.inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 8px;
}
.inspector .title h2 {
  font-size: 24px;
  line-height: 1.1;
  word-break: break-word;
}
.inspector .title .row {
  margin-top: 6px;
}
.verdicts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.verdicts .btn {
  width: 100%;
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fact {
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--bg);
}
.fact b {
  display: block;
  font-size: 19px;
  font-weight: 900;
}
.fact span {
  color: var(--muted);
  font-size: 12.5px;
}
.fact.warn {
  background: #fff1cc;
}
.fact.bad {
  background: #ffe0e6;
}
.fact.good {
  background: #d8f4e6;
}
.check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 7px 0;
  font-size: 14px;
}
.check svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.check.ok svg {
  color: var(--good);
}
.check.warn svg {
  color: var(--warn);
}
.check.bad svg {
  color: var(--bad);
}
.history {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.history li {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 2px solid var(--line);
}
.history li:last-child {
  border-bottom: 0;
}
.history time {
  flex: none;
  width: 92px;
  color: var(--faint);
}
.keys {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 2;
}
details summary {
  cursor: pointer;
  font-weight: 900;
}
details[open] summary {
  margin-bottom: 10px;
}

/* ------------------------------------------------------------ campaign */

.campaign {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.order {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.orow {
  display: grid;
  grid-template-columns: 26px 40px 76px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 14px;
  background: var(--card);
  cursor: grab;
}
.orow:hover {
  background: var(--bg);
}
.orow.sel {
  background: var(--grid);
}
.orow.dragging {
  opacity: 0.4;
}
.orow.drop-above {
  box-shadow: inset 0 3px 0 var(--accent);
}
.orow.drop-below {
  box-shadow: inset 0 -3px 0 var(--accent);
}
.orow .grip {
  color: var(--faint);
}
.orow .slot {
  font-size: 18px;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.orow .who {
  min-width: 0;
}
.orow .who b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.orow .who span {
  color: var(--muted);
  font-size: 12.5px;
}
.orow .moves {
  display: flex;
  gap: 4px;
  opacity: 0;
}
.orow:hover .moves,
.orow.sel .moves {
  opacity: 1;
}
.sticky {
  position: sticky;
  top: 18px;
}
.pool {
  max-height: 420px;
  overflow-y: auto;
}
.dirty-bar {
  position: sticky;
  top: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--r);
  background: var(--yellow);
  box-shadow: 0 5px 0 var(--yellow-lip);
}
.dirty-bar .spacer {
  flex: 1;
}
.mini-stage {
  position: relative;
  height: 300px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg);
}
.mini-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* ------------------------------------------------------------ charts */

.chart {
  position: relative;
  width: 100%;
}
.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.chart text {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
}
.chart .axis {
  stroke: var(--line);
  stroke-width: 2;
}
.chart .gridline {
  stroke: var(--line);
  stroke-width: 1.5;
}
.chart .hit {
  fill: transparent;
  cursor: pointer;
}
.chart .hover-band {
  fill: var(--bg);
}
.tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  padding: 8px 11px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 4px 0 #3b2924;
  transform: translate(-50%, calc(-100% - 10px));
}
.tip b {
  font-weight: 900;
}
.tip i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 3px;
}
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 4px;
  vertical-align: -1px;
}
.legend i.line {
  height: 3px;
  vertical-align: 3px;
}
.hbar {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 14px;
}
.hbar .lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hbar .bar {
  height: 14px;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
  min-width: 2px;
}
.hbar .bar.alt {
  background: var(--series-2);
}
.hbar .val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hbar .val small {
  color: var(--muted);
}

/* ------------------------------------------------------------ config */

.cfg-group {
  padding: 0;
  overflow: hidden;
}
.cfg-group > header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
}
.cfg-group > header .ic {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
}
.cfg-group > header .ic svg {
  width: 20px;
  height: 20px;
}
.cfg-group > header p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}
.knob {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  padding: 11px 18px;
  border-top: 2px solid var(--line);
}
.knob.changed {
  background: #fffaf0;
  box-shadow: inset 4px 0 0 var(--accent);
}
.knob .k b {
  display: block;
}
.knob .k span {
  color: var(--muted);
  font-size: 13px;
}
.knob .k code {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 500;
}
.knob .v {
  display: flex;
  align-items: center;
  gap: 8px;
}
.knob .reset {
  color: var(--accent);
  font-size: 12.5px;
  border: 0;
  background: none;
  cursor: pointer;
  font-weight: 900;
  padding: 2px 4px;
}
.knob .unread {
  color: var(--warn);
  font-size: 12px;
}
.range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range input[type='range'] {
  width: 140px;
  accent-color: var(--accent);
}

/* ------------------------------------------------------------ events */

.evrow td {
  vertical-align: top;
}
.evrow .props {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
  color: var(--muted);
}
.evrow.fresh td {
  animation: flash 1.2s ease-out;
}
@keyframes flash {
  from {
    background: #fff1cc;
  }
}
.livedot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green-lip);
  box-shadow: 0 0 0 0 rgba(95, 185, 142, 0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px rgba(95, 185, 142, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(95, 185, 142, 0);
  }
}

/* ------------------------------------------------------------ leaderboards */

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 20px 0 6px;
}
.podium div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 92px;
  padding-top: 12px;
  border-radius: 14px 14px 0 0;
  font-size: 22px;
  font-weight: 900;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 2px solid var(--line);
}
.lb-row .rank {
  width: 26px;
  text-align: right;
  font-weight: 900;
  color: var(--muted);
}
.lb-row .sq {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}
.lb-row .sq::before,
.lb-row .sq::after {
  top: 7px;
  width: 4px;
  height: 7px;
}
.lb-row .sq::before {
  left: 7px;
}
.lb-row .sq::after {
  right: 7px;
}

/* ------------------------------------------------------------ narrow screens */

@media (max-width: 1280px) {
  .levels {
    grid-template-columns: 290px minmax(0, 1fr);
    height: auto;
  }
  .levels .stage-col {
    height: calc(100vh - 44px);
    min-height: 520px;
  }
  .levels .queue {
    height: calc(100vh - 44px);
    min-height: 520px;
  }
  .levels .inspector {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    overflow: visible;
  }
  .campaign {
    grid-template-columns: 1fr;
  }
  .sticky {
    position: static;
  }
}
@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 6px 0 0 var(--lip);
  }
  .side.open {
    transform: none;
  }
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(251, 243, 231, 0.94);
    border-bottom: 3px solid var(--grid);
  }
  .mobile-bar b {
    font-size: 19px;
    font-weight: 900;
  }
  .content {
    padding: 16px 16px 40px;
  }
  .page-head h1 {
    font-size: 27px;
  }
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
  .levels {
    grid-template-columns: 1fr;
  }
  .levels .queue {
    height: 420px;
    min-height: 0;
  }
  .levels .stage-col {
    height: 74vh;
    min-height: 420px;
  }
  .orow {
    grid-template-columns: 34px 64px minmax(0, 1fr) auto;
  }
  .orow .grip,
  .orow .meter {
    display: none;
  }
  .orow .moves {
    opacity: 1;
  }
  .hbar {
    grid-template-columns: 110px minmax(0, 1fr) 54px;
  }
}

/* Stage toolbar: one row at desktop widths. */
.toolbar {
  gap: 6px;
}
.toolbar .btn.sm {
  padding: 6px 10px;
  font-size: 13.5px;
  gap: 5px;
}
.sq.sm {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  box-shadow: inset 0 -3px 0 var(--square-lip);
}
.sq.sm::before,
.sq.sm::after {
  top: 7px;
  width: 4px;
  height: 7px;
}
.sq.sm::before {
  left: 7px;
}
.sq.sm::after {
  right: 7px;
}

/* Analytics: weak-level flags. */
.pill.flag.bad {
  background: #ffe0e6;
  color: #a33c55;
}
.pill.flag.warn {
  background: #fff1cc;
  color: #8a6512;
}
.flags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.levels-stats tr.flagged td:first-child {
  box-shadow: inset 3px 0 0 var(--bad);
}
.weak-list {
  display: grid;
  gap: 12px;
}
.weak {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--grid);
}
.weak-name {
  font-weight: 900;
  margin-bottom: 6px;
}
.weak ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}
