:root {
  --navy-950: #050d18;
  --navy-900: #07172b;
  --navy-800: #0b2340;
  --navy-700: #10345d;
  --gold: #d5ad48;
  --gold-soft: #f2d791;
  --white: #ffffff;
  --text: #172337;
  --muted: #66758a;
  --surface: #f5f7fa;
  --line: #dce3ec;
  --success: #1f7a4d;
  --warning: #a36c12;
  --danger: #a52c35;
  --shadow: 0 18px 48px rgba(7, 23, 43, .10);
  --radius: 18px;
  --radius-sm: 12px;
  --container: 1180px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--surface);
  line-height: 1.55;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--surface); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container { width: min(calc(100% - 40px), var(--container)); margin: 0 auto; }
.page { min-height: calc(100vh - 77px); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(5, 13, 24, .94); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.nav {
  min-height: 76px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 250px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid rgba(213,173,72,.45); border-radius: 12px;
  color: var(--gold); background: linear-gradient(145deg, rgba(213,173,72,.13), rgba(255,255,255,.03));
  font-weight: 900; letter-spacing: -.06em;
}
.brand-text { color: var(--white); }
.brand-text strong { display: block; letter-spacing: -.02em; }
.brand-text small { display: block; color: #a9b5c7; font-size: 11px; margin-top: 1px; }
.navlinks { display: flex; gap: 4px; align-items: center; flex: 1; justify-content: center; }
.navlink { color: #c1ccdc; border-radius: 10px; padding: 9px 10px; font-size: 13px; }
.navlink:hover, .navlink.active { color: var(--white); background: rgba(255,255,255,.06); }
.nav-actions { display: flex; gap: 9px; align-items: center; }
.mobile-menu { display: none; margin-left: auto; }

.btn {
  border: 1px solid transparent; border-radius: 12px; padding: 10px 15px;
  display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  font-weight: 760; font-size: 13px; transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: var(--navy-950); background: var(--gold); box-shadow: 0 10px 22px rgba(213,173,72,.18); }
.btn-primary:hover { background: #e1bb5f; }
.btn-ghost { color: var(--white); border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.04); }
.btn-outline { color: var(--navy-800); border-color: var(--line); background: var(--white); }
.btn-outline:hover { border-color: #c7d0dc; background: #fbfcfd; }
.btn-danger { color: var(--white); background: var(--danger); }
.btn-full { width: 100%; }

.hero {
  position: relative; overflow: hidden; color: var(--white);
  background:
    radial-gradient(circle at 84% 12%, rgba(213,173,72,.18), transparent 25%),
    radial-gradient(circle at 9% 40%, rgba(17,80,134,.30), transparent 30%),
    linear-gradient(135deg, var(--navy-950), var(--navy-800));
}
.hero::after {
  content:""; position:absolute; inset:0; opacity:.16; pointer-events:none;
  background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px);
  background-size: 36px 36px; mask-image: linear-gradient(to bottom, black, transparent 80%);
}
.hero-inner { position: relative; z-index: 1; padding: 78px 0 64px; display: grid; grid-template-columns: 1.4fr .8fr; gap: 50px; align-items: center; }
.kicker { color: var(--gold-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .16em; font-weight: 850; }
.hero h1 { font-size: clamp(38px, 5.5vw, 72px); line-height: .98; letter-spacing: -.055em; margin: 12px 0 20px; max-width: 860px; }
.hero p { color: #c7d2e3; font-size: 17px; max-width: 720px; margin: 0; }
.hero-actions { margin-top: 28px; display:flex; flex-wrap:wrap; gap:10px; }
.hero-card {
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
  border-radius: 24px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.18);
}
.crest { width: 88px; height: 88px; border-radius: 22px; display:grid; place-items:center; border:1px solid rgba(213,173,72,.35); background: radial-gradient(circle at 45% 35%, rgba(213,173,72,.28), rgba(255,255,255,.03)); color:var(--gold); font-weight:900; font-size: 32px; margin-bottom: 16px; }
.hero-card h3 { margin: 0 0 8px; }
.hero-card p { font-size: 13px; }

.legal-banner { background: #fff7e4; color: #5e460f; border-bottom: 1px solid #f0dfad; }
.legal-inner { padding: 12px 0; display:flex; gap:11px; align-items:flex-start; font-size: 13px; }
.legal-inner strong { white-space: nowrap; }
.legal-inner span { opacity: .95; }

.section { padding: 72px 0; }
.section.alt { background: var(--white); }
.section-head { display:flex; justify-content:space-between; gap:20px; align-items:end; margin-bottom: 28px; }
.eyebrow { color: var(--warning); text-transform:uppercase; letter-spacing:.12em; font-size:11px; font-weight:900; }
.section h2 { margin: 6px 0 0; font-size: clamp(28px, 4vw, 42px); line-height:1.05; letter-spacing:-.035em; }
.section-lead { color: var(--muted); max-width: 720px; margin: 10px 0 0; }

.steps { display:grid; grid-template-columns: repeat(4,1fr); gap:16px; }
.step-card { background:var(--white); border:1px solid var(--line); border-radius: var(--radius); padding:22px; box-shadow:0 8px 24px rgba(7,23,43,.04); }
.step-num { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:var(--navy-900); color:var(--gold); font-weight:900; margin-bottom:16px; }
.step-card h3 { font-size:16px; margin:0 0 7px; }
.step-card p { margin:0; font-size:13px; color:var(--muted); }

.grid-3 { display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; }
.grid-2 { display:grid; grid-template-columns:repeat(2, 1fr); gap:16px; }
.card { background:var(--white); border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:0 8px 26px rgba(7,23,43,.04); }
.card h3 { margin:0 0 8px; font-size:17px; }
.card p { margin:0; color:var(--muted); font-size:14px; }
.metric { font-size:30px; font-weight:900; letter-spacing:-.04em; color:var(--navy-900); }
.metric-label { color:var(--muted); font-size:12px; }

.callout { border-left: 4px solid var(--gold); padding:16px 18px; border-radius:12px; background:#fffdf7; color:#4e421f; }
.callout strong { display:block; margin-bottom:5px; }

.page-head { background: linear-gradient(150deg, var(--navy-950), var(--navy-800)); color:var(--white); padding: 50px 0 45px; }
.page-head h1 { font-size: clamp(34px, 5vw, 56px); letter-spacing:-.045em; line-height:1; margin: 7px 0 10px; }
.page-head p { margin:0; color:#c6d0df; max-width:760px; }
.breadcrumbs { color:#a5b2c6; font-size:12px; }

.doc { display:grid; grid-template-columns: 250px minmax(0, 1fr); gap:28px; align-items:start; }
.doc-nav { position:sticky; top:96px; background:var(--white); border:1px solid var(--line); border-radius:16px; padding:14px; }
.doc-nav a { display:block; padding:9px 10px; border-radius:9px; font-size:13px; color:var(--muted); }
.doc-nav a:hover { background:var(--surface); color:var(--navy-800); }
.document { background:var(--white); border:1px solid var(--line); border-radius:18px; padding: 30px; box-shadow:0 8px 26px rgba(7,23,43,.04); }
.document > div[id] { scroll-margin-top: 96px; }
.document h2 { font-size:24px; margin:28px 0 9px; }
.document h2:first-child { margin-top:0; }
.document h3 { font-size:16px; margin:20px 0 7px; }
.document p, .document li { color:#56657a; font-size:14px; }
.document ul, .document ol { padding-left: 22px; }
.document .notice { margin: 20px 0; }

.toolbar { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.input, .select, .textarea { width:100%; border:1px solid var(--line); background:var(--white); border-radius:11px; padding:11px 12px; color:var(--text); outline:none; }
.input:focus, .select:focus, .textarea:focus { border-color:#b4c0cf; box-shadow:0 0 0 3px rgba(16,52,93,.08); }
.textarea { min-height:120px; resize:vertical; }
.field { display:grid; gap:6px; }
.field label { font-size:12px; font-weight:800; color:#36465b; }
.form-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.form-grid .full { grid-column:1/-1; }
.form-stack { display:grid; gap:14px; }
.form-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:16px; }
.helper { color:var(--muted); font-size:12px; }
.checkbox { display:flex; gap:9px; align-items:flex-start; font-size:12px; color:var(--muted); }
.checkbox input { margin-top:3px; }

.auth-shell { min-height:calc(100vh - 77px); display:grid; place-items:center; padding:50px 0; }
.auth-card { width:min(100%, 460px); }
.tabs { display:flex; padding:4px; border-radius:12px; background:var(--surface); margin-bottom:18px; }
.tab { flex:1; border:0; border-radius:9px; padding:9px; background:transparent; color:var(--muted); font-weight:800; }
.tab.active { background:var(--white); box-shadow:0 3px 12px rgba(7,23,43,.08); color:var(--navy-900); }

.state-card { display:flex; flex-direction:column; gap:16px; }
.state-top { display:flex; gap:14px; align-items:center; }
.flag { width:56px; height:38px; border-radius:8px; object-fit:cover; background:linear-gradient(180deg,#17385e 0 33%, #fff 33% 66%, #caa145 66%); border:1px solid #cfd8e3; flex:none; }
.flag-lg { width:88px; height:60px; border-radius:10px; }
.state-name { margin:0; font-size:18px; }
.state-meta { color:var(--muted); font-size:12px; }
.tags { display:flex; flex-wrap:wrap; gap:7px; }
.tag { display:inline-flex; align-items:center; gap:6px; padding:6px 8px; border-radius:999px; background:#eef2f6; color:#445266; font-size:11px; font-weight:800; }
.tag.gold { background:#fbf2d9; color:#7c5b0e; }
.tag.green { background:#e9f6ef; color:#226745; }
.tag.red { background:#fdebec; color:#8b2931; }

.stats { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.stat { padding:16px; border-radius:14px; border:1px solid var(--line); background:var(--white); }

.list { display:grid; gap:9px; }
.list-row { display:flex; justify-content:space-between; gap:18px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:13px; background:var(--white); }
.list-row > div:first-child { min-width:0; }
.list-title { font-weight:850; font-size:13px; }
.list-sub { color:var(--muted); font-size:11px; margin-top:2px; }

.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:14px; background:var(--white); }
table { width:100%; border-collapse:collapse; min-width:680px; }
th, td { text-align:left; padding:12px 14px; border-bottom:1px solid var(--line); font-size:12px; }
th { color:#66758a; background:#fafbfc; font-size:10px; text-transform:uppercase; letter-spacing:.08em; }
tr:last-child td { border-bottom:0; }

.empty { text-align:center; padding:42px 20px; color:var(--muted); }
.spinner { width:20px; height:20px; border:2px solid #d8dee8; border-top-color:var(--navy-800); border-radius:50%; animation:spin .8s linear infinite; margin:auto; }
@keyframes spin { to { transform:rotate(360deg); } }
.notice { padding:12px 14px; border-radius:12px; font-size:12px; }
.notice.info { background:#edf4fb; color:#2b5b82; }
.notice.success { background:#eaf6ef; color:#236545; }
.notice.warn { background:#fff6e6; color:#805b13; }
.notice.danger { background:#fdebed; color:#8e3038; }

.footer { background:var(--navy-950); color:#93a2b7; padding:34px 0; }
.footer-grid { display:grid; grid-template-columns: 1.2fr .8fr; gap:30px; }
.footer strong { color:var(--white); }
.footer p { margin:8px 0 0; font-size:12px; max-width:760px; }
.footer-links { display:flex; gap:12px; flex-wrap:wrap; justify-content:flex-end; align-content:start; }
.footer-links a { font-size:12px; color:#b5c0cf; }

.modal-backdrop { position:fixed; inset:0; z-index:80; background:rgba(5,13,24,.55); display:grid; place-items:center; padding:20px; }
.modal { width:min(100%, 520px); max-height:90vh; overflow:auto; background:var(--white); border-radius:20px; border:1px solid var(--line); box-shadow:0 30px 90px rgba(0,0,0,.25); }
.modal-head { display:flex; justify-content:space-between; gap:14px; padding:18px 20px; border-bottom:1px solid var(--line); }
.modal-head h3 { margin:0; }
.icon-btn { width:34px; height:34px; border-radius:10px; border:1px solid var(--line); background:var(--white); color:var(--muted); }
.modal-body { padding:20px; }

@media (max-width: 980px) {
  .navlinks { display:none; }
  .mobile-menu { display:inline-flex; }
  .nav { gap:10px; }
  .hero-inner { grid-template-columns:1fr; }
  .steps { grid-template-columns:repeat(2,1fr); }
  .grid-3 { grid-template-columns:repeat(2,1fr); }
  .doc { grid-template-columns:1fr; }
  .doc-nav { position:static; display:flex; overflow:auto; gap:6px; }
  .doc-nav a { white-space:nowrap; }
}
@media (max-width: 680px) {
  .container { width:min(calc(100% - 28px), var(--container)); }
  .brand { min-width:auto; }
  .brand-text small { display:none; }
  .nav-actions .btn-outline { display:none; }
  .brand-text strong { font-size:12px; }
  .hero-inner { padding:52px 0 48px; }
  .hero h1 { font-size:40px; }
  .hero p { font-size:15px; }
  .legal-inner { display:block; }
  .legal-inner strong { display:block; margin-bottom:3px; }
  .section { padding:54px 0; }
  .steps, .grid-2, .grid-3, .form-grid, .stats, .footer-grid { grid-template-columns:1fr; }
  .section-head { display:block; }
  .document { padding:20px; }
  .page-head { padding:40px 0; }
  .page-head h1 { font-size:38px; }
  .form-actions { display:grid; grid-template-columns:1fr; }
  .form-actions .btn { width:100%; }
  .footer-links { justify-content:flex-start; }
}

.map-card { overflow:hidden; }
.world-map { width:100%; height:560px; border-radius:16px; overflow:hidden; border:1px solid var(--line); background:#dbe4ee; }
.editor-map { height:520px; }
.map-legend { display:flex; gap:12px; flex-wrap:wrap; align-items:center; color:var(--muted); font-size:11px; }
.map-legend span { display:inline-flex; align-items:center; gap:6px; }
.legend-swatch { width:12px; height:12px; border-radius:3px; display:inline-block; background:#4f93c7; border:1px solid #2f6c9f; flex:none; }
.legend-swatch-pending { background:rgba(233,189,85,.14); border:2px dashed #b47b0d; }
.map-popup-status { display:inline-flex; align-items:center; width:fit-content; padding:3px 7px; border-radius:999px; font-size:11px; font-weight:800; }
.map-popup-status.is-approved { color:#195a83; background:#e7f2fa; }
.map-popup-status.is-pending { color:#865800; background:#fff3d4; }
.map-help { color:var(--muted); font-size:12px; margin-top:10px; }
.map-popup { display:grid; gap:4px; min-width:180px; }
.map-popup strong { font-size:14px; color:var(--navy-900); }
.map-popup span { font-size:11px; color:var(--muted); }
.map-popup a { font-size:11px; font-weight:800; color:var(--navy-800); margin-top:5px; }
.setup-card { max-width:760px; margin:auto; }
.setup-card code { padding:2px 5px; border-radius:6px; background:#edf1f5; }
.leaflet-container { font:inherit; }
.leaflet-control-attribution { font-size:9px; }

/* Map labels: a state flag and name are pinned to its drawn boundary. */
.state-map-label-icon { background: transparent; border: 0; }
.state-map-label { display:flex; align-items:center; gap:7px; width:224px; max-width:224px; padding:6px 9px; border:1px solid rgba(7,23,43,.24); border-radius:9px; background:rgba(255,255,255,.96); box-shadow:0 5px 16px rgba(7,23,43,.25); color:var(--navy-900); }
.state-map-label img { width:29px; height:20px; flex:none; object-fit:cover; border:1px solid #d3dbe5; border-radius:3px; }
.state-map-label-compact { width:auto !important; max-width:none !important; min-width:0; padding:3px; gap:0; border-radius:6px; box-shadow:0 2px 7px rgba(7,23,43,.28); }
.state-map-label-compact img { width:29px; height:20px; }
.state-map-label-compact .state-map-flag-fallback { width:29px; height:20px; }
.state-map-label span:not(.state-map-flag-fallback) { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:11px; font-weight:850; }
.state-map-flag-fallback { font-size:20px; line-height:20px; flex:none; }
.map-popup-head { display:flex; align-items:center; gap:8px; margin-bottom:3px; }
.map-popup-head img { width:32px; height:22px; border:1px solid #d3dbe5; border-radius:3px; object-fit:cover; }
.map-popup-head strong { font-size:14px; }
.map-popup-flag { font-size:22px; }
.map-popup-more { border:0; background:transparent; padding:6px 0 0; text-align:left; font-size:11px; font-weight:850; color:var(--navy-800); cursor:pointer; }
.state-card-actions { display:flex; flex-wrap:wrap; gap:9px; margin-top:14px; }
.state-card-actions .btn { flex:1; }
.state-details { display:grid; gap:15px; }
.state-details-head { display:flex; gap:14px; align-items:center; }
.state-details-head h2 { margin:3px 0; font-size:24px; }
.state-details-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.state-details-stats .stat { padding:12px 10px; min-width:0; }
.state-details-stats .metric { font-size:15px; overflow-wrap:anywhere; }
.state-details-stats .metric-label { font-size:10px; }
.state-detail-media img { width:min(100%,220px); max-height:220px; object-fit:contain; margin-top:8px; border:1px solid var(--line); border-radius:10px; }
@media (max-width:520px) { .state-details-stats { grid-template-columns:1fr; } .state-map-label { width:190px; max-width:190px; } }

@media (max-width: 680px) { .world-map { height:430px; } .editor-map { height:430px; } }


/* Homepage catalogue and newsroom */
.home-country-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.home-news-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.home-news-card { display:flex; flex-direction:column; align-items:flex-start; min-height:190px; }
.home-news-card h3 { margin:7px 0 10px; line-height:1.25; }
.home-news-card p { white-space:pre-line; display:-webkit-box; -webkit-line-clamp:5; -webkit-box-orient:vertical; overflow:hidden; }
.news-card-date { color:var(--muted); font-size:11px; font-weight:750; }
.news-card-actions { width:100%; flex-wrap:wrap; gap:8px; margin-top:auto; padding-top:8px; }
.news-card-actions .btn { min-height:38px; }
.news-full-view { display:grid; gap:14px; }
.news-full-body { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.75; color:var(--ink); }
.news-full-source { border-top:1px solid var(--line); padding-top:12px; margin:0; color:var(--muted); font-size:12px; }
@media (max-width: 900px) { .home-country-grid,.home-news-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 620px) { .home-country-grid,.home-news-grid { grid-template-columns:1fr; } }

/* Mobile-first application shell: thumb-friendly fixed navigation and forms. */
.mobile-bottom-nav { display:none; }

@media (max-width: 680px) {
  .mobile-bottom-nav {
    position:fixed;
    z-index:70;
    inset:auto 0 0;
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:4px;
    padding:7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top:1px solid rgba(255,255,255,.12);
    background:rgba(5,13,24,.97);
    box-shadow:0 -8px 28px rgba(5,13,24,.16);
    backdrop-filter:blur(16px);
  }
  .mobile-bottom-nav a {
    display:flex;
    min-width:0;
    min-height:52px;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    border-radius:11px;
    color:#aebcd0;
    -webkit-tap-highlight-color:transparent;
  }
  .mobile-bottom-nav a span { font-size:19px; line-height:1.15; }
  .mobile-bottom-nav a small { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; font-weight:750; }
  .mobile-bottom-nav a.active { color:var(--gold-soft); background:rgba(213,173,72,.12); }
  .topbar .nav { min-height:64px; }
  .brand { gap:8px; }
  .brand-mark { width:36px; height:36px; border-radius:10px; }
  .brand-text strong { font-size:13px; }
  .nav-actions { gap:6px; }
  .nav-actions > a.btn-outline,
  .nav-actions > a.btn-primary { display:none; }
  .nav-actions > button[data-action="logout"] { padding:8px 10px; font-size:11px; }
  .mobile-menu { padding:8px 10px; font-size:12px; }
  .page { min-height:calc(100vh - 64px); padding-bottom:16px; }
  .page-head { padding:30px 0 28px; }
  .page-head h1 { font-size:clamp(30px,9vw,38px); overflow-wrap:anywhere; }
  .page-head p { font-size:13px; }
  .section { padding:30px 0; }
  .section-head { margin-bottom:18px; }
  .section-head > .btn,
  .section-head > a.btn { margin-top:14px; }
  .container { width:min(calc(100% - 24px),var(--container)); }
  .card { padding:16px; border-radius:15px; }
  .grid-2,.grid-3,.steps,.home-country-grid,.home-news-grid,.form-grid,.stats,.footer-grid { grid-template-columns:minmax(0,1fr); }
  .toolbar { display:grid; grid-template-columns:minmax(0,1fr); }
  .toolbar > * { width:100%; max-width:none !important; }
  .btn { min-height:42px; }
  .form-actions { display:grid; grid-template-columns:minmax(0,1fr); }
  .form-actions .btn { width:100%; }
  .form-stack { gap:13px; }
  .input,.select,.textarea { min-height:44px; font-size:16px; }
  .textarea { min-height:104px; }
  .state-card-actions { display:grid; grid-template-columns:minmax(0,1fr); }
  .state-card-actions .btn { width:100%; }
  .list-row { align-items:flex-start; flex-direction:column; gap:10px; padding:12px; }
  .list-row > .btn,.list-row > .tag { align-self:flex-start; }
  .table-wrap { max-width:calc(100vw - 56px); }
  .world-map { height:350px; border-radius:12px; }
  .editor-map { height:390px; }
  .map-legend { margin-top:10px; }
  .map-card .section-head { display:block; }
  .state-details-head { align-items:flex-start; }
  .state-details-stats { grid-template-columns:minmax(0,1fr); }
  .state-area-hint { line-height:1.6; }
  .doc-nav { padding:8px; }
  .document { padding:17px; }
  .document h2 { font-size:21px; }
  .modal-backdrop { padding:10px; align-items:end; }
  .modal { max-height:88dvh; border-radius:18px 18px 10px 10px; }
  .modal-head { padding:14px 16px; }
  .modal-body { padding:16px; }
  .footer { padding:26px 0 calc(88px + env(safe-area-inset-bottom)); }
  .footer-links { gap:10px 14px; }
}

.btn:disabled { opacity:.62; cursor:wait; transform:none; }
.needs-attention { outline:2px solid var(--warning); outline-offset:2px; }

/* Chats and detailed Hydroball match cards */
.chat-layout { display:grid; grid-template-columns:minmax(220px, .72fr) minmax(0, 1.8fr); gap:18px; align-items:start; }
.chat-sidebar { min-width:0; }
.chat-global { display:block; padding:13px 14px; margin-bottom:18px; border:1px solid var(--line); border-radius:12px; color:var(--text); font-weight:700; text-decoration:none; }
.chat-global.active, .chat-contact.active { border-color:var(--gold); background:rgba(213,173,72,.1); }
.chat-contacts { display:grid; gap:7px; max-height:62vh; overflow:auto; margin-top:12px; }
.chat-contact { display:grid; gap:4px; border:1px solid var(--line); border-radius:11px; padding:11px 12px; text-decoration:none; color:var(--text); min-width:0; }
.chat-contact strong { overflow-wrap:anywhere; }
.chat-contact small { color:var(--muted); font-size:12px; }
.chat-main { min-width:0; }
.chat-title { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:14px; border-bottom:1px solid var(--line); }
.chat-title h2 { margin:4px 0 0; font-size:24px; }
.chat-messages { display:flex; flex-direction:column; gap:10px; min-height:230px; max-height:55vh; overflow:auto; padding:16px 0; }
.chat-message { max-width:min(88%, 680px); align-self:flex-start; padding:10px 12px; border-radius:12px 12px 12px 3px; background:var(--soft, #f2f5f8); border:1px solid var(--line); overflow-wrap:anywhere; }
.chat-message.mine { align-self:flex-end; border-radius:12px 12px 3px 12px; background:rgba(213,173,72,.13); }
.chat-message-meta { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; margin-bottom:5px; font-size:12px; }
.chat-message-meta time { color:var(--muted); }
.chat-message-body { white-space:pre-wrap; line-height:1.45; }
.chat-composer { border-top:1px solid var(--line); padding-top:14px; }
.chat-composer .textarea { min-height:72px; }
.chat-compose-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:10px; }
.game-specs { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
.game-rules { margin-top:9px; }
.game-rules summary { cursor:pointer; color:var(--link, #174b7a); font-weight:600; }
.game-rules p { white-space:pre-wrap; overflow-wrap:anywhere; margin-bottom:0; }
.muted { color:var(--muted); }
@media (max-width: 760px) {
  .chat-layout { grid-template-columns:1fr; }
  .chat-contacts { display:flex; flex-wrap:nowrap; overflow-x:auto; max-height:none; padding-bottom:5px; }
  .chat-contact { min-width:170px; }
  .chat-messages { max-height:48vh; }
  .chat-message { max-width:96%; }
  .chat-compose-footer { align-items:flex-start; flex-direction:column; }
  .game-list-row { align-items:flex-start; flex-direction:column; }
}

/* Admin controls and public verification badge */
.verified-badge { display:inline-flex; width:16px; height:16px; color:#1d9bf0; vertical-align:-3px; margin-left:5px; flex:0 0 auto; }
.verified-badge svg { display:block; width:100%; height:100%; }
.admin-panel { display:grid; gap:18px; }
.admin-stat-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.admin-stat-value { font-size:32px; line-height:1.1; font-weight:850; letter-spacing:-.04em; margin:7px 0; }
.admin-section-card { min-width:0; }
.admin-section-card h2 { margin:3px 0 7px; font-size:26px; }
.admin-section-card .section-head { margin-bottom:16px; }
.admin-user-name { display:grid; gap:3px; min-width:140px; }
.admin-user-name strong { display:flex; gap:2px; align-items:center; }
.admin-user-name small, .admin-section-card td small { color:var(--muted); font-size:11px; }
.admin-danger-note { display:block; color:#a52c35 !important; font-size:11px; margin-top:4px; }
.admin-ban-control { display:grid; gap:6px; min-width:170px; }
.admin-ban-control .input { width:100%; min-width:150px; padding:7px 9px; font-size:12px; }
.admin-content-url { margin:4px 0; font-size:12px; }
.admin-content-url a { color:#1d67b1; text-decoration:underline; }
.admin-action-stack { display:flex; flex-wrap:wrap; gap:6px; min-width:190px; }
.admin-action-stack .btn, .admin-section-card td > .btn { padding:7px 9px; font-size:11px; }

/* Polished mobile navigation: consistent vector symbols instead of platform-dependent emoji. */
.nav-icon { flex:none; display:block; color:currentColor; }
.mobile-bottom-nav a { text-decoration:none; }
.mobile-bottom-nav a .nav-icon { transition:transform .18s ease, opacity .18s ease; opacity:.92; }
.mobile-bottom-nav a.active .nav-icon { transform:translateY(-1px); opacity:1; }
.mobile-bottom-nav a:focus-visible { outline:2px solid var(--gold-soft); outline-offset:2px; }
@media (max-width:680px) {
  .page { padding-bottom:calc(90px + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav { padding-left:10px; padding-right:10px; }
  .mobile-bottom-nav a { min-height:56px; gap:4px; }
  .mobile-bottom-nav a small { font-size:10px; letter-spacing:.01em; }
}

/* Match cards and score-sheet layout */
.game-list-content { width:100%; min-width:0; }
.game-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:13px; }
.game-war-detail { margin-top:10px; padding:11px 12px; border:1px solid #ead8b0; border-radius:11px; background:#fffbf1; color:#685321; font-size:12px; line-height:1.6; }
.game-judge-form { margin-top:14px; padding-top:13px; border-top:1px solid var(--line); }
.game-judge-form > label { display:block; margin-bottom:6px; color:var(--muted); font-size:11px; font-weight:850; }
.game-judge-form .form-actions { justify-content:flex-start; margin:0; }
.game-judge-form .select { max-width:320px; }
.result-team-row { box-shadow:none; padding:14px; margin-top:8px; }
.result-team-row > strong { display:block; margin-bottom:10px; }
@media (max-width:680px) {
  .game-actions { display:grid; grid-template-columns:minmax(0,1fr); }
  .game-actions .btn { width:100%; }
  .game-judge-form .form-actions { display:grid; grid-template-columns:minmax(0,1fr); }
  .game-judge-form .select { max-width:none; }
}

/* Consistent vector icon alignment on narrow screens and map fallbacks. */
.chat-global { display:flex; align-items:center; gap:9px; }
.chat-global .nav-icon { width:19px; height:19px; flex:none; }
.map-popup-flag,
.state-map-flag-fallback { display:inline-flex; align-items:center; justify-content:center; flex:none; }
.map-popup-flag .nav-icon { width:22px; height:22px; }
.state-map-flag-fallback .nav-icon { width:20px; height:20px; }
.state-map-flag-fallback { width:29px; height:20px; border:1px solid #d3dbe5; border-radius:3px; color:#52647a; background:#f5f7fa; }
@media (max-width:680px) {
  .chat-global { min-height:44px; padding:10px 12px; border-radius:10px; }
  .mobile-bottom-nav .nav-icon { width:23px; height:23px; }
}


/* Neutral, consistent fallback for missing state flags: never imply a real national flag. */
.state-flag-placeholder {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#f1f5f9 !important;
  color:#64748b;
  border:1px solid #cbd5e1;
  padding:8px;
  object-fit:initial;
}
.state-flag-placeholder .nav-icon { width:26px; height:26px; }
.state-flag-placeholder.flag-lg .nav-icon { width:34px; height:34px; }
.territory-history-row { align-items:flex-start; }
.territory-history-row p { margin:7px 0 4px; white-space:pre-line; overflow-wrap:anywhere; }
.territory-history-row a { font-size:12px; font-weight:750; color:#1d67b1; }
@media (max-width:680px) {
  .mobile-bottom-nav a { padding:5px 2px; }
  .mobile-bottom-nav a .nav-icon { width:24px; height:24px; }
  .mobile-bottom-nav a small { font-size:10px; line-height:1.1; }
  .state-flag-placeholder { padding:6px; }
  .state-flag-placeholder .nav-icon { width:24px; height:24px; }
}

/* State leadership, profile editing and presidential news composer. */
.officials-fields {
  display:grid;
  gap:12px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:linear-gradient(180deg,#fbfcfe,#f5f8fb);
}
.officials-fields .eyebrow { margin-bottom:2px; }
.officials-fields .field { margin:0; }
.required-note { color:var(--danger); font-size:11px; font-weight:800; }
.state-officials-summary { display:grid; gap:5px; padding:12px 14px; margin-top:12px; border:1px solid var(--line); border-radius:12px; background:#f8fafc; font-size:13px; }
.state-officials-summary strong { color:var(--navy-800); }
.news-page-stack { display:grid; gap:22px; }
.news-composer { display:grid; gap:12px; max-width:840px; margin:0 auto; width:100%; }
.news-composer h2 { margin:0; font-size:clamp(23px,3vw,30px); }
.news-composer p { margin:0; }
.profile-form-status { margin-top:8px; }

/* Keep the primary navigation operable if a dialog was left open. Route changes close the dialog. */
.topbar { position:sticky; top:0; z-index:1000; isolation:isolate; }
.world-map,.editor-map { position:relative; z-index:0; isolation:isolate; }
.modal-backdrop { z-index:2000; }
.mobile-nav-panel { position:relative; z-index:1; padding:0 0 12px; }
.mobile-nav-card { background:#081a30; border-color:rgba(255,255,255,.08); display:grid; gap:4px; }
.mobile-nav-card .navlink { color:#d3dcea; padding:10px 12px; text-align:left; }
.mobile-nav-card .navlink:hover,.mobile-nav-card .navlink.active { background:rgba(255,255,255,.1); color:#fff; }
@media (max-width:680px) {
  .mobile-bottom-nav { z-index:1001; pointer-events:auto; }
  .mobile-bottom-nav a { pointer-events:auto; touch-action:manipulation; }
}
/* All map panes stay inside their own canvas instead of creating invisible click-blocking layers. */
.world-map { overflow:hidden; contain:layout paint; }
.editor-map { overflow:hidden; contain:layout paint; }


/* President-led war diplomacy */
.president-war-card { border-color: rgba(213,173,72,.55); background: linear-gradient(135deg, #fff 0%, #fffaf0 100%); }
.president-war-card .section-head { align-items: center; gap: 18px; }
.president-war-card .section-head h3 { margin: 4px 0 8px; }
.president-war-card .muted { max-width: 680px; margin: 0; }
.war-declaration-row { align-items: flex-start; gap: 16px; }
.war-cause { margin-top: 10px; color: var(--text); }
.war-description { margin: 5px 0 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
.war-actions { margin-top: 12px; }
.war-announcements-panel { margin-bottom: 22px; }
.war-announcement-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.war-announcement { min-width: 0; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; }
.war-announcement-top { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.war-announcement h3 { margin: 4px 0 14px; font-size: 20px; }
.war-announcement-meta { display: grid; gap: 10px; margin: 10px 0 14px; }
.war-announcement-meta > div { display: grid; gap: 2px; }
.war-announcement-meta strong { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.war-announcement-meta span { overflow-wrap: anywhere; font-weight: 650; }
.war-announcement p { white-space: pre-wrap; overflow-wrap: anywhere; }
.news-card-actions { margin-top: auto; padding-top: 8px; }
.btn-danger { color: var(--danger); border-color: rgba(165,44,53,.25); }
.btn-danger:hover { background: #fff1f2; }
@media (max-width: 720px) {
  .president-war-card .section-head { align-items: stretch; flex-direction: column; }
  .president-war-card .section-head .btn { width: 100%; }
  .war-declaration-row { flex-direction: column; }
  .war-declaration-row > .tag { align-self: flex-start; order: -1; }
  .war-actions .btn { width: 100%; }
  .war-announcement-list { grid-template-columns: minmax(0, 1fr); }
  .war-announcement { padding: 14px; }
}
