:root {
  --bg-main: #171616;
  --bg-dark: #000;
  --bg-alt: #141414;
  --bg-world: #e0e0e0;
  --bg-button: #1a1a1a;
  --bg-overlay: rgba(20, 20, 20, 0.83);
  
  --text-primary: #fff;
  --text-secondary: #dcdcdc;
  --text-dark: #2d2d2d;
  --text-body: #2d2d2d; /* Consolidated from #292929 */
  --text-muted: #dcdcdc;
  
  
  --border-dark: #2d2d2d;
  --border-gray: #333;
  --border-white: #fff;
  
  --white: #fff;
  --black: #000;
  --error: #ff5e5e;
  
  --shadow-retro: 0.6cqw 0.6cqw 0 rgba(255, 255, 255, 0.2);
  --shadow-label: 0.35cqmin 0.35cqmin 0 var(--black);
}

/* add minimalist basic style in css classic */
@font-face {
  font-family: 'Press Start 2P';
  src: url('./assets/Press_Start_2P/PressStart2P-Regular.ttf');
}

/* 
  #####################################
  #####################################
  ############# GENERAL CSS ###########
  #####################################
  #####################################
 */

body {
    color: var(--text-body);
    background-color: var(--bg-main);
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/*  Font Definitions */
* {
  font-family: 'Press Start 2P';
}

.hidden {
  display: none !important;
}

.container {
  container-type: size;
  width: 100vw;
  height: 56.25vw;
  overflow: hidden;
}

.child-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  aspect-ratio: 16/9;
  container-type: size;
  width: min(100dvw, calc(100dvh * 16 / 9));
  height: auto;
}


/* 
  #####################################
  #####################################
  ############# WORLD CSS #############
  #####################################
  #####################################
 */


.world {
  overflow: hidden;
  background-color: var(--bg-world);
}


.actor {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 2cqw;
  --actor-width: 2cqw;
  width: var(--actor-width);
  position: relative;
  overflow: visible !important;
  transition: transform 0.3s ease-out;
  flex-shrink: 1;
  min-width: 0;
}

/* Cuerpo visual del actor para permitir solapamiento */
.actor::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--actor-width);
  height: 100%;
  border: 0.2cqmin solid var(--border-dark);
  background: var(--bg-world);
  box-sizing: border-box;
  z-index: 0;
}


.actor .eyes {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: var(--actor-width);
  display: flex;
  justify-content: space-evenly;
  pointer-events: none;
  z-index: 1;
}

.actor .label {
  position: absolute;
  top: -2cqw;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: black;
  font-size: 1cqw;
  white-space: nowrap;
  pointer-events: none;
}

.actor .eyes .eye {
  width: 20%;
  aspect-ratio: 1;
  background-color: var(--border-dark);
}


.stairs {
  position: absolute;
  display: flex;
  justify-content: end;
  align-items: center;
  flex-direction: column;
  gap: 3cqw;
  width: 80cqw;
  height: 80cqw;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

/* Solo hay una escalera y 11 escalones, los escalones mas bajos toman el ancho de 80% del contenedor y va bajando el ancho a medida que el escalon esta mas arriba */
/* es al reves el orden de los escalones */
.stair:nth-child(1) {
  width: 8cqw;
}

.stair:nth-child(2) {
  width: 16cqw;
}

.stair:nth-child(3) {
  width: 24cqw;
}

.stair:nth-child(4) {
  width: 32cqw;
}

.stair:nth-child(5) {
  width: 40cqw;
}

.stair:nth-child(6) {
  width: 48cqw;
}

.stair:nth-child(7) {
  width: 56cqw;
}

.stair:nth-child(8) {
  width: 64cqw;
}

.stair:nth-child(9) {
  width: 72cqw;
}

.stair:nth-child(10) {
  width: 80cqw;
}

.stair:nth-child(11) {
  width: 88cqw;
}

.stair {
  height: 1.5cqmin;
  position: relative;
  transition: opacity 0.4s ease-out;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.25cqw;
  overflow: visible;
}

.stair .visual {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.4;
  background-color: var(--border-dark);
}

.spawn {
  position: absolute;
  top: 100cqw;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  right: 0;
  left: 0;
}

.you-marker {
  top: -2cqw;
  left: 50%;
  transform: translate(-50%, 0);
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  will-change: transform;
  animation: bouncePointer 0.8s infinite alternate ease-in-out;
}


@keyframes bouncePointer {
  from { 
    transform: translate(-50%, -4.5cqmin); 
  }
  to { 
    transform: translate(-50%, -6cqmin); 
  }
}


/* Corregido: brightness(0%) dejaba el elemento negro puro, no gris oscuro */
.other {
  filter: grayscale(100%) brightness(40%);
  transition: filter 0.3s ease;
}

.you-label {
  background: var(--bg-alt);
  color: var(--text-muted);
  padding: 0.4cqmin 0.8cqmin;
  font-size: 0.8cqw;
  border: 0.2cqmin solid var(--black);
  box-shadow: var(--shadow-label);
  white-space: nowrap;
}

.pointer-arrow {
  width: 0;
  height: 0;
  border-left: 0.8cqmin solid transparent;
  border-right: 0.8cqmin solid transparent;
  border-top: 1.2cqmin solid var(--bg-alt);
  /* drop-shadow corregido para que siga la forma del triángulo */
  filter: drop-shadow(0 0.2cqmin 0 var(--black));
  margin-top: -0.1cqmin; 
}



/* 
  #####################################
  #####################################
  ############# UI CSS ################
  #####################################
  #####################################
 */
h1 {
  color: var(--white);
  line-height: 8cqmin;
  letter-spacing: 0.8cqmin;
  text-align: center;
  font-size: 6cqmin;
  font-style: italic;
}

.score, .players-count, .question-number {
  position: absolute;
  top: 1.5cqw;
  font-size: 1.5cqw;
}

.score {
  left: 2cqw;
}

.top-x {
  position: absolute;
  top: 4cqw;
  left: 2cqw;
  font-size: 0.5cqw;
}

.players-count {
  right: 2cqw;
}

.question-number {
  left: 50%;
  transform: translate(-50%, 0);
}


.style-retro {
    background: var(--white);
    color: var(--black);
    border: 0.5cqw solid var(--black);
    box-shadow: var(--shadow-retro);
    padding: 1.5cqw 3cqw;
    font-size: 1.5cqw;
}

#message {
  position: absolute;
  font-size: 2.5cqmin;
  text-align: center;
  top: 3cqw;
  left: 50%;
  transform: translate(-50%, 1cqw);
}

button {
    color: var(--text-dark);
    cursor: pointer;
    padding: 0.5cqw 1cqw;
    border: 0.1cqw solid var(--border-dark);
}

button:disabled {
    cursor: default;
    opacity: 0.5;
}

.btn-option:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.crt-screen {
    position: absolute;
    width: inherit;
    height: inherit;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.05), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.05));
    background-size: 100% 0.4cqw, 0.3cqw 100%;
    pointer-events: none;
    z-index: 1000;
}

.crt-screen::after {
    content: " ";
    display: block;
    position: absolute;
    inset: 0;
    background: radial-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 100%);
    z-index: 1001;
}

.modal-quiz {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65cqw;
    background: var(--bg-dark);
    border: 0.6cqw solid var(--border-white);
    padding: 3cqw;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2cqw;
    box-shadow: var(--shadow-retro);
}

.title-quiz {
    color: var(--text-primary);
    text-align: center;
    line-height: 1.4;
    font-size: 1.8cqw;
    margin: 0;
    margin-bottom: 2cqw;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5cqw;
}

.btn-option {
    background: var(--bg-button);
    border: 0.4cqw solid var(--border-gray);
    color: var(--text-primary);
    padding: 1.5cqw;
    text-align: left;
    font-size: 1cqw;
    cursor: pointer;
    transition: all 0.1s;
}

.btn-option:hover:not(:disabled) {
    background: var(--white);
    color: var(--black);
    border-color: var(--border-white);
}

.btn-option:disabled {
    cursor: default;
    opacity: 0.7;
}

.btn-option.selected {
    background: var(--white);
    color: var(--black);
    border-color: var(--border-white);
    animation: selected 0.3s ease-in-out;
}

@keyframes selected {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.timer-container {
    width: 100%;
    height: 1.2cqw;
    background: var(--bg-button);
    border: 0.3cqw solid var(--border-gray);
    margin-top: 1cqw;
    position: relative;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: var(--white);
    transition: width 0.1s linear;
}