* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1d2433 0%, #0b0d12 55%);
  color: #f7f7f7;
  --success-green: #4bff7a;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  cursor: var(--player-cursor), auto;
}

@font-face {
  font-family: "OmbudsmanStencil";
  src: url("/assets/OmbudsmanStencil.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

body[data-loading="true"] .app-header,
body[data-loading="true"] .stage,
body[data-loading="true"] .sound {
  opacity: 0;
  pointer-events: none;
}

.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 32px;
  background: radial-gradient(circle at top left, #262b35 0%, #0b0d12 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 1000;
}

body[data-loading="true"] .loading-screen {
  opacity: 1;
  pointer-events: auto;
}

.loading-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 12px;
}

.loading-brand .brand-icon {
  border-left: none;
}

.loading-status {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #d9d9d9;
}

.loading-line {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s ease, color 0.25s ease;
}

.loading-line[data-line="2"],
.loading-line[data-line="3"] {
  opacity: 0;
  visibility: hidden;
}

.loading-line.visible {
  opacity: 1;
  visibility: visible;
}

.loading-line.dim {
  color: #8c8c8c;
}

.loading-dots {
  font-family: "Menlo", "Courier New", monospace;
  white-space: pre;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 22px;
  height: 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
}

.brand-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #f7f7f7;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.brand-dot[data-color="yellow"] {
  background: #f5c542;
}

.brand-dot[data-color="blue"] {
  background: #4b84ff;
}

.brand-dot[data-color="red"] {
  background: #dc0303;
}

.brand-dot[data-color="green"] {
  background: #29a11f;
}

.brand-title {
  font-size: 14px;
  letter-spacing: 0.32em;
}

.subtitle {
  margin: 0;
  color: #9aa4b7;
  font-size: 11px;
  letter-spacing: 0.22em;
}

.status {
  padding: 6px 12px;
  border-radius: 999px;
  background: #1b1f2a;
  color: #9dd4ff;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 12px 24px;
}


.stage-grid {
  position: relative;
  width: min(92vw, 1100px);
  height: min(74vh, 780px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.cursor-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.remote-cursor {
  position: absolute;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: inherit;
}

.remote-cursor[data-color="yellow"] {
  color: #f5c542;
}

.remote-cursor[data-color="blue"] {
  color: #4b84ff;
}

.remote-cursor[data-color="red"] {
  color: #dc0303;
}

.remote-cursor[data-color="green"] {
  color: #29a11f;
}

.remote-cursor svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

.stage-dividers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  --divider-gap: 80px;
}

.stage-divider {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
}

.stage-divider.divider-vertical {
  width: 1px;
  left: 50%;
  transform: translateX(-0.5px);
}

.stage-divider.divider-horizontal {
  height: 1px;
  top: 50%;
  transform: translateY(-0.5px);
}

.stage-divider.divider-top {
  top: 0;
  height: calc(50% - var(--divider-gap));
}

.stage-divider.divider-bottom {
  bottom: 0;
  height: calc(50% - var(--divider-gap));
}

.stage-divider.divider-left {
  left: 0;
  width: calc(50% - var(--divider-gap));
}

.stage-divider.divider-right {
  right: 0;
  width: calc(50% - var(--divider-gap));
}

.success-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.success-indicator {
  position: absolute;
}

.success-indicator[data-color="yellow"] {
  top: 25%;
  left: 25%;
}

.success-indicator[data-color="blue"] {
  top: 25%;
  left: 75%;
}

.success-indicator[data-color="red"] {
  top: 75%;
  left: 25%;
}

.success-indicator[data-color="green"] {
  top: 75%;
  left: 75%;
}

.super-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.super-stage.active {
  opacity: 1;
  pointer-events: auto;
  animation: taskRevealGrid 0.45s steps(2) 1 var(--super-stage-delay, 0.25s);
  animation-fill-mode: both;
}

.super-stage.exit {
  animation: taskVanishGrid 0.45s steps(2) 1 forwards;
  pointer-events: none;
}

.super-title {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 1100px);
  text-align: center;
  font-size: 27px;
  white-space: nowrap;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cdd5e5;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
  line-height: 1.05;
  z-index: 2;
  pointer-events: none;
}

.super-field {
  position: absolute;
  inset: 0;
}

.super-timer-dots {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: none;
  z-index: 2;
}

.super-timer-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.super-timer-dots .dot.filled {
  background: #f7f7f7;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.super-circle {
  position: absolute;
  width: 48px;
  height: 48px;
  border: none;
  padding: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: var(--player-cursor), pointer;
  color: inherit;
  z-index: 1;
}

.super-circle::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 153, 64, 0);
  box-shadow: 0 0 0 rgba(255, 153, 64, 0);
  opacity: 0;
  pointer-events: none;
}

.super-circle.miss {
  animation: superMissGlow 0.45s ease;
}

.super-circle.miss::after {
  animation: superMissStroke 0.45s ease;
}

.super-circle.miss .super-circle__stroke {
  stroke: #ff9940;
}

.super-circle__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.super-circle__stroke {
  stroke-linecap: round;
}

.super-circle__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  color: #f7f7f7;
  font-size: 16px;
  font-family: "OmbudsmanStencil", "Menlo", "Courier New", monospace;
  line-height: 1;
  text-align: center;
  transform: translateX(0.5px);
}

.super-circle.removing .super-circle__stroke {
  animation: superBorderErase 0.65s linear forwards;
}

.super-circle.removing .super-circle__label {
  animation: superCircleFade 0.15s linear forwards;
  animation-delay: 0.65s;
}

.quadrant {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}



.slot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.result-flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(0.7);
  --glitch-scale: 0.7;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle at center, rgba(var(--flash-color), 0.55), rgba(var(--flash-color), 0));
  filter: blur(6px);
  mix-blend-mode: screen;
}

.success-indicator {
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  color: currentColor;
  opacity: 0;
  pointer-events: none;
  --arrow-offset-x: 0px;
  --arrow-offset-y: 0px;
  --arrow-rotate: 0deg;
}

.success-indicator .plus {
  width: 28px;
  height: 28px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.success-indicator .plus::before,
.success-indicator .plus::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 5px;
  background: currentColor;
  border-radius: 4px;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.success-indicator .plus::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.success-indicator .arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translate(-50%, -50%) rotate(var(--arrow-rotate));
  opacity: 0;
}

.success-indicator.dir-right {
  --arrow-rotate: 0deg;
}

.success-indicator.dir-left {
  --arrow-rotate: 180deg;
}

.success-indicator.dir-up {
  --arrow-rotate: -90deg;
}

.success-indicator.dir-down {
  --arrow-rotate: 90deg;
}

.success-indicator.active {
  animation: indicatorPulse 3.2s ease-out;
}

.success-indicator.active .arrow {
  animation: arrowFly 3.2s ease-out;
}

.result-flash.success {
  --flash-color: 80, 255, 140;
  background: radial-gradient(
    circle at var(--flash-origin, 50% 50%),
    rgba(var(--flash-color), 0.45) 0%,
    rgba(var(--flash-color), 0.2) 35%,
    rgba(var(--flash-color), 0) 60%
  );
  animation: flashPulse 1.2s ease-out;
}

.result-flash.fail {
  --flash-color: 255, 92, 92;
  animation: flashPulse 1.2s ease-out;
}

.slot .check {
  width: 72px;
  height: 56px;
  display: grid;
  place-items: center;
  color: currentColor;
  position: relative;
}

.slot .check svg {
  width: 100%;
  height: 100%;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.15));
}



.slot.filled .check {
  opacity: 1;
}

.slot.empty .check {
  opacity: 1;
}

.slot.empty .check svg {
  filter: none;
}

.slot.empty .check svg path {
  stroke: currentColor;
  opacity: 0.35;
}


body[data-phase="disconnected"] .grid,
body[data-phase="disconnected"] .task-inline,
body[data-phase="disconnected"] .shape-task,
body[data-phase="disconnected"] .memory-task,
body[data-phase="disconnected"] .timer-dots,
body[data-phase="disconnected"] .success-indicator,
body[data-phase="disconnected"] .result-flash,
body[data-phase="disconnected"] .slot,
body[data-phase="disconnected"] .placeholder {
  opacity: 0;
}


.slot-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.slot-divider {
  width: 100%;
  max-width: 110px;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.slot .label {
  font-size: 36px;
  color: #f7f7f7;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
}

.slot .ip {
  font-size: 11px;
  color: #8d96a9;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
}

.grid {
  display: grid;
  gap: 6px;
  place-content: center;
  position: relative;
  z-index: 3;
}

.shape-task {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.2s ease;
}

.shape-task.active {
  opacity: 1;
}

.memory-task {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.2s ease;
}

.memory-task.active {
  opacity: 1;
}

.memory-task__pairs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 20px;
  max-width: 240px;
}

.memory-task__prompt {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.memory-task__options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  pointer-events: auto;
  width: 100%;
}

.memory-task__option {
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: var(--player-cursor), pointer;
}

.memory-task__option:disabled {
  cursor: default;
}

.memory-task__dot {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "OmbudsmanStencil", "Menlo", "Courier New", monospace;
  font-size: 18px;
  color: #f7f7f7;
}

.memory-task__dot--neutral {
  color: #1b2231;
}

.memory-task__dot--pair {
  width: 64px;
  height: 64px;
  font-size: 20px;
}

.memory-task__dot--large {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.memory-task__number {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  line-height: 1;
  font-size: 1.2em;
}

.shape-task__shapes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  justify-items: center;
  align-items: center;
  max-width: 220px;
}

.shape-task.question .shape-task__shapes {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  grid-template-columns: 1fr;
  max-width: none;
}

.shape-task__shape {
  width: 90px;
  height: 90px;
  color: inherit;
}

.shape-task__options {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  pointer-events: auto;
  width: 100%;
}

.shape-task__option {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: var(--player-cursor), pointer;
}

.shape-task__option:disabled {
  cursor: default;
}

.shape-task__dot {
  width: 100%;
  height: 100%;
  display: block;
}

.cell {
  background: transparent;
  border: none;
  color: #f7f7f7;
  font-size: 20px;
  font-weight: 600;
  font-family: "OmbudsmanStencil", "Menlo", "Courier New", monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  cursor: var(--player-cursor), pointer;
  position: relative;
}

.cell.find-target {
  font-size: 30px;
  letter-spacing: -0.08em;
}

.cell:disabled {
  opacity: 1;
  cursor: var(--player-cursor), default;
}

.cell::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 8px;
  border: 1px solid transparent;
  opacity: 0;
  pointer-events: none;
}

.cell-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 6px;
  color: currentColor;
  line-height: 1;
}

.cell.correct {
  color: var(--success-green);
}

.cell.crt-hit .cell-value {
  text-shadow: 0 0 6px rgba(75, 255, 122, 0.45), 0 0 12px rgba(75, 255, 122, 0.25);
  animation: crtCellPulse 0.05s linear 1;
}

.cell.click-pulse::after {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: clickPulse 0.4s ease-out;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #515a6d;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  z-index: 3;
}

.timer-dots {
  position: absolute;
  display: flex;
  gap: 6px;
  pointer-events: none;
  z-index: 3;
  opacity: 1;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, var(--timer-offset-y, 0));
  --glitch-base-x: -50%;
  --glitch-base-y: var(--timer-offset-y, 0px);
  transition: opacity 0.2s ease;
}

.timer-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.timer-dots .dot.filled {
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.timer-dots .dot.gain {
  animation: dotGain 0.35s steps(2) 1;
}


.center-hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
  z-index: 4;
  width: min(92vw, 1100px);
}

.center-hud .control-row {
  pointer-events: auto;
}

.task {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #cdd5e5;
  position: relative;
  padding-bottom: 10px;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
}

.task-inline {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
  font-size: var(--task-font-size, 17px);
  line-height: 1.1;
  max-width: 85%;
  text-align: center;
  white-space: nowrap;
}

.task-inline.task-hidden {
  display: none;
}

.task-inline[data-task-id="find_sixes"],
.task-inline[data-task-id="find_nines"] {
  font-size: var(--task-font-size, 17px);
}

.task-inline.task-inline--wrap {
  white-space: normal;
}

.task::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 120px;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-50%);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

button {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid #f6d04d;
  background: transparent;
  color: #f6d04d;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  cursor: var(--player-cursor), pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: var(--player-cursor), not-allowed;
}

.super-circle.locked {
  opacity: 1;
}

.selection-count {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #9aa4b7;
  text-transform: uppercase;
}

.result {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9dd4ff;
  min-height: 16px;
}

.sound {
  padding: 10px 24px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8d96a9;
  cursor: var(--player-cursor), pointer;
}

.sound.off {
  color: #556074;
}

body[data-phase="lobby"] .grid,
body[data-phase="countdown"] .grid {
  visibility: hidden;
}

body[data-phase="lobby"] .shape-task,
body[data-phase="countdown"] .shape-task,
body[data-phase="lobby"] .memory-task,
body[data-phase="countdown"] .memory-task {
  opacity: 0;
  pointer-events: none;
}

body[data-super="1"] {
  --super-divider-delay: 0.9s;
  --super-stage-delay: 1.25s;
}

body[data-super="1"] .quadrant[data-color="yellow"] {
  --super-exit-delay: 0s;
}

body[data-super="1"] .quadrant[data-color="blue"] {
  --super-exit-delay: 0.12s;
}

body[data-super="1"] .quadrant[data-color="red"] {
  --super-exit-delay: 0.24s;
}

body[data-super="1"] .quadrant[data-color="green"] {
  --super-exit-delay: 0.36s;
}

body[data-super="1"] .quadrant .grid,
body[data-super="1"] .quadrant .shape-task,
body[data-super="1"] .quadrant .memory-task,
body[data-super="1"] .quadrant .task-inline,
body[data-super="1"] .quadrant .timer-dots,
body[data-super="1"] .quadrant .slot,
body[data-super="1"] .quadrant .placeholder,
body[data-super="1"] .quadrant .result-flash {
  animation: taskVanishGrid 0.45s steps(2) 1 forwards;
  animation-delay: var(--super-exit-delay, 0s);
  pointer-events: none;
}

body[data-super="1"] .quadrant .task-inline {
  animation: taskVanishLabel 0.45s steps(2) 1 forwards;
  animation-delay: var(--super-exit-delay, 0s);
}

body[data-super="1"] .cursor-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

body[data-super="1"] .stage-dividers {
  animation: superDividerFade 0.35s ease forwards;
  animation-delay: var(--super-divider-delay, 0.9s);
}

body[data-super="1"] .success-layer {
  opacity: 0;
}

body[data-phase="lobby"] .placeholder,
body[data-phase="countdown"] .placeholder {
  display: none;
}

body[data-phase="lobby"] .timer-dots,
body[data-phase="countdown"] .timer-dots {
  opacity: 0;
  --timer-offset-y: 6px;
}

body[data-phase="countdown"][data-countdown="prestart"] .timer-dots {
  opacity: 1;
  --timer-offset-y: 0;
  animation: dotsGlitchIn 0.45s steps(2) 1;
}

body[data-phase="countdown"][data-countdown="prestart"] .slot {
  animation: slotGlitchOut 0.45s steps(2) 1 forwards;
}

body[data-phase="countdown"][data-countdown="prestart"]
  .quadrant[data-color="yellow"]
  .slot {
  animation-delay: 0s;
}

body[data-phase="countdown"][data-countdown="prestart"]
  .quadrant[data-color="blue"]
  .slot {
  animation-delay: 0.12s;
}

body[data-phase="countdown"][data-countdown="prestart"]
  .quadrant[data-color="red"]
  .slot {
  animation-delay: 0.24s;
}

body[data-phase="countdown"][data-countdown="prestart"]
  .quadrant[data-color="green"]
  .slot {
  animation-delay: 0.36s;
}

body[data-phase="lobby"] .task,
body[data-phase="countdown"] .task,
body[data-phase="lobby"] .result,
body[data-phase="countdown"] .result {
  opacity: 0;
  pointer-events: none;
}

body[data-phase="round"] .slot {
  display: none;
}


body[data-phase="round"] .task-inline {
  opacity: 1;
}

body[data-phase="round"] .success-indicator.active {
  opacity: 1;
}

.quadrant.task-exit .grid,
.quadrant.task-exit .shape-task,
.quadrant.task-exit .memory-task {
  animation: taskVanishGrid 0.45s steps(2) 1 forwards;
  pointer-events: none;
}

.quadrant.task-exit .task-inline {
  animation: taskVanishLabel 0.45s steps(2) 1 forwards;
  pointer-events: none;
}

.quadrant.task-enter .grid,
.quadrant.task-enter .shape-task,
.quadrant.task-enter .memory-task {
  animation: taskRevealGrid 0.45s steps(2) 1;
}

.quadrant.task-enter .task-inline {
  animation: taskRevealLabel 0.45s steps(2) 1;
}

.quadrant.urgent::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at center, rgba(255, 77, 77, 0.35), rgba(255, 77, 77, 0));
  opacity: 0.2;
  animation: urgentPulse 0.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}

.quadrant.out::before {
  opacity: 0;
  animation: none;
}

.quadrant.out .grid,
.quadrant.out .task-inline,
.quadrant.out .result-flash,
.quadrant.out .memory-task {
  opacity: 0;
}

.quadrant.out .grid {
  pointer-events: none;
}

.quadrant.glitch .grid,
.quadrant.glitch .task-inline,
.quadrant.glitch .memory-task {
  animation: glitchOut 0.25s steps(2) 1;
}

body[data-phase="round"] .placeholder {
  display: none;
}

[data-color="yellow"] {
  --accent: #f5c542;
  color: #f5c542;
  --flash-origin: 100% 100%;
}

[data-color="blue"] {
  --accent: #4b84ff;
  color: #4b84ff;
  --flash-origin: 0% 100%;
}

[data-color="red"] {
  --accent: #dc0303;
  color: #dc0303;
  --flash-origin: 100% 0%;
}

[data-color="green"] {
  --accent: #29a11f;
  color: #29a11f;
  --flash-origin: 0% 0%;
}

@media (max-width: 900px) {
  .stage-grid {
    width: min(92vw, 700px);
    height: min(60vh, 500px);
  }

  .center-hud {
    width: min(92vw, 700px);
  }

  .app-header {
    padding: 16px 18px;
  }
}

@keyframes flashPulse {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  35% {
    opacity: 0.7;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.15);
  }
}

@keyframes indicatorPulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  35% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes slotGlitchOut {
  0% {
    opacity: 1;
    transform: translateY(0);
    filter: none;
  }
  20% {
    opacity: 0.4;
    transform: translate(2px, -1px);
  }
  40% {
    opacity: 0.9;
    transform: translate(-2px, 1px);
  }
  60% {
    opacity: 0.2;
    transform: translate(3px, 0);
  }
  80% {
    opacity: 0.6;
    transform: translate(-1px, -2px);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px);
    filter: blur(2px);
  }
}

@keyframes dotsGlitchIn {
  0% {
    opacity: 0;
    transform: translate(-50%, 4px);
    filter: blur(2px);
  }
  25% {
    opacity: 0.4;
    transform: translate(calc(-50% - 1px), 0);
  }
  55% {
    opacity: 0.8;
    transform: translate(calc(-50% + 1px), -1px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
    filter: none;
  }
}

@keyframes superBorderErase {
  0% {
    stroke-dasharray: var(--circumference) var(--circumference);
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dasharray: 0 var(--circumference);
    stroke-dashoffset: var(--circumference);
    opacity: 0;
  }
}

@keyframes superCircleFade {
  to {
    opacity: 0;
  }
}

@keyframes superMissGlow {
  0% {
    box-shadow: 0 0 0 rgba(255, 153, 64, 0);
  }
  35% {
    box-shadow: 0 0 14px rgba(255, 153, 64, 0.85);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 153, 64, 0);
  }
}

@keyframes superMissStroke {
  0% {
    opacity: 0;
    border-color: rgba(255, 153, 64, 0);
    box-shadow: 0 0 0 rgba(255, 153, 64, 0);
  }
  35% {
    opacity: 1;
    border-color: rgba(255, 153, 64, 1);
    box-shadow: 0 0 8px rgba(255, 153, 64, 0.75);
  }
  100% {
    opacity: 0;
    border-color: rgba(255, 153, 64, 0);
    box-shadow: 0 0 0 rgba(255, 153, 64, 0);
  }
}

@keyframes dotGain {
  0% {
    transform: scale(0.4);
    opacity: 0;
    box-shadow: 0 0 0 currentColor;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 12px currentColor;
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 8px currentColor;
  }
}

@keyframes taskRevealGrid {
  0% {
    opacity: 0;
    transform: translate(0, 0);
    filter: blur(2px) brightness(1.2);
  }
  25% {
    opacity: 0.5;
    transform: translate(-1px, 1px);
  }
  55% {
    opacity: 0.85;
    transform: translate(1px, -1px);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0);
    filter: none;
  }
}

@keyframes taskRevealLabel {
  0% {
    opacity: 0;
    transform: translate(calc(-50% + 0px), 0);
    filter: blur(2px) brightness(1.2);
  }
  25% {
    opacity: 0.5;
    transform: translate(calc(-50% - 1px), 1px);
  }
  55% {
    opacity: 0.85;
    transform: translate(calc(-50% + 1px), -1px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%);
    filter: none;
  }
}

@keyframes taskVanishGrid {
  0% {
    opacity: 1;
    transform: translate(var(--glitch-base-x, 0px), var(--glitch-base-y, 0px))
      scale(var(--glitch-scale, 1));
    filter: none;
  }
  20% {
    opacity: 0.6;
    transform: translate(
        calc(var(--glitch-base-x, 0px) + 2px),
        calc(var(--glitch-base-y, 0px) - 1px)
      )
      scale(var(--glitch-scale, 1));
    filter: contrast(1.3);
  }
  50% {
    opacity: 0.9;
    transform: translate(
        calc(var(--glitch-base-x, 0px) - 2px),
        calc(var(--glitch-base-y, 0px) + 1px)
      )
      scale(var(--glitch-scale, 1));
  }
  75% {
    opacity: 0.3;
    transform: translate(
        calc(var(--glitch-base-x, 0px) + 1px),
        calc(var(--glitch-base-y, 0px) - 2px)
      )
      scale(var(--glitch-scale, 1));
    filter: brightness(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(
        calc(var(--glitch-base-x, 0px) + 0px),
        calc(var(--glitch-base-y, 0px) - 4px)
      )
      scale(var(--glitch-scale, 1));
    filter: blur(2px);
  }
}

@keyframes taskVanishLabel {
  0% {
    opacity: 1;
    transform: translateX(-50%);
    filter: none;
  }
  20% {
    opacity: 0.6;
    transform: translate(calc(-50% + 2px), -1px);
    filter: contrast(1.3);
  }
  50% {
    opacity: 0.9;
    transform: translate(calc(-50% - 2px), 1px);
  }
  75% {
    opacity: 0.3;
    transform: translate(calc(-50% + 1px), -2px);
    filter: brightness(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + 0px), -4px);
    filter: blur(2px);
  }
}

@keyframes superDividerFade {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes arrowFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--arrow-rotate));
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--arrow-rotate));
  }
  100% {
    opacity: 1;
    transform: translate(
      calc(-50% + var(--arrow-offset-x)),
      calc(-50% + var(--arrow-offset-y))
    ) rotate(var(--arrow-rotate));
  }
}

@keyframes urgentPulse {
  0%,
  100% {
    opacity: 0.1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes clickPulse {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  40% {
    opacity: 0.6;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}

@keyframes crtCellPulse {
  0% {
    text-shadow: 0 0 6px rgba(75, 255, 122, 0.45), 0 0 12px rgba(75, 255, 122, 0.25);
  }
  100% {
    text-shadow: 0 0 0 rgba(75, 255, 122, 0);
  }
}

@keyframes glitchOut {
  0% {
    opacity: 1;
    transform: translate(0, 0);
    filter: contrast(1);
  }
  40% {
    opacity: 0.6;
    transform: translate(2px, -2px);
    filter: contrast(1.5);
  }
  100% {
    opacity: 0;
    transform: translate(-2px, 2px);
    filter: contrast(1);
  }
}
.total-time {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 10px;
  color: #f7f7f7;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  text-align: center;
}

.total-label {
  white-space: nowrap;
}

.total-time .total-value {
  font-size: 30px;
  letter-spacing: 0.12em;
  color: #f7f7f7;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: "OmbudsmanStencil", "Inter", "Segoe UI", sans-serif;
}

.total-time.visible {
  opacity: 1;
}
