/* Shepherding Cats: Movement Tracker
   © 2026 Will Daley d/b/a BrainDodge Studios. All rights reserved. */

:root{font-family:Inter,system-ui,sans-serif;color:#ecebdf;background:#17251f;-webkit-text-size-adjust:100%}
*{box-sizing:border-box}
body{margin:0;overflow-x:hidden;padding-top:env(safe-area-inset-top);background:#17251f;padding-bottom:calc(88px + env(safe-area-inset-bottom))}
a{color:inherit}
small{font-size:11px;letter-spacing:2px;color:#bdc5ac}
main{display:flex;justify-content:center;padding:16px 32px 24px}
.map{background:#0b110e;border:1px solid #52604d;border-radius:14px;overflow:hidden;align-self:start}
.maphead{display:flex;justify-content:space-between;gap:12px;padding:14px 18px;font-size:14px;color:#f4d593;font-weight:600}
#reset,#newround{min-height:36px;padding:6px 12px;font-size:13px;font-weight:normal;flex:none}
.maphead{gap:8px}
.legend{display:flex;flex-wrap:wrap;gap:8px 18px;padding:12px 18px;font-size:12px;color:#c7ceb9}
.key{display:inline-block;width:12px;height:12px;border-radius:50%;margin-right:6px;vertical-align:-1px;border:2px solid #f0eee0}
.key.earlier{background:#cfd8b0;border-color:#142b1b}.key.current{background:#16251e;border-color:#ffd23f}.key.end{background:#ffd23f;border-color:#fff}
svg{width:100%;display:block;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
p{color:#bac6b8;line-height:1.55;font-size:14px}
h3{font-size:12px;text-transform:uppercase;letter-spacing:1.5px;margin:14px 0 10px;color:#d3ddc4}
#status{min-height:22px;margin:0;padding:4px 18px 0;font-size:13px;color:#f4d593}
.hint{font-size:13px}
button{background:#2c3e32;color:#f2f1e6;border:1px solid #5d6c55;padding:11px 14px;border-radius:8px;font:inherit;font-size:14px;cursor:pointer;min-height:44px;touch-action:manipulation}
button:hover:not(:disabled){background:#42583e}
button:disabled{opacity:.4;cursor:default}
button:focus-visible,g:focus-visible{outline:3px solid #f2d789}
.primary{background:#d7d99b;color:#1e2b20;font-weight:600}
.primary:hover:not(:disabled){background:#e7e9b0}
button[aria-pressed=true]{background:#f2d789;color:#1e2b20;border-color:#fff}
.save{display:block;letter-spacing:0}

/* Plan row */
#tiles{display:flex;flex-wrap:wrap;gap:8px;padding:12px 18px 4px;border-top:1px solid #2c3a2f}
#tiles .tile,#drawertiles .tile{width:48px;flex:none}
#drawertiles{display:flex;gap:8px;overflow-x:auto;padding:12px 12px 10px 8px;margin:0 -8px 8px;border-bottom:1px solid #2c3a2f}
#drawertiles[hidden]{display:none}
.drawer .legend{padding:8px 0 0}
.tile{position:relative;aspect-ratio:1;background:#fff;border-radius:8px}
.tile img{width:100%;height:100%;border-radius:8px;display:block}
.tile span{position:absolute;left:4px;top:2px;font-size:10px;font-weight:700;color:#58614f}
.tile.done{opacity:.35}
.tile.now{outline:3px solid #f2d789;outline-offset:2px}
.tile .x{position:absolute;right:-7px;top:-7px;min-height:0;width:22px;height:22px;padding:0;border-radius:50%;background:#c8402a;border:2px solid #fff;color:#fff;font-size:16px;line-height:1;font-weight:700}
#pickergrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(52px,1fr));gap:6px}
#pickergrid button{padding:0;min-height:0;aspect-ratio:1;background:#fff;border:0;overflow:hidden;opacity:.9}
#pickergrid button:active{transform:scale(.94)}
#pickergrid img{width:100%;height:100%;display:block}
#nowtile{width:34px;height:34px;border-radius:6px;margin:-6px 10px -6px 0;flex:none}
.maphead{align-items:center}
.maphead #mode{flex:1}

/* Add button at the end of the plan row */
.tile.add{min-height:0;padding:0;background:transparent;border:2px dashed #8b9a82;color:#d7d99b;font-size:26px;font-weight:400;display:grid;place-items:center}

/* Tile drawer: slides up above the toolbar */
.drawer{position:fixed;left:0;right:0;bottom:calc(72px + env(safe-area-inset-bottom));z-index:4;max-height:min(70dvh,560px);overflow:auto;background:#0f1a15;border-top:1px solid #52604d;box-shadow:0 -10px 30px #0008;padding:12px max(16px,env(safe-area-inset-right)) 16px max(16px,env(safe-area-inset-left))}
.drawer[hidden]{display:none}
.drawerhead{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px;font-size:14px}
.drawerhead button{min-height:40px;padding:8px 18px}
.drawer details{margin-top:12px}
.drawer summary{cursor:pointer;font-size:13px;color:#c7ceb9}

/* New game: board choice */
.sheet{position:fixed;inset:0;z-index:10;background:#000a;display:grid;place-items:center;padding:16px}
.sheet[hidden]{display:none}
.sheetbox{background:#0f1a15;border:1px solid #52604d;border-radius:14px;padding:16px;width:min(520px,100%);max-height:100%;overflow:auto}
#mapchoices{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}
#mapchoices span{font-size:13px}
#mapchoices button{display:flex;flex-direction:column;gap:8px;padding:8px;text-align:left}
#mapchoices img{width:100%;aspect-ratio:1;border-radius:6px;display:block}

/* Board layers */
.hit{fill:transparent;stroke:none}
.roomhit{cursor:pointer}
.room{fill:#16251ed9;stroke:#f0eee0;stroke-width:3}
.room.earlier{fill:#cfd8b0;stroke:#142b1b}
.room.current{fill:#16251e;stroke-width:8}
.room.end{stroke:#142b1b;stroke-width:4}
.room.end.active{stroke:#fff;stroke-width:7}
.roomtext{fill:#fff;font:bold 20px system-ui;pointer-events:none;text-anchor:middle;dominant-baseline:central}
.roomtext.dark{fill:#18261d}
.route{fill:none;stroke-linejoin:round;stroke-linecap:round}
.route-under{fill:none;stroke:#0b110e;stroke-linejoin:round;stroke-linecap:round;opacity:.7}
.start{fill:none;stroke-width:5;stroke-dasharray:8 7}
.tag,#routes{pointer-events:none}
#board{cursor:pointer}
.tag rect:not(.hit){stroke:#0b110e;stroke-width:4}
.tag text{fill:#0b110e;font:800 24px system-ui;text-anchor:middle;dominant-baseline:central;pointer-events:none}
svg[data-mode=branch] .room{stroke:#f2d789}

/* Switch button: shows the branch being plotted in its color */
.switch{display:flex;align-items:center;justify-content:center;gap:8px;font-weight:700}
.switch i{width:22px;height:22px;border-radius:50%;background:var(--c);border:2px solid #fff;flex:none}
.switch b{font-size:18px}

/* Toolbar: always reachable at the bottom, sized for thumbs */
.toolbar{position:fixed;left:0;right:0;bottom:0;z-index:5;display:grid;grid-template-columns:1fr 1fr 1fr 1.4fr;gap:8px;padding:10px max(12px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));background:#0f1a15f2;border-top:1px solid #52604d;backdrop-filter:blur(6px)}
.toolbar button{min-height:52px;font-size:15px}

/* Phones and tablets (everything but desktop): edge-to-edge, no bounding box or side
   margins, toolbar pinned to the bottom */
@media not all and (min-width:851px) and (hover:hover) and (pointer:fine){
  main{padding:0 0 16px}
  #tiles{padding:10px 16px 4px}
  #status{padding:4px 16px 0}
  .map{width:100%;border-radius:0;border-left:0;border-right:0;border-top:0}
  .maphead{padding:10px 16px;font-size:13px}
  .legend{padding:10px 16px;font-size:11px}
  .toolbar button{font-size:14px;padding:8px 6px}
}

/* Landscape phones and tablets: a full-width board would be taller than the screen, so
   only the board shrinks to fit the height left over by the header, plan row and the
   pinned toolbar; the header and plan row still span the full width. */
@media(min-width:601px) and (orientation:landscape){
  #board{width:min(100%,max(320px,calc(100dvh - 280px)));margin:0 auto}
  .toolbar{grid-template-columns:repeat(3,minmax(0,150px)) minmax(0,220px);justify-content:center}
  .drawer{left:50%;right:auto;transform:translateX(-50%);width:min(720px,100%);border:1px solid #52604d;border-radius:14px 14px 0 0}
}

/* Desktop: wide screen with a mouse or trackpad. Width alone can't tell a laptop from a
   landscape tablet, so touch screens keep the tablet layout. The board fills the window
   height on the left; header, toolbar, plan and the tile drawer stack in a sidebar instead
   of being pinned over the board. main and .map are flattened so their children can sit in
   the body grid without changing the markup. */
@media(min-width:851px) and (hover:hover) and (pointer:fine){
  body{display:grid;height:100dvh;overflow:hidden;padding:24px;gap:14px 24px;justify-content:center;align-content:start;
    grid-template-columns:auto 360px;grid-template-rows:auto auto auto auto minmax(0,1fr);
    grid-template-areas:"board head" "board tools" "board plan" "board status" "board drawer"}
  main,.map{display:contents}
  #board{grid-area:board;width:min(calc(100dvh - 48px),calc(100vw - 432px));min-width:360px;background:#0b110e;border:1px solid #52604d;border-radius:14px}
  .maphead{grid-area:head;flex-wrap:wrap;padding:0;font-size:15px}
  .maphead #mode{flex-basis:100%;order:-1}
  #reset,#newround{flex:1}
  .toolbar{grid-area:tools;position:static;grid-template-columns:repeat(3,1fr);padding:0;background:none;border:0;backdrop-filter:none}
  .toolbar #next{grid-column:1/-1;order:-1}
  .toolbar button{font-size:15px;padding:11px 14px}
  #tiles{grid-area:plan;padding:12px;background:#0b110e;border:1px solid #2c3a2f;border-radius:12px}
  #status{grid-area:status;padding:0}
  .drawer{grid-area:drawer;position:static;align-self:start;max-height:100%;border:1px solid #52604d;border-radius:12px;box-shadow:none;padding:14px;transform:none;width:auto}
}

/* Help page */
.helplink{display:grid;place-items:center;width:36px;min-height:36px;flex:none;border:1px solid #5d6c55;border-radius:8px;background:#2c3e32;color:#f2f1e6;text-decoration:none;font-size:16px;font-weight:700}
.helplink:hover{background:#42583e}
.drawer .helpnote{margin:12px 0 0;font-size:13px}
body.help,body.help *{box-sizing:border-box}
body.help{display:block;height:auto;overflow:visible;padding:0 0 40px}
.helpbar{position:sticky;top:0;z-index:2;padding:10px 16px;padding-top:max(10px,env(safe-area-inset-top));background:#0f1a15f2;border-bottom:1px solid #52604d;backdrop-filter:blur(6px)}
.back{color:#f4d593;font-weight:600;text-decoration:none;font-size:15px}
.back:hover{text-decoration:underline}
.help article{max-width:720px;margin:0 auto;padding:8px 16px 0}
.help h1{font-size:26px;margin:20px 0 8px;color:#f4d593}
.help h2{font-size:20px;margin:0 0 8px;color:#f4d593}
.help h3{margin:18px 0 6px}
.help section{padding:20px 0 4px;border-top:1px solid #2c3a2f;scroll-margin-top:56px}
.help p,.help li{font-size:15px;line-height:1.6;color:#d4dccb}
.help ol,.help ul{padding-left:22px;margin:8px 0}
.help li{margin:4px 0}
.help b{color:#f2f1e6}
.help a{color:#f4d593}
.toc{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 22px}
.toc a{padding:6px 12px;border:1px solid #52604d;border-radius:999px;font-size:13px;text-decoration:none;background:#0f1a15}
.toc a:hover{background:#2c3e32}
.help figure{margin:0}
.help figcaption{font-size:12px;color:#c7ceb9;line-height:1.4;margin-top:8px}
.tilerow{display:flex;flex-wrap:wrap;gap:18px;margin:12px 0}
.tilerow figure{width:120px}
.tilerow .tile{width:56px}
.glyphs{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:14px;margin:12px 0}
.glyphs img{width:56px;height:56px;border-radius:8px;background:#fff;display:block}
.help .legend{flex-direction:column;gap:10px;padding:8px 0;font-size:14px}
.backlink{margin-top:28px}
.copyright{margin:14px 0 0;font-size:11px;color:#8f9a88}
.help .copyright{font-size:12px;color:#8f9a88;margin-top:12px}
