body {
  overflow: hidden;
}

html::before,
html::after,
body::before,
body::after {
  display: none !important;
}

body.crt-rgb-impact-active .living-app {
  animation: crtRgbSplitImpact 520ms steps(1, end) both;
  will-change: filter;
}

.living-app {
  padding: 8px 12px;
  overflow-x: hidden;
  overflow-y: auto;
}

.living-game-page {
  position: relative;
}

body[data-page="game"] .living-game-panel {
  --living-board-size: min(100%, 540px);
  gap: 10px;
  justify-content: flex-start;
  overflow: visible;
}

.living-top-plate,
.living-control-plate,
.living-board-plate {
  width: var(--living-board-size);
  max-width: var(--living-board-size);
  align-self: center;
}

.living-top-plate {
  gap: 8px;
}

.living-top-plate .challenge-date-card {
  min-height: var(--current-clock-block-height, 42px);
}

.living-top-plate .challenge-date-label {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: clamp(10px, 2.8vw, 13px);
  letter-spacing: 0.04em;
}

.living-top-plate .pause-button {
  display: grid;
  place-items: center;
}

.living-pause-button {
  background: transparent;
  color: rgba(248, 252, 255, 0.98);
  font-family: var(--font), Arial, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: none;
}

.living-pause-button.is-paused {
  padding-left: 2px;
}

.living-new-game-button {
  cursor: pointer;
  pointer-events: auto;
}

.living-new-game-button:active {
  background: rgba(185, 28, 28, 0.46);
}

.living-new-game-button .challenge-date-label {
  pointer-events: none;
}

.living-new-game-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.living-player-hp-base {
  background: rgba(34, 197, 94, 0.16);
}

.living-player-hp-fill {
  background: rgba(34, 197, 94, 0.98);
  transform-origin: left center;
}

.living-computer-hp-base {
  background: rgba(239, 68, 68, 0.13);
}

.living-computer-hp-fill {
  background: rgba(239, 68, 68, 0.96);
  transform-origin: right center;
}

.living-center-turns {
  position: relative;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 0;
  color: rgba(248, 252, 255, 0.98);
  font-family: "DigitalNumbers", monospace !important;
  font-size: min(var(--clock-large-font-size, 30px), calc(var(--current-clock-block-height, 42px) * 0.62));
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-rendering: geometricPrecision;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
}

.living-turn-counter-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.living-turn-counter-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.living-timer-inactive {
  color: var(--clock-digit-inactive, rgba(255, 255, 255, 0.1)) !important;
  text-shadow: none;
}

.living-title-row {
  display: grid;
  gap: 2px;
  padding: 2px 2px 0;
  color: rgba(255, 255, 255, 0.96);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  text-transform: uppercase;
}

.living-title-row span,
.living-update-caption {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  line-height: 1.1;
}

.living-title-row strong {
  overflow-wrap: anywhere;
  font-size: clamp(17px, 4.3vw, 30px);
  line-height: 0.95;
}

.living-score-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
}

.living-score-meta span {
  display: grid;
  min-height: 42px;
  padding: 6px;
  align-content: center;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.18);
  font-size: 10px;
  line-height: 1.08;
}

.living-score-meta strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-family: "DigitalNumbers", "VCR OSD Mono Nova", monospace;
  font-size: clamp(18px, 5vw, 27px);
  line-height: 0.9;
}

.living-status-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.living-board-plate {
  width: var(--living-board-size);
  height: auto !important;
  flex-basis: auto !important;
  aspect-ratio: 1 / 1;
  padding: 8px;
}

.living-board-scroll-layer {
  width: 100%;
  height: 100%;
}

.living-board-transform-layer {
  width: 100%;
  height: auto !important;
  max-width: 100%;
  aspect-ratio: 1 / 1;
}

.living-board-transform-layer .board-canvas-layer,
.living-board-transform-layer .board-fx-canvas,
.living-click-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.living-board-transform-layer .board-canvas-layer,
.living-board-transform-layer .board-fx-canvas {
  image-rendering: auto !important;
}

.living-board-transform-layer .board-base-canvas {
  z-index: 1;
}

.living-board-transform-layer .board-content-canvas {
  z-index: 2;
}

.living-board-transform-layer .board-fx-canvas {
  z-index: 3;
  pointer-events: none;
}

.living-click-layer {
  z-index: 4;
  background: transparent;
}

.living-cell-hitbox {
  position: absolute;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.living-cell-hitbox:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 216, 107, 0.84);
}

.living-control-plate {
  display: grid;
  gap: 8px;
  place-items: stretch;
}

.living-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.living-update-caption {
  grid-column: 1 / -1;
  min-height: 1.2em;
}

.living-ai-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.living-ai-control[hidden],
body.living-pvp-mode .living-ai-control {
  display: none;
}

.living-ai-button {
  min-width: 0;
  min-height: 28px;
  padding: 5px 4px;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.26);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(248, 252, 255, 0.72);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

.living-ai-button.is-active {
  border-color: rgba(250, 204, 21, 0.9);
  background: rgba(250, 204, 21, 0.15);
  color: rgba(255, 255, 255, 0.95);
}

.living-ai-button:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 216, 107, 0.72);
}

.living-opponent-panel {
  grid-column: 1 / -1;
  min-height: 30px;
  display: grid;
  place-items: center;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.26);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(248, 252, 255, 0.82);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
}

.living-opponent-panel[hidden] {
  display: none;
}

.living-control-grid .skill-button {
  min-width: 0;
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  height: var(--current-clock-block-height, 42px);
  aspect-ratio: auto;
}

.living-control-grid .skill-button .power-count {
  right: 6px;
  bottom: 6px;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 2px 5px;
  font-size: 9px;
  line-height: 1;
}

.living-control-grid .skill-button .power-label {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 20px;
  line-height: 1;
}

.living-dual-skill-button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 0 42px;
  overflow: hidden;
}

.living-dual-skill-button .power-label {
  grid-column: 1;
  position: relative;
  z-index: 1;
}

.living-skill-counter {
  position: absolute;
  top: 5px;
  z-index: 2;
  display: grid;
  min-width: 24px;
  max-width: calc(50% - 18px);
  height: 18px;
  padding: 0 4px;
  place-items: center;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.32);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(248, 252, 255, 0.92);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 10px;
  line-height: 1;
  box-sizing: border-box;
  pointer-events: none;
}

.living-skill-counter-player {
  left: 9px;
  right: auto;
  border-color: rgba(92, 200, 255, 0.56);
  background: rgba(92, 200, 255, 0.24);
  color: rgba(235, 250, 255, 0.96);
}

.living-skill-counter-computer {
  left: auto;
  right: 9px;
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(239, 68, 68, 0.24);
  color: rgba(255, 235, 235, 0.96);
}

.living-control-grid .skill-button[disabled] {
  opacity: 0.45;
}

.living-control-grid .living-dual-skill-button[disabled] {
  opacity: 1;
}

.living-control-grid .living-dual-skill-button[disabled] .power-label {
  opacity: 0.34;
}

.living-control-grid .living-dual-skill-button[disabled] .living-skill-counter {
  opacity: 0.92;
}

.living-control-grid .skill-button.is-active {
  border-color: rgba(250, 204, 21, 0.92);
  background: rgba(250, 204, 21, 0.16);
}

.living-control-grid .living-chord-button.is-active {
  border-color: rgba(92, 200, 255, 0.92);
  background: rgba(92, 200, 255, 0.14);
}

.living-log {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 70px;
  max-height: 90px;
  margin: 0;
  padding: 7px 7px 7px 24px;
  overflow: auto;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(248, 252, 255, 0.78);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 10px;
  line-height: 1.2;
}

.living-log li::marker {
  color: rgba(250, 204, 21, 0.96);
}

.result-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.58);
}

.result-backdrop.hidden {
  display: none;
}

.result-dialog {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  padding: 18px;
  border: var(--game-line-width, 1px) solid var(--game-plate-border-color, rgba(255, 255, 255, 0.2));
  background: var(--game-plate-background, rgba(255, 251, 244, 0.3));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  text-align: center;
}

.result-dialog h2 {
  margin: 0;
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: clamp(24px, 6vw, 42px);
  line-height: 1;
  text-transform: uppercase;
}

.result-dialog p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 13px;
  line-height: 1.35;
}

.pvp-room-dialog {
  width: min(430px, 100%);
  text-align: left;
}

.pvp-room-dialog h2 {
  text-align: center;
}

.pvp-room-view {
  display: grid;
  gap: 10px;
}

.pvp-room-view.hidden {
  display: none;
}

.pvp-field {
  display: grid;
  gap: 6px;
  color: rgba(248, 252, 255, 0.82);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 11px;
  line-height: 1.15;
  text-transform: uppercase;
}

.pvp-field input {
  min-height: 36px;
  padding: 7px 9px;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.94);
  font: inherit;
  letter-spacing: 0;
  outline: 0;
}

.pvp-field input:focus {
  border-color: rgba(250, 204, 21, 0.86);
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.32);
}

.pvp-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.pvp-segmented button {
  min-height: 32px;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(248, 252, 255, 0.74);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.pvp-segmented button.is-active {
  border-color: rgba(250, 204, 21, 0.92);
  background: rgba(250, 204, 21, 0.16);
  color: rgba(255, 255, 255, 0.96);
}

.pvp-segmented button:disabled {
  cursor: default;
  opacity: 0.34;
}

.pvp-room-error {
  min-height: 1.2em;
  color: rgba(255, 198, 198, 0.92) !important;
  text-align: center;
}

@media (max-width: 560px) {
  body[data-page="game"] .living-game-panel {
    --living-board-size: min(100%, 100vw - 24px);
    gap: 8px;
  }

  .living-app {
    padding: 6px;
  }

  .living-top-plate,
  .living-control-plate,
  .living-board-plate {
    padding: 6px;
  }

  .living-control-grid .skill-button {
    min-height: 38px;
    height: 38px;
  }

  .living-score-meta {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
  }

  .living-score-meta span {
    min-height: 38px;
    padding: 5px;
    font-size: 9px;
  }

  .living-log {
    max-height: 76px;
  }
}
