/* ================================================================
   Skills Map Archipelago — Core Styles
   Lightweight replacement for 890-line inline <style> block.
   ================================================================ */

/* ── CSS Variables ────────────────────────────────────────────── */
:root {
  --skill-bg-glow: rgba(114, 214, 255, 0.18);
  --skill-bg-shell: rgba(114, 214, 255, 0.62);
  --skill-bg-core: rgba(8, 12, 24, 0.35);
  --skill-text: #f5f7ff;
  --skill-ring: rgba(114, 214, 255, 0.45);
  --bg-ocean: linear-gradient(180deg, #0a1628 0%, #162847 100%);
  --bg-sky: radial-gradient(circle at 30% 20%, #121829, #03040a);
  --panel-bg: rgba(15, 23, 36, 0.95);
  --panel-text: #e5e7f0;
  --panel-card-bg: rgba(255, 255, 255, 0.06);
  --panel-card-border: rgba(255, 255, 255, 0.08);
  --panel-card-muted: rgba(226, 235, 255, 0.82);
  --panel-card-strong: rgba(245, 247, 255, 0.96);
}

[data-theme="high-contrast"] {
  --skill-bg-glow: rgba(255, 255, 255, 0.4);
  --skill-bg-shell: rgba(255, 255, 255, 0.95);
  --skill-bg-core: rgba(0, 0, 0, 0.95);
  --skill-text: #ffffff;
  --skill-ring: rgba(255, 255, 255, 1);
  --bg-ocean: linear-gradient(180deg, #000000 0%, #1a1a1a 100%);
  --bg-sky: linear-gradient(180deg, #000000 0%, #0d0d0d 100%);
  --panel-bg: rgba(0, 0, 0, 0.98);
  --panel-text: #ffffff;
  --panel-card-bg: rgba(255, 255, 255, 0.15);
  --panel-card-border: rgba(255, 255, 255, 0.55);
  --panel-card-muted: #e5e5e5;
  --panel-card-strong: #ffffff;
}

/* ── Base ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, sans-serif;
  background: var(--bg-sky);
  color: var(--skill-text);
  overflow: hidden;
}

/* ── Canvas ───────────────────────────────────────────────────── */
#sceneCanvas {
  position: fixed;
  top: 0; left: 0;
  display: block;
  width: 100vw; height: 100vh;
  cursor: grab;
  background: var(--bg-ocean);
  z-index: 1;
}
#sceneCanvas.is-dragging { cursor: grabbing; }

/* ── Loading Overlay ──────────────────────────────────────────── */
#loadingOverlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 18px;
  background: rgba(3, 4, 10, 0.88);
  backdrop-filter: blur(10px);
  z-index: 10;
  transition: opacity 0.5s ease;
}
#loadingOverlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 54px; height: 54px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #72d6ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-text {
  letter-spacing: 0.4px; font-size: 15px;
  color: rgba(235, 240, 255, 0.9);
}

/* ── Hint Banner ──────────────────────────────────────────────── */
#hintBanner {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px; border-radius: 999px;
  background: rgba(12, 18, 34, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(235, 240, 255, 0.88);
  font-size: 13px; letter-spacing: 0.45px;
  pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity 0.6s ease 0.2s;
}
#hintBanner.visible { opacity: 1; }

/* ── Top Bar Buttons ──────────────────────────────────────────── */
.theme-toggle-btn {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.8);
  color: var(--panel-text);
  padding: 10px 16px; border-radius: 8px;
  cursor: pointer; font-size: 16px;
  font-family: "Segoe UI", Roboto, sans-serif;
  transition: transform 160ms ease, background 160ms ease;
}
.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.82);
  outline: none;
}
[data-theme="high-contrast"] .theme-toggle-btn {
  background: #ffffff; color: #000000; border-color: #000000;
}
.auth-btn { right: 200px; }

/* ── Island Tooltip ───────────────────────────────────────────── */
.island-tooltip {
  position: fixed; z-index: 12;
  padding: 12px 18px; border-radius: 14px;
  background: var(--panel-bg, rgba(8, 12, 26, 0.92));
  border: 1px solid var(--panel-card-border, rgba(114, 214, 255, 0.38));
  color: var(--panel-text, rgba(236, 242, 255, 0.95));
  pointer-events: none;
  box-shadow: 0 18px 40px rgba(2, 6, 18, 0.52);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 20px));
  transition: opacity 0.18s ease, transform 0.18s ease;
  min-width: 220px; max-width: 320px;
  display: flex; flex-direction: column; gap: 4px; font-size: 13px;
}
.island-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 26px));
}
.island-tooltip.is-hidden { opacity: 0; }
.island-tooltip strong {
  font-size: 15px; font-weight: 600; letter-spacing: 0.35px;
  color: var(--panel-card-strong, currentColor);
}
.island-tooltip span {
  color: var(--panel-card-muted, rgba(186, 201, 230, 0.92));
  font-size: 12px; letter-spacing: 0.3px;
}

/* ── Island Side Panel ────────────────────────────────────────── */
.island-panel {
  position: fixed; top: 0; right: -420px;
  width: 400px; height: 100vh;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  transition: right 320ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 14; overflow-y: auto; padding: 32px;
  color: var(--panel-text);
  display: flex; flex-direction: column;
}
.island-panel.open { right: 0; }

.island-panel header { position: relative; margin-bottom: 24px; }

.island-panel .close-btn {
  position: absolute; top: -8px; right: -8px;
  width: 38px; height: 38px; border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px; color: #f5f7ff;
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: background 180ms, transform 180ms;
}
.island-panel .close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.island-panel h2 { margin: 0; font-size: 28px; letter-spacing: 0.6px; }

.biome-badge {
  display: inline-block; padding: 6px 14px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 14px; font-size: 13px;
  letter-spacing: 0.35px; margin-top: 10px;
}

.island-tagline {
  margin-top: 12px; font-size: 14px;
  color: var(--panel-card-muted); letter-spacing: 0.35px;
}

/* Logo section */
.logo-section {
  margin: 20px 0; display: flex;
  justify-content: center; align-items: center;
}
.logo-3d-container {
  width: 120px; height: 120px;
  display: flex; justify-content: center; align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 3px rgba(255, 255, 255, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.logo-3d-container:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), inset 0 1px 3px rgba(255, 255, 255, 0.15);
}
.island-logo-emoji {
  font-size: 64px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: floatLogo 3s ease-in-out infinite;
}

/* Progress */
.progress-section { margin-bottom: 28px; }
.progress-bar {
  width: 100%; height: 10px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 6px; overflow: hidden;
  margin: 16px 0 10px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  transition: width 320ms ease-out;
}
.progress-section p { margin: 0; font-size: 13px; color: var(--panel-card-muted); }

/* Games list */
.games-section, .rewards-section { margin-bottom: 28px; }
.games-section h3, .rewards-section h3 {
  margin: 0 0 12px; font-size: 16px; letter-spacing: 0.4px;
}

.games-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.games-list li {
  padding: 12px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 8px;
  cursor: pointer;
  transition: background 180ms, transform 180ms;
}
.games-list li:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateX(4px);
}
.games-list li.is-selected {
  border: 1px solid rgba(114, 214, 255, 0.6);
  box-shadow: 0 0 14px rgba(114, 214, 255, 0.22);
}

.game-line {
  width: 100%; display: flex;
  justify-content: space-between; align-items: center; gap: 10px;
}
.games-list strong { font-size: 14px; letter-spacing: 0.35px; }
.game-status { font-size: 14px; opacity: 0.75; }

/* Skill pills */
.game-skills, .world-skills { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(236, 242, 255, 0.95);
  font-size: 12px; letter-spacing: 0.3px; line-height: 1.2;
  box-shadow: 0 4px 10px rgba(6, 12, 22, 0.25);
}
.skill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--skill-color, #72d6ff);
  box-shadow: 0 0 10px var(--skill-color, #72d6ff);
}

/* Rewards */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.reward-card {
  padding: 12px; background: rgba(255, 255, 255, 0.08);
  border-radius: 12px; text-align: center;
  font-size: 13px; letter-spacing: 0.3px;
}

/* Worlds list */
.worlds-section { margin-bottom: 24px; }
.worlds-section h3 { margin: 0 0 12px; font-size: 16px; letter-spacing: 0.4px; }
.worlds-list {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0; padding: 0;
}
.worlds-list li {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 8px;
  padding: 10px 14px; border-radius: 12px;
  background: rgba(12, 18, 34, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 180ms ease, border 180ms ease, background 180ms ease;
}
.worlds-list li:hover {
  transform: translateY(-2px);
  border-color: rgba(114, 214, 255, 0.45);
  background: rgba(12, 18, 34, 0.5);
}
.worlds-list li.is-selected {
  border-color: rgba(114, 214, 255, 0.85);
  box-shadow: 0 0 18px rgba(114, 214, 255, 0.22);
}
.world-chip-header { display: flex; align-items: center; gap: 8px; width: 100%; }
.world-chip-swatch {
  width: 14px; height: 14px; border-radius: 50%;
  box-shadow: 0 0 10px rgba(114, 214, 255, 0.5);
}
.world-chip-label { font-size: 13px; letter-spacing: 0.35px; }
.world-chip-progress {
  margin-left: auto; font-size: 12px;
  color: rgba(186, 201, 230, 0.85);
}

/* Launch button */
.primary-btn {
  width: 100%; padding: 14px 0; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #2196f3, #1976d2);
  color: #fff; font-weight: 600; font-size: 15px;
  letter-spacing: 0.35px; cursor: pointer;
  transition: transform 180ms, box-shadow 180ms;
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(33, 150, 243, 0.35);
}
.primary-btn.is-disabled,
.primary-btn:disabled {
  cursor: not-allowed; opacity: 0.6;
  box-shadow: none; transform: none;
}
.primary-btn.is-disabled:hover,
.primary-btn:disabled:hover { transform: none; box-shadow: none; }

/* ── Mini-Map ─────────────────────────────────────────────────── */
.mini-map-container {
  position: fixed; bottom: 20px; left: 20px;
  z-index: 1000;
  font-family: "Segoe UI", Roboto, sans-serif;
}
.mini-map-toggle {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(15, 23, 36, 0.95);
  border: 2px solid rgba(114, 214, 255, 0.6);
  color: var(--skill-text); font-size: 24px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(114, 214, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}
.mini-map-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 30px rgba(114, 214, 255, 0.5);
  border-color: rgba(114, 214, 255, 0.9);
}
.mini-map-toggle:active { transform: scale(1.05); }

.mini-map-content {
  position: absolute; bottom: 70px; left: 0;
  width: 300px;
  background: rgba(15, 23, 36, 0.98);
  border: 2px solid rgba(114, 214, 255, 0.4);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 40px rgba(114, 214, 255, 0.2);
  backdrop-filter: blur(20px);
  opacity: 0; transform: translateY(20px) scale(0.9);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.mini-map-container.open .mini-map-content {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: all;
}
.mini-map-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(114, 214, 255, 0.2);
}
.mini-map-header h3 {
  margin: 0; font-size: 16px; font-weight: 600;
  color: var(--skill-text); letter-spacing: 0.5px;
}
.mini-map-close {
  width: 28px; height: 28px; border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--skill-text); font-size: 24px;
  line-height: 1; border-radius: 50%;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.mini-map-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}
.mini-map-canvas {
  width: 100%; height: 250px; display: block;
  background: linear-gradient(180deg, #0a1628 0%, #162847 100%);
  cursor: pointer;
}

[data-theme="high-contrast"] .mini-map-toggle { background: #ffffff; border-color: #000000; }
[data-theme="high-contrast"] .mini-map-content {
  background: rgba(0, 0, 0, 0.98); border-color: rgba(255, 255, 255, 0.8);
}
[data-theme="high-contrast"] .mini-map-canvas { background: #000000; }

/* ── Screen Reader ────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floatLogo {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(2deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-5px) rotate(-2deg); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.mini-map-container.open .toggle-icon {
  animation: pulse 2s ease-in-out infinite;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .island-panel { width: 100%; right: -100%; padding: 24px; }
  .mini-map-container { bottom: 16px; left: 16px; }
  .mini-map-toggle { width: 48px; height: 48px; font-size: 20px; }
  .mini-map-content { width: 280px; bottom: 60px; }
  .mini-map-canvas { height: 220px; }
  .auth-btn { right: auto; left: 16px; top: 16px; }
  .theme-toggle-btn:not(.auth-btn) { right: 16px; }
}
