@font-face{
  font-family:"Phenomena"; font-style:normal; font-weight:700;
  src:url("fonts/Phenomena-Bold.woff2") format("woff2"); font-display:swap;
}
@font-face{
  font-family:"Phenomena"; font-style:normal; font-weight:900;
  src:url("fonts/Phenomena-Black.woff2") format("woff2"); font-display:swap;
}

:root{
  --canvas:#FDFDFD;
  --ink:#1A1A1A;
  --p900:#4E3C84;
  --p500:#654EA3;
  --p300:#7B66B8;
  --p200:#9C8BCC;
  --p100:#EEEAF7;
  --p50:#F6F4FB;
  --sec500:#FFEC08;
  --n50:#F7F7F8;
  --n100:#EFEFF1;
  --n200:#E2E2E6;
  --n300:#CACAD1;
  --n400:#9FA0A9;
  --n500:#6A6C77;
  --n700:#3F4049;
  --city:var(--p900);
  --village:var(--p300);
  --accent:var(--p500);
  --display:"Phenomena", "Inter Tight", system-ui, sans-serif;
  --body:"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*{ box-sizing:border-box; }

html, body{
  margin:0; padding:0;
  background:var(--canvas);
  color:var(--ink);
  font-family:var(--body);
  font-size:16px;
  line-height:1.5;
}

.widget{ max-width:980px; margin:0 auto; padding:24px; }

.sr-only{
  position:absolute; width:1px; height:1px;
  margin:-1px; padding:0; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

.head{ margin-bottom:16px; }
.overline{
  display:block; font-size:11px; font-weight:600; letter-spacing:1px;
  text-transform:uppercase; color:var(--n500);
}
.title{
  font-family:var(--display); font-weight:900;
  font-size:clamp(28px, 5.5vw, 44px); line-height:1.05; letter-spacing:-0.8px;
  margin:4px 0 6px;
}
.subtitle{ margin:0; font-size:14px; color:var(--n700); max-width:70ch; }

.controls{
  display:flex; flex-wrap:wrap; gap:12px 20px;
  justify-content:space-between; align-items:center; margin-bottom:16px;
}
.levels{ display:inline-flex; gap:6px; align-items:center; }
.level-btn{
  min-height:44px; padding:8px 16px; border:1px solid var(--n200);
  border-radius:8px; background:var(--canvas); cursor:pointer;
  font-family:var(--body); font-size:14px; font-weight:600; color:var(--n700);
  transition:background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
}
.level-btn:hover{ background:var(--n100); }
.level-btn[aria-checked="true"]{ background:var(--p500); color:var(--canvas); border-color:var(--p500); }

.years{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.years-label{
  font-size:11px; font-weight:600; letter-spacing:1px;
  text-transform:uppercase; color:var(--n500);
}
.year-axis{ display:flex; flex-wrap:wrap; gap:3px; }
.year-btn{
  min-height:44px; min-width:52px; padding:0 12px;
  border:1px solid transparent; border-radius:8px; background:transparent;
  cursor:pointer; font-family:var(--body); font-size:14px; font-weight:600;
  font-variant-numeric:tabular-nums; color:var(--n700);
  transition:background-color 150ms ease-out;
}
.year-btn:hover{ background:var(--n100); }
.year-btn[aria-pressed="true"]{ background:var(--ink); color:var(--canvas); border-color:var(--ink); }

.sankey-wrap{ position:relative; width:100%; }
#sankey{ width:100%; height:auto; display:block; }
.node-label{
  font-family:var(--body); font-size:13px; fill:var(--ink);
  font-variant-numeric:tabular-nums;
}

.ranking{ width:100%; }
.rank-legend{
  display:flex; flex-wrap:wrap; gap:8px 18px;
  margin:0 0 14px; font-size:12px; color:var(--n700);
}
.rank-leg-item{ display:inline-flex; align-items:center; gap:6px; }
.rank-swatch{
  width:14px; height:14px; border-radius:3px; flex:0 0 auto;
  border:1px solid transparent;
}
.rank-head{
  display:grid;
  grid-template-columns:140px 1fr 42px 64px;
  align-items:end; gap:12px;
  padding:0 4px 4px;
  font-size:10px; font-weight:600; letter-spacing:0.3px;
  text-transform:uppercase; color:var(--n400);
}
.rank-head-bar{ justify-self:start; }
.rank-head-pct{ text-align:right; }
.rank-head-proj{ text-align:right; }

.rank-rows{ display:flex; flex-direction:column; gap:6px; }
.rank-row{
  display:grid;
  grid-template-columns:140px 1fr 42px 64px;
  align-items:center; gap:12px;
  min-height:28px; padding:2px 4px; border-radius:6px;
}
.rank-row:hover{ background:var(--n50); }
.rank-row:focus{ outline:none; }
.rank-row:focus-visible{ outline:2px solid var(--p500); outline-offset:1px; }
.rank-name{
  font-size:13px; font-weight:600; color:var(--ink);
  text-align:right; line-height:1.25;
  overflow:hidden; text-overflow:ellipsis;
}
.rank-barwrap{ min-width:0; }
.rank-bar{
  display:flex; width:100%; height:13px;
  border-radius:5px; overflow:hidden; background:var(--n100);
}
.rank-seg{
  height:100%; min-width:1px; display:block;
  transition:filter 120ms ease-out;
}
.rank-seg:hover{ filter:brightness(0.92); cursor:default; }
.rank-pct{
  font-size:13px; font-weight:700; color:var(--n700);
  font-variant-numeric:tabular-nums; text-align:right;
}
.rank-proj{
  font-size:13px; font-weight:700; color:var(--n500);
  font-variant-numeric:tabular-nums; text-align:right;
}
.tooltip{
  position:absolute; pointer-events:none; z-index:50;
  background:var(--canvas); color:var(--ink);
  border:1px solid var(--n200); border-radius:8px;
  box-shadow:0 12px 32px rgba(26, 26, 26, 0.12);
  padding:8px 12px; font-size:13px; line-height:1.4; max-width:240px;
  font-variant-numeric:tabular-nums;
}
.ribbon:focus, .year-btn:focus, .level-btn:focus{ outline:2px solid var(--p500); outline-offset:2px; }
@supports selector(:focus-visible){
  .ribbon:focus, .year-btn:focus, .level-btn:focus{ outline:none; }
  .ribbon:focus-visible, .year-btn:focus-visible, .level-btn:focus-visible{
    outline:2px solid var(--p500); outline-offset:2px;
  }
}

.scene-cap{ font-size:12px; color:var(--n500); margin:12px 0 0; max-width:64ch; }
.scene-cap strong{ font-variant-numeric:tabular-nums; color:var(--n700); }

.notes{ margin-top:28px; border-top:1px solid var(--n100); padding-top:18px; }
.note-list{ margin:0; padding-left:18px; font-size:12px; color:var(--n500); }
.note-list li{ margin-bottom:6px; }
.note-list strong{ color:var(--n700); }

.loading{
  position:fixed; inset:0; display:flex; gap:12px;
  align-items:center; justify-content:center;
  background:var(--canvas); font-size:14px; color:var(--n500); z-index:10;
}
.loading[hidden]{ display:none; }
.spinner{
  width:22px; height:22px; border-radius:50%;
  border:2.5px solid var(--n200); border-top-color:var(--p500);
  animation:spin 0.9s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

@media (max-width: 599px){
  .widget{ padding:16px; }
  .year-btn{ min-width:48px; font-size:13px; padding:0 8px; }
  .rank-head{ display:none; }
  .rank-row{
    grid-template-columns:1fr auto auto;
    grid-template-areas:"name proj pct" "bar bar bar";
    gap:4px 10px; padding:6px 4px; min-height:44px;
  }
  .rank-name{ grid-area:name; text-align:left; }
  .rank-pct{ grid-area:pct; }
  .rank-proj{ grid-area:proj; color:var(--n500); }
  .rank-proj::after{ content:" пр."; font-weight:400; font-size:11px; color:var(--n400); }
  .rank-barwrap{ grid-area:bar; }
  .rank-bar{ height:13px; }
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:0.01ms !important;
    transition-duration:0.01ms !important;
  }
}

@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("fonts/inter-cyrillic-ext.woff2") format("woff2");unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("fonts/inter-cyrillic.woff2") format("woff2");unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("fonts/inter-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("fonts/inter-latin.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("fonts/inter-cyrillic-ext.woff2") format("woff2");unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("fonts/inter-cyrillic.woff2") format("woff2");unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("fonts/inter-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("fonts/inter-latin.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("fonts/inter-cyrillic-ext.woff2") format("woff2");unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("fonts/inter-cyrillic.woff2") format("woff2");unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("fonts/inter-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("fonts/inter-latin.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-cyrillic-ext.woff2") format("woff2");unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-cyrillic.woff2") format("woff2");unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-latin.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-tight-cyrillic-ext.woff2") format("woff2");unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-tight-cyrillic.woff2") format("woff2");unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-tight-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:700;font-display:swap;src:url("fonts/inter-tight-latin.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:900;font-display:swap;src:url("fonts/inter-tight-cyrillic-ext.woff2") format("woff2");unicode-range:U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:900;font-display:swap;src:url("fonts/inter-tight-cyrillic.woff2") format("woff2");unicode-range:U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:900;font-display:swap;src:url("fonts/inter-tight-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;}
@font-face{font-family:"Inter Tight";font-style:normal;font-weight:900;font-display:swap;src:url("fonts/inter-tight-latin.woff2") format("woff2");unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}