:root {
  --ink: #0d0b1e;
  --panel: #1a1633;
  --amber: #ffe93d;
  --coral: #ff2e88;
  --paper: #f4f1fa;
  --teal: #00fff2;
  --green: #39ff88;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: 'VT323', monospace;
  font-size: 20px;
}

.display { font-family: 'Press Start 2P', monospace; line-height: 1.4; }

#app {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.screen.hidden { display: none; }

.hidden { display: none; }

h1.display {
  color: var(--amber);
  font-size: clamp(1.1rem, 6vw, 1.8rem);
  margin: 0;
  text-shadow: 3px 3px 0 var(--coral);
}

.subtitle {
  margin: 0 0 10px;
  color: var(--teal);
  font-weight: 400;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}

input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1.3rem;
  font-family: 'VT323', monospace;
  border-radius: 6px;
  border: 3px solid var(--panel);
  background: var(--panel);
  color: var(--paper);
  outline: none;
  text-align: center;
  letter-spacing: 0.04em;
}

input:focus { border-color: var(--amber); }

input::placeholder { color: #6b6690; }

.button-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.72rem;
  line-height: 1.6;
  font-weight: 400;
  padding: 14px 20px;
  border-radius: 6px;
  border: 3px solid transparent;
  cursor: pointer;
  flex: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
}

/* Hover-only effects are wrapped so touchscreens (no real hover) never hit
   the "first tap simulates hover, second tap clicks" trap some mobile
   browsers apply to any element with a :hover rule. */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.6); }
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
}

.btn-primary { background: var(--coral); color: var(--ink); border-color: var(--coral); }
.btn-secondary { background: var(--teal); color: var(--ink); border-color: var(--teal); }

.btn-mode {
  background: var(--panel);
  color: var(--paper);
  border: 3px solid #332d55;
  font-size: 0.68rem;
  line-height: 1.5;
}

.btn-mode .mode-desc {
  display: block;
  font-family: 'VT323', monospace;
  font-weight: 400;
  font-size: 0.85rem;
  color: #9c98b5;
  margin-top: 6px;
}

.btn-mode.active {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-mode.active .mode-desc { color: var(--amber); }

.mode-badge {
  color: var(--amber);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.68rem;
  margin: 0 0 6px;
}

.divider {
  color: #6b6885;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.error {
  color: var(--coral);
  font-size: 1.15rem;
}

.error.hidden { display: none; }

.room-code {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.6rem, 8vw, 2.4rem);
  letter-spacing: 0.12em;
  color: var(--amber);
  background: var(--panel);
  border: 3px solid var(--amber);
  padding: 14px 20px;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
}

.hint {
  color: #9c98b5;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.4;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-list li {
  background: var(--panel);
  border: 2px solid #332d55;
  padding: 10px 16px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2rem;
}

.ready-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  padding: 5px 10px;
  border-radius: 4px;
  background: #3a3752;
  color: #9c98b5;
}

.ready-badge.ready {
  background: var(--green);
  color: var(--ink);
}

/* GAME SCREEN */
#screen-game {
  max-width: 640px;
  position: relative;
}

#game-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.65rem;
}

#room-code-small {
  color: var(--amber);
  letter-spacing: 0.1em;
}

#mode-small {
  color: var(--teal);
}

#timer-small {
  font-family: 'Press Start 2P', monospace;
  color: var(--coral);
  font-size: 0.75rem;
}

#timer-small.hidden { display: none; }

#fall-zone {
  width: 100%;
  height: 260px;
  background: var(--panel);
  border: 3px solid #332d55;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#falling-emoji, #falling-emoji-2 {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 64px;
  transition: top linear;
}

#falling-emoji-2.hidden { display: none; }

#round-feedback {
  position: absolute;
  bottom: 10px;
  font-size: 1.2rem;
  color: var(--teal);
}

#scoreboard {
  width: 100%;
  background: var(--panel);
  border: 3px solid #332d55;
  border-radius: 10px;
  padding: 14px 18px;
}

#scoreboard h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: var(--amber);
  margin: 0 0 10px;
  font-weight: 400;
}

#scoreboard-list {
  margin: 0;
  padding-left: 20px;
  text-align: left;
}

#scoreboard-list li {
  font-size: 1.2rem;
  padding: 2px 0;
}

/* GAME OVER SCREEN */
#gameover-winner {
  color: var(--amber);
}

#gameover-scoreboard {
  width: 100%;
  background: var(--panel);
  border: 3px solid #332d55;
  border-radius: 10px;
  padding: 14px 18px;
}

#gameover-scoreboard h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: var(--amber);
  margin: 0 0 10px;
  font-weight: 400;
}

#gameover-scoreboard-list {
  margin: 0;
  padding-left: 20px;
  text-align: left;
}

#gameover-scoreboard-list li {
  font-size: 1.2rem;
  padding: 2px 0;
}

/* ===== QMoji Arcade continuity: back-to-launchpad + loading transition,
   matching the sibling games' identical markup/behavior ===== */

.back-to-launchpad {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 500;
  padding: 9px 13px;
  border-radius: 6px;
  border: 3px solid var(--panel);
  background: var(--panel);
  color: var(--paper);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.03em;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .back-to-launchpad:hover { border-color: var(--teal); color: var(--teal); }
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.loading-screen.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.loading-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.9rem;
  color: var(--amber);
  text-shadow: 3px 3px 0 var(--coral);
}
.loading-dots { animation: loadingPulse 0.6s steps(1) infinite; }
@keyframes loadingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.loading-bar {
  width: 220px;
  height: 14px;
  border: 3px solid var(--panel);
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel);
}
.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--teal));
  transition: width 0.35s ease;
}
