:root {
  --red: #d81e2c;
  --cream: #fdf6e3;
  --ink: #1c1c1c;
  --accent: #2b6cb0;
  --wally-blue: #3aa5dd;
  --wally-blue-dark: #1c6f9e;
  --sky-blue: #5fc0ea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Baloo 2", "Segoe UI", system-ui, sans-serif;
  background: var(--sky-blue);
  color: var(--ink);
}

.site-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: var(--red);
  color: white;
}

.site-header h1 {
  margin: 0 0 0.25rem;
  font-family: "Titan One", "Baloo 2", system-ui, sans-serif;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 0;
  font-weight: 700;
  opacity: 0.9;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.hidden { display: none !important; }

/* Home / hero screen: whole cover image visible on a black backdrop, buttons overlaid */
body.is-home .site-header {
  display: none;
}

body.is-home {
  overflow: hidden;
}

html:has(body.is-home) {
  overflow: hidden;
}

body.is-home main {
  padding: 0;
  max-width: none;
}

.home-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 70px,
    #ffffff 70px 140px
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
}

.home-bg {
  max-width: 70%;
  max-height: 60vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.home-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stamp-btn {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 3px dashed var(--ink);
  background: white;
  color: var(--ink);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform: rotate(-6deg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  transition: transform 0.15s ease;
}

.stamp-btn:hover {
  transform: rotate(-6deg) scale(1.06);
}

.stamp-btn-accent {
  border-color: var(--red);
  color: var(--red);
  transform: rotate(5deg);
}

.stamp-btn-accent:hover {
  transform: rotate(5deg) scale(1.06);
}

/* Puzzle list */
.puzzle-list-view {
  position: relative;
  padding-top: 0;
}

.stripe-bar {
  height: 12px;
  margin: 0 -1rem 1.75rem;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 18px,
    #ffffff 18px 36px
  );
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}

.puzzle-list-view > .stripe-bar:last-child {
  margin: 1.75rem -1rem 0;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stamp-btn-small {
  width: 68px;
  height: 68px;
  font-size: 0.7rem;
  flex-shrink: 0;
  border-color: var(--wally-blue-dark);
  color: var(--wally-blue-dark);
}

.list-heading {
  flex: 1;
  min-width: 200px;
}

.list-title {
  margin: 0;
  font-family: "Titan One", "Baloo 2", system-ui, sans-serif;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: 0.01em;
}

.list-title .title-blue {
  color: var(--wally-blue);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.list-title .title-red {
  color: var(--red);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.list-tagline {
  margin: 0.4rem 0 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  color: var(--wally-blue-dark);
  opacity: 0.85;
  font-size: 1.05rem;
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.75rem;
}

.puzzle-card {
  background: white;
  border-radius: 12px;
  overflow: visible;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, rotate 0.18s ease;
  border: 3px solid var(--ink);
  text-align: left;
  padding: 0;
  rotate: 0deg;
}

.puzzle-card:nth-child(odd):hover {
  rotate: -1.5deg;
}

.puzzle-card:nth-child(even):hover {
  rotate: 1.5deg;
}

.puzzle-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 20px rgba(58,165,221,0.35);
  border-color: var(--wally-blue-dark);
}

.card-image-wrap {
  position: relative;
  padding: 7px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 10px,
    #ffffff 10px 20px
  );
  border-radius: 10px 10px 0 0;
}

.puzzle-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #eee;
  border-radius: 6px;
}

.difficulty-stamp {
  position: absolute;
  top: -0.6rem;
  right: -0.6rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  border: 2px dashed currentColor;
  background: rgba(253, 246, 227, 0.92);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  rotate: -8deg;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.difficulty-easy { color: #1e7a3c; }
.difficulty-medium { color: #a3760a; }
.difficulty-hard { color: #b5560a; }
.difficulty-very-hard { color: var(--red); }

.puzzle-card .card-body {
  padding: 0.85rem 1rem 1rem;
}

.puzzle-card h3 {
  margin: 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
}

.loading, .empty-state {
  color: #666;
  font-family: "Baloo 2", system-ui, sans-serif;
}

/* Game view: takes over the whole viewport so the image can be truly full screen */
body.is-playing .site-header {
  display: none;
}

body.is-playing main {
  padding: 0;
  max-width: none;
}

.game-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #111;
  display: flex;
  flex-direction: column;
}

.game-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.75rem;
  pointer-events: none;
}

.game-toolbar > * {
  pointer-events: auto;
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
}

.btn:hover { opacity: 0.9; }

/* Google Maps style: floating white circular/rounded icon buttons */
.map-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: white;
  color: #444;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: background 0.1s ease;
}

.map-icon-btn:hover {
  background: #f2f2f2;
}

.map-icon-btn:active {
  background: #e6e6e6;
}

.map-icon-btn-active {
  background: var(--accent);
  color: white;
}

.map-icon-btn-active:hover {
  background: var(--accent);
  opacity: 0.9;
}

.map-controls {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.zoom-pill {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: white;
  color: #444;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease;
}

.zoom-btn:hover {
  background: #f2f2f2;
}

.zoom-btn:active {
  background: #e6e6e6;
}

.zoom-divider {
  height: 1px;
  background: #e0e0e0;
}

.recenter-btn {
  font-size: 1.3rem;
}

.character-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  z-index: 5;
  display: flex;
  align-items: center;
  padding: 0 0.9rem;
  background: transparent;
}

#game-title {
  margin: 0 0 0 auto;
  color: white;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-avatars {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 0.6rem;
  flex-wrap: nowrap;
}

.character-avatar {
  position: relative;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  filter: grayscale(1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: filter 0.2s ease, transform 0.2s ease;
}

/* Shows a running count of secretly-numbered Waldo-Watchers found, e.g.
   "2/?" — bigger than the named-character avatars so the text fits, and
   never dimmed/grayscale since it isn't a single findable spot. */
.watcher-counter {
  background: #4b2e83;
  filter: none;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.watcher-counter.found {
  border-color: #2ecc71;
  color: #2ecc71;
}

.character-avatar.has-photo {
  background: #eee;
}

.character-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  object-position: center;
  padding: 4px;
  box-sizing: border-box;
}

.character-avatar.found {
  filter: none;
  opacity: 1;
  border-color: #2ecc71;
  transform: scale(1.08);
}

.character-avatar.found::after {
  content: "✓";
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #2ecc71;
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #1c1c1c;
}

.avatar-waldo { background: #d81e2c; }
.avatar-woof { background: #8a5a2c; }
.avatar-wenda { background: #e0762a; }
.avatar-wizard { background: #6b3fa0; }
.avatar-odlaw { background: #d8a900; }

.image-wrap {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.image-wrap.panning {
  cursor: grabbing;
}

.image-wrap img {
  position: absolute;
  transform-origin: 0 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

/* Sits as a sibling of .image-wrap (not a descendant), so it is never
   clipped by that container's overflow:hidden (which exists to crop the
   zoomed map itself). Marker screen position/scale is recomputed in JS on
   every pan/zoom update instead of inheriting a CSS transform. */
.markers-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}

.found-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  border: 3px solid #2ecc71;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

.miss-marker {
  position: absolute;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  border: 3px solid var(--red);
  border-radius: 50%;
  pointer-events: none;
  animation: fade-out 0.6s forwards;
}

@keyframes fade-out {
  to { opacity: 0; }
}

.coord-readout {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 6;
  background: rgba(0,0,0,0.65);
  color: #7CFC00;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.miss-feedback {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: var(--red);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  z-index: 3;
  margin: 0;
}

.found-feedback {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: #2ecc71;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  z-index: 3;
  margin: 0;
}

.all-found-banner {
  position: absolute;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: repeating-linear-gradient(-45deg, var(--red) 0 20px, #ffffff 20px 40px);
  background-size: 200% 200%;
  color: var(--ink);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  padding: 1rem 2rem;
  border-radius: 999px;
  border: 3px solid var(--ink);
  z-index: 4;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  text-shadow: 0 1px 0 rgba(255,255,255,0.7);
  animation: banner-in 0.3s ease, stripe-move 1.4s linear infinite;
  white-space: nowrap;
}

.all-found-banner.watchers-banner {
  top: 9rem;
}

.all-found-banner.everything-banner {
  top: 13rem;
}

@keyframes banner-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes stripe-move {
  from { background-position: 0 0; }
  to { background-position: 56px 0; }
}

.minimap {
  position: relative;
  width: 200px;
  height: 140px;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.7);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.minimap img {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.minimap-viewport {
  position: absolute;
  border: 2px solid #ffd23f;
  background: rgba(255, 210, 63, 0.18);
  pointer-events: none;
}

@media (max-width: 640px) {
  .minimap { width: 120px; height: 88px; }
}

