* {
  box-sizing: border-box;
}
/* zoom prevention: don't allow text-size adjust to cause zoom-like behavior */
html,
body {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  font-family:
    var(--font-family),
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial;
  background: linear-gradient(
    180deg,
    rgba(2, 6, 23, 1) 0%,
    rgba(8, 12, 22, 1) 100%
  );
  background: linear-gradient(180deg, #0014a7 0%, #0014a7 100%);
  color: var(--secondary-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

header {
  display: flex;
  gap: 2rem;
  text-align: center;
  width: 100%;
  justify-content: space-around;
  margin-bottom: 1rem;
}

.logo {
  font-family: "Press Start 2P", "Orbitron", sans-serif;
  font-size: 1rem;
  color: var(--primary-color);
  text-shadow:
    0 0 12px rgba(255, 77, 166, 0.25),
    0 0 28px rgba(0, 255, 213, 0.03);
  letter-spacing: 1.6px;
}

.hud-stats {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--stat-background);
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 0 10px var(--secondary-color);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--third-color);
}

.container {
  position: relative;
  margin-top: 2rem;
}

canvas {
  border: 4px solid var(--secondary-color);
  box-shadow: 0 0 20px var(--secondary-color);
  background: var(--secondary-color);
  display: block;
  margin: 0 auto;
  border-radius: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .stat-block {
    flex-direction: row;
  }

  .stat-block {
    width: auto;
  }

  .life-block {
    display: none;
  }
}

/* overall wrapper with subtle padding */
.game-wrapper {
  width: 100%;
  max-width: 440px;
  position: relative;
}

/* retro animated background */
.retro-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      1000px 400px at 10% 10%,
      rgba(0, 85, 70, 0.06),
      transparent 10%
    ),
    radial-gradient(
      800px 300px at 90% 90%,
      rgba(255, 70, 120, 0.03),
      transparent 8%
    ),
    linear-gradient(180deg, rgba(6, 8, 15, 0.9), rgba(3, 6, 10, 0.95));
  z-index: -3;
  pointer-events: none;
  filter: blur(14px);
  opacity: 0.9;
}

/* scanlines overlay */
.scanlines {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px
  );
  background-size: 100% 4px;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: overlay;
}

#reveal {
  display: none;
}

/* main panel */
.container {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  border-radius: 12px;
  padding: 12px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.7),
    var(--glow);
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

/* hide settings panel and footer as requested */
#settingsPanel {
  display: none !important;
}
.game-footer {
  display: none !important;
}

/* HUD top: enforce two-line layout: title first line, hud-stats second */
.hud-top {
  display: flex;
  flex-direction: column; /* title-wrap on first line, hud-stats on second */
  gap: 8px;
  margin-bottom: 10px;
}
.title-wrap {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  flex-direction: column;
  gap: 2px;
}
.logo {
  font-family: "Press Start 2P", "Orbitron", sans-serif;
  font-size: 1rem;
  color: var(--secondary-color);
  text-shadow:
    0 0 12px rgba(255, 77, 166, 0.25),
    0 0 28px rgba(0, 255, 213, 0.03);
  letter-spacing: 1.6px;
}

/* hud-stats full width */
.hud-stats {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.stat-block {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  min-height: 5rem;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.stat-label {
  font-size: 1rem;
  color: var(--third-color);
  letter-spacing: 1px;
}
.stat-number {
  font-size: 2rem;
  color: var(--secondary-color);
  font-weight: 700;
  text-shadow: 0 6px 18px rgba(0, 255, 213, 0.06);
}

/* life block */
.life-block {
  padding: 6px 10px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.01),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.03);
  text-align: center;
  min-height: 5rem;
}
.life-label {
  font-size: 1rem;
  color: var(--third-color);
}
.life-bar {
  height: 2.5rem;
  color: var(--third-color);
  font-weight: 800;
  text-shadow: 0 6px 14px rgba(255, 77, 166, 0.04);
  font-size: 1.5rem;
  line-height: 2.5rem;
}

/* main area */
.game-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

/* masked answer - big HUD */
.masked-wrap {
  display: flex;
  justify-content: center;
}
.masked-answer {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.18),
    rgba(255, 255, 255, 0.01)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #fff;
  font-family: "Press Start 2P", "Orbitron", monospace;
  font-size: 1rem;
  letter-spacing: 6px;
  text-align: center;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(0, 255, 213, 0.03) inset;
  text-transform: uppercase;
}

/* grid of tiles */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.tile {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.01),
    rgba(0, 0, 0, 0.12)
  );
  border-radius: 10px;
  padding: 12px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--secondary-color);
  font-size: 0.8rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.6),
    0 0 26px rgba(255, 209, 102, 0.02) inset;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    color 0.12s linear,
    background 0.18s ease;
  position: relative;
  overflow: hidden;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    600px 200px at 10% 10%,
    rgba(0, 255, 200, 0.03),
    transparent 15%
  );
  pointer-events: none;
}
.tile:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.6),
    0 0 36px rgba(0, 255, 213, 0.04);
}
.tile.pop {
  transform: scale(1.04);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}
.tile.correct {
  background: linear-gradient(
    90deg,
    rgba(76, 225, 163, 0.08),
    rgba(0, 0, 0, 0.06)
  );
  color: var(--good);
  box-shadow:
    0 10px 40px rgba(76, 225, 163, 0.06),
    0 0 26px rgba(76, 225, 163, 0.06) inset;
}
.tile.incorrect {
  background: linear-gradient(
    90deg,
    rgba(255, 110, 110, 0.04),
    rgba(0, 0, 0, 0.06)
  );
  color: var(--danger);
  transform: translateY(-4px) rotate(-1deg);
}

/* controls area */
.controls-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.timer-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}
.timer-label {
  font-size: 1rem;
  color: var(--muted);
}
.timer-bar {
  background: rgba(255, 255, 255, 0.02);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.02);
}
.timer-progress {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--secondary-color), #8ee7cc);
  transition: width 0.25s linear;
}
.timer-seconds {
  font-size: 1rem;
  color: var(--muted);
  text-align: right;
}

/* guess area */
.guess-area {
  display: block;
  gap: 8px;
  align-items: center;
  text-align: center;
}
#guessInput {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 1rem;
  box-shadow: inset 0 -2px 8px rgba(0, 0, 0, 0.6);
  font-family: var(--font-family);
  max-width: 100vw;
  width: 100%;
  display: block;
}
.btn-arcade {
  padding: 10px 12px;
  background: linear-gradient(
    90deg,
    var(--secondary-color),
    var(--secondary-color)
  );
  color: #041014;
  border: none;
  border-radius: 8px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(255, 77, 166, 0.06);
  cursor: pointer;
  margin-top: 1rem;
}
.btn-arcade.alt {
  background: var(--secondary-color);
  color: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.btn-arcade:active {
  transform: translateY(2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

/* message and reveal */
.message {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  text-align: center;
}
.reveal {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.02);
  text-align: center;
}

/* leaderboard style */
.leaderboard {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}
.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  margin-top: 6px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.01),
    rgba(0, 0, 0, 0.06)
  );
  border: 1px solid rgba(255, 255, 255, 0.02);
  font-weight: 700;
}
.lb-rank {
  color: var(--muted);
  min-width: 34px;
}
.lb-name {
  flex: 1;
  padding-left: 8px;
  color: #fff;
}
.lb-score {
  min-width: 64px;
  text-align: right;
  color: var(--secondary-color);
}

/* small / responsive */
@media (max-width: 420px) {
  .game-wrapper {
    max-width: 390px;
  }
  .masked-answer {
    font-size: 1rem;
    letter-spacing: 5px;
    padding: 10px;
    line-height: 2rem;
  }
  .tile {
    min-height: 62px;
    font-size: 1rem;
    padding: 10px;
  }
  .hud-stats {
    gap: 8px;
    justify-content: space-between;
  }
  .stat-number {
    font-size: 2rem;
  }
  .title-wrap .logo {
    font-size: 2rem;
    text-align: center;
    display: block;
  }
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .guess-area {
    gap: 6px;
  }
}

button,
input {
  font-family: var(--font-family);
}

#header_logo {
  text-align: center;
  margin: 0 auto;
  max-width: 50%;
}

#title {
  display: none;
}
