/* Playground tokens; geography, time controls and cards form one workbench. */
body[data-tool="island-bridges"] { --accent:var(--ok); --accent-soft:rgba(25,122,70,.08); }
body[data-tool="island-bridges"] .t-wrap { max-width:1200px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.ib-heading { padding-top:26px; padding-bottom:20px; }
.ib-heading h1 { font-size:30px; line-height:1.35; letter-spacing:-1px; font-weight:600; }
.ib-heading p { font-size:11px; color:var(--ink-2); margin-top:6px; }
.ib-toolbar { display:flex; align-items:center; gap:10px; padding-bottom:14px; }
.ib-toolbar .ib-search { margin-left:auto; }
.ib-modes { display:flex; flex:none; padding:3px; border:1px solid var(--line-strong); border-radius:7px; gap:3px; background:var(--surface); }
.ib-modes label { position:relative; cursor:pointer; }
.ib-modes input { position:absolute; opacity:0; width:1px; height:1px; }
.ib-modes span { display:block; padding:7px 15px; border-radius:4px; font-size:12px; color:var(--ink-2); font-weight:500; }
.ib-modes input:checked + span { color:var(--surface); background:var(--ink); }
.ib-modes input:focus-visible + span { outline:2px solid var(--accent); outline-offset:3px; }
#explorer button, #explorer select, #explorer input { font-family:var(--font-sans); color:var(--ink); }
#explorer button { cursor:pointer; }
#explorer button:disabled, #explorer select:disabled { cursor:default; opacity:.45; }
#explorer button:not(:disabled):hover { border-color:var(--ink-2); }
#explorer select { border:1px solid var(--line-strong); border-radius:5px; padding:8px 26px 8px 10px; background:var(--surface); font-size:12px; min-height:37px; }
.ib-story-grid { display:grid; grid-template-columns:minmax(0,1fr) 340px; grid-template-areas:"map story" "timeline timeline"; gap:16px; align-items:stretch; }
.ib-map-panel { grid-area:map; min-width:0; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.ib-map-stage { position:relative; height:420px; overflow:hidden; background:var(--paper); background-image:linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px); background-size:28px 28px; }
#map { display:block; width:100%; height:100%; cursor:grab; }
#map[data-dragging="true"] { cursor:grabbing; }
#coast path { fill:var(--surface); stroke:var(--line-strong); stroke-width:.7; vector-effect:non-scaling-stroke; }
.ib-marker { cursor:pointer; }
.ib-marker .ib-hit { fill:transparent; }
.ib-marker .ib-dot { fill:var(--surface); stroke:var(--ink-3); stroke-width:1.4; vector-effect:non-scaling-stroke; }
.ib-marker[data-state="open"] .ib-dot { fill:var(--ok); stroke:var(--surface); }
.ib-marker[data-state="none"] .ib-dot { stroke-dasharray:2 2; }
.ib-marker[data-state="uncertain"] .ib-dot { fill:var(--line-strong); stroke-dasharray:2 2; }
.ib-marker[aria-pressed="true"] .ib-halo { fill:var(--accent-soft); stroke:var(--accent); stroke-width:2; vector-effect:non-scaling-stroke; }
.ib-marker:focus-visible { outline:none; }
.ib-marker:focus-visible .ib-halo { stroke:var(--ink); stroke-width:3; vector-effect:non-scaling-stroke; }
#map-labels { pointer-events:none; }
#map-labels text { fill:var(--ink); font-family:var(--font-sans); font-weight:600; stroke:var(--paper); paint-order:stroke; stroke-width:4px; stroke-linejoin:round; }
#map-labels line { stroke:var(--ink-3); stroke-width:.8; vector-effect:non-scaling-stroke; }
.ib-map-top { position:absolute; top:14px; left:14px; right:14px; display:flex; align-items:flex-start; gap:12px; justify-content:flex-end; pointer-events:none; }
#follow { display:flex; align-items:center; gap:7px; pointer-events:auto; border:1px solid var(--line-strong); background:var(--surface); border-radius:5px; padding:7px 10px; font-size:11px; min-height:36px; }
#follow::before { content:""; display:block; width:13px; height:13px; border:1px solid var(--ink-3); border-radius:3px; font-size:10px; line-height:11px; text-align:center; }
#follow[aria-pressed="true"]::before { content:"✓"; color:var(--surface); background:var(--accent); border-color:var(--accent); }
.ib-map-tools { position:absolute; bottom:16px; left:14px; display:flex; gap:5px; }
.ib-map-tools button { background:var(--surface); border:1px solid var(--line-strong); border-radius:5px; min-width:34px; min-height:34px; padding:5px 9px; font-size:12px; }
.ib-north { position:absolute; right:20px; bottom:20px; color:var(--ink-2); font:11px var(--font-mono); }
.ib-map-caption { min-height:39px; display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px 12px; align-items:center; padding:10px 14px; border-top:1px solid var(--line); background:var(--surface); color:var(--ink-2); font-size:10px; }
.ib-legend { display:flex; flex-wrap:wrap; gap:12px; }
.ib-legend [hidden] { display:none; }
.ib-legend span { display:flex; gap:5px; align-items:center; }
.ib-key { display:inline-block; width:8px; height:8px; border:1px solid var(--ink-3); border-radius:50%; background:var(--surface); flex:none; }
.ib-key--open { background:var(--ok); border-color:var(--ok); }
.ib-key--none { border-style:dashed; }
.ib-story-card { grid-area:story; align-self:start; border:1px solid var(--line); border-radius:10px; background:var(--surface); padding:24px; min-width:0; }
.ib-kicker { color:var(--ink-2); font-size:11px; margin-bottom:6px; }
.ib-story-date { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 8px; font:500 35px/1.2 var(--font-mono); letter-spacing:-1.6px; color:var(--ok); }
.ib-story-date small { font:12px var(--font-sans); letter-spacing:0; color:var(--ink-2); }
#story-title { font-size:25px; font-weight:600; letter-spacing:-.5px; line-height:1.4; }
.ib-story-bridge { color:var(--ink-2); font-size:13px; margin:5px 0 20px; }
.ib-island-tabs { display:flex; flex-wrap:wrap; gap:5px; margin:12px 0; }
.ib-island-tabs button { padding:4px 8px; background:var(--paper); border:1px solid var(--line); border-radius:4px; font-size:11px; }
.ib-island-tabs button[aria-pressed="true"] { border-color:var(--accent); color:var(--ok) !important; }
.ib-facts { border-top:1px solid var(--line); padding:15px 0 0; margin:18px 0 0; }
.ib-facts > div { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.ib-facts dt { font-size:11px; color:var(--ink-2); }
.ib-facts dd { font:500 16px var(--font-mono); text-align:right; }
.ib-facts .ib-fact-none { font:12px var(--font-sans); }
.ib-card-details { margin-top:20px; padding-top:12px; border-top:1px solid var(--line); font-size:11px; color:var(--ink-2); }
.ib-card-details summary { cursor:pointer; min-height:30px; padding:4px 0; }
.ib-card-details p { line-height:1.9; margin:8px 0; }
.ib-date-source { display:grid; gap:6px; }
.ib-date-source a { text-underline-offset:3px; overflow-wrap:anywhere; }
.ib-card-action { display:inline-block; margin-top:18px; padding:9px 13px; border-radius:5px; border:1px solid var(--accent); background:var(--accent); color:var(--surface) !important; font-size:12px; }
.ib-empty-copy { color:var(--ink-2); font-size:13px; line-height:1.9; margin:16px 0; }
.ib-timeline { grid-area:timeline; position:sticky; top:12px; z-index:5; border:1px solid var(--line-strong); border-radius:10px; background:var(--surface); padding:12px 20px 8px; box-shadow:0 5px 18px var(--grid); }
.ib-timeline-top { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.ib-date-control { display:flex; align-items:center; }
.ib-date-control > div { display:flex; align-items:center; gap:8px; }
.ib-date-control button { width:36px; height:36px; border:1px solid var(--line); background:var(--paper); border-radius:4px; font-size:22px; line-height:1; }
#month-input { font:500 24px/1.2 var(--font-mono) !important; border:0; padding:3px 0; width:130px; text-align:center; min-width:0; background:transparent; letter-spacing:-1px; }
.ib-time-actions { display:flex; gap:8px; align-items:center; }
#play { min-height:37px; min-width:72px; padding:8px 12px; border:1px solid var(--line-strong); background:var(--paper); border-radius:5px; font-size:12px; }
#play span { font-size:10px; margin-right:5px; }
.ib-ruler { position:relative; margin-top:4px; padding-top:16px; }
#timeline { display:block; width:100%; height:26px; margin:0; padding:0; accent-color:var(--accent); cursor:ew-resize; }
#event-marks { position:absolute; top:8px; left:8px; right:8px; height:20px; pointer-events:none; }
#event-marks i { position:absolute; top:0; width:2px; height:10px; background:var(--line-strong); }
#event-marks i.is-active { background:var(--accent); height:17px; top:-3px; }
#event-marks i.is-uncertain { opacity:.5; min-width:3px; }
#time-ticks { position:relative; height:18px; margin:0 8px; font:10px var(--font-mono); color:var(--ink-2); }
#time-ticks span { position:absolute; transform:translateX(-50%); white-space:nowrap; }
#time-ticks span:first-child { transform:none; }
#time-ticks span:last-child { transform:translateX(-100%); }
#timeline-status { font:11px var(--font-mono); color:var(--ink-2); white-space:nowrap; text-align:center; }
#connected-count { white-space:nowrap; }
.ib-records { padding-top:30px; }
.ib-records-head { margin-bottom:12px; }
.ib-records h2 { font-size:17px; font-weight:600; }
#record-count { font:12px var(--font-mono); color:var(--ink-2); margin-left:5px; }
.ib-search { width:220px; max-width:100%; }
.ib-search input { width:100%; border:1px solid var(--line-strong); border-radius:5px; background:var(--surface); padding:10px 12px; font-size:12px; }
.ib-event-rail { display:flex; gap:12px; overflow-x:auto; padding:2px 2px 14px; scroll-snap-type:x proximity; scrollbar-width:thin; overscroll-behavior-x:contain; }
.ib-event-card { display:flex; flex-direction:column; align-items:flex-start; flex:0 0 205px; min-height:134px; border:1px solid var(--line); border-radius:8px; background:var(--surface); padding:16px; text-align:left; scroll-snap-align:center; }
.ib-event-card[aria-pressed="true"] { border-color:var(--accent); background:var(--accent-soft); box-shadow:inset 0 0 0 1px var(--accent); }
.ib-event-card time { font:500 15px var(--font-mono); color:var(--ink-2); }
.ib-event-card strong { font-size:18px; font-weight:600; line-height:1.4; margin-top:9px; }
.ib-event-card > span { color:var(--ink-2); font-size:12px; margin-top:4px; }
.ib-event-card small { font-size:10px; color:var(--ink-2); margin-top:auto; padding-top:10px; }
#load-error { padding-top:18px; }
#retry { padding:7px 12px; border:1px solid var(--line-strong); border-radius:4px; background:var(--surface); }
.ib-method { margin-top:28px; margin-bottom:32px; padding-top:18px; border-top:1px solid var(--line-strong); }
.ib-method summary { cursor:pointer; font-size:12px; color:var(--ink-2); }
.ib-method dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:28px; margin-top:20px; }
.ib-method dt { font-size:12px; font-weight:600; margin-bottom:6px; }
.ib-method dd, .ib-method p { font-size:12px; color:var(--ink-2); line-height:1.9; }
.ib-method p { margin-top:18px; }
@media (max-width:900px) {
  .ib-story-grid { grid-template-columns:minmax(0,1fr) 290px; gap:12px; }
  .ib-story-card { padding:20px; }
  .ib-map-stage { height:400px; }
  .ib-search { width:180px; }
}
@media (max-width:640px) {
  .ib-heading { padding-top:20px; padding-bottom:16px; }
  .ib-heading h1 { font-size:26px; }
  .ib-toolbar { flex-wrap:wrap; gap:8px; padding-bottom:12px; }
  .ib-toolbar .ib-search { width:100%; }
  .ib-modes span { padding:7px 10px; font-size:11px; }
  .ib-modes { max-width:100%; }
  #explorer select { font-size:11px; padding-left:8px; padding-right:19px; }
  .ib-story-grid { grid-template-columns:minmax(0,1fr); grid-template-areas:"map" "timeline" "story"; gap:10px; }
  .ib-map-stage { height:clamp(210px,34svh,300px); }
  .ib-map-caption { font-size:10px; padding:8px 10px; min-height:33px; }
  .ib-legend { gap:12px; }
  .ib-map-top { top:10px; left:10px; right:10px; }
  #follow { padding:6px 9px; font-size:10px; }
  .ib-story-card { padding:18px; }
  #story-body { position:relative; }
  .ib-story-date { font-size:29px; }
  #story-title { font-size:22px; }
  .ib-story-bridge { margin-bottom:14px; font-size:12px; }
  .ib-facts { padding:11px 0 0; margin:14px 0 0; }
  .ib-story-date small { font-size:11px; }
  .ib-card-details { margin-top:14px; }
  .ib-timeline { top:8px; padding:10px 12px 6px; border-radius:8px; }
  .ib-timeline-top { gap:8px; }
  .ib-date-control > div { gap:4px; }
  #month-input { font-size:20px !important; width:108px; }
  .ib-date-control button { width:32px; height:36px; font-size:20px; }
  .ib-time-actions { gap:6px; }
  #play { min-width:34px; min-height:36px; padding:5px 8px; font-size:0; }
  #play span { font-size:11px; margin:0; }
  #timeline-status { font-size:10px; }
  #time-ticks span:nth-child(2), #time-ticks span:nth-child(4) { display:none; }
  .ib-records { padding-top:22px; }
  .ib-event-card { flex-basis:185px; padding:14px; min-height:128px; }
  .ib-method dl { grid-template-columns:1fr; gap:18px; }
}
@media (max-width:370px) {
  .ib-toolbar { gap:6px; }
  .ib-modes span { padding:7px 8px; }
  .ib-region-label { margin-left:auto; }
}
@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
  .ib-event-rail { scroll-behavior:auto; scroll-snap-type:none; }
}
