:root {
  --bg-dark: #050711;
  --bg-card: rgba(14, 18, 36, 0.85);
  --bg-card-hover: rgba(22, 28, 56, 0.95);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.4);
  --accent-gold: #f59e0b;
  --accent-purple: #a855f7;
  --border-glass: rgba(255, 255, 255, 0.12);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --shadow-elevated: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 25px rgba(56, 189, 248, 0.15);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* ===== TRYB DZIENNY (Kosmos, ale lekko jaśniejszy niż nocą) ===== */
body.day-mode {
  --bg-dark: #0a1329;
  --bg-card: rgba(18, 28, 56, 0.88);
  --bg-card-hover: rgba(28, 42, 80, 0.96);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.4);
  --accent-gold: #fbbf24;
  --border-glass: rgba(255, 255, 255, 0.18);
  --shadow-elevated: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.2);
  background-color: #0b1427;
  background-image: radial-gradient(ellipse at 50% 50%, #16274e 0%, #091020 100%);
}

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

body {
  font-family: var(--font-sans);
  background-color: #010204;
  background-image: radial-gradient(ellipse at 50% 50%, #040711 0%, #000103 100%);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.8s ease, background-image 0.8s ease, color 0.8s ease;
}

/* Canvas container */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
}

#canvas-container:active {
  cursor: grabbing;
}

/* Header */
.main-header {
  position: fixed;
  top: 20px;
  left: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(10, 14, 28, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.6));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(6deg); }
}

.site-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  background: linear-gradient(135deg, #ffffff 30%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.site-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
  transform: translateY(-2px);
}

/* Bottom Controls */
.bottom-controls {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 10px;
  background: rgba(10, 14, 28, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 8px 12px;
  border-radius: 40px;
  border: 1px solid var(--border-glass);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.control-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

/* Interaction Hint */
.interaction-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  animation: fadeIn 1s ease-out;
}

.hint-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
}
.hint-close:hover {
  color: var(--text-main);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-glass);
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.7);
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 24px;
}

.sidebar.open {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
}

.sidebar-search {
  margin-bottom: 14px;
}

.sidebar-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.25s ease;
}

.sidebar-search input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.chip.active {
  background: var(--accent-cyan);
  color: #050711;
  border-color: var(--accent-cyan);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.monuments-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.monuments-list::-webkit-scrollbar {
  width: 5px;
}
.monuments-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.monument-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.monument-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateX(-4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.monument-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.item-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.item-info {
  flex: 1;
}

.item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.item-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  opacity: 0.5;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.monument-item:hover .item-arrow {
  opacity: 1;
  color: var(--accent-cyan);
  transform: translateX(4px);
}

/* Tooltip on globe hover */
.globe-tooltip {
  position: absolute;
  z-index: 30;
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(10, 15, 30, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.4);
  padding: 8px 16px;
  border-radius: 30px;
  pointer-events: none;
  transform: translate(-50%, -120%);
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -100%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -120%) scale(1); }
}

.tooltip-flag {
  font-size: 1.3rem;
}

.tooltip-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

.tooltip-country {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Detail Card Modal */
.detail-card-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.detail-card-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-card {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 440px;
  max-width: calc(100vw - 60px);
  max-height: calc(100vh - 80px);
  background: var(--bg-card);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-card.open {
  transform: translateY(0);
  opacity: 1;
}

.detail-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.detail-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.detail-hero {
  position: relative;
  width: 100%;
  height: 200px;
  background: #111;
  overflow: hidden;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.detail-card:hover .detail-hero img {
  transform: scale(1.05);
}

.detail-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(14, 18, 36, 1) 0%, rgba(14, 18, 36, 0.2) 60%, rgba(0, 0, 0, 0.6) 100%);
}

.detail-category-badge {
  position: absolute;
  bottom: 12px;
  left: 16px;
  background: rgba(56, 189, 248, 0.2);
  backdrop-filter: blur(8px);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  max-height: 400px;
}

.detail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.detail-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.detail-year-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-align: right;
  min-width: 90px;
}

.year-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.year-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.detail-description {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 18px;
}

/* Stats Grid */
.detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.stat-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stat-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

/* Actions */
.detail-actions {
  display: flex;
  gap: 10px;
}

.primary-btn, .secondary-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.primary-btn {
  background: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
  color: #050711;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.primary-btn:hover {
  background: #7dd3fc;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: #fff;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .main-header {
    top: 14px;
    left: 14px;
    right: 14px;
  }
  .site-title {
    font-size: 0.95rem;
  }
  .site-subtitle {
    display: none;
  }
  .badge {
    display: none;
  }
  .interaction-hint {
    display: none;
  }
  .sidebar {
    width: 100vw;
    right: -100vw;
  }
  .detail-card {
    left: 14px;
    right: 14px;
    bottom: 85px;
    width: auto;
    max-width: none;
  }
  .bottom-controls {
    bottom: 14px;
    padding: 6px 10px;
    gap: 6px;
  }
  .control-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  .control-btn .btn-text {
    display: none;
  }
  .control-btn .btn-icon {
    font-size: 1.1rem;
  }
}

/* ===== PRZYCISK DZIEŃ / NOC & AKCENTY ===== */
.control-btn#btn-day-night.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}

body.day-mode .logo-group {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.2);
}

body.day-mode .bottom-controls {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

body.day-mode .sidebar {
  border-left-color: rgba(255, 255, 255, 0.2);
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.5);
}

body.day-mode .detail-card {
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}
