:root {
  --gold: #c9a44a; --goal: #5fae6b; --pin: #e8c25a; --danger: #c2603f;
  --shl: #6fa8d6; --shr: #d6a96f; --bg: #1a1916; --panel: #1b1a17; --line: #2c2a26;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: radial-gradient(120% 100% at 50% 0%, #232019 0%, #141310 70%);
  color: #d8d4cc; font: 14px/1.5 -apple-system, Segoe UI, Roboto, sans-serif; min-height: 100vh;
}
.site-header { position: relative; text-align: center; padding: 18px 0 6px; }
/* Mirror the .ap-bar rail (max-width 720, centered) so the star's right edge
   tracks the 'Start over' button at every viewport width. */
.site-star {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  width: min(720px, 100% - 36px);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  line-height: 0; pointer-events: none;
}
.site-star .gh-mark, .site-star .github-button, .site-star iframe { pointer-events: auto; }
.gh-mark { display: inline-flex; color: #8a8378; transition: color 0.15s; }
.gh-mark:hover { color: var(--gold); }
.site-header h1 {
  font-size: 22px; letter-spacing: 3px; text-transform: uppercase; color: #f0e2c6;
  margin: 0; font-weight: 700;
}
.site-header .sub { color: #8a8378; font-size: 12px; letter-spacing: 1px; }
#app { max-width: 920px; margin: 0 auto; padding: 14px 18px 40px; }
.site-footer {
  max-width: 920px; margin: 0 auto; padding: 18px 18px 28px; text-align: center;
  border-top: 1px solid var(--line); color: #6f6a60; font-size: 11px; line-height: 1.6;
}
.site-footer span { display: block; }

/* ---- stage rail ---- */
.ap-rail { display: flex; gap: 7px; font-size: 12px; margin: 4px 0 16px; justify-content: center; }
.ap-rail span { padding: 4px 13px; border-radius: 13px; border: 1px solid var(--line); color: #777; }
.ap-rail span.done { color: var(--goal); border-color: #2f5c37; }
.ap-rail span.active { color: #15120c; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.ap-rail span.nav { cursor: pointer; }
.ap-rail span.nav:hover { color: #eee; border-color: var(--gold); }
.ap-bar { position: relative; display: flex; justify-content: center; max-width: 720px; margin: 4px auto 16px; }
.ap-bar .ap-rail { margin: 0; }
.ap-reset { position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-size: 12px; padding: 4px 11px; border-radius: 6px; border: 1px solid #3a3833; background: #221f1b; color: #b9b3a6; cursor: pointer; }
.ap-reset:hover { color: #eee; border-color: #555; }
/* Mirror of .ap-reset, pinned to the left edge of the bar at the same height. */
.ap-changelog { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 12px; padding: 4px 11px; border-radius: 6px; border: 1px solid #3a3833; background: #221f1b; color: #b9b3a6; cursor: pointer; }
.ap-changelog:hover { color: #eee; border-color: #555; }
/* "New" pill on the Changelog button when there are unseen changelog entries. */
.ap-badge-new { margin-left: 6px; padding: 1px 5px; border-radius: 7px; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; background: var(--shr); color: #1a1916; vertical-align: 1px; }

/* ---- changelog modal ---- */
.cl-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(8, 7, 5, 0.66); overflow-y: auto; }
.cl-modal { position: relative; width: 100%; max-width: 540px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px 24px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
.cl-modal h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: 2px; text-transform: uppercase; color: #f0e2c6; }
.cl-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border: 1px solid #3a3833; border-radius: 6px; background: #221f1b; color: #b9b3a6; cursor: pointer; font-size: 13px; line-height: 1; }
.cl-close:hover { color: #eee; border-color: #555; }
.cl-entry { margin-top: 16px; }
.cl-entry:first-of-type { margin-top: 0; }
.cl-entry h3 { margin: 0 0 6px; font-size: 12px; color: var(--gold); letter-spacing: 1px; }
.cl-entry ul { margin: 0; padding-left: 18px; }
.cl-entry li { margin: 4px 0; color: #cfc9bd; }
.lock-name-input { width: 100%; max-width: 300px; padding: 7px 10px; background: #141310; border: 1px solid #3a3833; border-radius: 6px; color: #e8e2d6; font-size: 13px; }
.lock-name-input::placeholder { color: #6b665c; }
.fill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.loc-fill { font-size: 11px; padding: 4px 10px; }
.kind-row { display: flex; gap: 16px; }
.kind-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #cdc; cursor: pointer; }
.kind-opt input { accent-color: var(--gold); }

/* ---- layout ---- */
.ap-main { display: flex; gap: 16px; align-items: flex-start; max-width: 720px; margin: 0 auto; }
.ap-board { flex: 0 0 auto; } /* board keeps its natural width on the left */
.ap-side { flex: 1 1 auto; min-width: 300px; } /* panel grows to the shared right edge */
.ap-locktitle { text-align: center; color: var(--gold); font-size: 14px; letter-spacing: 1px; margin: -6px 0 12px; }
.lock-intro { text-align: center; color: #8a8378; font-size: 13px; margin: 0 0 12px; }
.lock-col { flex: 1 1 0; min-width: 280px; }
.ap-footer { display: flex; align-items: center; justify-content: center; margin-top: 34px; }
.ap-kbd { font-size: 11px; color: #6b665c; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; user-select: none; }
.ap-kbd input { cursor: pointer; accent-color: var(--gold); }
.ap-kbd-tip { position: relative; border-bottom: 1px dotted #6b665c; cursor: help; }
.ap-kbd-tip::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  white-space: pre; text-align: left; font-size: 11px; line-height: 1.7; color: #cfcabd;
  background: #1b1a18; border: 1px solid var(--line); border-radius: 7px; padding: 8px 11px;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5;
}
.ap-kbd-tip:hover::after { opacity: 1; }
@media (max-width: 760px) { .ap-main { flex-direction: column; } }

.ap-boardtop { display: flex; justify-content: flex-end; min-height: 24px; }
.ap-toggle { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #aaa; cursor: pointer; }
.ap-toggle input { width: 15px; height: 15px; accent-color: var(--gold); }

/* ---- board: 3D ---- */
.tp-view2d { display: none; }
.tp.basic .tp-view3d { display: none; }
.tp.basic .tp-view2d { display: block; }
.tp-stage { position: relative; margin: 0 auto; perspective: 1100px; }
.tp-plate {
  position: absolute; left: 120px; top: 150px; display: flex; gap: 8px; padding: 10px 12px;
  border-radius: 6px; transform-style: preserve-3d;
  background: linear-gradient(160deg, #6a6e74, #4a4d52 45%, #3a3d42); border: 1px solid #0d0d0e;
  box-shadow: 0 16px 0 -1px #1b1c20, 0 26px 22px -6px rgba(0,0,0,.6), inset 0 1px 0 #868a90;
}
.tp-plate.probe { box-shadow: 0 0 0 2px var(--gold), 0 16px 0 -1px #1b1c20, 0 26px 22px -6px rgba(0,0,0,.6); }
.tp-plate.dim { opacity: .5; }
.tp-plate.selectable { cursor: pointer; }
.tp-hole {
  position: relative; width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #1f2125, #08090b); box-shadow: inset 0 2px 3px #000;
}
.tp-hole.goal::after {
  content: ""; position: absolute; top: -5px; left: -5px; right: -5px; bottom: -5px;
  border: 1.5px dashed var(--gold); border-radius: 4px;
}
.tp-hole.pin::before {
  content: ""; position: absolute; inset: 1px; border-radius: 50%; transform: translateZ(12px);
  background: radial-gradient(circle at 38% 30%, #ffe9a6, #c68f2c);
  box-shadow: 0 0 8px 3px rgba(232,194,90,.55), 0 3px 4px rgba(0,0,0,.5);
}
.tp-hole.pin.goal::before {
  background: radial-gradient(circle at 38% 30%, #b9f0bf, #3e8a4a);
  box-shadow: 0 0 9px 3px rgba(95,174,107,.55);
}
.tp-flatlabel {
  position: absolute; left: 0; width: 110px; text-align: right; font-size: 12px; color: #cfcfcf;
  white-space: nowrap; line-height: 18px;
}
.tp-flatlabel b { color: var(--gold); }
.tp-flatlabel.on, .tp-flatlabel.on b { color: #fff; }
.tp-flatlabel .ok { color: var(--goal); }
.tp-flatlabel .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 5px; vertical-align: middle; background: #777; }
.tp-flatlabel .dot.pin { background: var(--pin); }
.tp-flatlabel .dot.ok { background: var(--goal); }

/* ---- board: 2D — offset slides on a 13-col field ---- */
.tp-2d {
  --hole: 15px; --colgap: 4px; --label-w: 62px; --row-gap: 10px;
  position: relative; max-width: 640px; margin: 0 auto;
}
.tp-2drow { display: flex; align-items: center; gap: var(--row-gap); margin: 6px 0; justify-content: flex-start; }
.tp-2drow.selectable { cursor: pointer; }
/* nowrap: a previewed move renders as "P1 · 3→4", which must stay on one line —
   a wrapped label changes the row height and misaligns the board. --label-w is
   sized to fit that longest form. */
.tp-2dlabel { width: var(--label-w); text-align: right; font-size: 12px; color: #cfcfcf; white-space: nowrap; }
.tp-2dlabel b { color: var(--gold); }
.tp-2dlabel b.done { color: var(--goal); }

/* the 13-column field a slide rides in */
.tp-field {
  position: relative; display: grid; column-gap: var(--colgap);
  grid-template-columns: repeat(13, var(--hole)); align-items: center;
  height: calc(var(--hole) + 12px);
}
/* the sliding plate body behind its 7 holes (placed via grid-column in JS) */
.tp-tray {
  grid-row: 1; align-self: stretch; margin: 1px -5px; border-radius: 5px;
  background: linear-gradient(180deg, #46494e, #2a2c30); border: 1px solid #000;
  box-shadow: inset 0 1px 0 #62666c;
}
.tp-tray.sel  { background: linear-gradient(180deg, #5a4f2e, #352d18); box-shadow: inset 0 1px 0 #8a7a45, 0 0 0 2px var(--gold); }
.tp-tray.next { box-shadow: inset 0 1px 0 #62666c, 0 0 0 2px var(--gold); }
/* faint "where it is now" marker drawn behind the solid slide while recording a move */
.tp-tray.ghost { background: none; border: 1px dashed var(--gold); opacity: .5; box-shadow: none; pointer-events: none; }
/* a previewed move that would push this slide past the edge: pinned at the edge, marked as a jam */
.tp-tray.jam { box-shadow: inset 0 1px 0 #6c4a40, 0 0 0 2px var(--danger); }
/* holes carried by the slide (placed via grid-column in JS) */
.tp-hole2 {
  grid-row: 1; z-index: 2; width: var(--hole); height: var(--hole); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #1f2125, #08090b); box-shadow: inset 0 2px 3px #000;
}
.tp-hole2.pin { background: radial-gradient(circle at 40% 35%, #f4d878, #b8862f); box-shadow: 0 0 7px 2px rgba(232,194,90,.6); }
.tp-hole2.pin.ok { background: radial-gradient(circle at 40% 35%, #9ee6a6, #3e8a4a); }
/* while a slide is being dragged, show the grabbing cursor everywhere */
body.tp-dragging, body.tp-dragging * { cursor: grabbing !important; }
/* single dashed keyway box over column 7, spanning all rows */
.tp-keybox {
  position: absolute; top: 2px; bottom: 2px; z-index: 4; pointer-events: none;
  left: calc(var(--label-w) + var(--row-gap) + 6 * (var(--hole) + var(--colgap)) - 4px);
  width: calc(var(--hole) + 8px); border: 1.5px dashed var(--gold); border-radius: 6px;
}

/* ---- panel cards ---- */
.ap-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 14px 15px; margin-bottom: 12px; }
.ap-h { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: #888; margin-bottom: 9px; }
.muted { color: #777; font-size: 12px; }
.ap-btn {
  font-size: 13px; padding: 8px 16px; border-radius: 6px; border: 1px solid #3a3833;
  background: #26241f; color: #cdb; cursor: pointer; display: inline-block; margin: 2px 2px 0 0;
}
.ap-btn:hover { background: #302d26; }
.ap-btn.primary { background: var(--gold); color: #15120c; border-color: var(--gold); font-weight: 600; }
.ap-btn[disabled] { opacity: .4; cursor: not-allowed; }
.badge { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 11px; border: 1px solid; margin-left: 6px; }
.badge.safe { color: var(--goal); border-color: #2f5c37; background: #16271a; }
.badge.risk { color: var(--danger); border-color: #5c2f24; background: #271816; }

/* ---- setup ---- */
.cnt { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cnt .num { font-size: 22px; color: #fff; font-weight: 700; width: 26px; text-align: center; }
.step { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #3a3833; background: #26241f; color: #cdb; font-size: 16px; cursor: pointer; }
.prow { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.prow .pl { width: 30px; color: var(--gold); font-size: 13px; }
.scale { display: flex; gap: 4px; }
.sc { width: 20px; height: 20px; border-radius: 4px; border: 1px solid #333; font-size: 11px; color: #888; display: flex; align-items: center; justify-content: center; cursor: pointer; background: #201f1b; }
.sc.cur { background: #3a2f12; border-color: var(--gold); color: var(--gold); font-weight: 700; }
.sc.goal { outline: 1px dashed #5c5026; }
.lock-list { display: flex; flex-direction: column; gap: 6px; }
.lock-row { display: flex; flex-direction: column; gap: 6px; }
.lock-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.lock-acts { display: flex; align-items: center; gap: 10px; }
.lock-item .x { cursor: pointer; color: #a55; }
.lock-item .io { cursor: pointer; color: #8a9; font-size: 15px; }
.lock-item .io:hover { color: var(--gold); }
/* Loot summary: kept out of sight to avoid crowding the list — revealed on row hover. */
.lock-contents { display: none; padding: 1px 9px 2px; font-size: 12px; }
.lock-row:hover .lock-contents { display: block; }

/* ---- saved-lock folder headers ---- */
.lock-folder { margin-bottom: 6px; }

.lock-folder-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
}
.lock-folder-h:hover { background: rgba(255, 255, 255, 0.05); }

.lf-caret { width: 1em; color: #8a8378; font-size: 0.85em; }
.lf-label { font-weight: 600; }
.lf-count {
  margin-left: auto;
  color: #8a8378;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

/* Inset the rows so they read as belonging to the folder above them. */
.lock-folder .lock-list { margin-left: 10px; }

/* ---- saved-lock contents search ---- */
.lock-search { position: relative; margin-bottom: 10px; }
.ls-input {
  width: 100%; box-sizing: border-box; padding: 7px 28px 7px 10px;
  background: #141310; border: 1px solid #3a3833; border-radius: 6px;
  color: #e8e2d6; font-size: 13px;
}
.ls-input:focus { outline: none; border-color: var(--gold); }
.ls-clear {
  position: absolute; right: 8px; top: 7px; cursor: pointer; color: #8a8378;
  font-size: 13px; user-select: none;
}
.ls-clear:hover { color: var(--gold); }
.ls-clear.hidden { display: none; }
.ls-suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  margin-top: 2px; overflow: hidden;
}
.ls-suggest:empty { display: none; }
.ls-opt { padding: 6px 10px; font-size: 13px; cursor: pointer; }
.ls-opt:hover, .ls-opt.sel { background: rgba(255, 255, 255, 0.07); color: var(--gold); }

/* ---- contents (loot) editor ---- */
.contents-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.ct-row { display: flex; align-items: center; gap: 6px; }
.ct-item { flex: 1; min-width: 0; padding: 7px 10px; background: #141310; border: 1px solid #3a3833; border-radius: 6px; color: #e8e2d6; font-size: 13px; }
.ct-item::placeholder { color: #6b665c; }
.ct-qty { width: 60px; flex: none; padding: 7px 8px; background: #141310; border: 1px solid #3a3833; border-radius: 6px; color: #e8e2d6; font-size: 13px; text-align: center; }
.ct-del { width: 30px; height: 30px; flex: none; border-radius: 6px; border: 1px solid #3a3833; background: #26241f; color: #a55; font-size: 13px; cursor: pointer; }
.ct-del:hover { border-color: #a55; }
.ct-add { align-self: flex-start; margin-top: 2px; }

/* ---- import / export ---- */
.lock-io { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.import-col { max-width: 640px; margin: 0 auto; }
.share-panel { padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: #16140f; }
.share-code { width: 100%; box-sizing: border-box; padding: 7px 9px; background: #141310; border: 1px solid #3a3833; border-radius: 6px; color: #cdb; font-family: ui-monospace, Menlo, monospace; font-size: 11px; resize: vertical; }
.share-copied { margin-left: 8px; }
.cf-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.cf-side { font-size: 12px; }
.cf-tag { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #777; margin-bottom: 2px; }
.cf-name { color: #e8e2d6; font-size: 13px; }
.cf-choice { display: flex; flex-direction: column; gap: 4px; }
.seg-opt { padding: 4px 10px; font-size: 12px; color: #888; cursor: pointer; border: 1px solid #333; border-radius: 6px; text-align: center; white-space: nowrap; }
.seg-opt.on { background: #23394a; border-color: #34526a; color: var(--shl); font-weight: 600; }

/* ---- discovery ---- */
.note { font-size: 11.5px; color: #9a9488; background: #1f1d18; border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: 5px; padding: 8px 10px; margin-top: 10px; line-height: 1.5; }
/* ---- solve ---- */
.ap-nm-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #888; }
.ap-nm { font-size: 27px; font-weight: 700; color: #fff; margin-top: 3px; }
.ap-nm .dir { color: var(--gold); }
.ap-nm-sub { font-size: 12px; color: #9a9; margin-top: 6px; }
.ap-steplist { font-size: 12px; color: #8a8a86; line-height: 1.7; max-height: 150px; overflow: auto; margin-top: 6px; }
.ap-steplist > div { cursor: pointer; padding: 1px 2px; border-radius: 4px; }
.ap-steplist > div:hover { background: #232220; }
.ap-steplist .cur { color: #fff; font-weight: 600; }
.ap-steplist .past { color: #5f6b60; }
.ap-steplist .step-arrow { color: var(--gold); font-weight: 700; }
.ap-steplist .past .step-arrow { color: #4f7a56; }
/* cycle indicators in the plan list — brackets enclose the run, ×N sits outside */
.ap-steplist > .cyc-group { display: flex; align-items: stretch; gap: 5px; padding: 0; margin: 3px 0; cursor: default; border-radius: 0; }
.ap-steplist > .cyc-group:hover { background: none; }
.cyc-rows { display: flex; flex-direction: column; align-items: flex-start; flex: 0 1 auto; min-width: 0; }
.cyc-rows > div { cursor: pointer; padding: 1px 2px; border-radius: 4px; white-space: nowrap; }
.cyc-rows > div:hover { background: #232220; }
.cyc-brace { flex: 0 0 6px; margin: 1px 0; border: 2px solid var(--gold); }
.cyc-brace.left { border-right: 0; border-radius: 3px 0 0 3px; }
.cyc-brace.right { border-left: 0; border-radius: 0 3px 3px 0; }
.cyc-count { flex: 0 0 auto; align-self: center; font-size: 11px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.ap-plan-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ap-collapse { font-size: 11px; color: #6b665c; text-transform: none; letter-spacing: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.ap-collapse input { accent-color: var(--gold); cursor: pointer; }
.ap-plan-h-r { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: 0 0 auto; }
.ap-fullplan { font-size: 11px; padding: 3px 9px; border-radius: 6px; border: 1px solid #3a3833; background: #221f1b; color: #b9b3a6; cursor: pointer; text-transform: none; letter-spacing: 0; }
.ap-fullplan:hover { color: #eee; border-color: #555; }
/* full-plan modal — reuses the .cl-overlay backdrop; the plan list grows to fill it */
.pm-modal { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 720px; max-height: 84vh; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
.pm-modal:focus { outline: none; } /* focused on open for a11y; no visible ring on the dialog container */
.pm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 34px 12px 0; }
.pm-head h2 { margin: 0; font-size: 16px; letter-spacing: 2px; text-transform: uppercase; color: #f0e2c6; }
.pm-steplist { position: relative; flex: 1 1 auto; min-height: 0; max-height: none; font-size: 14px; line-height: 1.95; overscroll-behavior: contain; column-fill: auto; }
/* When the plan spills into multiple columns (see layoutPlanColumns), keep each step
   row and each bracketed cycle whole rather than splitting it across a column break. */
.pm-steplist > div, .pm-steplist > .cyc-group { break-inside: avoid; }
.cpl-card { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-bottom: 1px solid #232220; font-size: 12px; }
.cpl-card:last-child { border-bottom: 0; }
.cpl-card .mv { width: 86px; color: #cdc; }
.cpl-card .mv b { color: var(--gold); }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 9px; border: 1px solid #333; color: #999;
        margin-right: 4px; white-space: nowrap; display: inline-block; margin-bottom: 2px; }
.chip.left { color: var(--shl); border-color: #34526a; }
.chip.right { color: var(--shr); border-color: #6a5634; }
.ap-legend { font-size: 11px; color: #777; margin-top: 8px; }
.ap-legend .left { color: var(--shl); }
.ap-legend .right { color: var(--shr); }
.success { color: var(--goal); font-size: 20px; font-weight: 700; }

/* ===== flat board + unified mapping ===== */
.tp-2dright { margin-left: auto; flex: 0 0 auto; }
.map-wrap { max-width: 720px; margin: 0 auto; }

.ms-btns { display: flex; flex-wrap: wrap; gap: 6px; }

/* quiet text-style action for rare, destructive-ish operations */
.linklike { color: #6b665c; font-size: 11px; text-decoration: underline dotted; cursor: pointer; }
.linklike:hover { color: #a89; }

/* ---- mapping ledger: per-row symbol buttons under labeled column headers.
   Column widths live in vars so the header line and every row stay aligned —
   defined on .map-wrap because the header sits OUTSIDE the board element;
   the phone breakpoint shrinks them and hides the in-button words. ---- */
.map-wrap { --led-tag: 158px; --led-move: 62px; }
.ledger-head { display: flex; justify-content: flex-end; gap: 8px; max-width: 640px; margin: 0 auto -2px; }
.ledger-head span { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #776f5e; text-align: center; }
.ledger-head .lh-tag { width: var(--led-tag); }
.ledger-head .lh-move { width: var(--led-move); }
.led-row { display: inline-flex; gap: 8px; align-items: center; }
.led-group { display: inline-flex; gap: 3px; width: var(--led-tag); justify-content: center; align-items: center; }
.led-group.move { width: var(--led-move); }
.led-btn { font-size: 12px; padding: 3px 8px; border: 1px solid #3a3833; border-radius: 5px; background: #26241f;
           color: #999; cursor: pointer; display: inline-block; white-space: nowrap; line-height: 1.4; }
.led-btn:hover { border-color: #555; }
.led-btn.on-with { color: var(--goal); border-color: #2f5c37; }
.led-btn.on-opp { color: var(--danger); border-color: #5c2f24; }
.led-btn.on-wig { color: var(--gold); border-color: #6b5a2b; }
.led-btn.dis { opacity: 0.25; cursor: default; pointer-events: none; }
/* the repositioning plan's next move, lit up right in the grid */
@keyframes plan-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--gold), 0 0 3px #c9a44a44; }
  50% { box-shadow: 0 0 0 1px var(--gold), 0 0 9px #c9a44a88; }
}
.led-btn.plan-next { color: var(--gold); border-color: var(--gold); animation: plan-pulse 1.6s ease-in-out infinite; }
@media (max-width: 560px) {
  .map-wrap { --led-tag: 62px; --led-move: 58px; }
  .led-btn .led-word { display: none; }
  .led-btn { padding: 3px 7px; }
}

.self-note { font-size: 12px; color: #8a8378; font-style: italic; border: 1px dashed #3a3833; border-radius: 6px; padding: 5px 12px; white-space: nowrap; }

.chip.with { color: var(--goal); border-color: #2f5c37; }
.chip.opp { color: var(--danger); border-color: #5c2f24; }

/* ---- phones: keep the mapping row (board + Moves with/opposite) on-screen ---- */
@media (max-width: 560px) {
  /* tighter board so the 13-col field leaves room for the rel controls */
  .tp-2d { --hole: 11px; --colgap: 2px; --label-w: 48px; --row-gap: 7px; }
  .tp-2dlabel { font-size: 11px; }
  /* stack each plate's two buttons into a narrow right-hand column that can shrink/wrap */
  .tp-2dright { flex: 0 1 auto; min-width: 0; }
  .self-note { white-space: normal; }
  /* no physical keyboard on phones — hide the shortcuts toggle (also disabled in JS) */
  .ap-footer { display: none; }

  /* header: the centered title spans the full width on phones, so the absolutely
     positioned GitHub widget landed on top of it. Drop both into a flex column and
     float the widget above the title on its own line. */
  .site-header { display: flex; flex-direction: column; padding-top: 12px; }
  .site-star { position: static; transform: none; width: auto; order: -1; align-self: flex-end; margin: 0 14px 6px 0; }
  .site-header h1 { font-size: 19px; letter-spacing: 2px; }

  /* stage rail: 'Start over' was absolutely pinned right and overlapped the last
     stage pill. Stack it under the (wrappable) rail instead. */
  .ap-bar { flex-direction: column; align-items: center; gap: 9px; }
  .ap-rail { flex-wrap: wrap; }
  .ap-reset, .ap-changelog { position: static; transform: none; }
}
