/* The players' map. Embedded in a WordPress page by the adoh-map shortcode, so
   it must not fight the surrounding theme: everything is scoped under #app, it
   claims a height rather than the viewport, and it sets no page-level styles. */

#app{
  --ink:#e8eef4;
  --muted:#9aa6b2;
  --panel:rgba(14,19,25,.93);
  --rule:#2d3841;
  --gold:#ffd666;

  position:relative;
  width:100%;
  height:min(78vh,760px);
  min-height:380px;
  background:#0b0e12;
  border:1px solid var(--rule);
  border-radius:6px;
  overflow:hidden;
  color:var(--ink);
  font:14px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif;
  touch-action:none;
}

#app *{box-sizing:border-box}
#canvas{display:block;width:100%;height:100%;cursor:grab}
#canvas.drag{cursor:grabbing}

/* ------------------------------------------------------------------ chrome */
#controls{position:absolute;top:12px;right:12px;display:flex;flex-direction:column;gap:6px}
#controls button{
  width:36px;height:36px;border-radius:5px;border:1px solid var(--rule);
  background:var(--panel);color:var(--ink);font:600 15px/1 system-ui,sans-serif;
  cursor:pointer;
}
#controls button:hover{background:#1d252d;border-color:#3d4a55}
#controls button:focus-visible{outline:2px solid var(--gold);outline-offset:1px}
#controls #fit{font-size:12px;letter-spacing:.03em}

/* BELOW the view bar. At top:12px it sat exactly under #views, which has an
   opaque background and a higher z-index, so the search box was invisible from
   the moment the view bar was added. */
#search{position:absolute;top:58px;left:12px;width:min(268px,calc(100% - 84px));z-index:2}
#q{
  width:100%;padding:8px 11px;border-radius:5px;border:1px solid var(--rule);
  background:var(--panel);color:var(--ink);font:inherit;
}
#q:focus-visible{outline:2px solid var(--gold);outline-offset:1px}
#results{
  margin-top:4px;max-height:min(46vh,300px);overflow-y:auto;
  background:var(--panel);border:1px solid var(--rule);border-radius:5px;
}
#results[hidden]{display:none}
#results div{padding:7px 11px;cursor:pointer;border-bottom:1px solid #1e262e}
#results div:last-child{border-bottom:0}
#results div:hover,#results div.on{background:#232c35;color:var(--gold)}

/* -------------------------------------------------------------- the detail */
#info{
  /* over the region list, which is painted later in the document and would
     otherwise cover the panel it is meant to sit beside */
  position:absolute;left:12px;bottom:12px;z-index:2;width:min(320px,calc(100% - 24px));
  max-height:min(58%,420px);overflow-y:auto;
  background:var(--panel);border:1px solid var(--rule);border-radius:6px;
  padding:14px 16px 16px;
}
#info[hidden]{display:none}
#info h2{margin:0 6px 4px 0;font-size:16px;font-weight:600;line-height:1.3}
#info p{margin:0 0 10px;color:var(--muted);font-size:12.5px}
/* Bigger and red, because it was the ONLY way to drop a selection and it read
   as decoration. Clicking empty map does it too now, but this is the one a
   reader can see. z-index over the sticky action row below it. */
#close{
  position:absolute;top:8px;right:8px;width:34px;height:34px;z-index:3;
  border:1px solid #6d2725;border-radius:6px;background:#2a1513;color:#ff8a80;
  /* a flex box, because a button's own text centring puts the glyph low and
     left of a box this size: the default padding is not symmetric and
     line-height:1 on a 24px glyph leaves the descender space at the bottom */
  display:flex;align-items:center;justify-content:center;padding:0;
  font:400 26px/1 system-ui,-apple-system,"Segoe UI",sans-serif;cursor:pointer;
}
#close:hover{background:#4a1f1c;border-color:#b3453f;color:#fff}
#close:focus-visible{outline:2px solid var(--gold);outline-offset:1px}

.giver{padding:5px 0;border-top:1px solid #1e262e;font-size:13px}
.giver:first-of-type{border-top:0}
.giver .qs{color:var(--muted);font-size:11.5px;margin-left:6px}
.ghead{
  color:var(--muted);font-size:11px;letter-spacing:.06em;
  text-transform:uppercase;margin:2px 0 3px;
}

#hint{
  position:absolute;left:12px;bottom:12px;margin:0;
  color:var(--muted);font-size:11.5px;pointer-events:none;
}
#info:not([hidden]) ~ #hint{display:none}

@media (max-width:560px){
  #app{height:min(70vh,560px)}
  #hint{display:none}
  #info{left:8px;right:8px;width:auto}
}

/* ---- the view bar and the filters -------------------------------------- */
/* Both float over the canvas like #controls and #search already do, so the map
   keeps the whole box and nothing steals height from it. */
#views, #filters{
  position:absolute; z-index:2; display:flex; gap:6px; align-items:center;
  background:rgba(10,14,18,.82); padding:6px 8px; border-radius:8px;
  backdrop-filter:blur(3px);
}
#views{ top:10px; left:10px; }
#filters{ top:10px; left:50%; transform:translateX(-50%); font-size:12px; }

#views button{
  background:#1a222c; color:#dce3ea; border:1px solid #2c3742;
  border-radius:6px; padding:5px 11px; font:inherit; font-size:13px; cursor:pointer;
}
#views button:hover:not(:disabled){ background:#243040; }
#views button.on{ border-color:#ffd666; color:#ffd666; }
#views button:disabled{ opacity:.38; cursor:default; }

#filters label{ display:flex; align-items:center; gap:4px; color:#c6d0da; cursor:pointer; }
#filters input{ accent-color:#ffd666; }
#filters select{
  background:#1a222c; color:#dce3ea; border:1px solid #2c3742;
  border-radius:6px; padding:3px 6px; font:inherit; font-size:12px;
}
#filters :disabled{ opacity:.38; cursor:default; }

/* ---- the panel's new sections ------------------------------------------ */
#igivers .lnk{
  padding:3px 6px; border-radius:5px; cursor:pointer; color:#cfe0f2;
  display:flex; justify-content:space-between; gap:8px;
}
#igivers .lnk:hover{ background:#1d2833; color:#fff; }
#igivers .acts{ display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }
#igivers .acts button{
  flex:1 1 auto; background:#1a222c; color:#dce3ea; border:1px solid #2c3742;
  border-radius:6px; padding:6px 10px; font:inherit; font-size:12px; cursor:pointer;
}
#igivers .acts button:hover{ background:#243040; border-color:#ffd666; color:#ffd666; }

#results .qs{ opacity:.55; margin-left:8px; font-size:11px; }

/* At phone width the two floating bars would collide, so they stack and the
   filters give up their centring. */
@media (max-width:760px){
  #filters{ top:52px; left:10px; transform:none; flex-wrap:wrap; max-width:calc(100% - 20px); }
  #search{ top:100px; }
}

/* ---- the guide ---------------------------------------------------------- */
#helpbox{
  position:absolute; z-index:4; top:58px; left:50%; transform:translateX(-50%);
  width:min(560px,calc(100% - 40px)); max-height:min(72vh,640px); overflow-y:auto;
  background:rgba(12,16,21,.97); border:1px solid var(--rule); border-radius:8px;
  padding:16px 20px 20px; color:var(--ink); line-height:1.5;
}
#helpbox h2{ margin:0 0 4px; font-size:17px; color:var(--gold); }
#helpbox h3{ margin:16px 0 3px; font-size:13px; color:#dce3ea; }
#helpbox p{ margin:0; font-size:13px; color:#aeb9c4; }
#helpbox #helpclose{
  float:right; background:none; border:0; color:var(--ink);
  font-size:22px; line-height:1; cursor:pointer; padding:0 2px;
}
#controls #help{ font-size:17px; }

@media (max-width:760px){
  #search{ top:150px; }
  #helpbox{ top:150px; }
}

/* ---- the action row stays put ------------------------------------------- */
/* The buttons are the reason the panel is open. Under a long giver list and a
   dozen connections they scrolled out of reach, so they sit at the top and
   stick there while the detail below them scrolls. */
#igivers .acts.sticky{
  position:sticky; top:0; z-index:2; margin:0 0 10px;
  padding:8px 34px 8px 0; background:var(--panel);
  border-bottom:1px solid #1e262e;
}

/* ---- the region list ---------------------------------------------------- */
/* It covers the map rather than filtering it, because it answers a different
   question: what is inside this place. Same as the in-game Region View. */
#region{
  /* clear of the view bar AND the search box, both of which float above it */
  position:absolute; inset:100px 12px 12px 12px; z-index:1; overflow-y:auto;
  background:rgba(11,14,18,.96); border:1px solid var(--rule); border-radius:8px;
  padding:14px 16px 16px;
}
#region[hidden]{ display:none }
#region h3{ margin:0 0 10px; font-size:14px; color:var(--gold); font-weight:600 }
#region .cards{ display:flex; flex-wrap:wrap; gap:8px }
#region .card{
  display:flex; flex-direction:column; gap:2px; align-items:flex-start;
  width:190px; padding:8px 10px; text-align:left; cursor:pointer;
  background:#151c24; color:#dce3ea; border:1px solid #2c3742; border-radius:6px;
  font:inherit;
}
#region .card:hover{ background:#22303d; border-color:#3d4a55 }
#region .card.on{ border-color:var(--gold); color:var(--gold) }
#region .card .nm{ font-size:13px; line-height:1.3 }
#region .card .sub{ font-size:11px; color:var(--muted) }
#region .card.on .sub{ color:#c9a95e }

/* the map fills the box, so the list has to leave room for the panel on top
   of it at phone width rather than sitting under it */
@media (max-width:760px){
  #region{ inset:196px 8px 8px 8px }
  #region .card{ width:calc(50% - 4px) }
}

/* ---- the route's two ends ------------------------------------------------ */
/* Steps are hops, and a hop means nothing until you know what it leaves from. */
#igivers .fromto{
  margin:2px 0 6px; color:#cfe0f2; font-size:12px;
}

/* a restriction is worth noticing, so it is not the same grey as the rest */
#igivers .qs.warn{ color:#ffb36b; }
#igivers .note{
  margin:4px 0 6px; padding:6px 8px; border-radius:5px;
  background:#2a2216; color:#e8c48d; font-size:11.5px; line-height:1.4;
}