/* ══════════════════════════════════════════════════════════════════
   Last Sietch: Dune flagship page components
   Map widget, status banner, presence chart, progression, field intel.
   Built on the tokens in site.css (Last Sietch synthwave palette).
   ══════════════════════════════════════════════════════════════════ */

/* ── Server card ──────────────────────────────────────────────── */
.dune-server-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; max-width: 560px; }
.dune-server-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.6rem; transition: box-shadow 0.3s ease, transform 0.2s ease; }
.dune-server-card:hover { box-shadow: 0 0 22px rgba(244,161,72,0.15); transform: translateY(-2px); }
.dune-server-badge { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; color: var(--glow); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.dune-server-badge.tease { color: var(--offline); position: relative; }
.dune-server-badge.tease::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-left: 0.4rem; vertical-align: middle; animation: tease-pulse 1.8s ease-in-out infinite; }
.dune-server-badge.live { color: var(--live); position: relative; }
.dune-server-badge.live::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-left: 0.4rem; vertical-align: middle; box-shadow: 0 0 6px currentColor; animation: live-pulse 1.8s ease-in-out infinite; }
@keyframes tease-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes live-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

.dune-server-title { font-size: 1.5rem; font-weight: 700; color: var(--ink); margin-bottom: 0.3rem; }
.dune-server-subtitle { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--glow); margin-bottom: 0.75rem; }
.dune-server-detail { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.75rem; }
.dune-server-pop { font-family: var(--font-mono); font-size: 0.95rem; color: var(--glow); font-weight: 700; }
.dune-server-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.75rem; }
.dune-sietch { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink); padding-top: 0.75rem; border-top: 1px solid var(--border); }
.dune-source { margin-top: 1.25rem; font-size: 0.78rem; color: var(--muted); font-style: italic; max-width: 65ch; }

/* ── Live status banner ───────────────────────────────────────── */
.dune-status-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
.dune-status-headline { display: flex; flex-direction: column; gap: 0.25rem; }
.dune-status-bg-title { font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.dune-status-bg-region { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.dune-status-count { text-align: center; }
.dune-status-count .count-value { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--glow); }
.dune-status-count .count-label { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.dune-map-indicator { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.4rem; }
.dune-map-indicator.online { color: var(--live); }
.dune-map-indicator.offline { color: var(--offline); }
.dune-map-indicator.restricted { color: var(--glow); }
.dune-stale-note { font-family: var(--font-mono); font-size: 0.7rem; color: var(--glow); margin-bottom: 1.5rem; }
.dune-instance-line { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ── Presence chart ───────────────────────────────────────────── */
.dune-history { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; }
.dune-win-btns { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.dune-win-btn { padding: 0.4rem 1rem; font-size: 0.75rem; }
.dune-win-btn.active { background: var(--glow); color: #0a0a0f; }
.dune-chart-svg { width: 100%; height: 180px; display: block; }
.dune-chart-empty { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); text-align: center; padding: 2rem 0; }
.dune-chart-meta { display: flex; gap: 2rem; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.dune-chart-meta strong { color: var(--glow); font-weight: 700; }

/* ── Progression ──────────────────────────────────────────────── */
.dune-prog-histogram-wrap { width: 100%; min-height: 220px; border: 1px solid var(--border); background: rgba(0,0,0,0.25); padding: 0.75rem; border-radius: 4px; }
.dune-prog-histogram-wrap .dune-chart-svg { height: 220px; }
.dune-prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 720px) { .dune-prog-grid { grid-template-columns: 1fr; } }
.dune-prog-panel { border: 1px solid var(--border); background: rgba(0,0,0,0.25); padding: 1rem 1.25rem 1.25rem; border-radius: 4px; min-height: 220px; }
.dune-prog-panel .dune-map-subtitle { margin: 0 0 0.25rem; font-size: 1rem; }
.dune-prog-caption-mini { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); margin: 0 0 0.75rem; }
.dune-prog-topn { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 0.85rem; counter-reset: progrow; }
.dune-prog-topn li { display: flex; justify-content: space-between; align-items: baseline; padding: 0.3rem 0; border-bottom: 1px dashed var(--border-soft); counter-increment: progrow; }
.dune-prog-topn li:last-child { border-bottom: 0; }
.dune-prog-topn li::before { content: counter(progrow, decimal-leading-zero) "."; color: var(--muted); margin-right: 0.5rem; font-size: 0.75rem; }
.dune-prog-topn .dune-prog-name { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dune-prog-topn .dune-prog-name.dune-prog-online::after { content: " ●"; color: var(--live); font-size: 0.7rem; }
.dune-prog-topn .dune-prog-lvl { color: var(--glow); font-weight: 700; margin-left: 0.5rem; }
.dune-prog-topn .dune-prog-xp { color: var(--muted); font-size: 0.7rem; margin-left: 0.5rem; }
.dune-prog-levelups { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 0.8rem; max-height: 280px; overflow-y: auto; }
.dune-prog-levelups li { padding: 0.3rem 0; border-bottom: 1px dashed var(--border-soft); color: var(--muted); }
.dune-prog-levelups li:last-child { border-bottom: 0; }
.dune-prog-levelups .dune-prog-name { color: var(--ink); }
.dune-prog-levelups .dune-prog-lvl { color: var(--glow); font-weight: 700; }
.dune-prog-levelups .dune-prog-ago { font-size: 0.7rem; color: var(--muted); margin-left: 0.5rem; }

/* ── Server map ───────────────────────────────────────────────── */
.dune-map-subtitle { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin: 1.5rem 0 0.25rem; }
.dune-map-subtitle:first-of-type { margin-top: 0; }
.dune-map-caption { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; max-width: 70ch; }
.dune-map-widget { margin-bottom: 1.5rem; }
.dune-map-viewport { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: #07070b; border: 1px solid var(--border); border-radius: 8px; cursor: grab; touch-action: none; }
.dune-map-viewport.dragging { cursor: grabbing; }
.dune-map-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
#hagga-map-img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.dune-map-dots { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.dune-map-dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); transform-origin: center; animation: live-pulse 1.8s ease-in-out infinite; }
.dune-map-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); background: repeating-linear-gradient(45deg, #0a0a0f, #0a0a0f 12px, #101019 12px, #101019 24px); pointer-events: none; }
.dune-map-placeholder-icon { font-size: 1.75rem; }
.dune-map-zoom-ctrl { position: absolute; right: 0.6rem; bottom: 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.dune-map-zoom-ctrl button { width: 32px; height: 32px; font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700; color: var(--glow); background: rgba(10,10,15,0.85); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; line-height: 1; }
.dune-map-zoom-ctrl button:hover { border-color: var(--glow); }
.dune-map-calreadout { position: absolute; left: 0.6rem; top: 0.6rem; font-family: var(--font-mono); font-size: 0.7rem; color: var(--glow); background: rgba(10,10,15,0.85); border: 1px solid var(--border); border-radius: 4px; padding: 0.3rem 0.5rem; }
.dune-map-status { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin-top: 0.6rem; }

/* Hazard overlay */
.dune-map-hazards { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.dune-map-hazards.hidden { display: none; }
.dune-hazard { position: absolute; border-radius: 50%; border: 1px solid; box-sizing: border-box; }
.dune-hazard-quicksand { background: rgba(244,161,72,0.16); border-color: rgba(244,161,72,0.55); }
.dune-hazard-drumsand { background: rgba(120,150,210,0.14); border-color: rgba(120,150,210,0.5); }
.dune-hazard-radiationlow { background: rgba(103,217,122,0.14); border-color: rgba(103,217,122,0.5); }
.dune-hazard-radiationhigh { background: rgba(224,72,72,0.2); border-color: rgba(224,72,72,0.65); }

/* Landmark icons */
.dune-map-landmarks { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.dune-map-landmarks.hidden { display: none; }
.dune-landmark { position: absolute; width: 26px; height: 26px; transform-origin: center; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.85)); }
.dune-landmark:hover { filter: drop-shadow(0 0 4px var(--glow)); }
.dune-map-tooltip { position: absolute; z-index: 20; max-width: 220px; padding: 0.4rem 0.6rem; font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.4; color: var(--ink); background: rgba(10,10,15,0.96); border: 1px solid var(--border); border-radius: 4px; pointer-events: none; }
.dune-map-tooltip strong { display: block; color: var(--glow); }
.dune-tooltip-desc { display: block; margin-top: 0.15rem; color: var(--muted); }

.dune-map-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.dune-map-toggle { padding: 0.4rem 1rem; font-size: 0.75rem; }
.dune-map-toggle.active { background: var(--glow); color: #0a0a0f; }

/* ── Deep Desert intel ────────────────────────────────────────── */
.dune-fields-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.dune-field-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; }
.dune-field-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding-bottom: 0.6rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.dune-field-flavor { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.dune-field-grouptitle { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin: 0.9rem 0 0.4rem; }
.dune-field-grouptitle:first-of-type { margin-top: 0; }
.dune-field-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.35rem 0; font-family: var(--font-mono); font-size: 0.8rem; border-top: 1px solid var(--border-soft); }
.dune-field-row:first-of-type { border-top: none; }
.dune-field-name { color: var(--ink); flex: 1 1 100%; }
.dune-field-spawning { color: var(--live); font-size: 0.7rem; }
.dune-field-stat { color: var(--glow); font-weight: 700; }
.dune-field-bar { flex: 1 1 80px; height: 6px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.dune-field-bar-fill { display: block; height: 100%; background: var(--glow); }
.dune-field-empty { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); padding: 0.4rem 0; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dune-status-banner { flex-direction: column; align-items: flex-start; }
  .dune-chart-meta { gap: 1rem; flex-wrap: wrap; }
  .dune-map-viewport { aspect-ratio: 4 / 3; }
  .dune-fields-grid { grid-template-columns: 1fr; }
}
