:root {
  --bg: #0b1220;
  --panel: rgba(15, 23, 42, 0.86);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --ocean-1: #13233f;
  --ocean-2: #0a1528;
  --land: #2b3a55;
  --land-stroke: #3e5070;
  --grat: rgba(148, 163, 184, 0.08);
  --event: #fbbf24;
  --hq: #22d3ee;
  --exch: #a78bfa;
  --line: #f472b6;
  --chip-bg: rgba(34, 211, 238, 0.12);
  --chip-text: #67e8f9;
  --halo: rgba(56, 189, 248, 0.18);
}
[data-theme="light"] {
  --bg: #f8fafc;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #475569;
  --ocean-1: #dbeafe;
  --ocean-2: #bfdbfe;
  --land: #e2e8f0;
  --land-stroke: #cbd5e1;
  --grat: rgba(15, 23, 42, 0.06);
  --event: #d97706;
  --hq: #0891b2;
  --exch: #7c3aed;
  --line: #db2777;
  --chip-bg: rgba(8, 145, 178, 0.1);
  --chip-text: #0e7490;
  --halo: rgba(14, 165, 233, 0.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }

.etg { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 380px; overflow: hidden; }

.etg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 4px; z-index: 2; }
.etg-brand { display: flex; align-items: center; gap: 8px; }
.etg-brand h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.etg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--event);
  box-shadow: 0 0 0 0 var(--event); animation: etg-ping 2.4s infinite; }
.etg-meta { color: var(--muted); font-size: 12px; }

.etg-stage { position: relative; flex: 1; min-height: 0; }
.etg-globe { position: absolute; inset: 0; }
.etg-globe svg { width: 100%; height: 100%; display: block; }

.etg-card {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: min(380px, 42%); max-height: calc(100% - 24px); overflow: auto;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px;
  padding: 14px 16px 12px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); transition: opacity .35s ease;
}
.etg-card.fade { opacity: 0; }
.etg-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.etg-rank { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.etg-progress { flex: 1; height: 3px; background: var(--panel-border); border-radius: 2px; overflow: hidden; }
.etg-progress span { display: block; height: 100%; width: 0; background: var(--line); }
.etg-card h2 { margin: 0 0 8px; font-size: 18px; line-height: 1.25; font-weight: 650; }
.etg-tickers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.etg-tickers button { font: inherit; font-size: 12px; font-weight: 600; border: 0; cursor: pointer;
  background: var(--chip-bg); color: var(--chip-text); padding: 2px 8px; border-radius: 999px; }
.etg-tickers button:hover, .etg-tickers button:focus-visible { outline: 1px solid var(--chip-text); }
.etg-summary { margin: 0 0 10px; color: var(--text); opacity: .92; }
.etg-places { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px solid var(--panel-border);
  display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.etg-places li { display: block; padding-left: 15px; text-indent: -15px; }
.etg-places li > * { text-indent: 0; }
.etg-places li span { margin-left: 4px; }
.etg-places b { color: var(--text); font-weight: 600; }

.etg-sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.etg-sw.event { background: var(--event); }
.etg-sw.hq { background: var(--hq); }
.etg-sw.exchange { background: var(--exch); }
.etg-sw.country_default { background: var(--muted); }

.etg-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.etg-status[hidden] { display: none; }

.etg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 6px 16px 10px; font-size: 11px; color: var(--muted); z-index: 2; }
.etg-pager { display: flex; gap: 6px; }
.etg-pager button { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--panel-border);
  background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; padding: 0; }
.etg-pager button[aria-current="true"] { background: var(--line); border-color: var(--line); color: #fff; }
.etg-legend { display: flex; gap: 12px; }
.etg-credit a { color: var(--muted); }

/* globe marks */
.etg-ocean { fill: url(#etg-ocean); }
.etg-halo { fill: none; stroke: var(--halo); stroke-width: 10; }
.etg-grat { fill: none; stroke: var(--grat); stroke-width: .6; }
.etg-land { fill: var(--land); stroke: var(--land-stroke); stroke-width: .4; }
.etg-ghost { fill: var(--muted); opacity: .35; }
.etg-route { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; opacity: .95; }
.etg-pin circle.core { stroke: var(--bg); stroke-width: 1.5; }
.etg-pin.event circle.core { fill: var(--event); }
.etg-pin.hq circle.core { fill: var(--hq); }
.etg-pin.exchange circle.core { fill: var(--exch); }
.etg-pin.country_default circle.core { fill: var(--muted); }
.etg-pin circle.ring { fill: none; stroke-width: 1.5; animation: etg-ring 2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.etg-pin.event circle.ring { stroke: var(--event); }
.etg-pin.hq circle.ring { stroke: var(--hq); }
.etg-pin.exchange circle.ring { stroke: var(--exch); }
.etg-pin.country_default circle.ring { stroke: var(--muted); }
.etg-pin text { font-size: 11px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }

@keyframes etg-ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
@keyframes etg-ping { 0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .6); } 80%, 100% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); } }

/* narrow: card below the globe */
@media (max-width: 640px) {
  .etg-card { left: 10px; right: 10px; top: auto; bottom: 8px; transform: none; width: auto; max-height: 52%; }
  .etg-card h2 { font-size: 16px; }
  .etg-legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .etg-pin circle.ring, .etg-dot { animation: none; }
  .etg-card { transition: none; }
}
