:root {
  --blue: #1f6feb;
  --pink: #ff4da6;
  --red: #dc143c;
  --bg: #f7f7fb;
  --card: #fff;
  --text: #111;
  --muted: #666;
  --border: rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
body { margin:0; font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif; color: var(--text); background: var(--bg); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.site-hero-flag { position: relative; overflow: hidden; }
.flag-stripes { height: 160px; display: grid; grid-template-rows: 1fr 1fr; }
.flag-stripes .stripe.white { background: #fff; }
.flag-stripes .stripe.red { background: var(--red); }
.hero-inner { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr 1fr; align-items: center; }
.hero-line { display: flex; align-items: center; justify-content: center; text-align: center; }
.hero-title { margin: 0; font-weight: 900; font-size: clamp(1.4rem, 1rem + 2.2vw, 2.3rem); color: #111; }
.hero-red .hero-sub { margin: 0; font-weight: 700; font-size: clamp(.95rem, .9rem + 1vw, 1.2rem); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.2); }

.site-main { padding: 24px 0 24px; }

.stats-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 28px auto; }
.stats-2col .col { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.stats-2col h2 { margin: 0 0 10px; font-size: 1.15rem; }

.title-with-badge { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.badge-year { background: var(--red); color:#fff; font-weight:800; padding:4px 10px; border-radius:999px; font-size:.9rem; letter-spacing:.02em; white-space:nowrap; }

.legend { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.1); }
.legend .all { background: #aaa; }
.legend .men { background: var(--blue); }
.legend .women { background: var(--pink); }

.chart-wrap { position: relative; width: 100%; height: 300px; overflow: hidden; }
.chart-wrap.tall { height: 420px; }
@media (max-width: 900px) {
  .chart-wrap { position: relative; width: 100%; height: 300px; overflow: hidden; }
  .chart-wrap.tall { height: 420px; }
}

.chart-hint { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }

.conscripts { margin: 36px 0; }
.conscripts .container { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.conscripts-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.conscripts-legend { min-width: 260px; }
.conscripts-chart { min-width: 0; overflow: hidden; }

.site-footer { padding: 32px 0; color: var(--muted); }

.sticky-controls { position: fixed; left:0; right:0; bottom:0; background:#fff; border-top:1px solid var(--border); padding: 12px 0; z-index: 1000; }
.controls-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 2.5fr 1fr !important; gap: 24px; align-items: center; place-items:center; justify-items:center; }
.controls-inner .control { text-align:center; }
.control h3 { margin: 0 0 6px; font-size: 1rem; }
#year-slider { width: 100%; }
.range-labels { display:flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin-top: 4px; }

.tfr-box { display: inline-grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; }
.tfr-box .btn { border-radius: 10px; border: 1px solid var(--border); background: var(--card); padding: 8px 0; font-size: 22px; cursor: pointer; }
.tfr-box input { text-align: center; padding: 10px; font-size: 1.1rem; border: 1px solid var(--border); border-radius: 10px; }

@media (max-width: 900px) {
  .stats-2col { grid-template-columns: 1fr; gap: 16px; }
  .controls-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 2.5fr 1fr !important; gap: 24px; align-items: center; place-items:center; justify-items:center; }
  .conscripts-grid { grid-template-columns: 1fr; }
  .conscripts-legend { min-width: 0; }
}

.below-conscripts-menu { margin: 8px 0 10px; }
.mid-menu { text-align: center; }
.mid-menu .menu-links { list-style: none; padding: 0; margin: 0; display: inline-flex; gap: 18px; flex-wrap: wrap; }
.mid-menu .menu-links a { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 2px; }
.mid-menu .menu-links a:hover { border-color: var(--text); }

.control-year { width:100%; }


.conscripts-legend-inline { list-style:none; padding:0; margin: 0 0 8px; display:flex; gap:14px; align-items:center; justify-content:center; }
.conscripts-legend-inline .dot { width:12px; height:12px; border-radius:50%; display:inline-block; margin-right:8px; border:1px solid rgba(0,0,0,.1); }
.conscripts-legend-inline li { display:flex; align-items:center; gap:8px; }


.conscripts .row { display:flex; flex-wrap:wrap; gap:20px; }
.conscripts .col { flex:1; min-width:260px; }
.conscripts .col-1 { flex:1; }
.conscripts .col-2 { flex:2; display:flex; flex-direction:column; gap:12px; }

.conscripts-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.conscripts-legend-inline { list-style:none; padding:0; margin: 0 0 8px; display:flex; gap:14px; align-items:center; justify-content:center; }
.conscripts-chart { min-width: 0; }
@media (max-width: 900px) {
  .conscripts-right { gap: 6px; }
}


@media (max-width: 900px) {
  .chart-wrap { height: 260px; }
  .chart-wrap.tall { height: 380px; }
}
@media (max-width: 640px) {
  .chart-wrap { height: 230px; }
  .chart-wrap.tall { height: 360px; }
}

@media (max-width: 480px) {
  .badge-year { font-size: .8rem; padding: 3px 8px; }
}


/* Horizontal scroll for conscripts on small screens */
.conscripts-chart-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; overscroll-behavior-x: contain; }
.conscripts-chart-scroll .chart-inner { min-width: 1200px; }
.conscripts-chart-scroll::-webkit-scrollbar { height: 8px; }
.conscripts-chart-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 999px; }
@media (min-width: 1024px) {
  .conscripts-chart-scroll .chart-inner { min-width: 1200px; }
}
/* Reduce extra bottom space below chart */
.conscripts .chart-wrap.tall { height: 420px; }


/* Gradient edges hint */
.conscripts-chart-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x; overscroll-behavior-x: contain; }
.conscripts-chart-scroll:before,
.conscripts-chart-scroll:after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 24px;
  pointer-events: none;
  z-index: 2;
}
.conscripts-chart-scroll:before {
  left: 0;
  background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
}
.conscripts-chart-scroll:after {
  right: 0;
  background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
}

/* Scroll buttons */
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(255,255,255,0.8);
  border: 1px solid #ccc;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.scroll-btn.left { left: 4px; }
.scroll-btn.right { right: 4px; }
.scroll-btn:hover { background: #eee; }


/* Edge fades to hint horizontal scroll */



@media (prefers-color-scheme: dark) {
  
  
}


.conscripts-chart-shell { position: relative; }
.conscripts-chart-shell .scroll-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; border: none; background: rgba(0,0,0,.55); color: #fff; width: 28px; height: 36px; border-radius: 8px; display: inline-flex; align-items:center; justify-content:center; font-size: 18px; line-height: 1; }
.conscripts-chart-shell .scroll-btn.left { left: 6px; }
.conscripts-chart-shell .scroll-btn.right { right: 6px; }
.conscripts-chart-shell .scroll-btn:hover { background: rgba(0,0,0,.7); }
@media (min-width: 1025px) {
  .conscripts-chart-shell .scroll-btn { display: none; }
}

@media (max-width: 640px) {
  .conscripts .chart-wrap.tall { height: 280px; }
}
  .conscripts-chart-scroll .chart-inner { min-width: 700px; }
}

.conscripts-chart-scroll::before,
.conscripts-chart-scroll::after {
  display: none !important;
  content: none !important;
}


/* demopl no-fade overrides */
.scroll-fade,
.scroll-fade.left,
.scroll-fade.right {
  display: none !important;
  width: 0 !important;
  background: none !important;
  box-shadow: none !important;
}
.conscripts-chart-scroll::before,
.conscripts-chart-scroll::after {
  display: none !important;
  content: none !important;
  background: none !important;
  box-shadow: none !important;
}


@media (min-width: 1025px) {
  .conscripts-chart-scroll { overflow-x: visible; }
  .conscripts-chart-scroll .chart-inner { min-width: 100% !important; }
}
