/* World Military Power — mobile-first styles */
:root {
  --bg: #0e120d;
  --bg2: #141a12;
  --card: #182016;
  --card2: #1f2a1c;
  --line: #2c3a28;
  --text: #e8ecdf;
  --muted: #9aa58f;
  --accent: #e3b341;
  --accent2: #8fbf5a;
  --a: #e3b341;
  --b: #5ab0e6;
  --p-finance: #e3b341;
  --p-air: #5ab0e6;
  --p-manpower: #c98bd9;
  --p-land: #8fbf5a;
  --p-sea: #3f8fd1;
  --p-nuclear: #e5603f;
  --radius: 14px;
  --font: "Noto Sans", "Noto Sans Sinhala", "Noto Sans Tamil", system-ui, sans-serif;
  --head: "Oswald", "Noto Sans Sinhala", "Noto Sans Tamil", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.55;
  background-image: radial-gradient(circle at 20% -10%, #24311f 0, transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(143,191,90,.035) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(143,191,90,.035) 39px 40px);
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--head); line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.lang-si h1, .lang-si h2, .lang-ta h1, .lang-ta h2 { letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(14,18,13,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-family: var(--head); font-weight: 700; font-size: 1.05rem; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.topnav { display: none; gap: 4px; margin-left: 12px; }
.topnav a { color: var(--muted); padding: 8px 12px; border-radius: 10px; }
.topnav a.on, .topnav a:hover { color: var(--text); background: var(--card2); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { background: none; border: 0; color: var(--text); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; }
.icon-btn:hover { background: var(--card2); }
.langsw { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.langsw a { padding: 8px 9px; color: var(--muted); font-size: .8rem; font-weight: 600; min-height: 36px; display: grid; place-items: center; }
.langsw a.on { background: var(--accent); color: #1a1405; }
.langsw a:hover { text-decoration: none; }

/* layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.page-title { margin-top: 4px; }
.sec-title { margin: 22px 0 10px; font-size: 1.1rem; color: var(--accent2); text-transform: uppercase; letter-spacing: .06em; }
.lang-si .sec-title, .lang-ta .sec-title { text-transform: none; letter-spacing: 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sec-head h2 { margin: 0 0 10px; }
.notice { background: #2e2a14; border: 1px solid #5b4f1d; color: #f1e3a4; padding: 10px 14px; border-radius: 10px; font-size: .9rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--accent); color: #1a1405; font-weight: 700; font-family: var(--font); font-size: .95rem; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.back { display: inline-block; margin-bottom: 10px; min-height: 44px; line-height: 44px; }

/* hero */
.hero { padding: 22px 4px 8px; }
.hero h1 { font-size: 2rem; color: var(--accent); margin-bottom: 6px; }
.hero p { color: var(--muted); margin: 0 0 14px; max-width: 640px; }
.fake-search { width: 100%; max-width: 520px; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; cursor: pointer; text-align: left; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile b { display: block; font-family: var(--head); font-size: 1.35rem; color: var(--accent); line-height: 1.2; }
.tile span { color: var(--muted); font-size: .82rem; }

/* flags */
.flag { width: 28px; height: auto; aspect-ratio: 3/2; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.12); flex: none; }
.flag-none { display: inline-block; width: 28px; height: 19px; background: var(--card2); border-radius: 3px; }

/* rank list */
.ranklist { list-style: none; margin: 0; padding: 0; }
.ranklist li { display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "rk name val" "rk bar bar"; column-gap: 10px; row-gap: 4px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ranklist li:last-child { border-bottom: 0; }
.ranklist .rk { grid-area: rk; font-family: var(--head); font-size: 1.05rem; color: var(--muted); text-align: center; }
.ranklist li:nth-child(-n+3) .rk { color: var(--accent); }
.ranklist .clink { grid-area: name; }
.ranklist .rv { grid-area: val; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.ranklist .bar { grid-area: bar; }
.ranklist .badge, .ranklist .mini-btn { grid-area: bar; justify-self: start; }
.clink { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; min-width: 0; min-height: 32px; }
.clink .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: .7rem; background: #2e2a14; color: #f1e3a4; border: 1px solid #5b4f1d; padding: 1px 8px; border-radius: 99px; }
.mini-btn { font-size: .75rem; padding: 4px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); color: var(--text); }

.bar { display: block; height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; width: 100%; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 99px; }
.bar.p-finance i { background: var(--p-finance); }
.bar.p-air i { background: var(--p-air); }
.bar.p-manpower i { background: var(--p-manpower); }
.bar.p-land i { background: var(--p-land); }
.bar.p-sea i { background: var(--p-sea); }
.bar.p-nuclear i { background: var(--p-nuclear); }

/* Sri Lanka card */
.lk-card { background: linear-gradient(135deg, #2a1f0c, var(--card) 60%); border-color: #5b4f1d; }
.lk-link { display: flex; align-items: center; gap: 14px; color: var(--text); }
.lk-link:hover { text-decoration: none; }
.lk-link .flag { width: 64px; }
.lk-link h2 { margin: 0; }
.lk-link p { margin: 0; font-size: .85rem; }
.big-score { margin-left: auto; font-family: var(--head); font-size: 2rem; color: var(--accent); }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.mini-stats div { background: rgba(0,0,0,.25); border-radius: 10px; padding: 8px 10px; }
.mini-stats span { display: block; font-size: .75rem; color: var(--muted); }
.mini-stats b { font-variant-numeric: tabular-nums; }

/* quick lists */
.quick-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.quick { color: var(--text); margin: 0; }
.quick:hover { text-decoration: none; border-color: var(--accent2); }
.quick h3 { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.qi { width: 28px; height: 28px; display: grid; place-items: center; background: var(--card2); border-radius: 8px; font-size: .9rem; }
.quick ol { margin: 0; padding: 0; list-style: none; }
.quick li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; }
.quick li .flag { width: 20px; }
.quick li b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); color: var(--text); white-space: nowrap; font-size: .9rem; }
.chip.on { background: var(--accent); color: #1a1405; border-color: var(--accent); font-weight: 700; }
.chip:hover { text-decoration: none; border-color: var(--accent2); }
.chip.static { cursor: default; }

/* filters */
.filters, .cmp-form, .compare-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label, .compare-inline label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; font-size: .8rem; color: var(--muted); }
.filters label.check { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; font-size: .9rem; color: var(--text); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
select, input[type=text], input[type=search], input[type=number], input[type=password], input[type=url], textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font: inherit; font-size: 16px;
}
textarea { min-height: 120px; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* charts */
.chart-box { position: relative; width: 100%; min-height: 220px; }
.chart-box.radar { height: 300px; }

/* country page */
.country-head { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.country-head > .flag { grid-column: 1 / -1; width: 100%; max-width: 220px; border-radius: 8px; }
.country-head h1 { margin: 0 0 2px; }
.country-head p { margin: 0 0 6px; }
.rank-pill { display: inline-block; background: var(--card2); border: 1px solid var(--line); padding: 3px 12px; border-radius: 99px; font-size: .85rem; }
.score-ring { --p: 0; width: 104px; height: 104px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 79%, transparent 80% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--bg2) 0); }
.score-ring b { font-family: var(--head); font-size: 1.6rem; color: var(--accent); line-height: 1; }
.score-ring span { font-size: .62rem; color: var(--muted); max-width: 80px; }
.two-col { display: grid; gap: 16px; }
.pillars, .weights { list-style: none; margin: 0; padding: 0; }
.pillars li, .weights li { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; padding: 7px 0; font-size: .9rem; }
.pillars b, .weights b { text-align: right; font-variant-numeric: tabular-nums; }
.stat-groups { display: grid; gap: 16px; }
.stat-groups .card { margin: 0; }
.stat-group h2 { padding-left: 10px; border-left: 4px solid var(--accent); }
.g-finance h2 { border-color: var(--p-finance); } .g-air h2 { border-color: var(--p-air); }
.g-manpower h2 { border-color: var(--p-manpower); } .g-land h2 { border-color: var(--p-land); }
.g-sea h2 { border-color: var(--p-sea); } .g-nuclear h2 { border-color: var(--p-nuclear); }
.stat-group dl { margin: 0; }
.stat-group dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stat-group dl div:last-child { border-bottom: 0; }
.stat-group dt { color: var(--muted); font-size: .9rem; }
.stat-group dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.wr { display: inline-block; margin-left: 6px; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--card2); color: var(--accent2); }
.sources p { font-size: .88rem; color: var(--muted); }
.stat-groups { margin-bottom: 16px; }

/* compare */
.cmp-form label { flex: 1 1 140px; }
.swap-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-size: 1.2rem; cursor: pointer; flex: none; }
.vs-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; text-align: center; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); }
.vs-side:hover { text-decoration: none; }
.vs-side .flag { width: 100%; max-width: 120px; border-radius: 6px; }
.vs-side b { font-size: 1rem; }
.vs-side .big-score { margin: 0; font-size: 1.6rem; }
.vs-side:first-child .big-score { color: var(--a); }
.vs-side:last-child .big-score { color: var(--b); }
.vs-side small { color: var(--muted); font-size: .75rem; }
.vs-mark { font-family: var(--head); font-weight: 700; color: var(--muted); font-size: 1.1rem; }
.cmp-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.cmp-row:last-child { border-bottom: 0; }
.cmp-label { text-align: center; color: var(--muted); font-size: .82rem; margin-bottom: 4px; }
.cmp-vals { display: grid; grid-template-columns: minmax(70px, auto) 1fr minmax(70px, auto); gap: 8px; align-items: center; }
.cv { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
.cv.a { text-align: left; } .cv.b { text-align: right; }
.cv.win.a { color: var(--a); } .cv.win.b { color: var(--b); }
.cv.win::after { content: " ▲"; font-size: .65rem; }
.cmp-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.bar.rev { transform: scaleX(-1); }
.bar.a i { background: var(--a); }
.bar.b i { background: var(--b); }

/* map */
.map-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; }
.map-bar h1 { margin: 0; font-size: 1.3rem; }
.map-bar label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); flex: 1 1 220px; max-width: 360px; }
.world-map { height: 62vh; min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: #0b1520; }
.map-hint { margin: 8px 4px 16px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font); }
.pop h3 { display: flex; gap: 8px; align-items: center; margin: 0 0 6px; }
.pop .flag { width: 26px; }
.pop p { margin: 2px 0; }
.pop a.btn { min-height: 36px; margin-top: 8px; color: #1a1405; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }

/* weapons */
.weapon-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.weapon-card { margin: 0; color: var(--text); display: grid; grid-template-columns: 48px 1fr; column-gap: 12px; }
.weapon-card:hover { text-decoration: none; border-color: var(--accent2); }
.weapon-card .w-icon { grid-row: span 2; }
.weapon-card h3 { margin: 2px 0 4px; }
.weapon-card p { margin: 0; color: var(--muted); font-size: .87rem; }
.w-icon { width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.6rem; background: var(--card2); border-radius: 12px; }
.w-icon.big { width: 64px; height: 64px; font-size: 2.2rem; flex: none; }
.wd-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.wd-head h1 { margin: 0; }
.wd-head p { margin: 0; }
.prose { line-height: 1.75; }
.prose p { margin: 0 0 1em; }

/* search overlay */
.search-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(8,10,7,.96); padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); display: flex; flex-direction: column; }
.search-overlay[hidden] { display: none; }
.search-box { display: flex; gap: 8px; max-width: 640px; width: 100%; margin: 0 auto; }
.search-box input { min-height: 50px; font-size: 17px; }
.search-results { list-style: none; margin: 12px auto 0; padding: 0; max-width: 640px; width: 100%; overflow-y: auto; }
.search-results li a { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--line); color: var(--text); min-height: 52px; }
.search-results li a:hover, .search-results li a.sel { background: var(--card); text-decoration: none; }
.search-results .sr-score { margin-left: auto; color: var(--accent); font-weight: 700; }
.search-results .sr-en { color: var(--muted); font-size: .8rem; }

/* footer + bottom nav */
.foot { max-width: 1100px; margin: 10px auto 0; padding: 16px; color: var(--muted); font-size: .8rem; text-align: center; }
.foot p { margin: 4px 0; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(14,18,13,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; color: var(--muted); font-size: .66rem; text-align: center; line-height: 1.15; padding: 4px 2px; }
.bottomnav a.on { color: var(--accent); }
.bottomnav a:hover { text-decoration: none; }

@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .weapon-grid { grid-template-columns: repeat(2, 1fr); }
  .mini-stats { grid-template-columns: repeat(4, 1fr); }
  .country-head { grid-template-columns: auto 1fr auto; }
  .country-head > .flag { grid-column: auto; width: 140px; }
  .ranklist li { grid-template-columns: 40px minmax(160px, 260px) 1fr auto; grid-template-areas: "rk name bar val"; }
  .ranklist .badge, .ranklist .mini-btn { grid-area: auto; }
  .ranklist.full li:has(.badge) { grid-template-columns: 40px minmax(160px, 260px) auto 1fr auto; grid-template-areas: "rk name badge bar val"; }
  .ranklist .badge { grid-area: badge; }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottomnav { display: none; }
  .topnav { display: flex; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .weapon-grid { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; align-items: center; }
  .stat-groups { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 2.6rem; }
}

/* admin */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-nav a { padding: 10px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--text); min-height: 44px; }
.admin-nav a.on { background: var(--accent); color: #1a1405; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.form-grid label, .form-row label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.form-row { margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; }
.ok { color: var(--accent2); } .err { color: #ff7d6b; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; background: #1d2d17; border: 1px solid #3c5a2c; }
.flash.bad { background: #3a1915; border-color: #7a3027; }

/* ===================== v1.1 images ===================== */
.pic { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--card2); cursor: zoom-in; object-fit: cover; }
.fig { margin: 0; }
.fig figcaption { padding: 6px 2px 0; line-height: 1.3; }
.fig figcaption b { display: block; font-size: .85rem; }
.fig figcaption small, .hero-credit { display: block; color: var(--muted); font-size: .66rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-fig { margin: -16px -16px 14px; }
.hero-fig .pic { border-radius: var(--radius) var(--radius) 0 0; max-height: 420px; aspect-ratio: 16/9; }
.hero-fig figcaption { padding: 6px 16px 0; }

/* photo as background with a dark gradient so text stays readable */
.has-img { position: relative; isolation: isolate; overflow: hidden; }
.has-img::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--img) center / cover no-repeat; }
.has-img::after { content: ""; position: absolute; inset: 0; z-index: -1; }

.hero.has-img { margin: -16px -16px 8px; padding: 48px 20px 26px; min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end; border-bottom: 1px solid var(--line); }
.hero.has-img::after { background: linear-gradient(180deg, rgba(14,18,13,.25) 0%, rgba(14,18,13,.65) 55%, rgba(14,18,13,.97) 100%); }
.hero.has-img p { color: #d5dcc9; }
.hero-credit { margin-top: 10px; max-width: 100%; }

.card-banner { display: block; height: 120px; margin: -16px -16px 14px; border-radius: var(--radius) var(--radius) 0 0; background: var(--img) center / cover no-repeat; position: relative; }
.card-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(42,31,12,.9)); border-radius: inherit; }

.quick.has-img { padding-top: 0; }
.quick-img { display: block; height: 90px; margin: 0 -16px 12px; background: var(--img) center / cover no-repeat; border-radius: var(--radius) var(--radius) 0 0; }

.hscroll { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 0 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.wthumb { flex: 0 0 150px; scroll-snap-align: start; color: var(--text); font-size: .85rem; line-height: 1.3; }
.wthumb:hover { text-decoration: none; }
.wthumb-img { display: block; height: 100px; border-radius: 10px; background: var(--card2) var(--img) center / cover no-repeat; margin-bottom: 6px; }

.metric-head { display: flex; align-items: flex-end; min-height: 150px; color: var(--text); padding: 16px; }
.metric-head:hover { text-decoration: none; }
.metric-head::after { background: linear-gradient(180deg, rgba(14,18,13,.1), rgba(14,18,13,.92)); }
.metric-head b { display: block; font-family: var(--head); font-size: 1.4rem; }
.metric-head small { color: var(--accent); }

.country-head.has-img { padding-top: 140px; }
.country-head.has-img::after { background: linear-gradient(180deg, rgba(24,32,22,.05) 0%, rgba(24,32,22,.75) 45%, var(--card) 80%); }
.country-head.has-img > .flag { max-width: 110px; box-shadow: 0 2px 10px rgba(0,0,0,.6); }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gallery > *, .fig, .credit-row > div { min-width: 0; }
.gallery .pic { aspect-ratio: 4/3; }

.vs-photo { position: relative; display: block; width: 100%; max-width: 160px; aspect-ratio: 4/3; border-radius: 10px; background: var(--card2) var(--img) center / cover no-repeat; }
.vs-photo .flag { position: absolute; left: 6px; bottom: 6px; width: 36px; }

.weapon-card.has-img { grid-template-columns: 1fr; padding: 0; overflow: hidden; }
.weapon-card.has-img h3, .weapon-card.has-img p { padding: 0 14px; }
.weapon-card.has-img h3 { margin-top: 12px; }
.weapon-card.has-img p { padding-bottom: 14px; }
.wc-img { position: relative; display: block; aspect-ratio: 16/9; background: var(--card2) var(--img) center / cover no-repeat; }
.wc-img .w-icon { position: absolute; left: 10px; bottom: -18px; width: 40px; height: 40px; font-size: 1.3rem; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.weapon-card.has-img .wc-img + h3 { margin-top: 24px; }

.pop-img { display: block; width: 220px; max-width: 100%; height: 110px; object-fit: cover; border-radius: 8px; margin: 0 0 8px; }

.credit-list { display: grid; gap: 12px; }
.credit-row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; font-size: .85rem; }
.credit-row .pic { aspect-ratio: 4/3; }
.credit-row b { display: block; overflow-wrap: anywhere; }
.credit-row small { display: block; color: var(--muted); overflow-wrap: anywhere; }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(5,7,5,.95); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; padding-top: calc(56px + env(safe-area-inset-top)); }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 170px); object-fit: contain; border-radius: 8px; }
.lb-close { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; font-size: 1.3rem; }
.lb-cap { max-width: 720px; width: 100%; text-align: center; padding: 10px 4px; line-height: 1.4; }
.lb-cap b { display: block; }
.lb-cap small { display: block; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.lb-cap a { display: inline-block; margin-top: 6px; min-height: 36px; line-height: 36px; }

@media (min-width: 600px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero.has-img { min-height: 360px; border-radius: 0 0 var(--radius) var(--radius); }
  .country-head.has-img { padding-top: 200px; }
  .quick-img { height: 110px; }
  .wthumb { flex-basis: 180px; }
  .wthumb-img { height: 115px; }
}
@media (min-width: 900px) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero.has-img { margin: 0 0 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 60px 32px 30px; min-height: 400px; }
  .country-head.has-img { padding-top: 240px; }
}

/* v1.1.1 — OpenStreetMap tiles turned dark; only the map tiles, not the circles */
.world-map.dark-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.85) saturate(.35); }
.world-map.dark-tiles .leaflet-control-attribution { background: rgba(14,18,13,.8); color: var(--muted); }
.world-map.dark-tiles .leaflet-control-attribution a { color: var(--accent2); }

/* ===================== v1.2 weapon library ===================== */
.tabs { display: flex; gap: 6px; margin: 4px 0 6px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; padding: 9px 16px; min-height: 42px; display: inline-flex; align-items: center; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: #1a1405; }
.tabs a:hover { text-decoration: none; }
.lib-filters label { flex: 1 1 150px; }
.lib-filters .lib-q { flex: 1 1 100%; }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.model-card { margin: 0; padding: 0; overflow: hidden; color: var(--text); display: flex; flex-direction: column; }
.model-card:hover { text-decoration: none; border-color: var(--accent2); }
.mc-img { display: block; aspect-ratio: 4/3; background: var(--card2); overflow: hidden; }
.mc-img .pic, .mthumb .pic { width: 100%; height: 100%; object-fit: cover; border-radius: 0; cursor: pointer; }
.mc-noimg { display: grid; place-items: center; height: 100%; font-size: 2rem; opacity: .5; }
.mc-body { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 10px; min-width: 0; }
.mc-body b { font-size: .92rem; line-height: 1.3; overflow-wrap: anywhere; }
.mc-body small { color: var(--muted); font-size: .74rem; line-height: 1.3; }
.mc-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.mc-meta .flag { width: 20px; }
.mthumb { overflow: hidden; }
.wthumb small { display: block; font-size: .72rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 16px; }
.model-detail h1 { margin-bottom: 2px; }
.model-facts { display: grid; gap: 10px; margin: 12px 0; }
.model-facts > div { display: flex; flex-direction: column; gap: 2px; background: var(--card2); border-radius: 10px; padding: 10px 12px; }
.model-facts span { color: var(--muted); font-size: .78rem; }
.model-facts .clink .flag { width: 28px; }
.op-list { display: flex; flex-wrap: wrap; gap: 8px; }
.op { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px; min-height: 38px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); color: var(--text); font-size: .86rem; }
.op .flag, .op .flag-none { width: 20px; height: 14px; }
.op:hover { text-decoration: none; border-color: var(--accent2); }
.sr-head { padding: 12px 8px 4px; color: var(--accent2); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.sr-thumb { width: 44px; height: 33px; flex: none; object-fit: cover; border-radius: 5px; background: var(--card2); display: inline-block; }
.pick-wrap, [data-model-pick] { position: relative; }
.pick-results { list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--card); border: 1px solid var(--line); border-radius: 12px; max-height: 340px; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.compare-inline .pick-results { top: auto; }
.pick-results button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; min-height: 48px; background: none; border: 0; border-radius: 8px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pick-results button:hover { background: var(--card2); }
.pick-results small { color: var(--muted); }
.cmp-form .pick-wrap { flex: 1 1 220px; }
.cmp-vals.mcmp { grid-template-columns: 1fr 1fr; }
.vs-photo.mthumb { background: var(--card2); }
a.tile { color: var(--text); }
a.tile:hover { text-decoration: none; border-color: var(--accent2); }
@media (min-width: 600px) {
  .model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .model-facts { grid-template-columns: 1fr 1fr; }
  .lib-filters .lib-q { flex-basis: 260px; }
}
@media (min-width: 900px) {
  .model-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
