:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #111722;
  --surface-2: #17202d;
  --surface-3: #202b3b;
  --text: #f5f7fa;
  --muted: #99a7b8;
  --line: rgba(255,255,255,.1);
  --accent: #f0cf3c;
  --accent-text: #171408;
  --green: #48d597;
  --danger: #ff7474;
  --purple: #9f79ff;
  --yellow: #f2d45d;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--text); background: radial-gradient(circle at 80% -10%, rgba(240,207,60,.1), transparent 30rem), var(--bg); }
button,input,select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
a { color: inherit; }
.site-header { position: sticky; top: 0; z-index: 1000; min-height: 70px; padding: 12px max(20px, calc((100vw - 1500px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(8,11,16,.9); backdrop-filter: blur(18px); }
.brand { font-size: 1.05rem; font-weight: 900; letter-spacing: -.03em; text-decoration: none; }
.header-actions,.user-actions { display: flex; align-items: center; gap: 10px; }
.language-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
select,input { min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: #0d131c; }
.button { min-height: 42px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; font-weight: 750; transition: transform .15s ease, border-color .15s ease, opacity .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(240,207,60,.5); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { border-color: transparent; color: var(--accent-text); background: var(--accent); }
.button.subtle { background: transparent; }
.button.large { min-height: 48px; padding-inline: 20px; }
.button.danger-fill { border-color: transparent; background: var(--danger); color: #1b0909; }
.public-id { padding: 8px 11px; border: 1px solid rgba(72,213,151,.3); border-radius: 999px; color: #aaf2cf; background: rgba(72,213,151,.08); cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .79rem; }
main { min-height: calc(100vh - 70px); }
.landing-view { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 60px; }
.hero { min-height: 620px; display: grid; grid-template-columns: minmax(0,1.3fr) minmax(320px,.7fr); align-items: center; gap: 60px; padding: 60px 0; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: .72rem; font-weight: 900; letter-spacing: .16em; }
.hero h1 { max-width: 850px; margin: 0 0 20px; font-size: clamp(3rem, 7vw, 6.8rem); line-height: .91; letter-spacing: -.065em; }
.hero-text { max-width: 760px; color: var(--muted); font-size: 1.1rem; line-height: 1.7; }
.hero-actions { display: flex; gap: 10px; margin-top: 28px; }
.hero-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric-card { min-height: 155px; padding: 22px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg,var(--surface-2),#0c1119); }
.metric-card strong { font-size: 2rem; letter-spacing: -.05em; }
.metric-card span { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.how-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; scroll-margin-top: 100px; }
.how-grid article,.privacy-strip { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.how-grid article>span { color: var(--accent); font-weight: 900; }
.how-grid h2,.privacy-strip h2 { margin: 32px 0 8px; letter-spacing: -.035em; }
.how-grid p,.privacy-strip p { margin: 0; color: var(--muted); line-height: 1.65; }
.privacy-strip { margin-top: 15px; }
.privacy-strip h2 { margin-top: 0; }
.app-shell { width: min(1500px, calc(100% - 40px)); margin: 24px auto 60px; display: grid; grid-template-columns: 210px 1fr; gap: 22px; }
.sidebar { position: sticky; top: 94px; align-self: start; display: grid; gap: 7px; }
.nav-item { padding: 12px 14px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; font-weight: 700; }
.nav-item.active { color: var(--text); border-color: var(--line); background: var(--surface); }
.nav-item.danger { margin-top: 20px; color: #ff9d9d; }
.content,.event-view { min-width: 0; }
.page-heading,.section-heading,.event-topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading h1,.event-title h1 { margin: 0; font-size: clamp(1.8rem,4vw,3.2rem); letter-spacing: -.05em; }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin: 22px 0; }
.course-list { display: grid; gap: 10px; }
.course-card { padding: 18px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); cursor: pointer; }
.course-card:hover { border-color: rgba(240,207,60,.4); }
.course-card h3 { margin: 0 0 5px; }
.course-meta { color: var(--muted); font-size: .83rem; }
.course-counts { display: flex; gap: 8px; }
.badge { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .75rem; }
.event-view { width: min(1600px, calc(100% - 32px)); margin: 22px auto 60px; }
.event-topbar { align-items: center; margin-bottom: 18px; }
.event-title { flex: 1; }
.event-title>span { color: var(--muted); font-size: .8rem; }
.panel { margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg,rgba(21,28,39,.98),rgba(12,17,25,.98)); }
.upload-panel form { display: grid; grid-template-columns: 150px minmax(260px,1fr) auto minmax(160px,1fr); gap: 12px; align-items: end; }
label { color: var(--muted); font-size: .8rem; }
label>span { display: block; margin-bottom: 6px; }
label input,label select { width: 100%; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { min-width: 250px; }
.section-heading h2 { margin: 0 0 4px; letter-spacing: -.03em; }
.section-heading p { margin: 0; color: var(--muted); font-size: .86rem; }
.run-list { margin-top: 14px; border-top: 1px solid var(--line); }
.run-group-title { padding: 14px 4px 7px; color: var(--accent); font-size: .75rem; font-weight: 900; letter-spacing: .12em; }
.run-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; min-height: 50px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.run-label { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.run-date { color: var(--muted); font-size: .77rem; }
.run-time { min-width: 82px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.icon-delete { width: 34px; height: 34px; border: 1px solid rgba(255,116,116,.25); border-radius: 8px; color: #ffa5a5; background: transparent; cursor: pointer; }
.analysis-controls { display: flex; justify-content: space-between; gap: 18px; align-items: center; position: relative; z-index: 1; }
.selected-run-toggles,.control-cluster { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.run-toggle,.check-control { display: flex; align-items: center; gap: 7px; margin: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #0c121a; }
.run-toggle input,.check-control input { width: auto; min-height: auto; accent-color: var(--accent); }
.run-swatch { width: 9px; height: 9px; border-radius: 50%; }
.control-cluster label:not(.check-control) { min-width: 110px; }
.control-cluster select { min-height: 35px; padding: 5px 8px; }

.run-summary { padding: 14px 16px; }
.run-summary-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.run-summary-heading h2 { margin: 0 0 3px; font-size: .95rem; letter-spacing: -.02em; }
.run-summary-heading p { margin: 0; color: var(--muted); font-size: .74rem; }
.run-summary-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 8px; }
.run-summary-card { min-width: 0; padding: 10px 12px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; grid-template-areas: "dot name time" "dot meta gap"; column-gap: 9px; row-gap: 2px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: #0c121a; }
.run-summary-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 50%; }
.run-summary-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; color: var(--muted); }
.run-summary-time { grid-area: time; font-size: 1rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.run-summary-meta { grid-area: meta; color: var(--muted); font-size: .68rem; }
.run-summary-gap { grid-area: gap; color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; text-align: right; }
.run-summary-card.best { border-color: rgba(159,121,255,.42); background: rgba(159,121,255,.08); }
.analysis-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; align-items: stretch; }
.map-column { position: relative; isolation: isolate; min-width: 0; height: 720px; padding-left: 58px; }
.map { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #1b2632; overflow: hidden; }
.playback-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 48px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.playback-rail output { max-width: 43px; min-height: 42px; display: grid; place-items: center; font-size: .65rem; line-height: 1.15; text-align: center; font-variant-numeric: tabular-nums; }
.playback-rail input[type=range] { flex: 1; width: 22px; min-height: 0; padding: 0; writing-mode: vertical-lr; direction: ltr; accent-color: var(--accent); }
.play-button,.rail-button { width: 34px; height: 34px; border: 0; border-radius: 8px; cursor: pointer; }
.play-button { color: #151207; background: var(--accent); }
.rail-button { color: var(--text); background: var(--surface-3); }
.map-tools { position: absolute; z-index: 500; top: 10px; right: 10px; width: min(310px,calc(100% - 80px)); border: 1px solid rgba(255,255,255,.15); border-radius: 10px; background: rgba(11,15,22,.94); box-shadow: 0 8px 35px rgba(0,0,0,.35); }
.map-tools summary { padding: 10px 12px; cursor: pointer; font-size: .8rem; font-weight: 800; }
.map-toolbar { padding: 0 8px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.button.tool,.check-control.tool { min-height: 34px; padding: 6px 8px; font-size: .72rem; border-radius: 8px; }
.check-control.tool { justify-content: center; }
.graphs-column { min-width: 0; height: 720px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; contain: layout paint; padding-right: 4px; display: grid; align-content: start; gap: 10px; }
.graph-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.graph-head { padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.graph-head h3 { margin: 0; font-size: .9rem; }
.graph-head span { color: var(--muted); font-size: .72rem; }
.graph-wrap { position: relative; min-height: 210px; }
.graph-wrap svg { display: block; width: 100%; height: 220px; }
.graph-grid { stroke: rgba(255,255,255,.08); stroke-width: 1; }
.graph-axis { fill: var(--muted); font-size: 10px; }
.graph-cursor { stroke: rgba(255,255,255,.75); stroke-width: 1; }
.graph-tooltip { position: absolute; pointer-events: none; min-width: 160px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: rgba(5,8,12,.95); font-size: .72rem; box-shadow: 0 10px 25px rgba(0,0,0,.3); }
.graph-tooltip div { display: flex; justify-content: space-between; gap: 16px; }
.microsector-panel { margin-top: 14px; }
.microsector-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
#microsector-grid { display: grid; min-width: max-content; background: #0b1017; }
.sector-cell { min-width: 118px; padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: .74rem; }
.sector-cell.header { position: sticky; top: 0; z-index: 2; color: var(--muted); background: #121925; font-weight: 800; }
.sector-cell.name { position: sticky; left: 0; z-index: 3; min-width: 210px; background: #121925; font-weight: 800; }
.sector-cell.rank-1 { background: rgba(159,121,255,.23); }
.sector-cell.rank-2 { background: rgba(72,213,151,.19); }
.sector-cell.rank-other { background: rgba(242,212,93,.12); }
.sector-cell strong { display: block; font-size: .86rem; }
.sector-cell span { color: var(--muted); }
.dialog { width: min(500px,calc(100% - 28px)); padding: 28px; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: #111722; box-shadow: 0 30px 100px rgba(0,0,0,.6); }
.dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(5px); }
.dialog h2 { margin-top: 0; font-size: 2rem; letter-spacing: -.04em; }
.dialog p { color: var(--muted); line-height: 1.55; }
.dialog form:not(.dialog-close) { display: grid; gap: 10px; }
.dialog-close { position: absolute; top: 10px; right: 10px; }
.dialog-close button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-3); cursor: pointer; }
.link-button { padding: 10px 0 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; text-decoration: underline; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.status-text { color: var(--muted); font-size: .8rem; }
.status-text.error { color: #ff9b9b; }
.status-text.success { color: #9eebc5; }
.toast { position: fixed; z-index: 3000; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #17202d; box-shadow: 0 15px 50px rgba(0,0,0,.4); }
.empty-state { padding: 30px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.leaflet-container { font-family: inherit; background: #1d2834; }
.leaflet-control-attribution { font-size: 9px; }
@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; }
  .nav-item.danger { margin: 0 0 0 auto; }
  .analysis-grid { grid-template-columns: 1fr; }
  .map-column,.graphs-column { height: 600px; }
  .graphs-column { overflow-y: visible; height: auto; }
  .analysis-controls { position: static; flex-direction: column; align-items: stretch; }
}
@media (max-width: 700px) {
  .site-header { align-items: flex-start; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .language-control>span { display: none; }
  .landing-view,.app-shell,.event-view { width: min(100% - 22px,1600px); }
  .hero h1 { font-size: clamp(2.5rem,15vw,4rem); }
  .hero-panel,.how-grid { grid-template-columns: 1fr; }
  .hero-actions,.page-heading,.section-heading,.event-topbar { align-items: stretch; flex-direction: column; }
  .upload-panel form { grid-template-columns: 1fr; }
  .filters { display: grid; grid-template-columns: 1fr; width: 100%; }
  .filters input { min-width: 0; }
  .run-row { grid-template-columns: auto 1fr auto; }
  .run-date { grid-column: 2; }
  .map-column { height: 520px; padding-left: 48px; }
  .control-cluster { align-items: stretch; flex-direction: column; }
}
