@import "../../shell/shell-surface.css";

html,
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

.stats-drawer {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.stats-drawer-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  box-sizing: border-box;
}

.stats-drawer #stats-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  font-family: var(--score-mono, monospace);
  color: var(--score-text, #e8eaef);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-drawer #stats-panel .stat-group {
  border: 1px solid rgba(90, 100, 128, 0.45);
  border-radius: 5px;
  background: transparent;
  overflow: hidden;
}

.stats-drawer #stats-panel .stat-group:has(.stat-row--meter) {
  overflow: visible;
  padding-right: 4px;
}

.stats-drawer #stats-panel .stat-group .stat-row {
  border-bottom: 1px solid rgba(42, 49, 68, 0.65);
}

.stats-drawer #stats-panel .stat-group .stat-row:last-child {
  border-bottom: none;
}

.stats-drawer #stats-panel .stat-group-title {
  padding: 6px 8px 4px;
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.stats-drawer #stats-panel .stat-group[data-stat-group="stats"] .stat-group-title {
  color: var(--score-cyan, #2dd4bf);
}

.stats-drawer #stats-panel .stat-group[data-stat-group="stats"] .stat-row--meter .stat-meter-panel-inner--bias {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.stats-drawer #stats-panel .stat-group[data-stat-group="stats"] .stat-meter-actions {
  width: auto;
  min-width: 0;
  align-items: center;
}

.stats-drawer #stats-panel .stat-group[data-stat-group="stats"] .stat-meter-reset,
.stats-drawer #stats-panel .stat-group[data-stat-group="stats"] .stat-meter-visibility:not(.stat-meter-visibility--vertical) {
  width: 44px;
}

.stats-drawer #stats-panel .stat-group[data-stat-group="progress"] .stat-group-title {
  color: rgba(160, 230, 180, 0.85);
}

.stats-drawer #stats-panel .stat-group[data-stat-group="achievements"] .stat-group-title {
  color: rgba(196, 160, 255, 0.92);
}

.stats-drawer #stats-panel .stat-group--controls .stat-group-title {
  color: var(--score-cyan, #2dd4bf);
  padding-bottom: calc(4.4 / var(--controls-ref) * 100cqw);
}

.stats-drawer #stats-panel .stat-row--scene-meter .stat-label {
  color: rgba(160, 230, 180, 0.85);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.stats-drawer #stats-panel .stat-row[data-row-key="sceneFrameProgress"] .stat-meter-headers--two,
.stats-drawer #stats-panel .stat-row[data-row-key="sceneFrameProgress"] .stat-meter-ticks--two {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 4px;
}

.stats-drawer #stats-panel .stat-row[data-row-key="sceneFrameProgress"] .stat-meter-head--left {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.stats-drawer #stats-panel .stat-row[data-row-key="sceneFrameProgress"] .stat-meter-head--right {
  white-space: nowrap;
  padding-left: 2px;
}

.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-headers,
.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-values,
.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-ticks {
  grid-template-columns: auto 1fr auto;
  column-gap: 6px;
}

.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-head--left,
.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-head--right {
  font-size: 13.5px;
  letter-spacing: 0.04em;
}

.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-head--center {
  white-space: nowrap;
  font-size: 8px;
  letter-spacing: 0.03em;
  line-height: 1;
}

.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-head--center.is-normal {
  color: #4ade80;
}

.stats-drawer #stats-panel .stat-row[data-row-key="averageActionScore"] .stat-meter-head--center.is-hardcore {
  color: #f87171;
}

.stats-drawer #stats-panel .stat-row--scene-title {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  padding: 0;
  flex-shrink: 0;
  overflow: hidden;
}

.stats-drawer #stats-panel .stat-row--scene-title.stat-row--meter {
  padding: 0;
}

.stats-drawer #stats-panel .stat-row--scene-title .stat-meter-panel-inner {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 0;
  max-height: 100%;
}

.stats-drawer #stats-panel .stat-row--scene-title .stat-meter-wrap,
.stats-drawer #stats-panel .stat-row--scene-title .stat-meter {
  display: block;
  width: 100%;
  height: 100%;
}

.stats-drawer #stats-panel .stat-row--scene-title .stat-meter-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  padding: 0 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.stats-drawer #stats-panel .stat-row--scene-title .stat-meter-info-text {
  white-space: nowrap;
  overflow: hidden;
  line-height: 1;
  width: 100%;
  text-align: center;
}

.stats-drawer #stats-panel .stat-row--scene-title .stat-meter-info-text.is-multiline {
  white-space: pre-line;
  line-height: 1.05;
  overflow: hidden;
}

.stats-drawer .stat-meter-info-text {
  display: block;
  width: 100%;
  font-family: var(--score-font, system-ui, sans-serif);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #eef1f6;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.stats-drawer #stats-panel .stat-row--achievement-meter .stat-label {
  color: rgba(196, 160, 255, 0.92);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.stats-drawer #stats-panel .stat-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 4px 4px 4px 6px;
}

.stats-drawer #stats-panel .stat-row--group-head {
  background: transparent;
}

.stats-drawer #stats-panel .stat-row--group-head .stat-label {
  color: var(--score-text, #e8eaef);
  font-weight: 700;
}

.stats-drawer #stats-panel .stat-row-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.stats-drawer #stats-panel .stat-row-main .stat-label {
  flex: 1 1 auto;
  min-width: 0;
}

.stats-drawer #stats-panel .stat-row-main .stat-value {
  flex: 0 1 auto;
  max-width: 58%;
}

.stats-drawer #stats-panel .stat-row--meter {
  padding: 10px 12px;
}

.stats-drawer #stats-panel .stat-row-main--hidden {
  display: none;
}

.stats-drawer .stat-meter-panel-inner--no-actions {
  grid-template-columns: 1fr;
}

.stats-drawer .stat-meter-panel-inner--no-actions.stat-meter-panel-inner--progress {
  grid-template-columns: 1fr;
  column-gap: 0;
  min-height: 0;
}

.stats-drawer .stat-meter-panel-inner {
  display: grid;
  grid-template-columns: 1fr 76px;
  align-items: stretch;
  column-gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  flex: 1 1 auto;
}

.stats-drawer .stat-meter-panel-inner.is-paused .stat-meter-wrap {
  filter: grayscale(1) brightness(0.62);
  opacity: 0.72;
  pointer-events: none;
}

.stats-drawer .stat-meter-panel-inner.is-paused .stat-meter-wrap.is-progress-paused {
  filter: grayscale(1) brightness(0.62);
  opacity: 0.72;
}

.stats-drawer .stat-meter-panel-inner.is-paused .stat-meter-wrap.is-progress-paused .stat-meter-fill--progress {
  width: 0 !important;
}

.stats-drawer .stat-meter-panel-inner.is-paused .stat-meter-reset {
  filter: grayscale(1) brightness(0.75);
  opacity: 0.8;
}

.stats-drawer .stat-meter-wrap {
  min-width: 0;
  width: 100%;
}

.stats-drawer .stat-meter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.stats-drawer .stat-meter-headers,
.stats-drawer .stat-meter-values,
.stats-drawer .stat-meter-ticks {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  text-align: center;
}

.stats-drawer .stat-meter-headers--two,
.stats-drawer .stat-meter-values--two,
.stats-drawer .stat-meter-ticks--two {
  grid-template-columns: 1fr 1fr;
}

.stats-drawer .stat-meter-headers {
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(180, 186, 198, 0.85);
}

.stats-drawer .stat-meter-head--left {
  text-align: left;
}

.stats-drawer .stat-meter-head--center {
  color: rgba(200, 206, 218, 0.7);
}

.stats-drawer .stat-meter-head--right {
  text-align: right;
}

.stats-drawer .stat-meter--theme-timing .stat-meter-head--left {
  color: #8ee8ff;
}

.stats-drawer .stat-meter--theme-timing .stat-meter-head--right {
  color: #ffb366;
}

.stats-drawer .stat-meter--theme-timing .stat-meter-head--center {
  color: rgba(200, 230, 255, 0.92);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 1.1;
  white-space: normal;
}

.stats-drawer .stat-meter--theme-timing .stat-meter-value--center-score {
  color: #d6f4ff;
}

.stats-drawer .stat-meter--theme-accuracy .stat-meter-head--left {
  color: #8ee8ff;
}

.stats-drawer .stat-meter--theme-accuracy .stat-meter-head--right {
  color: #ff8866;
}

.stats-drawer .stat-meter--theme-lag .stat-meter-head--left {
  color: #8ee8ff;
}

.stats-drawer .stat-meter--theme-lag .stat-meter-head--right {
  color: #ffb366;
}

.stats-drawer .stat-meter--theme-green .stat-meter-head--left,
.stats-drawer .stat-meter--theme-green .stat-meter-head--right {
  color: rgba(160, 230, 180, 0.85);
}

.stats-drawer .stat-meter--theme-green .stat-meter-head--center {
  color: rgba(214, 255, 224, 0.95);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 1.1;
  white-space: normal;
}

.stats-drawer .stat-meter--theme-purple .stat-meter-head--left,
.stats-drawer .stat-meter--theme-purple .stat-meter-head--right {
  color: rgba(196, 160, 255, 0.92);
}

.stats-drawer .stat-meter-values {
  min-height: 18px;
}

.stats-drawer .stat-meter-value {
  font-family: var(--score-mono, monospace);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #eef1f6;
}

.stats-drawer .stat-meter-values--center-score {
  grid-template-columns: 1fr auto 1fr;
}

.stats-drawer .stat-meter-value--center-score {
  text-align: center;
  font-size: clamp(1.15rem, 4.8vw, 1.55rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #eef1f6;
}

.stats-drawer .stat-meter--theme-green .stat-meter-value--center-score {
  color: #d6ffe0;
}

.stats-drawer .stat-meter-value--left {
  text-align: left;
}

.stats-drawer .stat-meter-value--right {
  text-align: right;
}

.stats-drawer .stat-meter--theme-green .stat-meter-value--right {
  color: #b8ffc8;
}

.stats-drawer .stat-meter-wrap.is-empty .stat-meter-value {
  font-size: 13px;
  color: rgba(180, 186, 198, 0.45);
}

.stats-drawer .stat-meter-info {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 10px;
  overflow: hidden;
  font-family: var(--score-font, system-ui, sans-serif);
  color: #eef1f6;
}

.stats-drawer .stat-meter-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: rgba(10, 14, 24, 0.95);
  border: 1px solid rgba(60, 72, 96, 0.65);
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.45);
}

.stats-drawer .stat-meter-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: width 120ms ease-out;
}

.stats-drawer .stat-meter-fill--left {
  left: 0;
}

.stats-drawer .stat-meter-fill--right {
  right: 0;
}

.stats-drawer .stat-meter--theme-timing .stat-meter-fill--left {
  background: linear-gradient(90deg, #004080 0%, #0088dd 55%, #00d4ff 100%);
  box-shadow: inset -2px 0 8px rgba(0, 200, 255, 0.45), 0 0 10px rgba(0, 180, 255, 0.25);
}

.stats-drawer .stat-meter--theme-timing .stat-meter-fill--right {
  background: linear-gradient(270deg, #803000 0%, #dd6600 55%, #ff9922 100%);
  box-shadow: inset 2px 0 8px rgba(255, 140, 0, 0.45), 0 0 10px rgba(255, 120, 0, 0.22);
}

.stats-drawer .stat-meter--theme-accuracy .stat-meter-fill--left {
  background: linear-gradient(90deg, #004080 0%, #0088dd 55%, #00d4ff 100%);
  box-shadow: inset -2px 0 8px rgba(0, 200, 255, 0.35);
}

.stats-drawer .stat-meter--theme-accuracy .stat-meter-fill--right {
  background: linear-gradient(270deg, #802020 0%, #dd4444 55%, #ff6644 100%);
  box-shadow: inset 2px 0 8px rgba(255, 80, 0, 0.35);
}

.stats-drawer .stat-meter--theme-lag .stat-meter-fill--left {
  background: linear-gradient(90deg, #004080 0%, #0088dd 55%, #00d4ff 100%);
  box-shadow: inset -2px 0 8px rgba(0, 200, 255, 0.35);
}

.stats-drawer .stat-meter--theme-lag .stat-meter-fill--right {
  background: linear-gradient(270deg, #803000 0%, #dd6600 55%, #ff9922 100%);
  box-shadow: inset 2px 0 8px rgba(255, 140, 0, 0.35);
}

.stats-drawer .stat-meter--theme-green .stat-meter-fill--progress {
  background: linear-gradient(90deg, #1a6640 0%, #2ecc71 50%, #6fff9a 100%);
  box-shadow: inset -2px 0 8px rgba(80, 255, 140, 0.35), 0 0 10px rgba(46, 204, 113, 0.25);
}

.stats-drawer .stat-meter--theme-purple .stat-meter-fill--progress {
  background: linear-gradient(90deg, #4a2080 0%, #9b59ff 50%, #d4a8ff 100%);
  box-shadow: inset -2px 0 8px rgba(180, 120, 255, 0.4), 0 0 10px rgba(155, 89, 255, 0.28);
}

.stats-drawer .stat-meter--theme-score .stat-meter-head--left {
  color: rgba(180, 186, 198, 0.85);
}

.stats-drawer .stat-meter--theme-score .stat-meter-head--right {
  color: rgba(180, 186, 198, 0.85);
}

.stats-drawer .stat-meter--theme-score .stat-meter-head--center {
  color: rgba(200, 206, 218, 0.7);
}

.stats-drawer .stat-meter--theme-score.tier-off-neon .stat-meter-value--center-score {
  color: var(--score-neon-green, #39ff14);
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.35);
}

.stats-drawer .stat-meter--theme-score.tier-off-green .stat-meter-value--center-score {
  color: var(--score-green, #4ade80);
}

.stats-drawer .stat-meter--theme-score.tier-off-teal .stat-meter-value--center-score {
  color: var(--score-cyan, #2dd4bf);
}

.stats-drawer .stat-meter--theme-score.tier-off-amber .stat-meter-value--center-score {
  color: var(--score-amber, #fbbf24);
}

.stats-drawer .stat-meter--theme-score.tier-off-neon .stat-meter-fill--left {
  background: linear-gradient(90deg, #1a6630 0%, #39ff14 55%, #b8ffb0 100%);
  box-shadow: inset -2px 0 8px rgba(57, 255, 20, 0.45), 0 0 10px rgba(57, 255, 20, 0.28);
}

.stats-drawer .stat-meter--theme-score.tier-off-green .stat-meter-fill--left {
  background: linear-gradient(90deg, #14532d 0%, #22c55e 55%, #86efac 100%);
  box-shadow: inset -2px 0 8px rgba(74, 222, 128, 0.4), 0 0 10px rgba(34, 197, 94, 0.24);
}

.stats-drawer .stat-meter--theme-score.tier-off-teal .stat-meter-fill--left {
  background: linear-gradient(90deg, #0f4c5c 0%, #14b8a6 55%, #5eead4 100%);
  box-shadow: inset -2px 0 8px rgba(45, 212, 191, 0.4), 0 0 10px rgba(20, 184, 166, 0.24);
}

.stats-drawer .stat-meter--theme-score.tier-off-amber .stat-meter-fill--left {
  background: linear-gradient(90deg, #78350f 0%, #f59e0b 55%, #fcd34d 100%);
  box-shadow: inset -2px 0 8px rgba(251, 191, 36, 0.4), 0 0 10px rgba(245, 158, 11, 0.24);
}

.stats-drawer #stats-panel .stat-group[data-stat-group="achievements"]:has(.stat-row--meter) {
  overflow: visible;
  padding-right: 0;
}

.stats-drawer #stats-panel .stat-row--achievement-meter {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0 8px 8px;
}

.stats-drawer #stats-panel .stat-row--achievement-meter .stat-meter-panel-inner {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  column-gap: 0;
}

.stats-drawer #stats-panel .stat-row--achievement-meter .stat-meter-wrap,
.stats-drawer #stats-panel .stat-row--achievement-meter .stat-meter {
  width: 100%;
  max-width: none;
}

.stats-drawer #stats-panel .stat-row--achievement-meter .stat-meter-track {
  width: 100%;
}

.stats-drawer #stats-panel .stat-group[data-stat-group="achievements"] {
  overflow: visible;
}

.stats-drawer #stats-panel .stat-group--controls {
  overflow: visible;
  padding-right: 0;
  container-type: inline-size;
  container-name: controls-drawer;
  /* UI_4 mockup @ REF 297px — see docs/29 §11 */
  --controls-ref: 297;
  --controls-fill: #071426;
  --controls-label: #f8fafc;
  --controls-key-border-idle: #2a7088;
  --controls-key-glyph-idle: #3a9aad;
  --controls-key-glow-idle: rgba(34, 160, 190, 0.32);
  --controls-key-border-hi: #58f8fb;
  --controls-key-glyph-hi: #93fbff;
  --controls-key-glow-hi: #22dffb;
  --controls-border-secondary: #3eb4d0;
  --controls-border-edge: #3db5d1;
  --controls-chevron-glyph: #9dfdff;
  --controls-pulse-duration: 500ms;
}

.stats-drawer #stats-panel .controls-panel {
  width: 100%;
  padding: calc(4.4 / var(--controls-ref) * 100cqw) calc(6 / var(--controls-ref) * 100cqw)
    calc(8.8 / var(--controls-ref) * 100cqw);
  box-sizing: border-box;
}

.stats-drawer #stats-panel .controls-grid {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: calc(42 / var(--controls-ref) * 100cqw);
  row-gap: calc(6.6 / var(--controls-ref) * 100cqw);
  width: 100%;
  justify-content: center;
  justify-items: center;
}

.stats-drawer #stats-panel .controls-block-label {
  display: block;
  width: calc(62 / var(--controls-ref) * 100cqw);
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: calc(12 / var(--controls-ref) * 100cqw);
  font-weight: 700;
  letter-spacing: calc(2 / var(--controls-ref) * 100cqw);
  text-align: center;
  color: var(--controls-label);
  text-transform: uppercase;
}

.stats-drawer #stats-panel .controls-block-label--hit {
  grid-column: 1;
  grid-row: 1;
}

.stats-drawer #stats-panel .controls-block-label--replay {
  grid-column: 2;
  grid-row: 1;
}

.stats-drawer #stats-panel .controls-stack--hit {
  grid-column: 1;
  grid-row: 2;
}

.stats-drawer #stats-panel .controls-stack--replay {
  grid-column: 2;
  grid-row: 2;
}

.stats-drawer #stats-panel .controls-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stats-drawer #stats-panel .controls-key-btn,
.stats-drawer #stats-panel .controls-cycle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  background: var(--controls-fill);
  font-family: var(--score-font, system-ui, sans-serif);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  outline: none;
}

.stats-drawer #stats-panel .controls-key-btn {
  width: calc(57 / var(--controls-ref) * 100cqw);
  height: calc(53 / var(--controls-ref) * 100cqw);
  margin-bottom: calc(7.7 / var(--controls-ref) * 100cqw);
  border: calc(3 / var(--controls-ref) * 100cqw) solid var(--controls-key-border-idle);
  border-radius: calc(11 / var(--controls-ref) * 100cqw);
  color: var(--controls-key-glyph-idle);
  font-size: calc(26 / var(--controls-ref) * 100cqw);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 0 calc(3 / var(--controls-ref) * 100cqw) rgba(37, 180, 210, 0.35);
  box-shadow:
    0 0 calc(5 / var(--controls-ref) * 100cqw) var(--controls-key-glow-idle),
    0 0 calc(1 / var(--controls-ref) * 100cqw) rgba(42, 112, 136, 0.55);
  transition:
    background 90ms ease,
    border-color 90ms ease,
    box-shadow 90ms ease,
    color 90ms ease,
    text-shadow 90ms ease,
    transform 90ms ease;
}

@keyframes controls-key-pulse {
  0%,
  4% {
    border-color: var(--controls-key-border-hi);
    color: var(--controls-key-glyph-hi);
    text-shadow:
      0 0 0.15em #25dff2,
      0 0 0.3em rgba(37, 223, 242, 0.45);
    box-shadow:
      0 0 0.35em var(--controls-key-glow-hi),
      0 0 0.1em var(--controls-border-edge);
    transform: scale(1.04);
  }

  100% {
    border-color: var(--controls-key-border-idle);
    color: var(--controls-key-glyph-idle);
    text-shadow: 0 0 0.12em rgba(37, 180, 210, 0.35);
    box-shadow:
      0 0 0.2em var(--controls-key-glow-idle),
      0 0 0.04em rgba(42, 112, 136, 0.55);
    transform: scale(1);
  }
}

.stats-drawer #stats-panel .controls-key-btn.is-pulsed {
  animation: controls-key-pulse var(--controls-pulse-ms, 180ms) ease-out 1;
}

.stats-drawer #stats-panel .stat-group--hud-position {
  overflow: visible;
  padding-right: 0;
  padding-top: 4px;
  padding-bottom: 14px;
}

.stats-drawer #stats-panel .stat-group--hud-position .stat-group-title {
  color: var(--score-cyan, #2dd4bf);
  padding: 10px 14px 8px;
}

.stats-drawer #stats-panel .hud-position-panel {
  container-type: inline-size;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 0 14px;
}

.stats-drawer #stats-panel .hud-position-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: calc(10 / var(--hud-position-ref, 297) * 100cqw);
  width: calc(100% - 24px);
  margin: 0 12px;
  justify-items: stretch;
}

.stats-drawer #stats-panel .hud-position-btn {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: calc(56 / var(--hud-position-ref, 297) * 100cqw);
  margin: 0;
  padding: calc(16 / var(--hud-position-ref, 297) * 100cqw)
    calc(18 / var(--hud-position-ref, 297) * 100cqw);
  border: calc(2 / var(--hud-position-ref, 297) * 100cqw) solid var(--controls-key-border-idle);
  border-radius: calc(10 / var(--hud-position-ref, 297) * 100cqw);
  background: var(--controls-fill);
  box-sizing: border-box;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  color: var(--controls-key-glyph-idle);
  box-shadow:
    0 0 calc(5 / var(--hud-position-ref, 297) * 100cqw) var(--controls-key-glow-idle),
    0 0 calc(1 / var(--hud-position-ref, 297) * 100cqw) rgba(42, 112, 136, 0.55);
  transition:
    background 90ms ease,
    border-color 90ms ease,
    box-shadow 90ms ease,
    color 90ms ease,
    text-shadow 90ms ease,
    transform 90ms ease;
}

.stats-drawer #stats-panel .hud-position-btn-label {
  display: block;
  pointer-events: none;
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: calc(16.5 / var(--hud-position-ref, 297) * 100cqw);
  font-weight: 700;
  letter-spacing: calc(1.5 / var(--hud-position-ref, 297) * 100cqw);
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 calc(3 / var(--hud-position-ref, 297) * 100cqw) rgba(37, 180, 210, 0.35);
}

.stats-drawer #stats-panel .hud-position-btn:hover {
  border-color: #3d8fa8;
  color: #4eb4c8;
}

.stats-drawer #stats-panel .hud-position-btn:hover .hud-position-btn-label {
  text-shadow: 0 0 calc(4 / var(--hud-position-ref, 297) * 100cqw) rgba(37, 200, 230, 0.45);
}

.stats-drawer #stats-panel .hud-position-btn:active {
  border-color: var(--controls-key-border-hi);
  color: var(--controls-key-glyph-hi);
  transform: scale(0.98);
  transition: none;
}

.stats-drawer #stats-panel .hud-position-btn:active .hud-position-btn-label {
  text-shadow:
    0 0 calc(4 / var(--hud-position-ref, 297) * 100cqw) #25dff2,
    0 0 calc(8 / var(--hud-position-ref, 297) * 100cqw) rgba(37, 223, 242, 0.45);
}

.stats-drawer #stats-panel .hud-position-btn.is-active {
  border-color: var(--controls-key-border-hi);
  color: var(--controls-key-glyph-hi);
  box-shadow:
    0 0 calc(6 / var(--hud-position-ref, 297) * 100cqw) var(--controls-key-glow-hi),
    0 0 calc(2 / var(--hud-position-ref, 297) * 100cqw) var(--controls-border-edge);
}

.stats-drawer #stats-panel .hud-position-btn.is-active .hud-position-btn-label {
  text-shadow:
    0 0 0.15em #25dff2,
    0 0 0.3em rgba(37, 223, 242, 0.45);
}

.stats-drawer #stats-panel .controls-cycle-row {
  display: flex;
  align-items: stretch;
  gap: calc(13 / var(--controls-ref) * 100cqw);
  width: calc(58 / var(--controls-ref) * 100cqw);
}

.stats-drawer #stats-panel .controls-cycle {
  flex: 1 1 0;
  min-width: 0;
  height: calc(20 / var(--controls-ref) * 100cqw);
  padding: 0;
  border: calc(2 / var(--controls-ref) * 100cqw) solid var(--controls-border-secondary);
  border-radius: calc(5 / var(--controls-ref) * 100cqw);
  box-shadow: 0 0 calc(4 / var(--controls-ref) * 100cqw) rgba(26, 186, 216, 0.55);
}

.stats-drawer #stats-panel .controls-cycle-icon {
  display: block;
  width: 88%;
  height: 88%;
  color: var(--controls-chevron-glyph);
  filter: drop-shadow(0 0 calc(2 / var(--controls-ref) * 100cqw) rgba(69, 232, 240, 0.65));
}

.stats-drawer #stats-panel .controls-key-btn:hover {
  border-color: #3d8fa8;
  color: #4eb4c8;
  text-shadow: 0 0 calc(4 / var(--controls-ref) * 100cqw) rgba(37, 200, 230, 0.45);
  box-shadow:
    0 0 calc(6 / var(--controls-ref) * 100cqw) rgba(34, 180, 210, 0.42),
    0 0 calc(2 / var(--controls-ref) * 100cqw) rgba(42, 112, 136, 0.6);
}

.stats-drawer #stats-panel .controls-cycle:hover {
  border-color: var(--controls-key-border-hi);
}

.stats-drawer #stats-panel .controls-cycle:active {
  transform: scale(0.98);
}

.stats-drawer #stats-panel .controls-key-btn:active {
  border-color: var(--controls-key-border-hi);
  color: var(--controls-key-glyph-hi);
  text-shadow:
    0 0 calc(4 / var(--controls-ref) * 100cqw) #25dff2,
    0 0 calc(8 / var(--controls-ref) * 100cqw) rgba(37, 223, 242, 0.45);
  box-shadow:
    0 0 calc(8 / var(--controls-ref) * 100cqw) var(--controls-key-glow-hi),
    0 0 calc(2 / var(--controls-ref) * 100cqw) var(--controls-border-edge);
  transform: scale(0.98);
  transition: none;
}

.stats-drawer #stats-panel .controls-key-btn.is-pulsed {
  animation: controls-key-pulse var(--controls-pulse-duration) ease-out forwards;
  transition: none;
}

.stats-drawer .stat-meter--theme-purple .stat-meter-earned-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  width: 100%;
}

.stats-drawer .stat-meter--theme-purple .stat-meter-earned-row {
  text-align: center;
  width: 100%;
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(196, 160, 255, 0.95);
}

.stats-drawer .stat-meter-fill--progress {
  left: 0;
  transform-origin: left center;
}

.stats-drawer .stat-meter-center-line {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(220, 226, 238, 0.55);
  box-shadow: 0 0 6px rgba(220, 226, 238, 0.35);
  pointer-events: none;
  z-index: 2;
}

.stats-drawer .stat-meter-junction {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 3;
  transition: left 120ms ease-out;
}

.stats-drawer .stat-meter-wrap.is-empty .stat-meter-junction {
  opacity: 0;
}

.stats-drawer .stat-meter-ticks {
  font-family: var(--score-mono, monospace);
  font-size: 10px;
  line-height: 1;
  color: rgba(120, 132, 158, 0.75);
}

.stats-drawer .stat-meter-ticks span:first-child {
  text-align: left;
}

.stats-drawer .stat-meter-ticks span:last-child {
  text-align: right;
}

.stats-drawer .stat-meter-panel-inner--bias {
  grid-template-columns: 1fr 61px;
}

.stats-drawer .stat-meter-panel-inner--progress {
  grid-template-columns: 1fr 26px;
}

.stats-drawer .stat-meter-panel-inner--no-actions.stat-meter-panel-inner--bias,
.stats-drawer .stat-meter-panel-inner--no-actions.stat-meter-panel-inner--progress {
  grid-template-columns: 1fr;
  column-gap: 0;
  min-height: 0;
}

.stats-drawer .stat-meter-panel-inner--no-actions .stat-meter-wrap {
  width: 100%;
  max-width: 100%;
}

.stats-drawer .stat-meter-panel-inner--progress .stat-meter-actions {
  min-height: 64px;
}

.stats-drawer .stat-meter-values--hidden {
  display: none;
}

.stats-drawer .stat-meter--smooth-fill .stat-meter-fill--progress {
  transition: transform 100ms linear;
}

.stats-drawer .stat-meter-visibility--vertical {
  flex: 1 1 auto;
  width: 100%;
  min-height: 64px;
  height: auto;
  padding: 6px 0;
}

.stats-drawer .stat-meter-visibility--vertical .stat-meter-visibility-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1;
}

.stats-drawer .stat-meter-visibility--vertical .stat-meter-visibility-char {
  display: block;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.stats-drawer .stat-meter-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 100%;
  min-height: 64px;
}

.stats-drawer .stat-meter-reset {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 2px;
  min-height: 0;
  width: 70%;
  padding: 3px 3px;
  border: 1.5px solid #66e0ff;
  border-radius: 4px;
  background: rgba(8, 20, 36, 0.9);
  color: #8ee8ff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 6px rgba(0, 180, 255, 0.35), inset 0 0 8px rgba(0, 120, 200, 0.14);
}

.stats-drawer .stat-meter-reset:hover {
  color: #c8f4ff;
  border-color: #99eeff;
}

.stats-drawer .stat-meter-reset:active {
  transform: scale(0.98);
}

.stats-drawer .stat-meter-reset-icon {
  width: 14px;
  height: 14px;
}

.stats-drawer .stat-meter-reset-label {
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stats-drawer .stat-meter-visibility {
  flex: 0 0 auto;
  width: 70%;
  align-self: center;
  height: 26px;
  padding: 0;
  border: 1.5px solid rgba(102, 224, 255, 0.55);
  border-radius: 4px;
  background: rgba(12, 36, 56, 0.85);
  color: #8ee8ff;
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.stats-drawer .stat-meter-visibility.is-off {
  border-color: rgba(100, 108, 124, 0.55);
  background: rgba(16, 18, 26, 0.9);
  color: rgba(140, 148, 164, 0.75);
}

.stats-drawer .stat-meter-visibility:active {
  transform: scale(0.98);
}

.stats-drawer #dev-panel {
  position: static;
  width: 100%;
  min-width: unset;
  padding: 8px 10px;
  margin: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  color: #fff;
  pointer-events: auto;
}

.stats-drawer #dev-panel.dev-panel--collapsed {
  padding: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.stats-drawer .dev-toggle {
  width: 100%;
}

.stats-drawer .dev-seek-form {
  flex-wrap: wrap;
}

.stats-drawer .dev-seek-form input {
  max-width: 100%;
}

.stats-drawer #stats-panel .stat-group--player-name {
  overflow: visible;
  padding-right: 0;
  padding-bottom: 2px;
}

.stats-drawer #stats-panel .stat-group--player-name .stat-group-title {
  color: var(--score-cyan, #2dd4bf);
  padding: 10px 14px 8px;
}

.stats-drawer #stats-panel .player-name-input {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 24px);
  min-height: 60px;
  margin: 2px 12px 16px;
  padding: 12px 14px;
  border: 2px solid rgba(102, 224, 255, 0.55);
  border-radius: 6px;
  background: rgba(8, 20, 36, 0.92);
  color: #eef1f6;
  font-family: var(--score-mono, monospace);
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(0, 180, 255, 0.22), inset 0 0 12px rgba(0, 120, 200, 0.12);
  user-select: text;
  -webkit-user-select: text;
}

.stats-drawer #stats-panel .player-name-input::placeholder {
  color: rgba(139, 149, 171, 0.45);
  letter-spacing: 0.18em;
}

.stats-drawer #stats-panel .player-name-input:focus {
  outline: none;
  border-color: #66e0ff;
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.35), inset 0 0 12px rgba(0, 120, 200, 0.16);
}

.stats-drawer #stats-panel .stat-group--player-name.is-editing .player-name-input {
  border-color: rgba(255, 160, 64, 0.75);
  box-shadow: 0 0 12px rgba(255, 140, 40, 0.28), inset 0 0 12px rgba(0, 120, 200, 0.12);
}

.stats-drawer #stats-panel .player-name-hint {
  margin: 0 12px 8px;
  padding: 0;
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 168, 72, 0.92);
}

.stats-drawer #stats-panel .player-name-toggle {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 24px);
  margin: 0 12px 14px;
  padding: 8px 12px;
  border: 1px solid rgba(102, 224, 255, 0.45);
  border-radius: 6px;
  background: rgba(8, 20, 36, 0.75);
  color: rgba(196, 232, 255, 0.92);
  font-family: var(--score-font, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.stats-drawer #stats-panel .player-name-toggle:hover {
  border-color: #66e0ff;
  color: #eef1f6;
}

.stats-drawer #stats-panel .player-name-toggle.is-pending-done {
  border-color: rgba(255, 140, 40, 0.95);
  color: #ffe8cc;
  animation: player-name-done-pulse 1.6s ease-in-out infinite;
}

@keyframes player-name-done-pulse {
  0%,
  100% {
    border-color: rgba(255, 120, 32, 0.75);
    box-shadow: 0 0 6px rgba(255, 120, 32, 0.25);
  }

  50% {
    border-color: rgba(255, 180, 64, 1);
    box-shadow: 0 0 14px rgba(255, 140, 40, 0.55);
  }
}
