/* The map game (/map) and Map a place (/map/start): the local gaps page's layout, in the site's look.
   Pieces are checked (dark green), found and waiting for a check (light green) or blank (gray). The map itself runs
   brown to green (RAMP in map.js). */
.game {
  --pc-ck: #1B3326; --pc-fd: #638B51; --pc-blank: #E4E7E0; --pc-meet: #A88F65;
  --empty: #D7DADD; --stroke: #FFFFFF; --state-stroke: #1B3326; --rule2: #DCE2D9; --surface: #FFFFFF;
}
.wrap.wide { max-width: 1240px; }
.gamehead { padding-top: 40px; border-bottom: 3px solid var(--rule); padding-bottom: 14px; margin-bottom: 18px; }
.gamehead h1 { margin-bottom: 8px; }
.gamehead .lede { max-width: 72ch; }
.game h2 { font: 700 22px/1.2 var(--font-display); margin: 36px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--rule); }
.game h3 { margin: 0 0 6px; }
.note { font-size: 14px; color: var(--muted); margin: 0 0 10px; max-width: 80ch; }

/* the score line above the map */
.scoreline { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 22px; align-items: center; margin: 6px 0 4px; }
.grade { font: 700 44px/1 var(--font-display); color: var(--ink); background: var(--panel); border: 2px solid var(--rule);
  border-radius: 10px; width: 72px; height: 72px; display: grid; place-items: center; }
.grade.small { font-size: 22px; width: 38px; height: 38px; border-radius: 7px; border-width: 1px; }
.scoreline .what { display: grid; gap: 6px; min-width: 0; }
.scoreline .what b { color: var(--ink); }
.meter { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--pc-blank, #E4E7E0); max-width: 640px; }
.meter span { display: block; height: 100%; }
.meter .ck { background: #1B3326; }
.meter .fd { background: #638B51; }
.meter-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.meter-key span { display: inline-flex; align-items: center; gap: 5px; }
.meter-key i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; background: #E4E7E0; }
.meter-key i.ck { background: #1B3326; }
.meter-key i.fd { background: #638B51; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: end; margin: 18px 0 12px; }
.ctl { display: grid; gap: 4px; }
.ctl .eyebrow { margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule2); border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { font: inherit; font-size: 14px; border: 0; background: transparent; color: var(--text); padding: 7px 12px; cursor: pointer; border-right: 1px solid var(--rule2); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* map and side panel */
.mapmain { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .mapmain { grid-template-columns: minmax(0, 1fr); } }
.mapbox { position: relative; background: #fff; border: 1px solid var(--rule2); border-radius: 8px; padding: 10px; min-width: 0; }
.mapbox svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.maphead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.maptitle { font-weight: 700; color: var(--ink); font-size: 15px; }
.backs { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.back { font: inherit; font-size: 14px; border: 1px solid var(--rule2); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend .sw { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 18px; height: 12px; display: inline-block; border-radius: 2px; border: 1px solid var(--rule2); }
.legend .dotkey i { width: 11px; height: 11px; border-radius: 50%; background: #8FB27A; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #8C9A88; }
.legend .hint { font-style: italic; }
path.county { stroke: var(--stroke); stroke-width: .35; vector-effect: non-scaling-stroke; cursor: pointer; }
path.state { stroke: var(--state-stroke); stroke-width: .9; vector-effect: non-scaling-stroke; cursor: pointer; }
path.state.sel { stroke-width: 2.4; }
path.state:hover { stroke-width: 2; }
path.county:hover { stroke: var(--state-stroke); stroke-width: 1.4; }
.det path.county { stroke-width: .8; transition: opacity .3s; }
.det path.county.open { stroke: var(--state-stroke); stroke-width: 2; }
path.other { fill: #F1F0EB; stroke: #C9CEC6; stroke-width: .8; vector-effect: non-scaling-stroke; cursor: pointer; }
path.other:hover { fill: #E6E5DE; }
.dots circle { stroke: #fff; stroke-width: 1.4; vector-effect: non-scaling-stroke; cursor: pointer; }
.dots circle:hover { stroke: var(--state-stroke); stroke-width: 2; }
.labels text { font-family: var(--font-body, inherit); font-weight: 600; fill: var(--ink, #1B3326); stroke: #fff;
  stroke-linejoin: round; paint-order: stroke; }
.tip { position: absolute; pointer-events: none; background: #fff; color: var(--text); border: 1px solid var(--rule2);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.35; box-shadow: 0 4px 16px rgba(27,51,38,.18); max-width: 280px; z-index: 5; }
.tip b { color: var(--ink); }
.panel { background: #fff; border: 1px solid var(--rule2); border-radius: 8px; padding: 16px; min-width: 0; display: grid; gap: 14px; }
.panel h3.big { font: 700 24px/1.15 var(--font-display); margin: 0; }
.panel .titlerow { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.lvl { display: grid; gap: 5px; }
.lvl .row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.lvl .row b { color: var(--ink); }
.bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: #E4E7E0; }
.bar span { display: block; height: 100%; }
.piecegrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; font-size: 12.5px; color: var(--muted); }
.piecegrid div { display: grid; gap: 2px; }
.piecegrid .mini { display: flex; height: 6px; border-radius: 2px; overflow: hidden; background: #E4E7E0; }
.piecegrid .mini span { display: block; height: 100%; }
.panel p { margin: 0; font-size: 14px; }
.panel .tblwrap.scroll { max-height: 440px; overflow-y: auto; }
.panel .tblwrap.scroll thead th { position: sticky; top: 0; z-index: 1; }
.panel tr.hit td { background: #FFF4CC; }

/* six squares, one per piece */
.pcs { display: inline-flex; gap: 2px; vertical-align: middle; }
.pcs i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: #E4E7E0; }
.pcs i.c { background: #1B3326; }
.pcs i.f { background: #638B51; }
.pckey { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.pckey span { display: inline-flex; gap: 5px; align-items: center; }

/* tables */
.tblwrap { overflow-x: auto; min-width: 0; }
.game table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.game th { text-align: left; background: var(--tint); color: var(--ink); font-weight: 700; padding: 6px 8px; white-space: nowrap; }
.game td { padding: 5px 8px; border-bottom: 1px solid var(--rule2); vertical-align: top; }
.game td.n, .game th.n { text-align: right; }
.game .small td, .game .small th { font-size: 13px; padding: 4px 6px; }
.kindname { color: var(--muted); font-size: 12.5px; }
#statetable tbody tr { cursor: pointer; }
#statetable tbody tr:hover td { background: var(--panel); }
#statetable th { cursor: pointer; }
#statetable th[aria-sort="descending"]::after { content: " \25BE"; }
#statetable th[aria-sort="ascending"]::after { content: " \25B4"; }
.pct { color: var(--muted); font-size: 12.5px; }
.empty-board { background: var(--panel); border-radius: 8px; padding: 14px 16px; font-size: 14px; }

/* kinds and sizes */
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .twocol { grid-template-columns: minmax(0, 1fr); } }
.twocol.boards h2 { margin-top: 36px; }
.hbars { display: grid; gap: 9px; }
.hb { display: grid; gap: 3px; }
.hb .lab { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.hb .lab span:last-child { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb .track { display: flex; height: 12px; background: #E4E7E0; border-radius: 2px; overflow: hidden; }
.hb .track span { display: block; height: 100%; }
.defs { display: grid; gap: 8px; max-width: 78ch; }
.defs p { margin: 0; }
.gamefoot { margin-top: 32px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--rule2); padding-top: 10px; }

/* Map a place */
.howto { display: grid; gap: 10px; padding-left: 22px; max-width: 80ch; margin: 0 0 24px; }
.picker { background: var(--panel); border-radius: 10px; padding: 18px; display: grid; gap: 14px; }
.pickrow { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.pickrow label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pickrow select { font: inherit; font-size: 15px; font-weight: 400; color: var(--text); padding: 8px 10px; border: 1px solid #CBD3C8;
  border-radius: 6px; background: #fff; min-width: 180px; max-width: 100%; }
.picker .tblwrap { background: #fff; border-radius: 6px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover { background: var(--tint); }
a.btn { display: inline-block; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 720px) {
  .scoreline { grid-template-columns: minmax(0, 1fr); }
  .grade { width: 58px; height: 58px; font-size: 34px; }
  .pickrow select { min-width: 0; width: 100%; }
  .pickrow label { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { .game * { transition: none !important; } }
