/* --- P5Wrapper overrides --- */
#sketch-holder, .animation-content, #control-holder { display: none !important; }
body { display: block !important; margin: 0; padding: 0; overflow: hidden; }

/* --- Palette --- */
:root {
  --bg: #1695A3;
  --navy: #225378;
  --land: #F3FFE2;
  --hover: #EB7F00;
  --pressed: #225378;
  --hud-bg: rgba(14, 44, 62, 0.82);
  --hud-border: rgba(255, 255, 255, 0.08);
  --accent: #ACF0F2;
}

body {
  background-color: var(--bg);
  color: #fff;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* --- HUD (top bar) --- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 12px 16px 10px;
  background: var(--hud-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hud-border);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

#hud-country {
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#hud-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
}

.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
  margin-bottom: 1px;
}

.stat-val {
  font-size: 1rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}

/* --- Toast (wrong-guess feedback) --- */
#hud-toast {
  font-size: 0.8rem;
  font-weight: 300;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s, max-height 0.3s;
  color: var(--accent);
}
#hud-toast.visible {
  opacity: 1;
  max-height: 2em;
  margin-top: 4px;
}

/* --- Buttons (bottom-left) --- */
#btn-group {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--hud-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--hud-border);
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.2s;
}
.btn:hover {
  background: rgba(14, 44, 62, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn:active {
  background: var(--navy);
}
.btn.active {
  background: var(--accent);
  color: var(--navy);
  border-color: var(--accent);
}

/* --- SVG map container --- */
#svgcontainer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}
#svgcontainer svg {
  width: 100%;
  height: 100%;
}

/* --- SVG path styles --- */
#svgcontainer path {
  fill: var(--land);
  stroke: var(--navy);
  stroke-width: 0.5px;
  cursor: pointer;
  transition: fill 0.12s;
}
#svgcontainer path:hover {
  fill: var(--hover);
}
#svgcontainer .pressed {
  fill: var(--pressed) !important;
  stroke: var(--pressed) !important;
}

/* --- Show-me circle --- */
#showCircle {
  fill: rgba(0, 255, 0, 0);
  stroke: none;
  r: 1000;
  pointer-events: none;
  transition: none;
}
#showCircle.active {
  fill: rgba(0, 255, 0, 0.6);
  stroke: none;
  r: 5;
  pointer-events: none;
  transition: r 1s, fill 1s;
}

/* --- End-game overlay --- */
#endOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 0.5s;
}
#endOverlay.visible {
  background: rgba(0, 0, 0, 0.6);
}

#endCard {
  background: var(--hud-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hud-border);
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
}
#endOverlay.visible #endCard {
  transform: translateY(0);
  opacity: 1;
}

#endCard h1 {
  font-size: 2rem;
  font-weight: 300;
  margin: 0 0 8px;
}
#endCard p {
  font-weight: 300;
  opacity: 0.7;
  margin: 0 0 28px;
}

.end-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
}
.end-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.end-val {
  font-size: 1.6rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
.end-lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.5;
  margin-top: 2px;
}
