/* ===== Tokeny ===== */
:root{
  --blue:#2563eb;
  --blue-deep:#1d4ed8;
  --red:#b91c1c;
  --red-deep:#991b1b;
  --ink:#111827;
  --muted:#64748b;
  --glass-light:rgba(255,255,255,.55);
  --glass-light-strong:rgba(255,255,255,.75);
  --glass-dark:rgba(15,18,28,.62);
  --glass-border:rgba(255,255,255,.55);
  --glass-border-dark:rgba(255,255,255,.10);
  --radius-lg:26px;
  --radius-md:18px;
  --radius-sm:12px;
}

*{box-sizing:border-box}
html,body{height:100%;max-width:100%;overflow:hidden}
body{
  margin:0;
  font-family:"Segoe UI",system-ui,-apple-system,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #eef2fb 0%, transparent 45%),
    radial-gradient(circle at 85% 90%, #fbecec 0%, transparent 45%),
    #eef1f6;
  height:100vh;
  height:100dvh;
}

/* Rozostřené barevné "bloby" na pozadí — bez nich glass efekt nemá co rozostřovat */
.bg-blob{position:fixed;border-radius:50%;filter:blur(90px);z-index:0;pointer-events:none;opacity:.55}
.blob-blue{width:520px;height:520px;top:-120px;left:-100px;background:radial-gradient(circle,#60a5fa,transparent 70%)}
.blob-red{width:560px;height:560px;bottom:-160px;right:-140px;background:radial-gradient(circle,#f87171,transparent 70%)}

/* ===== Layout ===== */
.layout{
  position:relative;z-index:1;
  display:grid;grid-template-columns:280px 1fr;
  gap:20px;padding:20px;
  height:100vh;height:100dvh;
}

/* ===== Sidebar (tmavé sklo) ===== */
.sidebar{
  background:var(--glass-dark);
  backdrop-filter:blur(28px) saturate(180%);
  -webkit-backdrop-filter:blur(28px) saturate(180%);
  border:1px solid var(--glass-border-dark);
  border-radius:var(--radius-lg);
  color:#fff;padding:26px;
  position:relative;height:100%;
  box-shadow:0 20px 50px rgba(0,0,0,.25);
  display:flex;flex-direction:column;
  overflow:hidden;
}
.sidebar h1{font-size:18px;letter-spacing:.5px;line-height:1.25;font-weight:800;margin:0}
.brand{display:flex;align-items:center;gap:12px;margin-bottom:26px}
.brand-logo{width:44px;height:44px;border-radius:50%;flex-shrink:0}
#menu{flex:1;overflow-y:auto;overflow-x:hidden}

#menu .gov{
  display:flex;gap:12px;align-items:center;padding:12px;border-radius:var(--radius-md);
  margin:10px 0;cursor:pointer;background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
  transition:transform .18s ease, background .18s ease, box-shadow .18s ease;
}
#menu .gov:hover{background:rgba(255,255,255,.12);transform:translateY(-1px)}
#menu .gov.active{transform:scale(1.02)}
.gov.blue.active{background:linear-gradient(135deg,rgba(37,99,235,.9),rgba(29,78,216,.9));box-shadow:0 10px 26px rgba(37,99,235,.45)}
.gov.red.active{background:linear-gradient(135deg,rgba(185,28,28,.9),rgba(127,29,29,.9));box-shadow:0 10px 26px rgba(185,28,28,.45)}

.avatar{
  width:52px;height:52px;border-radius:14px;flex-shrink:0;position:relative;overflow:hidden;
  background:linear-gradient(135deg,rgba(255,255,255,.18),rgba(255,255,255,.05));
  border:1px solid rgba(255,255,255,.2);
}
.avatar-img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-fallback{
  position:absolute;inset:0;align-items:center;justify-content:center;
  display:none;font-weight:700;font-size:16px;color:#fff;
}

.social-row{display:flex;gap:8px;align-items:stretch;margin-top:16px;flex-shrink:0}

.donate-link{
  display:flex;align-items:center;justify-content:center;flex:1;min-width:0;
  height:44px;padding:0;
  border-radius:999px;overflow:hidden;background:#FFDD00;
  transition:transform .18s ease, box-shadow .18s ease;
}
.donate-link:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(255,221,0,.25)}
.donate-img{display:block;width:auto;height:70%;max-width:85%;object-fit:contain}

.x-link{
  display:flex;align-items:center;justify-content:center;flex:1;min-width:0;
  height:44px;padding:0;
  background:#000;border:1px solid rgba(255,255,255,.18);
  border-radius:999px;color:#fff;text-decoration:none;
  transition:background .18s ease;
}
.x-link:hover{background:#1a1a1a}
.x-icon{flex-shrink:0}

/* ===== Hlavní obsah ===== */
main{position:relative;z-index:1;min-width:0;height:100%;display:flex;flex-direction:column;min-height:0}

.view-switch{
  display:flex;gap:8px;flex-wrap:wrap;flex-shrink:0;
  padding:10px;margin-bottom:20px;
  background:var(--glass-light);
  backdrop-filter:blur(20px) saturate(160%);
  -webkit-backdrop-filter:blur(20px) saturate(160%);
  border:1px solid var(--glass-border);
  border-radius:var(--radius-md);
  box-shadow:0 8px 24px rgba(31,41,55,.06);
}
.view-switch button{
  flex:1;min-width:150px;padding:10px 14px;border-radius:10px;border:1px solid transparent;
  cursor:pointer;background:transparent;color:var(--muted);
  font-size:13px;font-weight:600;transition:all .18s ease;
}
.view-switch button:hover{background:rgba(255,255,255,.6);color:var(--ink)}
.view-switch button.active{color:#fff;background:linear-gradient(135deg,var(--blue),var(--blue-deep));box-shadow:0 8px 20px rgba(37,99,235,.3)}

.empty-hint{color:var(--muted);font-size:14px;font-style:italic;padding:20px 0 20px 90px}

.debt-summary{
  display:flex;align-items:center;gap:18px;flex-wrap:wrap;width:fit-content;
  margin:0 0 16px;padding:10px 16px;flex-shrink:0;
  background:var(--glass-light);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);
  border:1px solid var(--glass-border);border-radius:999px;
  font-size:13px;color:var(--ink);
}
.debt-summary b{font-weight:800}
.debt-legend{display:flex;gap:14px;flex-wrap:wrap}
.legend-item{display:inline-flex;align-items:center;gap:5px;font-size:12px;color:var(--muted)}
.legend-item i{display:inline-block;width:10px;height:10px;border-radius:3px;flex-shrink:0}

.pollster-badge{display:inline-block;background:rgba(15,23,42,.08);color:var(--muted);font-size:10px;font-weight:700;
  padding:2px 8px;border-radius:999px;margin:0 0 4px;letter-spacing:.3px;text-transform:uppercase}

/* Řádek "Volební průzkumy — měsíc rok" na ose - jen text, žádná karta */
.poll-row{cursor:pointer}
.poll-link{color:var(--ink);font-weight:700;font-size:14px;text-decoration:none;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:6px 0}
.poll-link:hover{color:#2563eb}
.poll-arrow{transition:transform .15s ease}
.poll-link:hover .poll-arrow{transform:translateX(3px)}

/* Bloky jednotlivých agentur v širokém panelu */
.poll-agency{padding:16px 0;border-bottom:1px solid rgba(100,116,139,.15)}
.poll-agency:last-child{border-bottom:none}
.poll-agency-head h3{margin:0;font-size:16px}
.poll-meta{color:var(--muted);font-size:12px;margin:2px 0 12px}
.poll-source-link{margin-top:10px;font-size:12px}
.poll-source-link a{color:#2563eb;text-decoration:none}
.poll-source-link a:hover{text-decoration:underline}

/* ===== Časová osa ===== */
#timeline{position:relative;padding:6px 10px 30px;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}

.axis-line{position:absolute;width:3px;background:rgba(100,116,139,.28);transform:translateX(-50%);z-index:0;border-radius:3px}

/* ===== Křivka státního dluhu (SVG přes časovou osu) ===== */
.debt-svg{position:absolute;top:0;left:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:1}
.debt-path{fill:none;stroke-linejoin:round;stroke-linecap:round;opacity:.85}
.debt-point{stroke:#eef1f6;stroke-width:3}
.debt-label{font-size:10px;font-weight:600;fill:#334155;dominant-baseline:middle;stroke:#eef1f6;stroke-width:3;paint-order:stroke}

.debt-diff{font-size:9px;font-style:italic;fill:#64748b;dominant-baseline:middle;stroke:#eef1f6;stroke-width:3;paint-order:stroke}
.debt-zero-line{stroke:#94a3b8;stroke-width:1;stroke-dasharray:3 3;opacity:.6}
.debt-zero-label{font-size:9px;font-weight:600;fill:#94a3b8;text-anchor:middle}
.debt-total{font-size:11px;fill:#334155;text-anchor:start;dominant-baseline:middle}
.debt-total-value{font-weight:800;fill:#0f172a}

/* Desktop: karty v režimu dluhu ustoupí doprava, ať je vidět pruh na křivku i souhrn za období */
#timeline.debt-mode .card{margin-left:230px;transition:margin-left .2s ease}
/* Pohled "dluh" nemá žádné karty - bez nich by roky byly namačkané těsně
   u sebe a graf nízký a nečitelný, tak mezi nimi uměle přidáme vzduch. */
#timeline.debt-mode .year-row{margin:36px 0}

.row,.year-row{display:flex;align-items:center;margin:18px 0;position:relative}

.date,.year-label{width:90px;text-align:right;padding-right:20px;flex-shrink:0}
.date{color:var(--muted);font-size:14px}
.year-label{color:var(--ink);font-weight:800;font-size:20px}

.dot,.year-marker{
  width:14px;height:14px;border-radius:50%;margin-right:18px;flex-shrink:0;
  position:relative;z-index:1;
  box-shadow:0 0 0 6px #eef1f6, 0 2px 8px rgba(0,0,0,.15);
}
.year-marker{background:var(--ink);width:16px;height:16px;margin-right:17px}

.year-rule{flex:1;border-top:1px dashed rgba(100,116,139,.35)}

.card{
  flex:1;min-width:0;padding:18px 20px;border-radius:var(--radius-md);cursor:pointer;position:relative;z-index:1;
  background:var(--glass-light-strong);
  backdrop-filter:blur(18px) saturate(160%);
  -webkit-backdrop-filter:blur(18px) saturate(160%);
  border:1px solid var(--glass-border);
  box-shadow:0 8px 22px rgba(31,41,55,.08);
  overflow-wrap:break-word;word-break:break-word;
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.card h3{font-size:15px;font-weight:700;margin:0 0 2px;color:var(--ink)}

/* Menší kauzy a aféry - stejná struktura jako hlavní kauzy, jen tlumenější */
.row.minor .dot{width:9px;height:9px;opacity:.75}
.row.minor .card{padding:12px 16px;opacity:.88}
.row.minor .card h3{font-size:13px}
.row.minor .card{font-size:13px}

/* Volební karty - mini graf výsledků stran */
.election-card{cursor:pointer}
.election-meta{color:var(--muted);font-size:12px;margin:2px 0 10px}
.party-list{display:flex;flex-direction:column;gap:6px}
.party-row{display:grid;grid-template-columns:64px 1fr auto;align-items:center;gap:8px;font-size:12px}
.party-name{font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.party-bar-track{height:8px;border-radius:4px;background:rgba(100,116,139,.15);overflow:hidden}
.party-bar{height:100%;border-radius:4px}
 .signed-bar-track{position:relative;height:8px;border-radius:4px;background:rgba(100,116,139,.15);overflow:hidden}
.signed-bar-zero{position:absolute;left:50%;top:0;bottom:0;width:1px;background:rgba(71,85,105,.55);z-index:2}
.signed-bar{position:absolute;top:0;height:100%;width:var(--bar-width);background:var(--bar-color);border-radius:4px}
.signed-bar.positive{left:50%}
.signed-bar.negative{right:50%}
.party-pct{color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}
.card .more{display:inline-block;margin-top:4px;font-size:13px;font-weight:700;color:#2563eb;white-space:nowrap}
.card:hover{transform:translateY(-3px);box-shadow:0 16px 34px rgba(31,41,55,.16);background:#fff}

/* ===== Vysouvací panel ===== */
#panel{
  position:fixed;top:20px;right:20px;bottom:20px;width:min(50vw,800px);max-width:calc(100vw - 40px);
  background:var(--glass-light-strong);
  backdrop-filter:blur(30px) saturate(180%);
  -webkit-backdrop-filter:blur(30px) saturate(180%);
  border:1px solid var(--glass-border);
  border-radius:var(--radius-lg);
  padding:24px;overflow:auto;
  box-shadow:0 24px 60px rgba(0,0,0,.22);
  transform:translateX(calc(100% + 40px));
  transition:transform .32s cubic-bezier(.22,.9,.32,1);
  z-index:50;
}
#panel.open{transform:translateX(0)}
#close{
  position:sticky;top:0;float:right;border:none;background:rgba(0,0,0,.06);
  width:34px;height:34px;border-radius:50%;cursor:pointer;font-size:16px;
  transition:background .15s ease;
}
#close:hover{background:rgba(0,0,0,.12)}
.share-x-btn{
  position:sticky;top:0;float:right;margin-right:8px;
  display:flex;align-items:center;gap:5px;
  border:none;background:rgba(0,0,0,.06);color:var(--ink);
  padding:0 12px;height:34px;border-radius:999px;cursor:pointer;
  font-size:12px;font-weight:600;
  transition:background .15s ease;
}
.share-x-btn:hover{background:rgba(0,0,0,.12)}
#detail h2{margin:36px 0 6px;font-size:22px}
#detail h3{font-size:14px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;margin-top:22px}
.person{display:inline-block;background:rgba(37,99,235,.1);color:var(--blue-deep);padding:5px 12px;border-radius:999px;margin:3px 4px 0 0;font-size:13px;font-weight:600}

/* ===== Patička ===== */
.site-footer{
  flex-shrink:0;
  position:relative;z-index:1;
  margin:0;padding:14px 4px 0;
  border-top:1px solid rgba(100,116,139,.15);
  display:flex;flex-wrap:wrap;gap:10px 24px;align-items:center;justify-content:space-between;
  color:var(--muted);font-size:12px;
}
.site-footer nav{display:flex;flex-wrap:wrap;gap:6px 20px}
.site-footer a{color:var(--muted);text-decoration:none;transition:color .15s ease}
.site-footer a:hover{color:var(--ink);text-decoration:underline}

/* ===== Responzivita ===== */
@media (max-width:860px){
  html,body{overflow:auto}
  .layout{grid-template-columns:1fr;padding:10px;gap:10px;height:auto;min-height:100vh;min-height:100dvh}
  .sidebar{display:block;position:relative;height:auto;top:0;padding:16px;min-width:0;overflow:visible}
  .brand{margin-bottom:16px}
  .brand-logo{width:34px;height:34px}
  .sidebar h1{font-size:15px}
  #menu{display:flex;flex-direction:column;gap:8px;flex:none;overflow-y:visible;overflow-x:visible}
  #menu .gov{padding:10px;margin:0}
  .avatar{width:40px;height:40px;border-radius:10px}
  .avatar-fallback{font-size:13px}
  #menu .gov b{font-size:14px}
  .social-row{margin-top:14px}

  /* Nový přepínač vrstev na mobilu - tlačítka pod sebou, ať se vejde text */
  .view-switch{flex-direction:column;padding:8px}
  .view-switch button{min-width:0}

  /* Na mobilu není vedle osy místo na kartu i křivku zároveň - v režimu
     dluhu proto kauzy úplně schováme a křivka dostane celou šířku. */
  #timeline.debt-mode .row{display:none}
  #timeline.debt-mode .year-rule{display:none}
  /* Bez karet by roky byly namačkané těsně u sebe a graf by byl nízký a
     nečitelný - uměle přidáme mezi roky víc vzduchu. */
  #timeline.debt-mode .year-row{margin:46px 0}

  main{min-width:0;height:auto;display:block}
  #timeline{flex:none;overflow-y:visible;overflow-x:hidden}
  .view-switch{flex-shrink:unset}
  .site-footer{border-top:1px solid rgba(100,116,139,.15);margin-top:20px;padding:16px 4px 28px}
  #panel{top:auto;bottom:0;right:0;left:0;width:auto;max-width:none;height:88vh;height:88dvh;border-radius:24px 24px 0 0;
    transform:translateY(100%);padding:18px}
  #panel.open{transform:translateY(0)}
  #close{width:44px;height:44px}
  .share-x-btn{height:44px}
  .date,.year-label{width:60px;font-size:13px;padding-right:12px}
  .dot,.year-marker{margin-right:12px}
  #timeline{padding:6px 2px 30px}
  .row,.year-row{margin:14px 0}
  .card{padding:16px 18px}
}

/* Malé telefony (do ~400px šířky) — ještě kompaktnější rozestupy a menší fonty */
@media (max-width:400px){
  .layout{padding:8px;gap:8px}
  .sidebar{padding:14px}
  .sidebar h1{font-size:17px;margin-bottom:16px}
  #menu .gov{min-width:180px;padding:10px}
  .avatar{width:44px;height:44px}
  .date,.year-label{width:52px;font-size:12px;padding-right:12px}
  .dot,.year-marker{margin-right:12px}
  .card{padding:14px 16px}
  .card h3{font-size:14px}
  #timeline{padding:4px 2px 24px}
}

/* Nižší výkon / mobil — zjednodušit blur, ať to nesekání */
@media (max-width:860px){
  .sidebar,.tabs,.card,#panel{backdrop-filter:blur(14px) saturate(140%);-webkit-backdrop-filter:blur(14px) saturate(140%)}
  .bg-blob{filter:blur(60px);opacity:.4}
}

/* Uživatelé preferující omezené animace */
@media (prefers-reduced-motion:reduce){
  *{transition-duration:.01ms!important;animation-duration:.01ms!important}
}
/* ===== Hashtagy ===== */

.hashtags{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin:10px 0 20px;
}

.hashtag{
    display:inline-block;
    padding:4px 10px;
    border-radius:20px;
    background:#eef2ff;
    border:1px solid #c7d2fe;
    color:#1d4ed8;
    font-size:.9rem;
    text-decoration:none;
}

/* ===== Zdroje ===== */

.sources{
    margin:10px 0;
    padding-left:20px;
}

.sources li{
    margin:6px 0;
}

.sources a{
    color:#2563eb;
    text-decoration:none;
}

.sources a:hover{
    text-decoration:underline;
}

/* ===== Osoby (klikací odkazy na Wikipedii) ===== */

.person{
    display:inline-block;
    margin:4px 6px 4px 0;
    padding:4px 10px;
    border-radius:20px;
    background:#f3f4f6;
    color:#111827;
    text-decoration:none;
    transition:.2s;
}

.person:hover{
    background:#dbeafe;
    color:#1d4ed8;
}