/* Tooltips and the Guide (js/help/). Tokens only. The Guide is a column beside .app (body becomes a row while it's
   open) or a 40px strip under it; .app keeps its own grids, just in less room. */
:root { --guide-w: 300px; --gstrip-h: 40px; }

/* ── tooltip ── */
.tipx { position: fixed; z-index: 50; max-width: 280px; background: var(--menu-bg); color: var(--text); border: 1px solid var(--edge2); border-radius: var(--r-m);
  padding: 6px 10px 7px; font-size: var(--fs-s); line-height: 1.45; box-shadow: var(--shadow-menu); animation: tipin var(--t-fast) var(--ease); }
.tipx[hidden] { display: none; }
.tipx .t { display: flex; align-items: center; gap: 10px; color: var(--bright); font-size: var(--fs); font-weight: var(--fw-on); }
.tipx.plain .t { font-weight: 400; color: var(--text); font-size: var(--fs-s); }
.tipx .k { margin-left: auto; display: flex; gap: 3px; flex: none; }
.tipx .d { color: var(--dim); margin-top: 2px; }
@keyframes tipin { from { opacity: 0; transform: translateY(-2px); } }
.tipx kbd, .guide kbd, .gstrip kbd { font: 500 var(--fs-xs) var(--mono); color: var(--bright); background: var(--key); border-radius: var(--r-s); padding: 1px 5px;
  box-shadow: inset 0 1px 0 var(--key-hi), 0 1px 0 var(--groove); white-space: nowrap; }

/* ── the column ── */
.guide, .gstrip, .gedge { display: none; }
body.guide-open { display: flex; }
body.guide-open > .app { flex: 1; min-width: 0; }
body.guide-open .guide { display: flex; }
body.guide-open .gedge { display: block; }
.guide { width: var(--guide-w); flex: none; height: 100vh; box-sizing: border-box; flex-direction: column; position: relative; z-index: 21;
  background: var(--body); color: var(--text); font-size: var(--fs); user-select: text; -webkit-user-select: text; }
.gedge { width: var(--gutter); flex: none; height: 100vh; background: var(--groove); cursor: col-resize; position: relative; z-index: 21; }
.gedge:hover { background: var(--blue-dim); }
/* two rows like the bar (nav.css): the Guide's keys on the nav row, phase › step on the steps row */
.guide .gbar { height: var(--bar-h); flex: none; display: grid; grid-template-rows: var(--nav-h, var(--bar-h)) var(--steps-h, 0); background: var(--body-lo); border-bottom: var(--gutter) solid var(--groove); }
.guide .grow { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; min-width: 0; }
.guide .gcrumb { color: var(--dim); font-size: var(--fs-s); border-top: 1px solid var(--row-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide .gbar b { font-weight: var(--fw-on); color: var(--bright); }
.gsp { flex: 1; }
.guide .gbody { flex: 1; overflow: auto; }
.gbtn { background: none; border: 0; color: var(--dim); font: inherit; cursor: pointer; padding: 4px 7px; border-radius: var(--r-s); }
.gbtn:hover, .gbtn.on { color: var(--bright); background: var(--hover); }
.guide .led, .gstrip .led { width: 6px; height: 6px; border-radius: 50%; flex: none; display: inline-block; }
.led.hot { background: var(--hot); box-shadow: 0 0 6px var(--hot-glow); }
.led.blue { background: var(--blue); box-shadow: 0 0 6px var(--blue); }
.guide .gsec { padding: 14px 14px 12px; border-bottom: 1px solid var(--row-line2); }
.guide .glbl { color: var(--dim); font-size: var(--fs-s); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.guide .glbl .gsp { flex: 1; } .guide .glbl span.gsp { text-align: right; color: var(--faint); }
.guide .gnext { margin-top: 10px; }
.guide h4 { margin: 0 0 4px; font-size: var(--fs-m); font-weight: var(--fw-on); color: var(--bright); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.guide p { margin: 0 0 8px; line-height: 1.55; }
.guide p.dim { color: var(--dim); font-size: var(--fs-s); }
.guide p.hint { color: var(--muted); font-size: var(--fs-s); }
.guide .here { color: var(--dim); font-size: var(--fs-s); margin-bottom: 8px; }
.guide .here b { color: var(--text); font-weight: 500; }
.guide .glist { display: grid; grid-template-columns: 100px 1fr; gap: 3px 10px; font-size: var(--fs-s); margin-bottom: 8px; }
.guide .next { display: flex; flex-direction: column; gap: 4px; }
.guide .next button { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; text-align: left; background: var(--panel2); border: 0; border-radius: var(--r-s);
  padding: 7px 9px; color: var(--text); font: inherit; cursor: pointer; box-shadow: inset 0 1px 0 var(--key-hi); transition: background var(--t-fast); }
.guide .next button:hover { background: var(--key-top); color: var(--bright); }
.ar { color: var(--hot); }
.guide .keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: baseline; font-size: var(--fs-s); }
.guide .keys .known { opacity: .45; }
.guide .gfoot { flex: none; padding: 9px 14px; color: var(--faint); font-size: var(--fs-s); border-top: 1px solid var(--row-line2); }
.guide .gfoot a { color: var(--dim); }
.guide :focus-visible, .gstrip :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* The bar (nav.css) centres the phases between two equal columns, which needs about 1240px. With the Guide open
   the bar is narrower than the window, so the viewport rules can't see it: size it by the bar's own width instead.
   Under 1260px the phases tighten (as nav.css does under 1100px); under 1180px they centre in the room between the
   two sides rather than on the bar, so they never run into the tools. */
body.guide-open > .app > .bar { container: cutbar / inline-size; }
@container cutbar (max-width: 1260px) {
  .bar .phases button { padding: 0 11px; }
  .bar .ws button[data-key]::after { display: none; }
}
@media (min-width: 821px) {  /* under 821px the bar stacks (nav.css) and the Guide is a sheet: this must not undo that */
  @container cutbar (max-width: 1180px) {
    .barrow { grid-template-columns: auto minmax(0, 1fr) auto; }
    .barrow .phases { justify-self: center; }
  }
}

/* dialogs, ⌘K and the first-run card centre in the room left of the Guide, so it never covers them */
body.guide-open > .modal, body.guide-open > .welcome, body.guide-open > .overlay { right: calc(var(--guide-w) + var(--gutter)); }
body.guide-strip > .modal, body.guide-strip > .welcome, body.guide-strip > .overlay { bottom: var(--gstrip-h); }

/* ── the strip (collapsed) ── */
body.guide-strip > .app { height: calc(100vh - var(--gstrip-h)); }
body.guide-strip .gstrip { display: flex; }
.gstrip { position: fixed; left: 0; right: 0; bottom: 0; height: var(--gstrip-h); z-index: 21; box-sizing: border-box; align-items: center; gap: 10px; padding: 0 8px 0 14px;
  background: var(--body-lo); border-top: var(--gutter) solid var(--groove); font-size: var(--fs); white-space: nowrap; overflow: hidden; }
.gstrip b { color: var(--bright); font-weight: var(--fw-on); }
.gstrip .dim { color: var(--dim); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gstrip .gfirst { background: none; border: 0; color: var(--dim); font: inherit; cursor: pointer; display: flex; gap: 6px; align-items: center; padding: 4px 8px; border-radius: var(--r-s); }
.gstrip .gfirst:hover { color: var(--bright); background: var(--hover); }

/* ── a phone: the Guide is a sheet over the bottom half, no strip ── */
@media (max-width: 820px) {
  body.guide-open { display: block; }
  body.guide-open .guide { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: 50vh; border-top: var(--gutter) solid var(--groove); box-shadow: var(--shadow-menu); }
  body.guide-open .gedge, body.guide-strip .gstrip { display: none; }
  body.guide-strip > .app { height: auto; }
  body.guide-open > .modal, body.guide-open > .welcome, body.guide-open > .overlay { right: 0; }
}
@media (prefers-reduced-motion: reduce) { .tipx { animation: none; } }
/* the keys list (now generated from topics.js) scrolls inside its dialog on short screens */
#modal .dlg .keys { max-height: calc(100vh - 190px); overflow: auto; }
