:root {
  --bg: #070b1d;
  --bg2: #0c1230;
  --ink: #eef1ff;
  --muted: #9aa3c7;
  --saffron: #ff9933;
  --green: #16b364;
  --pink: #ff2e88;
  --blue: #00c2ff;
  --purple: #8b5cf6;
  --gold: #ffd60a;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-brd: rgba(255, 255, 255, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(1000px 600px at -10% 110%, rgba(22, 179, 100, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh;
}

body { display: flex; flex-direction: column; }

main { flex: 1; width: min(1280px, 96vw); margin: 0 auto; padding-bottom: 24px; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- aurora blobs ---------- */
.aurora { position: fixed; inset: 0; overflow: hidden; z-index: -1; filter: blur(90px); opacity: 0.55; }
.blob { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; mix-blend-mode: screen; animation: drift 26s ease-in-out infinite alternate; }
.b1 { background: radial-gradient(circle at 30% 30%, #ff993388, transparent 65%); top: -18%; left: -12%; }
.b2 { background: radial-gradient(circle at 60% 40%, #8b5cf677, transparent 62%); bottom: -25%; right: -15%; animation-delay: -9s; }
.b3 { background: radial-gradient(circle at 50% 50%, #00c2ff66, transparent 60%); top: 35%; left: 45%; animation-delay: -17s; }
@keyframes drift {
  from { transform: translate3d(-4%, -3%, 0) scale(1) rotate(0deg); }
  to   { transform: translate3d(6%, 7%, 0) scale(1.18) rotate(28deg); }
}

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 10px; z-index: 50;
  width: min(1280px, 96vw); margin: 12px auto 20px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.2px; }
.logo-icon { font-size: 1.5rem; filter: drop-shadow(0 0 10px rgba(255, 153, 51, 0.7)); }
.logo-text em { font-style: normal; background: linear-gradient(90deg, var(--saffron), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-tag { font-size: 0.62rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #0a0f24; background: linear-gradient(90deg, var(--saffron), #ffffff, var(--green)); padding: 3px 8px; border-radius: 999px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 0.72rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--glass-brd); background: rgba(255,255,255,0.06); }
.pill-offline { color: #7dffc4; box-shadow: 0 0 14px rgba(22, 179, 100, 0.25) inset; }
.pill-privacy { color: #9fd0ff; }

/* ---------- landing ---------- */
.hero { text-align: center; margin: 34px 0 26px; }
.hero-title { font-size: clamp(2rem, 5.4vw, 3.6rem); line-height: 1.08; margin: 0 0 14px; font-weight: 900; letter-spacing: -1px; }
.grad-text {
  background: linear-gradient(90deg, var(--saffron), var(--pink), var(--purple), var(--blue), var(--green), var(--saffron));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hueflow 7s linear infinite;
}
@keyframes hueflow { to { background-position: 300% 0; } }
.hero-sub { color: var(--muted); max-width: 640px; margin: 0 auto; line-height: 1.65; font-size: 1.02rem; }
.tricolor-bar { width: 180px; height: 5px; margin: 22px auto 0; border-radius: 99px; background: linear-gradient(90deg, var(--saffron) 33%, #fff 33% 66%, var(--green) 66%); box-shadow: 0 0 18px rgba(255,153,51,.5); }

.dropzone {
  max-width: 620px; margin: 0 auto; padding: 42px 28px 30px; text-align: center;
  border: 2px dashed rgba(255, 255, 255, 0.22);
  transition: all 0.25s ease; cursor: pointer; outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--saffron); box-shadow: 0 0 0 4px rgba(255, 153, 51, 0.12), 0 18px 50px rgba(0, 0, 0, 0.35); transform: translateY(-2px); }
.dropzone.dragover { border-color: var(--green); background: rgba(22, 179, 100, 0.09); transform: scale(1.02); }
.dz-icon { font-size: 3rem; margin-bottom: 8px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.dz-title { font-size: 1.25rem; font-weight: 800; }
.dz-sub { color: var(--muted); margin: 8px 0 14px; }
.dz-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.dz-hint { margin-top: 16px; font-size: 0.78rem; color: var(--muted); }

.howto { max-width: 720px; margin: 22px auto 0; padding: 16px 22px; }
.howto summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.howto-card { background: rgba(255,255,255,0.04); border: 1px solid var(--glass-brd); border-radius: 14px; padding: 14px 16px; }
.howto-card h4 { margin: 0 0 8px; }
.howto-card ol { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.7; font-size: 0.9rem; }
code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 6px; font-size: 0.85em; }
.privacy-note { color: var(--muted); font-size: 0.82rem; margin: 16px 0 0; line-height: 1.6; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer; font: inherit; font-weight: 700;
  padding: 11px 20px; border-radius: 13px; color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s;
  position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--saffron), #ff5e3a 55%, var(--pink));
  box-shadow: 0 8px 26px rgba(255, 94, 58, 0.35);
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: skewX(-20deg); animation: shine 3.2s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -80%; } 100% { left: 130%; } }
.btn-ghost { background: rgba(255,255,255,0.07); border: 1px solid var(--glass-brd); }
.btn-round { width: 52px; height: 52px; border-radius: 50%; font-size: 1.15rem; padding: 0; background: linear-gradient(135deg, var(--saffron), var(--pink)); box-shadow: 0 6px 22px rgba(255, 46, 136, 0.4); }
.btn-sm { padding: 8px 13px; font-size: 0.82rem; }
.btn-big { font-size: 1.05rem; padding: 14px 28px; }

/* ---------- app layout ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.chip {
  border: 1px solid var(--glass-brd); background: rgba(255,255,255,0.05); color: var(--muted);
  padding: 7px 15px; border-radius: 999px; font-weight: 700; font-size: 0.84rem; cursor: pointer; transition: all .2s;
}
.chip:hover { color: var(--ink); border-color: var(--saffron); }
.chip.active { background: linear-gradient(135deg, var(--saffron), var(--pink)); color: #fff; border-color: transparent; box-shadow: 0 4px 18px rgba(255, 46, 136, 0.35); }

.layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: stretch; }

.map-wrap { position: relative; min-height: 560px; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.map-hud { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; pointer-events: none; }
.hud-chip { background: rgba(7, 11, 29, 0.72); border: 1px solid var(--glass-brd); backdrop-filter: blur(8px); padding: 6px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.hud-state { margin-left: auto; color: var(--gold); }

.state-toast {
  position: absolute; top: 54px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255,153,51,0.95), rgba(255,46,136,0.95));
  color: #fff; font-weight: 800; padding: 10px 22px; border-radius: 999px;
  box-shadow: 0 10px 34px rgba(255, 46, 136, 0.45); white-space: nowrap;
  animation: pop 2.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards; pointer-events: none;
}
@keyframes pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(-14px); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.06) translateY(0); }
  20% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-16px); }
}

.replay-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(7, 11, 29, 0.45); backdrop-filter: blur(2px); }

/* ---------- side panel ---------- */
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-brd); border-radius: 14px; padding: 6px; }
.tab { border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 0.86rem; padding: 9px 4px; border-radius: 10px; cursor: pointer; transition: all .2s; }
.tab.active { background: linear-gradient(135deg, var(--purple), var(--blue)); color: #fff; box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4); }

.panel { display: flex; flex-direction: column; gap: 12px; }
.card { padding: 16px 18px; }
.card h3 { margin: 0 0 12px; font-size: 0.95rem; letter-spacing: 0.3px; }

.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { background: rgba(255,255,255,0.045); border: 1px solid var(--glass-brd); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.mini b { font-size: 1.35rem; background: linear-gradient(90deg, var(--saffron), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mini span { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.state-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow-y: auto; padding-right: 4px; }
.sg-chip { font-size: 0.68rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.14); color: rgba(255,255,255,0.38); transition: all .3s; }
.sg-chip.hit { color: #fff; border-color: transparent; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.sg-chip.just-hit { animation: chipPop .5s ease; }
@keyframes chipPop { 0% { transform: scale(0.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.month-chart { display: flex; align-items: flex-end; gap: 5px; height: 110px; }
.mc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.mc-bar { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--blue), var(--purple)); min-height: 3px; transition: height .6s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 12px rgba(0,194,255,0.25); }
.mc-lab { font-size: 0.6rem; color: var(--muted); }

.place-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.place-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: rgba(255,255,255,0.045); border: 1px solid var(--glass-brd); border-radius: 11px; padding: 9px 12px; font-size: 0.86rem; }
.place-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-meta { color: var(--muted); font-size: 0.74rem; white-space: nowrap; }

.record-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.86rem; }
.record-list li { display: flex; justify-content: space-between; gap: 10px; }
.record-list span { color: var(--muted); }
.record-list b { color: var(--gold); }

.badge-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge { border-radius: 14px; padding: 14px; border: 1px solid var(--glass-brd); background: rgba(255,255,255,0.04); text-align: center; opacity: 0.35; filter: grayscale(0.9); transition: all .4s; }
.badge.won { opacity: 1; filter: none; border-color: rgba(255, 214, 10, 0.45); background: linear-gradient(160deg, rgba(255,214,10,0.12), rgba(255,46,136,0.08)); box-shadow: 0 6px 24px rgba(255, 214, 10, 0.12); }
.badge-emoji { font-size: 1.9rem; display: block; margin-bottom: 6px; }
.badge.won .badge-emoji { animation: bob 2.4s ease-in-out infinite; }
.badge-name { font-weight: 800; font-size: 0.82rem; }
.badge-desc { font-size: 0.68rem; color: var(--muted); margin-top: 3px; }

/* ---------- transport bar ---------- */
.transport {
  position: sticky; bottom: 12px; z-index: 40;
  margin-top: 16px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}
#scrubber { flex: 1; min-width: 160px; accent-color: var(--saffron); height: 6px; cursor: pointer; }
.sel {
  background: rgba(255,255,255,0.07); color: var(--ink); border: 1px solid var(--glass-brd);
  border-radius: 11px; padding: 9px 10px; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.sel option { background: var(--bg2); }

/* ---------- toasts / footer ---------- */
.toasts { position: fixed; right: 16px; bottom: 90px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: rgba(12, 18, 48, 0.92); border: 1px solid var(--glass-brd); border-left: 4px solid var(--saffron); padding: 11px 16px; border-radius: 12px; font-size: 0.86rem; box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: slideIn .3s ease; max-width: 320px; }
.toast.err { border-left-color: var(--pink); }
.toast.ok { border-left-color: var(--green); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

.footer { text-align: center; color: var(--muted); font-size: 0.75rem; padding: 18px 10px 26px; }
.noscript { padding: 30px; text-align: center; color: var(--pink); font-weight: 700; }

.loading-dots::after { content: "…"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .map-wrap { min-height: 62vh; }
  .howto-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 8px; }
  .transport { gap: 8px; }
  #scrubber { order: 10; flex-basis: 100%; }
}
