* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #ffffff;
  color: #111;
  font-family: 'Jersey 10', monospace, sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  height: 100dvh;
  padding: max(110px, 14vh) 12px max(40px, 5vh);
}

.site-logo {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(200px, 28vw, 300px);
  height: auto;
  z-index: 100;
  pointer-events: none;
}

@media (max-width: 640px) {
  .site-logo {
    width: clamp(220px, 60vw, 280px);
  }
  body {
    padding: max(100px, 13vh) 12px max(40px, 5vh);
  }
}

.hidden { display: none !important; }

.outline-text {
  color: #ffffff;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  letter-spacing: 1px;
}

#hud {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 28px;
  font-weight: 400;
}

.hearts {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  line-height: 1;
}

.heart {
  display: inline-flex;
  width: 28px;
  height: 26px;
}

.heart-svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

#game {
  background: linear-gradient(180deg, #1a1f3a 0%, #0f1220 100%);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 2 / 3;
  width: auto;
  height: auto;
  touch-action: none;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  height: 100dvh;
  background: #ffffff;
  color: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  overflow: hidden;
  padding: max(110px, 14vh) 16px max(40px, 5vh);
}

#loading-overlay h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 1px;
  padding: 8px 0 4px;
  margin: 0;
  text-align: center;
  color: #111;
  -webkit-text-stroke: 0;
}

#gameover-overlay h1 {
  font-family: 'Jersey 10', monospace, sans-serif;
  font-size: 56px;
  font-weight: 400;
  letter-spacing: 2px;
  padding: 8px 0 4px;
  margin: 0;
  text-align: center;
  color: #a5321d;
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
  transform-origin: center;
  animation: gameover-pulse 1.8s ease-in-out infinite;
}

@keyframes gameover-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  #gameover-overlay h1 { animation: none; }
}

#gameover-overlay p,
#loading-overlay p {
  font-size: 22px;
  text-align: center;
  padding: 4px 0;
  margin: 0;
  color: #111;
  -webkit-text-stroke: 0;
}

/* Character select: tagline + cards (logo lives at body level) */
#select-overlay {
  justify-content: flex-start;
  gap: 16px;
}

.select-tagline {
  flex: 0 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  color: #111;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  margin: 0;
}

.select-tagline em {
  font-style: normal;
  font-weight: 400;
}

.select-pick-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 0;
  width: 100%;
  justify-content: flex-start;
}

.pick-prompt {
  margin: 0;
  font-family: 'Jersey 10', monospace, sans-serif;
  color: #111;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 2px;
  text-align: center;
  line-height: 1;
}

.character-picks {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 4px;
  margin: 0;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 10px;
  color: rgba(140, 140, 140, 0.9);
  letter-spacing: 0.2px;
  z-index: 100;
  pointer-events: none;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  pointer-events: auto;
}

.footer-heart-slot {
  display: inline-block;
  width: 10px;
  height: 9px;
  vertical-align: -1px;
  line-height: 0;
}

.footer-heart-slot svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

/* Desktop: tagline centered above cards in the space below the fixed logo */
@media (min-width: 641px) {
  #select-overlay {
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    gap: 0;
    padding: max(110px, 14vh) 16px max(60px, 8vh);
  }

  #select-overlay .select-tagline { grid-row: 1; }
  #select-overlay .select-pick-area {
    grid-row: 2;
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  #select-overlay {
    padding: max(105px, 14vh) 12px 14px;
    gap: 10px;
  }

  .bodega-logo {
    width: clamp(240px, 75vw, 340px);
    max-height: 28vh;
  }

  .select-tagline {
    font-size: clamp(16px, 4.4vw, 22px);
  }

  .character-picks {
    flex-direction: column;
    gap: 12px;
    padding: 0 0 8px;
  }
}

.total-line {
  font-size: 22px;
  letter-spacing: 1px;
  opacity: 0.95;
}

.total-line.leader {
  color: #ffd84a;
  -webkit-text-stroke: 2px #000;
}

#gameover-totals {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  margin: 8px 0;
}

.gameover-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.gameover-row img {
  height: 64px;
  width: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.gameover-row .total-line {
  font-size: 26px;
  color: #111;
  -webkit-text-stroke: 0;
}

.gameover-row .total-line.leader {
  color: #111;
  -webkit-text-stroke: 0;
}

.character-pick {
  flex: 0 1 280px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  cursor: pointer;
  padding: 18px 18px 14px;
  background: #000000;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  aspect-ratio: 1 / 1;
}

@media (hover: hover) {
  .character-pick:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
  }
}

.character-pick:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.character-pick img {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  max-width: 70%;
  height: auto;
  width: auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

.character-pick .pick-name {
  flex: 0 0 auto;
  font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: 1.5px;
  color: #fff;
  -webkit-text-stroke: 1.5px #000;
}

.character-pick .total-line {
  flex: 0 0 auto;
  font-size: clamp(14px, 1.6vw, 18px);
  color: #ffffff;
  -webkit-text-stroke: 0;
}

@media (max-width: 640px) {
  .character-pick {
    flex: 0 1 auto;
    width: min(56vw, 220px);
    aspect-ratio: 1 / 1;
    padding: 8px 12px;
  }

  .character-pick img {
    max-width: 75%;
  }

  .character-pick .pick-name {
    font-size: 18px;
  }

  .character-pick .total-line {
    font-size: 14px;
  }
}

/* Pixel-style buttons */
.pixel-btn {
  margin-top: 8px;
  min-width: 220px;
  padding: 14px 36px;
  font-family: inherit;
  font-size: 24px;
  font-weight: 400;
  color: #fff;
  background: #a5321d;
  border: 3px solid #000;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1.5px;
  box-shadow: 0 4px 0 #000;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

@media (hover: hover) {
  .pixel-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 0 #000;
  }
}

.pixel-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000;
}

.pixel-btn.secondary {
  background: #ffffff;
  color: #111;
}
