/* ══════════════════════════════════════
   WorldView — Animations & Layout
   ══════════════════════════════════════ */

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

:root {
  --glass: rgba(12,15,30,.75);
  --gb: rgba(255,255,255,.08);
  --gh: rgba(255,255,255,.12);
  --ac: #6c63ff;
  --ac2: #00d2ff;
  --ac3: #ff6b6b;
  --tx: #e8eaf6;
  --td: #8a8fb5;
  --r: 18px;
  --sh: 0 8px 32px rgba(0,0,0,.4);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

html, body {
  height: 100%;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--tx);
  overflow: hidden;
  background: #0a0d1f;
}

/* ── Map (MapLibre GL — vector, GPU-rendered) ── */
#map { position: fixed; inset: 0; z-index: 0; transition: opacity .2s ease }
.maplibregl-ctrl-logo,
.maplibregl-ctrl-attrib { display: none !important }
.maplibregl-canvas { outline: none }
.maplibregl-marker { z-index: 12 !important; pointer-events: none }

/* ── Overlay Grid ── */
.ov {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
}
.ov > * { pointer-events: auto }

/* ── Header ── */
.hd {
  grid-column: 1 / -1;
  padding: 10px 24px;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, rgba(10,13,31,.92), rgba(10,13,31,.5) 80%, transparent);
  backdrop-filter: blur(12px);
  z-index: 20;
  flex-wrap: wrap;
}
.logo { font-size: 22px; font-weight: 700; letter-spacing: -.5px; cursor: pointer }
.logo span {
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.lp { display: flex; gap: 3px; margin-left: 8px }
.lb {
  padding: 3px 9px; border: 1px solid var(--gb); border-radius: 7px;
  background: transparent; color: var(--td); font-size: 10px;
  cursor: pointer; transition: all .25s var(--ease); font-family: inherit;
}
.lb:hover { background: var(--gh); color: var(--tx) }
.lb.on { background: rgba(108,99,255,.2); border-color: var(--ac); color: var(--tx) }
.ht { margin-left: auto; font-size: 13px; color: var(--td); white-space: nowrap }
.ht b { color: var(--tx); font-size: 17px; font-variant-numeric: tabular-nums }

/* ── Sidebar ── */
.sb {
  grid-row: 2; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 0 12px 12px 14px;
  background: linear-gradient(180deg, rgba(10,13,31,.6), rgba(10,13,31,.85));
  backdrop-filter: blur(8px);
}
.sx { position: relative; padding: 6px 0; flex-shrink: 0 }
.sx input {
  width: 100%; padding: 9px 12px 9px 34px;
  background: rgba(255,255,255,.06); border: 1px solid var(--gb);
  border-radius: 10px; color: var(--tx); font-size: 12px;
  outline: 0; transition: all .3s var(--ease); font-family: inherit;
}
.sx input:focus {
  border-color: var(--ac); background: rgba(255,255,255,.1);
  box-shadow: 0 0 20px rgba(108,99,255,.12);
}
.sx input::placeholder { color: var(--td) }
.si { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--td); font-size: 13px }

.cl {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
  padding-right: 3px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.cl::-webkit-scrollbar { width: 3px }
.cl::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px }

.ci {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 9px; cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
  border: 1px solid transparent; flex-shrink: 0;
}
.ci:hover { background: var(--gh); border-color: var(--gb); transform: translateX(4px) }
.ci.on { background: rgba(108,99,255,.15); border-color: rgba(108,99,255,.3) }
.ci .fl { font-size: 20px; line-height: 1; flex-shrink: 0 }
.ci .cn { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.ci .cs { font-size: 9.5px; color: var(--td) }

/* ── Main area ── */
.mn {
  grid-row: 2; display: flex; flex-direction: column;
  padding: 14px 18px; pointer-events: none; z-index: 5; overflow: hidden;
  position: relative;
}

/* ── Mode transitions ── */
.dash, .det {
  will-change: opacity, transform;
  transition: opacity .35s var(--ease), transform .35s var(--ease), visibility 0s linear 0s;
}
.dash.hide, .det.hide {
  opacity: 0; visibility: hidden; pointer-events: none !important;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear .3s;
}
.dash.hide { transform: scale(.96) }
.det.hide  { transform: translateY(16px) }

/* ── Detail view ── */
.det {
  display: flex; flex-direction: column; justify-content: flex-end;
  flex: 1; pointer-events: none;
  position: absolute; inset: 14px 18px;
}
.cds { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; pointer-events: auto }
.cd {
  background: var(--glass); backdrop-filter: blur(24px);
  border: 1px solid var(--gb); border-radius: var(--r);
  padding: 20px; box-shadow: var(--sh);
  transition: transform .3s var(--ease-bounce), border-color .25s var(--ease), box-shadow .3s var(--ease);
  will-change: transform;
  animation: cardIn .4s var(--ease-out) both;
}
.cd:nth-child(2) { animation-delay: .07s }
.cd:nth-child(3) { animation-delay: .14s }
.cd:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,.15);
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.cl-l { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--td); margin-bottom: 8px; display: flex; align-items: center; gap: 6px }
.cl-l .dt { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0 }
.cv { font-size: 38px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.1 }
.csb { font-size: 12px; color: var(--td); margin-top: 6px }
.tc .dt { background: var(--ac) }
.tc .cv { background: linear-gradient(135deg, var(--ac), var(--ac2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent }
.fc .dt { background: #ffd43b }
.fc .cv { color: #ffd43b; font-size: 28px }
.wc .dt { background: var(--ac3) }
.wc .cv { font-size: 32px }
.wc .cv .em { font-size: 38px; margin-right: 5px; -webkit-text-fill-color: initial }
.wd { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 8px }
.wd .di { font-size: 11px; color: var(--td) }
.wd .di b { color: var(--tx) }

.hr { pointer-events: auto; margin-bottom: 14px }
.hr-i { display: flex; align-items: center; gap: 16px }
.hr-f { font-size: 56px; line-height: 1; filter: drop-shadow(0 4px 12px rgba(0,0,0,.4)); transition: transform .3s var(--ease-bounce) }
.hr-n { font-size: 32px; font-weight: 800; letter-spacing: -1px }
.hr-d { font-size: 12.5px; color: var(--td); margin-top: 2px }
.hr-stats {
  display: flex; gap: 18px; margin-top: 10px;
  font-size: 13px; color: var(--td);
}
.hr-stats b { color: var(--tx); font-weight: 600 }
.hr-bio {
  margin-top: 8px; font-size: 13px; color: var(--td);
  line-height: 1.6; max-width: 600px;
  padding: 8px 12px;
  background: rgba(255,255,255,.04);
  border-left: 3px solid var(--ac);
  border-radius: 0 8px 8px 0;
}

.back-btn {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid var(--gb);
  color: var(--td); font-size: 12px; cursor: pointer;
  transition: all .25s var(--ease); margin-bottom: 10px; font-family: inherit;
}
.back-btn:hover { background: var(--gh); color: var(--tx); transform: translateX(-4px) }

.rg { display: grid; grid-template-columns: repeat(2,1fr); gap: 3px 12px; margin-top: 8px }
.rr { display: flex; justify-content: space-between; font-size: 11px; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04) }
.rr .rc { color: var(--td) }
.rr .rv { font-weight: 600; font-variant-numeric: tabular-nums }

.ld { display: flex; align-items: center; gap: 6px; color: var(--td); font-size: 11px }
.sp { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.1); border-top-color: var(--ac); border-radius: 50%; animation: spin .6s linear infinite }

/* ── Dashboard (6 big tiles, 3×2) ── */
.shuf {
  pointer-events: auto; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 7px; margin-bottom: 10px; border-radius: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--gb);
  color: var(--td); font-size: 12px; cursor: pointer;
  transition: all .25s var(--ease), visibility 0s linear 0s; font-family: inherit; flex-shrink: 0;
}
.shuf:hover { background: var(--gh); color: var(--tx); transform: scale(1.01) }
.shuf.hide { opacity: 0; visibility: hidden; pointer-events: none !important; transform: scale(.95) }

.dash {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  pointer-events: auto;
  flex: 1;
  overflow: hidden;
}

.dc {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--gb);
  border-radius: var(--r);
  padding: 20px 22px;
  cursor: pointer;
  display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
  will-change: transform, opacity;
  transition: transform .3s var(--ease-bounce), border-color .25s var(--ease),
              background .25s var(--ease), box-shadow .3s var(--ease);
  animation: tileIn .4s var(--ease-out) both;
}
.dc:nth-child(2) { animation-delay: .06s }
.dc:nth-child(3) { animation-delay: .12s }
.dc:nth-child(4) { animation-delay: .18s }
.dc:nth-child(5) { animation-delay: .24s }
.dc:nth-child(6) { animation-delay: .30s }

.dc:hover {
  transform: scale(1.02) translateY(-6px);
  border-color: rgba(108,99,255,.3);
  background: rgba(255,255,255,.08);
  box-shadow: 0 20px 50px rgba(108,99,255,.12), 0 8px 24px rgba(0,0,0,.3);
}
.dc:active { transform: scale(.98); transition-duration: .1s }

.dc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px }
.dc-flag { font-size: 48px; line-height: 1; flex-shrink: 0; transition: transform .3s var(--ease-bounce) }
.dc:hover .dc-flag { transform: scale(1.1) rotate(-3deg) }
.dc-title { flex: 1; min-width: 0 }
.dc-name { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.dc-cap { font-size: 12px; color: var(--td) }
.dc-time {
  font-size: 42px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: -1px; line-height: 1.15; margin: 4px 0;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.dc-stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--td); flex-wrap: wrap }
.dc-stats b { color: var(--tx); font-weight: 600 }
.dc-bio {
  font-size: 12.5px; color: var(--td); line-height: 1.55;
  margin-top: auto; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.05);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dc-wx-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px }
.dc-wx { display: flex; align-items: center; gap: 6px; font-size: 14px }
.dc-wx .em { font-size: 20px; -webkit-text-fill-color: initial }
.dc-wx b { color: var(--tx); font-size: 16px; font-weight: 700 }
.dc-cur { font-size: 12.5px; color: #ffd43b; font-weight: 600 }

/* ── Footer ── */
.ft {
  grid-column: 1 / -1; padding: 6px 24px; text-align: center;
  font-size: 10px; color: rgba(255,255,255,.2);
  background: linear-gradient(0, rgba(10,13,31,.9), transparent);
}

/* ── Keyframes ── */
@keyframes tileIn {
  from { opacity: 0; transform: translateY(24px) scale(.94) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.96) }
  to   { opacity: 1; transform: translateY(0) scale(1) }
}
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .9 }
  50%      { transform: scale(1.5); opacity: .3 }
}

/* ── Marker ── */
.marker-pulse {
  position: relative;
  width: 20px; height: 20px;
  background: radial-gradient(circle, #fff 0%, var(--ac) 40%, rgba(108,99,255,.6) 70%, transparent 100%);
  border-radius: 50%;
  box-shadow: 0 0 12px 4px var(--ac), 0 0 40px 8px rgba(108,99,255,.5), 0 0 80px 16px rgba(108,99,255,.2);
  z-index: 999;
}
.marker-pulse::after {
  content: '';
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(108,99,255,.5);
  border-radius: 50%;
  animation: ring 2s ease-out infinite;
}
@keyframes ring {
  0%   { transform: scale(.6); opacity: 1 }
  100% { transform: scale(2.2); opacity: 0 }
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .cds { grid-template-columns: 1fr 1fr }
  .dash { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr) }
}
@media (max-width: 860px) {
  .ov { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto }
  .sb { grid-row: 2; max-height: 120px; padding: 4px 10px; background: var(--glass); backdrop-filter: blur(16px); border-bottom: 1px solid var(--gb) }
  .cl { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 4px }
  .ci { flex-direction: column; min-width: 60px; padding: 5px; text-align: center }
  .ci:hover { transform: none }
  .ci .fl { font-size: 18px } .ci .cn { font-size: 9px } .ci .cs { display: none }
  .mn { grid-row: 3; padding: 8px 10px }
  .det { inset: 8px 10px }
  .cds { grid-template-columns: 1fr }
  .cv { font-size: 24px } .hr-f { font-size: 40px } .hr-n { font-size: 20px }
  .lp { display: none }
  .dash { grid-template-columns: 1fr; grid-template-rows: unset; overflow-y: auto; gap: 10px }
  .dc-time { font-size: 28px } .dc-flag { font-size: 36px } .dc-name { font-size: 16px }
}
