/* -----------------------------------------------------------
   GLOBAL LAYOUT
----------------------------------------------------------- */

body {
  margin: 0;
  background: #111;
  color: #eee;
  font-family: Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 20px;
  background: #222;
  border-bottom: 2px solid #333;
}

main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* -----------------------------------------------------------
   LEFT PANEL — GRID
----------------------------------------------------------- */

.left-panel {
  width: 30%;
  background: #1a1a1a;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
  padding: 10px;
}

.cell {
  background: #333;
  border: 1px solid #444;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 12px;
  transition: box-shadow 0.3s, transform 0.3s;
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cell.locked img {
  opacity: 0.35;
}

/* Hover glow */
.cell:hover {
  box-shadow: 0 0 12px rgba(150, 220, 255, 0.7);
  transform: translateY(-2px);
}

/* Runic tooltip on grid cells */
.cell::after {
  content: attr(data-hover);
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  background: radial-gradient(circle at top, rgba(240, 240, 255, 0.9), rgba(40, 40, 60, 0.95));
  color: #fdf7e6;
  padding: 3px 7px;
  border-radius: 10px;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 6px rgba(200, 230, 255, 0.8);
  white-space: nowrap;
  transition: opacity 0.2s;
}

.cell:hover::after {
  opacity: 1;
}

/* -----------------------------------------------------------
   RIGHT PANEL — CANVAS + CONTROLS
----------------------------------------------------------- */

.right-panel {
  flex: 1;
  background: #222;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

#mainCanvas {
  flex: 1;
  background: #000;
  border: 1px solid #444;
  opacity: 0;
  transition: opacity 0.6s ease-in-out, box-shadow 0.6s;
  box-shadow: 0 0 0 rgba(180, 220, 255, 0);
}

#mainCanvas.fade-in {
  opacity: 1;
  box-shadow: 0 0 25px rgba(180, 220, 255, 0.5);
}

.controls {
  margin-top: 10px;
}

.controls button {
  margin-right: 10px;
  padding: 8px 14px;
  background: #444;
  color: white;
  border: none;
  cursor: pointer;
}

.controls button:hover {
  background: #666;
}

.main-extra {
  margin-top: 10px;
}

#btnLore {
  padding: 8px 14px;
  background: #555;
  color: white;
  border: none;
  cursor: pointer;
}

#btnLore:hover {
  background: #777;
}

/* -----------------------------------------------------------
   SNOW LAYER
----------------------------------------------------------- */

#snow {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 24px;
  z-index: 9999;
  overflow: hidden;
  display: none;
}

/* -----------------------------------------------------------
   MINIMAP
----------------------------------------------------------- */

#minimap {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 160px;
  height: 200px;
  background: radial-gradient(circle at top, rgba(10, 10, 25, 0.95), rgba(0, 0, 0, 0.7));
  border: 1px solid #555;
  border-radius: 10px;
  padding: 6px;
  z-index: 5000;
  box-shadow: 0 0 15px rgba(160, 210, 255, 0.4);
}

.minimap-dot-wrapper {
  position: absolute;
}

.minimap-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #888;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
  z-index: 5000;
}

.minimap-dot:hover {
  background: #fdf7e6;
  box-shadow: 0 0 10px rgba(220, 250, 255, 0.9);
  transform: scale(1.2);
}

.minimap-dot.active {
  background: #00d0ff;
  box-shadow: 0 0 14px rgba(0, 200, 255, 0.8);
  animation: minimapPulse 1.4s infinite ease-in-out;
}

@keyframes minimapPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 4px rgba(0, 200, 255, 0.5);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 0 0 18px rgba(0, 230, 255, 0.9);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 4px rgba(0, 200, 255, 0.5);
  }
}

/* Minimap tooltip */
.minimap-tooltip {
  position: absolute;
  left: 50%;
  top: -26px;
  transform: translateX(-50%);
  background: radial-gradient(circle at top, rgba(245, 245, 255, 0.95), rgba(40, 40, 70, 0.98));
  color: #fdf7e6;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 10px rgba(200, 230, 255, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-style: italic;
  z-index: 10000;
}

.minimap-tooltip::before {
  content: "ᚨᛚᚨ";
  position: absolute;
  top: -8px;
  left: 6px;
  font-size: 8px;
  opacity: 0.35;
}

.minimap-dot-wrapper:hover .minimap-tooltip {
  opacity: 1;
}

/* -----------------------------------------------------------
   FOOTER
----------------------------------------------------------- */

footer {
  background: #1a1a1a;
  padding: 10px;
  border-top: 2px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  color: #ccc;
  font-size: 14px;
}

.footer-buttons {
  display: flex;
  gap: 10px;
}

.footer-btn {
  padding: 6px 12px;
  background: #444;
  color: white;
  border: none;
  cursor: pointer;
}

.footer-btn:hover {
  background: #666;
}

/* -----------------------------------------------------------
   LORE POPUP (DIMMED BACKGROUND)
----------------------------------------------------------- */

.lore-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.lore-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.hidden {
  display: none;
}

/* Popup window */
.lore-popup {
  width: min(480px, 90vw);
  max-height: 70vh;
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.14),
      rgba(50, 60, 90, 0.95)
    );
  backdrop-filter: blur(10px);
  border-radius: 14px;
  border: 1px solid rgba(220, 235, 255, 0.7);
  box-shadow:
    0 0 18px rgba(180, 220, 255, 0.7),
    0 0 40px rgba(120, 180, 255, 0.4);
  padding: 14px 18px 18px 18px;
  display: flex;
  flex-direction: column;
  animation: loreAppear 0.3s ease-out;
  position: relative;
}

.lore-popup::before {
  content: "ᚨᛚᚨ ᚾᛁᛏᛏᛖᛚ ᚡᚨᛚᛖ";
  position: absolute;
  top: 4px;
  right: 10px;
  font-size: 9px;
  opacity: 0.35;
  pointer-events: none;
}

.lore-header h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
  color: #fdf7e6;
  text-shadow: 0 0 6px rgba(240, 250, 255, 0.9);
}

.lore-body {
  flex: 1;
  overflow-y: auto;
  font-size: 14px;
  color: #f4f0e8;
  line-height: 1.5;
  padding-right: 4px;
}

.lore-footer {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

/* Rune button */
.rune-link-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(230, 245, 255, 0.9);
  background: radial-gradient(circle at top, #fdf7e6, #7793c9);
  color: #111;
  font-size: 20px;
  cursor: pointer;
  box-shadow:
    0 0 10px rgba(240, 250, 255, 0.9),
    0 0 16px rgba(120, 180, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: runePulse 1.8s infinite ease-in-out;
  transition: transform 0.15s ease-out, box-shadow 0.2s;
}

.rune-link-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 0 16px rgba(255, 255, 255, 1),
    0 0 26px rgba(140, 200, 255, 0.9);
}

@keyframes loreAppear {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes runePulse {
  0% {
    box-shadow:
      0 0 6px rgba(240, 250, 255, 0.7),
      0 0 12px rgba(120, 180, 255, 0.4);
  }
  50% {
    box-shadow:
      0 0 14px rgba(255, 255, 255, 1),
      0 0 26px rgba(160, 210, 255, 0.9);
  }
  100% {
    box-shadow:
      0 0 6px rgba(240, 250, 255, 0.7),
      0 0 12px rgba(120, 180, 255, 0.4);
  }
}

.footer-btn {
  padding: 8px 14px;
  background: radial-gradient(circle at top, #2a2a2a, #111);
  color: #fdf7e6;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(200,220,255,0.6);
  transition: box-shadow 0.3s, background 0.3s, transform 0.2s;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-btn:hover {
  background: radial-gradient(circle at top, #444, #222);
  box-shadow: 0 0 10px rgba(180,220,255,0.6);
  transform: translateY(-2px);
}

.footer-btn .rune {
  font-size: 16px;
  opacity: 0.85;
  text-shadow: 0 0 6px rgba(200,220,255,0.8);
}

