/* Romanian flag colors — fixed brand tokens */
:root {
  --ro-blue: #002B7F;
  --ro-yellow: #FCD116;
  --ro-red: #CE1126;
}

/* ---- Light theme (default) ---- */
:root {
  --bg: #f2f4f8;
  --panel: #ffffff;
  --panel-2: #eaeef5;
  --line: #dde3ee;
  --text: #14213d;
  --muted: #5c6785;
  --accent: #8a6400;       /* readable amber for goal text on light (AA on panels) */
  --accent-2: #002B7F;     /* flag blue, readable on light */
  --win: #1e9e56;          /* fills (form dots); text uses the *-text tokens */
  --draw: #8a93a6;
  --loss: #CE1126;
  --win-text: #147a3c;
  --draw-text: #5f6a80;
  --loss-text: #CE1126;
  --on-loss: #ffffff;      /* text on a --loss fill */
  --gk: #FCD116;
  --def: #002B7F;
  --mid: #147a3c;
  --on-pos: #ffffff;       /* text on DEF/MID/FWD fills */
  --fwd: #CE1126;
  --topbar: #002B7F;
  --topbar-text: #ffffff;
  --topbar-input: rgba(255,255,255,.14);
  --radius: 12px;
  color-scheme: light;     /* native controls + scrollbars follow the theme */
}

/* ---- Dark palette (system-dark + explicit dark), navy-tinted for flag feel ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --panel: #141a2c; --panel-2: #1b2338; --line: #29314c;
    --text: #e9ecf6; --muted: #99a3c0;
    --accent: #FCD116; --accent-2: #6f9bff;
    --win: #2ecc71; --loss: #ef4a5a;
    --win-text: #2ecc71; --draw-text: #99a3c0; --loss-text: #ff6b78; --on-loss: #0b1020;
    --gk: #FCD116; --def: #4a7dff; --mid: #2ecc71; --fwd: #ff5470; --on-pos: #0b1020;
    --topbar: #001a4d; --topbar-text: #ffffff; --topbar-input: rgba(255,255,255,.10);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --panel: #141a2c; --panel-2: #1b2338; --line: #29314c;
  --text: #e9ecf6; --muted: #99a3c0;
  --accent: #FCD116; --accent-2: #6f9bff;
  --win: #2ecc71; --loss: #ef4a5a;
  --win-text: #2ecc71; --draw-text: #99a3c0; --loss-text: #ff6b78; --on-loss: #0b1020;
  --gk: #FCD116; --def: #4a7dff; --mid: #2ecc71; --fwd: #ff5470; --on-pos: #0b1020;
  --topbar: #001a4d; --topbar-text: #ffffff; --topbar-input: rgba(255,255,255,.10);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, select { font-family: inherit; color: inherit; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--topbar);
  color: var(--topbar-text);
  backdrop-filter: blur(8px);
}
/* Romanian flag stripe under the topbar */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px;
  background: linear-gradient(90deg,
    var(--ro-blue) 0 33.33%, var(--ro-yellow) 33.33% 66.66%, var(--ro-red) 66.66% 100%);
}
.brand { display: flex; align-items: center; gap: 12px; }
.flag { font-size: 30px; line-height: 1; }
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: .2px; color: var(--topbar-text); }
.tagline { margin: 2px 0 0; color: rgba(255,255,255,.72); font-size: 12.5px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#filter {
  background: var(--topbar-input); border: 1px solid rgba(255,255,255,.22);
  color: #fff; border-radius: 999px;
  padding: 8px 14px; width: 220px; outline: none; font-size: 13.5px;
}
#filter::placeholder { color: rgba(255,255,255,.6); }
#filter:focus { border-color: var(--ro-yellow); }
.fsel {
  background: var(--topbar-input); border: 1px solid rgba(255,255,255,.22);
  color: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px;
  cursor: pointer; outline: none; max-width: 190px;
}
.fsel:focus { border-color: var(--ro-yellow); }
.fsel option { color: #14213d; background: #fff; }
#refresh, #rescrape {
  background: var(--ro-yellow); color: #1a1300; border: none;
  border-radius: 999px; padding: 8px 14px; font-weight: 700;
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
#stories-link {
  color: var(--topbar-text); text-decoration: none; font-weight: 700; font-size: 13px;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 7px 12px; white-space: nowrap;
}
#stories-link:hover { border-color: var(--ro-yellow); }
#refresh:disabled, #rescrape:disabled { opacity: .6; cursor: default; }
.updated { color: rgba(255,255,255,.72); font-size: 12px; white-space: nowrap; }

/* Layout */
main { max-width: 1240px; margin: 0 auto; padding: 20px; }
.loading { color: var(--muted); }

.league { margin-bottom: 26px; }
.league-head {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  padding: 8px 4px; border-bottom: 1px solid var(--line);
}
.league-head .caret { color: var(--muted); width: 14px; transition: transform .15s; }
.league-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.league-head .count {
  color: var(--muted); font-size: 12px;
  background: var(--panel-2); padding: 2px 8px; border-radius: 999px;
}

.grid {
  display: grid; gap: 12px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

/* Card */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.card-top { display: flex; justify-content: flex-start; align-items: flex-start; gap: 10px; }
.card-top .who { flex: 1; min-width: 0; }
.avatar {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background-size: cover; background-position: center top;
  background-color: var(--panel-2); border: 2px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
}
.avatar.ini { font-weight: 800; font-size: 15px; color: var(--on-pos); }
.avatar.ini.pos-GK { background: var(--gk); color: #1a1300; border-color: var(--gk); }
.avatar.ini.pos-DEF { background: var(--def); border-color: var(--def); }
.avatar.ini.pos-MID { background: var(--mid); border-color: var(--mid); }
.avatar.ini.pos-FWD { background: var(--fwd); border-color: var(--fwd); }
.avatar.ini.pos-UNK { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.card .name { font-weight: 680; font-size: 15px; }
.card .team { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.card .bio { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.card .bio .mv { color: var(--accent); font-weight: 700; }
.card .team { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.card .team .tn { min-width: 0; }
.crests { display: inline-flex; align-items: center; margin-right: 4px; }
.crests .crest {
  border-radius: 50%; background: var(--panel); border: 1.5px solid var(--line);
  object-fit: contain; flex: 0 0 auto;
}
.crest.cur {
  width: 30px; height: 30px; padding: 2px;
  border-color: var(--ro-yellow); box-shadow: 0 0 0 1px var(--ro-yellow);
}
.crest.past { width: 19px; height: 19px; padding: 1px; margin-left: -8px; opacity: .95; }
.crests:hover .crest.past { margin-left: 1px; }  /* fan out on hover */
.crests .crest { transition: margin .15s; }
.nt {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text);
  background: linear-gradient(90deg, rgba(0,43,127,.14), rgba(252,209,22,.12), rgba(206,17,38,.14));
  border: 1px solid var(--line); border-left: 3px solid var(--ro-yellow);
  border-radius: 8px; padding: 5px 9px;
}
.nt b { color: var(--accent-2); }
.nt-flag { font-size: 13px; }
.pos {
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  padding: 3px 7px; border-radius: 6px; color: var(--on-pos); white-space: nowrap;
}
.pos.GK { background: var(--gk); color: #1a1300; }
.pos.DEF { background: var(--def); }
.pos.MID { background: var(--mid); }
.pos.FWD { background: var(--fwd); }
.pos.UNK { background: var(--muted); color: var(--bg); }

.stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat {
  background: var(--panel-2); border-radius: 8px;
  padding: 6px 9px; text-align: center; min-width: 46px; flex: 1;
}
.stat b { display: block; font-size: 15px; }
.stat span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.stat.g b { color: var(--accent); }
.stat.a b { color: var(--accent-2); }

.form { display: flex; gap: 4px; }
.dot {
  width: 18px; height: 18px; border-radius: 5px;
  font-size: 10px; font-weight: 800; color: #0c0f14;
  display: grid; place-items: center;
}
.dot.W { background: var(--win); }
.dot.D { background: var(--draw); }
.dot.L { background: var(--loss); color: var(--on-loss); }

.results { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.res-first { display: flex; flex-direction: column; gap: 5px; }
.more { display: flex; flex-direction: column; gap: 5px; max-height: 330px; overflow-y: auto; padding-right: 4px; }
.more::-webkit-scrollbar { width: 8px; }
.more::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.more::-webkit-scrollbar-track { background: transparent; }
.more { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.res { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.res .muted { color: var(--muted); font-size: 12px; font-style: italic; }
.res.nat { background: linear-gradient(90deg, rgba(0,43,127,.10), transparent); border-radius: 6px; }
.res .date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.res .fix { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .sc { font-weight: 700; }
.res-right { display: flex; gap: 5px; align-items: center; justify-content: flex-end; }
.res a { text-decoration: none; font-size: 13px; opacity: .82; }
.res a:hover { opacity: 1; }
.icl { display: inline-flex; align-items: center; border-radius: 5px;
  background: none; border: none; padding: 0; cursor: pointer; }
.icl svg { display: block; transition: transform .1s; }
.icl:hover svg { transform: scale(1.12); }

/* Embedded video */
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px;
  overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-yt {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  color: var(--muted); font-size: 12.5px; text-decoration: none;
}
.video-yt:hover { color: var(--text); }
.video-yt svg { flex: 0 0 auto; }
.mk-video:not(:empty) { margin-top: 12px; }
.video-close {
  margin-top: 8px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; cursor: pointer;
}
.video-close:hover { border-color: var(--accent-2); }
.vmodal {
  width: min(92vw, 860px); border: none; border-radius: 14px; padding: 0;
  background: var(--panel); overflow: visible; box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.vmodal::backdrop { background: rgba(6,10,24,.66); backdrop-filter: blur(2px); }
.vmodal .video-wrap { padding: 12px; border-radius: 14px; overflow: hidden; }
.vmodal-x {
  position: absolute; top: -14px; right: -14px; width: 32px; height: 32px;
  border-radius: 50%; border: 2px solid var(--panel); background: var(--ro-red);
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer; z-index: 2;
}
.ga { font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; }
.ga.goals { color: var(--accent); }
.ga.assists { color: var(--accent-2); }

/* View toggle (Classic / Arcade) */
.views { display: inline-flex; gap: 2px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px; }
.view-btn {
  border: none; background: none; color: #fff; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; opacity: .72;
  white-space: nowrap;
}
.view-btn:hover { opacity: 1; }
.view-btn.active { opacity: 1; background: rgba(255,255,255,.94); color: var(--ro-blue); }

/* Arcade (Mortal-Kombat-style) select screen */
.mk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mk-hint { color: var(--muted); font-size: 13px; margin: 0; }
.mk-sort { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.mk-sort select {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; outline: none;
}
.mk-sort select:focus { border-color: var(--accent-2); }
.mk-dir {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.mk-dir:hover:not(:disabled) { border-color: var(--accent-2); }
.mk-dir:disabled { opacity: .45; cursor: default; }
.mk-metric {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  background: var(--ro-yellow); color: #1a1300; font-weight: 800;
  font-size: 9px; padding: 2px 5px; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.mk { display: flex; gap: 16px; align-items: flex-start; }
.mk-grid {
  flex: 1 1 auto; display: grid; gap: 7px;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
}
.mk-tile {
  position: relative; border: 2px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 10px; padding: 0; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column;
}
.mk-tile .avatar.face {
  width: 100%; height: auto; aspect-ratio: 1; border-radius: 0; border: none;
  font-size: 20px;
}
.mk-name {
  font-size: 10.5px; font-weight: 700; padding: 3px 3px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel);
}
.mk-pos { position: absolute; top: 4px; left: 4px; font-size: 8.5px; padding: 2px 4px; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.mk-tile:hover { border-color: var(--accent-2); }
.mk-tile.sel {
  border-color: var(--ro-yellow);
  box-shadow: 0 0 0 2px var(--ro-yellow), 0 0 16px rgba(252,209,22,.55);
  z-index: 1;
}
.mk-panel { flex: 0 0 322px; position: sticky; top: 78px; align-self: flex-start; }
.mk-panel .card { margin: 0; }
@media (max-width: 720px) {
  .mk { flex-direction: column; align-items: stretch; }
  .mk-grid { width: 100%; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .mk-panel { position: static; width: 100%; order: -1; flex: 0 0 auto; }
}

/* Theme selector (sits on the blue topbar) */
.themes { display: inline-flex; gap: 2px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px; }
.theme-btn {
  border: none; background: none; cursor: pointer; font-size: 14px;
  width: 28px; height: 26px; border-radius: 999px; line-height: 1;
  opacity: .6; filter: grayscale(.35);
}
.theme-btn:hover { opacity: .9; }
.theme-btn.active { opacity: 1; filter: none; background: rgba(255,255,255,.92); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.mine { color: var(--accent); font-weight: 700; } /* highlight the tracked player's team */
.showall {
  background: none; border: none; color: var(--accent-2);
  cursor: pointer; font-size: 12px; padding: 2px 0; text-align: left;
}
.rating { color: var(--muted); font-size: 11px; }

/* National teams view */
.nat-view { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.nat-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.nat-h { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.nat-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 16px 0 6px; }
.nat-controls { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.nat-controls select { background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; cursor: pointer; outline: none; }
.nat-res { display: grid; grid-template-columns: 22px 54px 1fr auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.nat-res:last-child { border-bottom: none; }
.nat-res .date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.wdl.dot { width: 18px; height: 18px; }
.nat-fix { min-width: 0; }
.nat-line { overflow: hidden; text-overflow: ellipsis; }
.nat-comp { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

.wdl-sum { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; margin: 12px 0 4px; }
.wdl-counts { font-size: 13px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wdl-counts b { font-size: 17px; }
.wdl-counts b.w { color: var(--win-text); }
.wdl-counts b.d { color: var(--draw-text); }
.wdl-counts b.l { color: var(--loss-text); }
.wdl-rate { margin-left: auto; font-weight: 800; color: var(--accent); }
.wdl-n { color: var(--muted); font-size: 11px; }
.wdl-form { display: flex; gap: 3px; margin-top: 8px; flex-wrap: wrap; }
.wdl-form .dot { width: 16px; height: 16px; font-size: 9px; }

.fifa { font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; margin-left: auto; white-space: nowrap; }
.fifa .up { color: var(--win-text); }
.fifa .down { color: var(--loss-text); }

.standings { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.standings-title { background: var(--panel-2); padding: 8px 12px; font-weight: 700; font-size: 12.5px; }
.stand-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stand-table th, .stand-table td { padding: 6px 6px; text-align: center; }
.stand-table th { color: var(--muted); font-weight: 600; font-size: 11px; border-bottom: 1px solid var(--line); }
.stand-table td.tn { text-align: left; white-space: nowrap; }
.stand-table td.gd { color: var(--muted); }
.stand-table td.pts { font-weight: 800; }
.stand-table tbody tr { border-bottom: 1px solid var(--line); }
.stand-table tbody tr:last-child { border-bottom: none; }
.stand-table tr.me { background: linear-gradient(90deg, rgba(252,209,22,.18), transparent); }
.stand-table tr.me td.tn { font-weight: 800; color: var(--accent); }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

/* Latest-events button + badge (on the blue topbar) */
.events-btn {
  position: relative; width: 30px; height: 27px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.32); background: rgba(255,255,255,.12);
  color: #fff; cursor: pointer; font-size: 14px; line-height: 1;
}
.events-btn:hover { background: rgba(255,255,255,.22); }
.ev-badge {
  position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--ro-red); color: #fff;
  font-size: 10px; font-weight: 800; display: inline-flex; align-items: center;
  justify-content: center; border: 1.5px solid var(--topbar);
}

/* Events drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(6,10,24,.5); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(92vw, 400px);
  background: var(--panel); z-index: 41; box-shadow: -8px 0 30px rgba(0,0,0,.35);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.drawer-head h2 { margin: 0; font-size: 15px; }
.drawer-x {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 18px; cursor: pointer;
}
.events-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.event { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.avatar.ev { width: 34px; height: 34px; flex: 0 0 auto; border-width: 1.5px; }
.event-body { flex: 1; min-width: 0; }
.event-top { font-size: 13px; }
.event-act { margin: 4px 0; display: flex; gap: 8px; }
.event-match { font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.event-links { display: inline-flex; gap: 5px; margin-left: auto; align-items: center; }

/* Help button */
.help-btn {
  width: 27px; height: 27px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.32); background: rgba(255,255,255,.12);
  color: #fff; cursor: pointer; font-weight: 800; font-size: 14px; line-height: 1;
}
.help-btn:hover { background: rgba(255,255,255,.22); }

/* Intro / cheatsheet dialog */
.intro {
  width: min(92vw, 460px); border: none; border-radius: 14px; padding: 0;
  background: var(--panel); color: var(--text); overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.intro::backdrop { background: rgba(6,10,24,.55); backdrop-filter: blur(2px); }
.intro-flag {
  height: 5px;
  background: linear-gradient(90deg,
    var(--ro-blue) 0 33.33%, var(--ro-yellow) 33.33% 66.66%, var(--ro-red) 66.66% 100%);
}
.intro-body { padding: 18px 22px 22px; }
.intro-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.intro-head .flag { font-size: 26px; }
.intro-head h2 { margin: 0; font-size: 17px; }
.intro-body > p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.intro-body h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.legend { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lg { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; min-width: 74px; }
.legend .g { color: var(--accent); }
.legend .a { color: var(--accent-2); }
.legend .hl { color: var(--accent); }
.legend .ytm { color: #ff5a5f; font-size: 14px; }
.intro-close {
  width: 100%; background: var(--ro-yellow); color: #1a1300; border: none;
  border-radius: 999px; padding: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.intro-close:hover { filter: brightness(1.05); }

@media (max-width: 520px) {
  .topbar { position: static; }   /* the wrapped topbar is too tall to pin on phones */
  .controls { width: 100%; }
  #filter { flex: 1; width: auto; }
}

/* ---- Loader (brand intro) ----
   Timeline (full, --t: 1): beads stack 0–0.6s, ball drops + rays burst 0.5–0.8s,
   wordmark 0.7–1.2s, "Goluri · Statistici · Rezumate" 1.0–1.4s. app.js adds
   .done once data has rendered and the minimum time has passed: the tricolor
   panels sweep in and out to reveal the page. */
.loader { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; --t: 1.8;
  cursor: pointer; touch-action: none; }
.ld-lock, .ld-lock body { overflow: hidden; }
.ld-short .loader { --t: .45; }
.ld-bg { position: absolute; inset: 0;
  background: radial-gradient(110% 70% at 50% 35%, #1c3d7a 0%, #0b1d3a 50%, #060f22 100%); }
.ld-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 0 16px; text-align: center; }
.ld-logo { width: min(46vw, 210px); height: auto; overflow: visible; }
.ld-bead { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%;
  animation: ld-stack calc(.32s * var(--t)) cubic-bezier(.2,.9,.3,1.25) both; }
.ld-bead:nth-of-type(1) { animation-delay: calc(.05s * var(--t)); }
.ld-bead:nth-of-type(2) { animation-delay: calc(.2s * var(--t)); }
.ld-bead:nth-of-type(3) { animation-delay: calc(.35s * var(--t)); }
@keyframes ld-stack { from { opacity: 0; transform: translateY(60%) scaleY(.4); }
  to { opacity: 1; transform: none; } }
.ld-ball { opacity: 0; animation: ld-drop calc(.42s * var(--t)) calc(.5s * var(--t)) both; }
@keyframes ld-drop {
  0% { opacity: 0; transform: translateY(-260px); animation-timing-function: cubic-bezier(.5,0,1,.6); }
  60% { opacity: 1; transform: translateY(0) scale(1.08, .9); animation-timing-function: ease-out; }
  80% { transform: translateY(-26px) scale(.97, 1.03); animation-timing-function: ease-in; }
  100% { opacity: 1; transform: none; } }
.ld-rays { opacity: 0; animation: ld-burst calc(.5s * var(--t)) calc(.72s * var(--t)) cubic-bezier(.2,.9,.3,1) both,
  ld-spin 24s calc(.72s * var(--t)) linear infinite; }
@keyframes ld-burst { from { opacity: 0; scale: .2; } to { opacity: 1; scale: 1; } }
@keyframes ld-spin { to { rotate: 360deg; } }
.ld-word { font-weight: 800; font-size: clamp(26px, 6.4vw, 42px); letter-spacing: -.01em; color: #fff;
  line-height: 1.1; white-space: nowrap; }
.ld-l { display: inline-block; opacity: 0;
  animation: ld-letter calc(.36s * var(--t)) calc((.7s + var(--i) * .025s) * var(--t)) cubic-bezier(.2,.9,.3,1.2) both; }
.ld-l.gold { color: #FCD116; }
.ld-sp { display: inline-block; width: .3em; }
@keyframes ld-letter { from { opacity: 0; transform: translateY(.6em) rotate(8deg); } to { opacity: 1; transform: none; } }
.ld-tags { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 800;
  letter-spacing: .28em; text-transform: uppercase; color: #cfd6e8; }
.ld-tags span, .ld-tags i { opacity: 0; animation: ld-fadeup calc(.3s * var(--t)) both; }
.ld-tags i { width: 5px; height: 5px; border-radius: 50%; background: #FCD116; }
.ld-tags > :nth-child(1) { animation-delay: calc(1s * var(--t)); }
.ld-tags > :nth-child(2) { animation-delay: calc(1.08s * var(--t)); }
.ld-tags > :nth-child(3) { animation-delay: calc(1.14s * var(--t)); }
.ld-tags > :nth-child(4) { animation-delay: calc(1.22s * var(--t)); }
.ld-tags > :nth-child(5) { animation-delay: calc(1.28s * var(--t)); }
@keyframes ld-fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ld-bar { width: min(56vw, 220px); height: 3px; border-radius: 3px; background: rgba(255,255,255,.12);
  overflow: hidden; margin-top: 6px; }
.ld-bar i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, #002B7F 0 33.3%, #FCD116 33.3% 66.6%, #CE1126 66.6%);
  animation: ld-progress calc(1.4s * var(--t)) cubic-bezier(.3,.6,.4,1) forwards; }
@keyframes ld-progress { to { transform: scaleX(.85); } }
/* exit: the panels sweep up over the navy, then on up and away */
.ld-wipe { position: absolute; inset: 0; display: flex; pointer-events: none; }
.ld-wipe i { flex: 1; transform: translateY(100%); }
.ld-wipe i:nth-child(1) { background: #002B7F; } .ld-wipe i:nth-child(2) { background: #FCD116; }
.ld-wipe i:nth-child(3) { background: #CE1126; }
.loader.ready .ld-bar i, .loader.done .ld-bar i { transform: scaleX(1); transition: transform .4s; animation: none; }
.loader.done .ld-wipe i { animation: ld-wipe .62s cubic-bezier(.7,0,.25,1) forwards; }
.loader.done .ld-wipe i:nth-child(2) { animation-delay: .05s; }
.loader.done .ld-wipe i:nth-child(3) { animation-delay: .1s; }
@keyframes ld-wipe { 0% { transform: translateY(100%); } 45%, 55% { transform: translateY(0); }
  100% { transform: translateY(-100%); } }
.loader.done .ld-bg, .loader.done .ld-stage { animation: ld-hide 0s .3s forwards; }
@keyframes ld-hide { to { visibility: hidden; } }
/* waiting for the visitor: logo floats, then "Intră ↓" (full intro only) */
.loader.ready .ld-logo { animation: ld-float 3.2s ease-in-out infinite; }
@keyframes ld-float { 50% { transform: translateY(-8px); } }
.ld-enter { margin-top: 18px; display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: #fff; font: inherit; font-weight: 800; font-size: 15px;
  letter-spacing: .3em; text-transform: uppercase; cursor: pointer; opacity: 0; visibility: hidden; }
.ld-enter small { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: none; color: #99a3c0; }
.ld-chev { display: block; margin: 2px 0 10px; color: #FCD116; font-size: 20px; letter-spacing: 0; animation: ld-nudge 1.4s ease-in-out infinite; }
@keyframes ld-nudge { 50% { transform: translateY(6px); } }
.ld-enter:focus-visible { outline: 2px solid #FCD116; outline-offset: 6px; border-radius: 6px; }
.loader.ready .ld-enter { visibility: visible; animation: ld-fadeup .5s calc(1.6s * var(--t)) both; }
.ld-short .ld-enter, .loader.done .ld-enter { display: none; }
.ld-reduce .loader * { animation: none !important; opacity: 1; }
.ld-reduce .loader.done { opacity: 0; transition: opacity .3s; }
