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

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #1a3a8c;
  color: #eee;
}

.hidden {
  display: none !important;
}

/* --- Map Screen --- */

#map-screen {
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 0;
  background: #1a3a8c;
}

/* --- Flower icon --- */

.flower-icon {
  overflow: visible !important;
  background: none !important;
  border: none !important;
}

.flower-icon img {
  width: 32px;
  height: 32px;
}

.flower-img {
  transform-origin: 50% 80%;
  animation: flower-sway 0.6s ease-in-out forwards;
  animation-play-state: paused;
}

.flower-icon.waving .flower-img {
  animation-play-state: running;
}

@keyframes flower-sway {
  0%   { transform: rotate(0deg); }
  25%  { transform: rotate(-8deg); }
  75%  { transform: rotate(8deg); }
  100% { transform: rotate(0deg); }
}

/* --- Avatar icon --- */

.avatar-icon img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(168, 230, 207, 0.9);
  box-shadow: 0 2px 10px rgba(0,0,0,0.6);
}

/* Fallback pulsing dot when no avatar image is provided */
.avatar-pulse {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #a8e6cf;
  box-shadow: 0 0 0 0 rgba(168, 230, 207, 0.7);
  animation: pulse-ring 1.4s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(168, 230, 207, 0.7); }
  70%  { box-shadow: 0 0 0 12px rgba(168, 230, 207, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 230, 207, 0); }
}

/* --- Animated dashed path --- */

@keyframes dash-flow {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -16; }
}

.animated-path path {
  animation: dash-flow 0.6s linear infinite;
}

/* --- Alignment panel (alignMode only) --- */

#align-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  background: rgba(15, 15, 30, 0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  backdrop-filter: blur(8px);
  color: #ddd;
  font-size: 0.82rem;
}

.align-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #a8e6cf;
  margin-bottom: 0.1rem;
}

#align-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

#align-panel input[type="range"] {
  width: 100%;
  accent-color: #a8e6cf;
}

#save-align-btn {
  margin-top: 0.3rem;
  padding: 0.5rem;
  border-radius: 7px;
  border: none;
  background: #a8e6cf;
  color: #1a1a2e;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

#save-align-btn:hover { background: #88d8b0; }

#align-saved {
  text-align: center;
  color: #a8e6cf;
  font-size: 0.8rem;
}

/* --- POI align panel (alignMode only, appears when a POI is selected) --- */

#poi-align-panel {
  position: absolute;
  top: 12px;
  right: 248px;
  z-index: 1000;
  background: rgba(15, 15, 30, 0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  backdrop-filter: blur(8px);
  color: #ddd;
  font-size: 0.82rem;
}

#poi-align-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

#poi-align-panel input[type="range"] {
  width: 100%;
  accent-color: #a8e6cf;
}

#poi-save-btn {
  margin-top: 0.3rem;
  padding: 0.5rem;
  border-radius: 7px;
  border: none;
  background: #a8e6cf;
  color: #1a1a2e;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

#poi-save-btn:hover { background: #88d8b0; }

#poi-align-saved {
  text-align: center;
  color: #a8e6cf;
  font-size: 0.8rem;
}

.poi-marker-selected {
  filter: drop-shadow(0 0 6px rgba(168, 230, 207, 0.9));
}

/* --- Nav button group (top-left, below zoom controls) --- */

#bottom-btns {
  position: absolute;
  top: 80px;
  left: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#bottom-btns button {
  padding: 0.45rem 1rem;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(15, 15, 30, 0.88);
  color: #a8e6cf;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

#bottom-btns button:hover {
  background: rgba(30, 30, 60, 0.95);
}

@keyframes about-pulse-anim {
  0%   { box-shadow: 0 0 0 0 rgba(168, 230, 207, 0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(168, 230, 207, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 230, 207, 0); }
}

#about-btn.about-pulse {
  animation: about-pulse-anim 1.8s ease-out infinite;
}

@media (max-width: 480px) {
  #bottom-btns button {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }
}

/* --- About panel --- */

#about-panel {
  position: absolute;
  top: 80px;
  right: 14px;
  z-index: 1001;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 120px);
  background: rgba(15, 15, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  color: #ddd;
  font-size: 0.88rem;
  overflow: hidden;
}

#about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

#about-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #a8e6cf;
}

#about-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

#about-close:hover { color: #fff; }

#about-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#about-body h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #a8e6cf;
  margin-bottom: 0.3rem;
}

#about-body p, #about-body dd {
  line-height: 1.55;
  color: #ccc;
}

#about-body ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

#about-body li { line-height: 1.5; }

#about-body code {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.82rem;
}

#about-body dl {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

#about-body dt {
  font-weight: 600;
  color: #eee;
}

#about-body dd {
  margin-left: 0;
  margin-top: 0.15rem;
  font-size: 0.85rem;
}

/* --- Contact panel --- */

#contact-panel {
  position: absolute;
  top: 80px;
  right: 14px;
  z-index: 1001;
  width: min(380px, calc(100vw - 28px));
  background: rgba(15, 15, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  color: #ddd;
  font-size: 0.88rem;
  overflow: hidden;
}

#contact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

#contact-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #a8e6cf;
}

#contact-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

#contact-close:hover { color: #fff; }

#contact-body {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  line-height: 1.55;
  color: #ccc;
}

#contact-body a {
  color: #a8e6cf;
  text-decoration: none;
}

#contact-body a:hover { text-decoration: underline; }

/* --- Journal panel --- */

#journal-panel {
  position: absolute;
  top: 80px;
  left: 14px;
  z-index: 1001;
  width: min(480px, calc(100vw - 28px));
  max-height: calc(100vh - 120px);
  background: rgba(15, 15, 30, 0.96);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  color: #ddd;
  font-size: 0.88rem;
  overflow: hidden;
}

#journal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

#journal-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #a8e6cf;
}

#journal-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

#journal-close:hover { color: #fff; }

#journal-body {
  padding: 0.75rem 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.journal-post {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 1.25rem;
}

.journal-post:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.journal-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.journal-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #eee;
  margin-bottom: 0.4rem;
}

.journal-body-text {
  font-size: 0.83rem;
  color: #bbb;
  line-height: 1.55;
  margin-bottom: 0.6rem;
}

.journal-body-text p { margin: 0 0 0.4rem; }

.journal-body-text img {
  max-width: 100%;
  border-radius: 8px;
  margin: 0.4rem 0;
  cursor: pointer;
  display: block;
}

.journal-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  margin-top: 0.5rem;
}

.journal-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.journal-images img:hover { opacity: 0.85; }

/* --- Lightbox --- */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
}

#lightbox-img {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}

/* --- Remove Leaflet's default framing on the artist image overlay */
.leaflet-image-layer {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* --- Trash progress widget (fixed top-left) --- */

#trash-widget {
  position: fixed;
  top: 16px;
  right: 0;
  z-index: 1000;
  background: rgba(15, 15, 30, 0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px 0 0 10px;
  padding: 0.55rem 0.8rem;
  min-width: 150px;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

#trash-month {
  font-size: 0.7rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

#trash-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}

#trash-bar {
  height: 100%;
  background: #a8e6cf;
  border-radius: 3px;
  transition: width 0.4s ease;
}

#trash-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #a8e6cf;
}

/* --- Mascot (fixed bottom-left) --- */

#mascot {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1100;
  pointer-events: none;
  margin: 0;
  padding: 0;
  line-height: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

#mascot img {
  width: 240px;
  max-width: 35vw;
  height: auto;
  display: block;
  margin: 0;
  padding: 0;
  image-rendering: auto;
}

#mascot {
  transition: opacity 0.3s ease;
}

#mascot.mascot-hidden {
  opacity: 0;
  pointer-events: none;
}

/* --- Artist credit (fixed top-right, fades after 12s) --- */

#artist-credit {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

#artist-credit.visible {
  opacity: 1;
}

#artist-credit img {
  max-width: 160px;
  max-height: 80px;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

/* --- Planning zone popups (dark theme) --- */

.leaflet-popup-content-wrapper {
  background: #1e1e36;
  color: #ddd;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.leaflet-popup-tip {
  background: #1e1e36;
}

.leaflet-popup-content {
  margin: 10px 14px;
  line-height: 1.55;
}

.leaflet-popup-close-button {
  color: #888 !important;
}
