/* K13 The Hardest Ship (js/hardest13.js): the maze-dodging game on the workbench. Tokens come from css/site.css.
   The card, head, reset pill, status line and footnote reuse the .wb rules in css/workbench.css and the bench subgrid;
   this file only adds the stage (HUD strip on top, board in the middle, level picker underneath) and the panel. */
.h13-stage{display:flex;flex-direction:column;padding:0;background:var(--paper-2);-webkit-user-select:none;user-select:none}

/* HUD: plain text chips above the board, so nothing ever covers a tile; the right side leaves room for the Restart pill */
.h13-top{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-height:54px;padding:10px 120px 10px 10px;background:var(--paper-2);border-bottom:1px solid var(--line)}
.h13-chip{font-family:var(--mono);font-size:11px;letter-spacing:.04em;line-height:1.4;color:var(--ink);background:var(--paper-3);border:1px solid var(--line-2);border-radius:100px;padding:3px 10px}
.h13-chip[hidden]{display:none}
.h13-deaths{color:var(--blue);border-color:var(--blue)}

/* the board keeps the level's own shape, 20 by 11 tiles */
.h13-view{position:relative;width:100%;aspect-ratio:20/11;background:var(--paper-3)}
.h13-cv{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
.h13-cv:focus-visible{outline:3px solid var(--blue);outline-offset:-4px}

/* level picker: thirteen real buttons, cleared ones filled */
.h13-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:10px 12px;background:var(--paper-2);border-top:1px solid var(--line)}
.h13-lab{font-family:var(--mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-right:4px}
.h13-lv{min-width:34px;height:34px;padding:0 6px;border-radius:100px;font-family:var(--mono);font-size:12px;color:var(--ink);background:var(--paper-3);border:1px solid var(--line-2);
  transition:color .3s var(--work,ease),border-color .3s var(--work,ease),background .3s var(--work,ease),transform .3s var(--pop)}
.h13-lv:hover:not(:disabled){color:var(--blue);border-color:var(--blue)}
.h13-lv:active:not(:disabled){transform:scale(.96)}
.h13-lv.done{background:var(--wash-mint)}
.h13-lv[aria-pressed="true"]{background:var(--ink);color:var(--paper-2);border-color:var(--ink)}
.h13-lv:disabled{opacity:.4;cursor:not-allowed}
.h13-lv:focus-visible,.h13-obtn:focus-visible{outline:2px solid var(--blue);outline-offset:3px}

/* the panel: level intro, paused, cleared, all thirteen shipped */
.h13-over{position:absolute;inset:0;z-index:5;display:grid;place-items:center;padding:12px;background:rgba(31,32,35,.42)}
.h13-over[hidden]{display:none}
.h13-panel{width:min(100%,380px);display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;padding:20px 20px 18px;border-radius:18px;
  background:var(--paper-2);color:var(--ink);border:1px solid var(--line);box-shadow:0 30px 70px -30px rgba(31,32,35,.6)}
.h13-over-t{font-family:var(--disp);font-weight:600;font-size:24px;line-height:1.15;letter-spacing:-.01em;color:var(--ink)}
.h13-over-s{font-size:14.5px;line-height:1.5;color:var(--muted)}
.h13-over-row{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:8px}
.h13-obtn{font-family:var(--body);font-weight:600;font-size:15px;min-height:44px;padding:0 22px;border-radius:100px;color:#fff;background:var(--blue);border:1.5px solid var(--blue);transition:background .3s var(--work,ease),transform .3s var(--pop)}
.h13-obtn:hover{background:var(--ink);border-color:var(--ink)}
.h13-obtn.ghost{color:var(--ink);background:transparent;border-color:var(--line-3)}
.h13-obtn.ghost:hover{color:var(--blue);background:transparent;border-color:var(--blue)}
:root[data-theme="dark"] .h13-obtn:not(.ghost){color:#1A1B1E}
:root[data-theme="dark"] .h13-obtn:not(.ghost):hover{background:var(--blue-2);border-color:var(--blue-2)}
:root[data-theme="dark"] .h13-over{background:rgba(10,10,12,.55)}

@media(prefers-reduced-motion:no-preference){
  .h13-panel{animation:h13-rise .45s var(--ease) both}
}
@keyframes h13-rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){
  .h13-lv,.h13-obtn{transition:none}
  .h13-lv:active:not(:disabled){transform:none}
}

/* on a phone the board is small, so the panel tucks its copy in and the picker buttons stay 34px for a thumb */
@media(max-width:560px){
  .h13-top{padding:8px 104px 8px 8px;gap:4px;min-height:50px}
  .h13-chip{padding:2px 8px;font-size:10.5px}
  .h13-view{min-height:190px}
  .h13-panel{padding:14px 14px 12px;gap:4px}
  .h13-over-t{font-size:19px}
  .h13-over-s{font-size:13px}
  .h13-obtn{min-height:40px;font-size:14px;padding:0 18px}
  .h13-bar{padding:8px;gap:5px}
}
