/* Kolory i akcenty unikalne dla Jeleniej Wyprawy */
:root {
  --bg: #1a2a1f;
  --surface: #2c3a2a;
  --card: #3d4a32;
  --border: #5e6b47;
  --gold: #c9a87b;
  --gold2: #dbc5a0;
  --ember: #b46b3a;
  --text: #f0efd9;
  --muted: #b2b692;
  --found: #4f7a4a;
  --radius: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: radial-gradient(circle at 25% 40%, rgba(80, 60, 30, 0.12) 2%, transparent 2.5%);
  background-size: 32px 32px;
  z-index: 0;
}

.leaflet-tile-pane {
  filter: brightness(0.65) saturate(0.65) sepia(0.15) hue-rotate(5deg) contrast(0.95);
}

#title-card {
  flex: 1;
  background: rgba(35, 45, 30, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  padding: 8px 14px 8px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#title-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

#dragon-hero,
#drawer-hero-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(201, 168, 123, 0.6));
  animation: deerFloat 3s ease-in-out infinite;
}

@keyframes deerFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

#title-card h1 {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  white-space: nowrap;
}

#prog-wrap {
  margin-top: 5px;
  background: var(--surface);
  border-radius: 4px;
  height: 5px;
  width: 100%;
  overflow: hidden;
}

#prog-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ember), var(--gold));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#count-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.5px;
}

.hud-btn {
  background: rgba(35, 45, 30, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 18px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.hud-btn:hover {
  border-color: var(--gold);
}

/* Overlay i drawer */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 2500;
}

#overlay.show {
  display: block;
}

#drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(340px, 92vw);
  background: rgba(35, 45, 30, 0.96);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(20px);
  transform: translateX(110%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3000;
  display: flex;
  flex-direction: column;
}

#drawer.open {
  transform: translateX(0);
}

#drawer-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-hero-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.drawer-hero-row img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(201, 168, 123, 0.5));
}

#drawer-head h2 {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  color: var(--gold);
}

#filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.filter-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--gold);
  color: #1a2a1f;
  border-color: var(--gold);
}

#drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.action-btn {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Lista jelonków */
#dragon-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#dragon-list::-webkit-scrollbar {
  width: 4px;
}
#dragon-list::-webkit-scrollbar-track {
  background: transparent;
}
#dragon-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.deer-item {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.deer-item:hover {
  border-color: var(--gold);
  transform: translateX(-2px);
}

.deer-item.found {
  border-left: 3px solid var(--found);
  opacity: 0.7;
  box-shadow: 0 0 8px rgba(79, 122, 74, 0.4);
}

.deer-item .emoji {
  font-size: 20px;
  flex-shrink: 0;
}

.deer-item .info {
  flex: 1;
  min-width: 0;
}

.deer-item .dname {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deer-item .daddr {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deer-item .check {
  font-size: 16px;
  flex-shrink: 0;
}

.deer-item .locate-icon {
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 4px;
}

/* Zdjęcia w liście */
.deer-item .deer-photos {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  margin-left: 32px;
  flex-basis: 100%;
  order: 10;
}

.deer-item.expanded .deer-photos {
  display: flex;
}

.menu-photo-wrapper {
  position: relative;
  display: inline-block;
}

.menu-photo-wrapper img {
  width: 55px;
  height: 55px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--gold);
  cursor: pointer;
  transition: transform 0.2s;
}

.menu-photo-wrapper img:hover {
  transform: scale(1.05);
  border-color: #fff;
}

.delete-photo-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}

/* Markery na mapie */
.marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid rgba(0, 0, 0, 0.5);
  position: relative;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(201, 168, 123, 0.45);
}

.marker-pin::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
.marker-pin.red {
  background: var(--ember);
}
.marker-pin.green {
  background: var(--found);
}

/* Popup Leaflet */
.leaflet-popup-content-wrapper {
  background: var(--card) !important;
  border: 1px solid rgba(200, 180, 140, 0.5) !important;
  border-radius: 14px !important;
  color: var(--text) !important;
  font-family: 'Crimson Pro', serif !important;
  font-size: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(210, 180, 110, 0.2) inset !important;
}

.leaflet-popup-tip {
  background: var(--card) !important;
}

.leaflet-popup-close-button {
  font-size: 24px !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  color: var(--gold) !important;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  margin: 4px;
}

.popup-inner h3 {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  color: var(--gold);
  margin-bottom: 6px;
}

.popup-inner .addr {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 8px;
}

.popup-inner .hint {
  font-size: 16px;
  font-style: italic;
  color: var(--text);
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid var(--gold);
}

.popup-inner .story {
  font-size: 16px;
  color: var(--text);
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid #c9a87b;
  font-style: italic;
  line-height: 1.5;
}

.popup-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--ember);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.popup-btn:hover {
  background: var(--gold);
  color: #1a2a1f;
}

/* Miniatury zdjęć w popupie */
.popup-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  justify-content: center;
}

.popup-photos img {
  width: 55px;
  height: 55px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--gold);
  cursor: pointer;
}

/* Efekt pulsowania */
@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}
.pulse-circle {
  position: absolute;
  pointer-events: none;
  animation: pulse 2s infinite;
}
.pulse-ring {
  animation: pulse 2s infinite;
}

/* Ekran gratulacji */
#congrats {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}
#congrats.show { display: flex; }
#congrats-dragon {
  width: 120px;
  animation: congratsDeer 0.7s cubic-bezier(0.2, 1.5, 0.5, 1) both;
  filter: drop-shadow(0 0 30px rgba(201, 168, 123, 0.8));
}
@keyframes congratsDeer {
  0% { transform: scale(0.2) rotate(-30deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
#congrats h2 { font-family: 'Cinzel', serif; font-size: 22px; color: var(--gold); }
#congrats p { color: var(--muted); font-size: 16px; }

/* Splash */
#splash {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.6s;
}
#splash.hidden { opacity: 0; pointer-events: none; }
#splash-dragon {
  width: 160px;
  animation: splashFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(201, 168, 123, 0.65));
}
@keyframes splashFloat {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-14px) rotate(3deg); }
}
#splash h1 { font-family: 'Cinzel', serif; font-size: 28px; color: var(--gold); letter-spacing: 3px; }
#splash p { color: var(--muted); font-size: 15px; font-style: italic; }
.splash-bar-wrap {
  width: 200px;
  height: 3px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.splash-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ember), var(--gold));
  animation: load 2s ease forwards;
}
@keyframes load { 0% { width: 0; } 100% { width: 100%; } }

/* Przyciski zoom na mapie */
.leaflet-control-zoom {
  position: absolute !important;
  bottom: 20px !important;
  left: 12px !important;
  top: auto !important;
  right: auto !important;
}

/* Drawer zamknięty – chowamy tytuł */
body.drawer-open #title-card {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#drawer-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
  flex-shrink: 0;
}
.logo-link { text-decoration: none; display: inline-block; }
.logo-text {
  font-family: 'Roboto', sans-serif;
  font-weight: 400;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.logo-dot { color: #eab308; }
.logo-link:hover .logo-text {
  background: linear-gradient(90deg, #c9a87b, #eab308, #b46b3a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Modal powiększonego zdjęcia */
#photo-modal img { animation: modalFadeIn 0.3s ease; }
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Panel routingu (Leaflet Routing Machine) – przeniesiony w prawy dolny róg */
.leaflet-routing-container {
    position: absolute !important;
    bottom: 20px !important;
    right: 20px !important;
    top: auto !important;
    left: auto !important;
    z-index: 1000 !important;
    max-width: 280px;
    background: rgba(35, 45, 30, 0.96) !important;
    border-radius: 12px !important;
    border: 1px solid var(--gold) !important;
    backdrop-filter: blur(8px);
}
.leaflet-routing-container .leaflet-routing-collapse-btn,
.leaflet-routing-container .leaflet-routing-close-btn {
    background: var(--ember) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    line-height: 28px !important;
    text-align: center !important;
    cursor: pointer !important;
}
.leaflet-routing-container .leaflet-routing-collapse-btn:hover,
.leaflet-routing-container .leaflet-routing-close-btn:hover {
    background: var(--gold) !important;
    color: #1a2a1f !important;
}

/* Mgła nad mapą (opcjonalny efekt) */
#map::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(26, 42, 31, 0.4), rgba(26, 42, 31, 0));
  z-index: 10;
}
