/* ─────────────── Game tools, as a workbench (2026-10-13) ───────────────
   Rober: "def a lot better can you improve visually the game tools popout".
   The same "hearthside instrument panel" as the top bar (topbar.css): dark
   glass, the painted wood-and-brass icon set, ember for attention, green for
   live. Markup: renderer/index.html #hooker-panel (the head) and app.js
   paintHookerPanel (the body). Loaded after styles.css, whose older .hkp-*
   and .hk-* rules this refines rather than replaces. */

#hooker-panel {
  --gt-brass: 233, 198, 136;
  --gt-ember: 245, 158, 11;
  --gt-live: 52, 211, 153;
  --gt-alarm: 248, 113, 113;
  --gt-glass: rgba(255, 255, 255, .03);
  --gt-line: rgba(255, 255, 255, .075);
}
#hooker-panel .modal-panel.hooker-panel {
  width: min(1000px, 94vw);
  padding: 0;
  overflow: hidden auto;
  border: 1px solid rgba(var(--gt-brass), .22);
  background:
    radial-gradient(600px 220px at 12% 0%, rgba(var(--gt-ember), .09), transparent 70%),
    linear-gradient(180deg, rgba(22, 20, 24, .98), rgba(12, 13, 18, .98));
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .05);
}
#hooker-panel .detail-close { top: 18px; right: 18px; z-index: 2; }

/* ── The head ── */
.hkp-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 72px 20px 26px;
  border-bottom: 1px solid var(--gt-line);
}
.hkp-medal {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(var(--gt-brass), .2), rgba(0, 0, 0, .35) 70%);
  box-shadow: inset 0 0 0 1px rgba(var(--gt-brass), .45), inset 0 2px 6px rgba(0, 0, 0, .5), 0 6px 18px -8px rgba(0, 0, 0, .9);
}
.hkp-medal img { width: 40px; height: 40px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
/* The ring that says the state: a halo round the medallion. */
.hkp-medal::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.hkp-head[data-state="live"] .hkp-medal::after { border-color: rgba(var(--gt-live), .75); box-shadow: 0 0 18px rgba(var(--gt-live), .45); animation: gt-breathe 2.6s ease-in-out infinite; }
.hkp-head[data-state="running"] .hkp-medal::after { border-color: rgba(var(--gt-ember), .7); box-shadow: 0 0 14px rgba(var(--gt-ember), .35); }
.hkp-head[data-state="down"] .hkp-medal::after { border-color: rgba(var(--gt-alarm), .7); box-shadow: 0 0 14px rgba(var(--gt-alarm), .3); }
.hkp-head[data-state="down"] .hkp-medal img { filter: grayscale(.8) brightness(.75) drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
.hkp-head[data-state="idle"] .hkp-medal::after,
.hkp-head[data-state="setup"] .hkp-medal::after { border-color: rgba(var(--gt-brass), .18); }
@keyframes gt-breathe { 50% { box-shadow: 0 0 26px rgba(var(--gt-live), .7); } }

.hkp-head-text { min-width: 0; }
#hooker-panel .hkp-head h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.01em;
  color: #fff6e8;
}
.hkp-lede { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--text-dim); text-wrap: pretty; max-width: 62ch; }
#hooker-panel .hk-pill { font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px; text-transform: none; }

/* ── Body: the stage and events on the left, the bench on the right ── */
#hooker-panel .hkp-body { display: block; padding: 22px 26px 26px; }
.hkp-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr); gap: 22px; align-items: start; }
.hkp-main, .hkp-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hkp-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgb(var(--gt-brass));
}
.hkp-h .grow { flex: 1; }
.hkp-quiet { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-mute); text-wrap: pretty; }
.hkp-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(var(--gt-ember), .35);
  background: rgba(var(--gt-ember), .08);
  font-size: 13px;
  color: #fde7c0;
}

/* ── The stage ── */
.hkp-stage {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--gt-line);
  background: linear-gradient(160deg, rgba(var(--gt-brass), .06), rgba(0, 0, 0, .25) 60%), var(--gt-glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
/* The running game's own art, far behind, as light rather than a picture. */
.hkp-stage-art {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.3) brightness(.45);
  opacity: .7;
  pointer-events: none;
}
.hkp-stage.has-game::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10, 11, 15, .2), rgba(10, 11, 15, .75) 55%, rgba(10, 11, 15, .85));
  pointer-events: none;
}
.hkp-stage > * { position: relative; z-index: 1; }
.hkp-stage-row { display: flex; gap: 18px; align-items: flex-end; padding: 18px; }
.hkp-cover {
  flex: none;
  width: 112px;
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .9), 0 0 0 1px rgba(var(--gt-brass), .3);
}
.hkp-cover.is-blank { display: grid; place-items: center; background: rgba(0, 0, 0, .35); }
.hkp-stage.is-hooked .hkp-cover { box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .9), 0 0 0 1px rgba(var(--gt-live), .6), 0 0 22px -4px rgba(var(--gt-live), .5); }
.hkp-stage-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hkp-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(var(--gt-brass), .85); }
.hkp-now-title { margin: 0; font-size: 22px; font-weight: 750; line-height: 1.15; letter-spacing: -.015em; color: #fff9ee; text-wrap: balance; overflow-wrap: anywhere; }
.hkp-now-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.hkp-engine { padding: 2px 9px; border-radius: 6px; background: rgba(var(--gt-brass), .12); color: #f3dfbd; font-weight: 650; }
.hkp-ver { font-variant-numeric: tabular-nums; }
.hkp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hkp-actions .btn { min-height: 34px; }

/* Live state as instrument tiles under the game. */
#hooker-panel .hk-live {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 18px 18px;
  border: 0;
  background: none;
}
#hooker-panel .hk-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--gt-line);
}
#hooker-panel .hk-stat.wide { grid-column: 1 / -1; }
#hooker-panel .hk-stat b { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(var(--gt-brass), .8); }
#hooker-panel .hk-stat span { font-size: 13.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.hkp-stage.is-hooked .hk-stat { border-color: rgba(var(--gt-live), .18); }

.hkp-shot { margin: 0; padding: 0 18px 18px; }
.hkp-shot .hk-shot { border-radius: 10px; border: 1px solid var(--gt-line); box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .9); }
.hkp-shot figcaption { margin-top: 6px; font-size: 11.5px; color: var(--text-mute); }

/* Nothing running: the hook, large and quiet, beside what to do. */
.hkp-stage.is-empty { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 20px; padding: 22px; }
.hkp-stage.is-empty .hkp-shot { grid-column: 1 / -1; padding: 12px 0 0; }
.hkp-empty-art { width: 96px; height: 96px; opacity: .55; filter: saturate(.7) drop-shadow(0 6px 12px rgba(0, 0, 0, .6)); }
.hkp-stage.is-down .hkp-empty-art { filter: grayscale(.85) brightness(.7); }
.hkp-empty-text { min-width: 0; }
.hkp-empty-text p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--text-dim); text-wrap: pretty; max-width: 58ch; }
.hkp-empty-text .hkp-now-title { font-size: 18px; }

/* ── Events: a timeline ── */
#hooker-panel .hkp-events .hk-events {
  max-height: 260px;
  overflow: auto;
  gap: 0;
  border-radius: 12px;
  border: 1px solid var(--gt-line);
  background: rgba(0, 0, 0, .2);
}
#hooker-panel .hk-ev {
  align-items: baseline;
  gap: 12px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  border-left: 2px solid transparent;
}
#hooker-panel .hk-ev:last-child { border-bottom: 0; }
#hooker-panel .hk-ev time { width: 4.6em; color: var(--text-mute); font-size: 11.5px; }
#hooker-panel .hk-ev .k { min-width: 7.5em; font-size: 11.5px; font-weight: 700; color: rgba(var(--gt-brass), .85); }
#hooker-panel .hk-ev .m { color: var(--text); }
#hooker-panel .hk-ev.kind-applied, #hooker-panel .hk-ev.kind-attached { border-left-color: rgba(var(--gt-live), .7); }
#hooker-panel .hk-ev.kind-applied .k, #hooker-panel .hk-ev.kind-attached .k { color: rgb(var(--gt-live)); }
#hooker-panel .hk-ev[class*="-failed"] { border-left-color: rgba(var(--gt-alarm), .7); background: rgba(var(--gt-alarm), .04); }
#hooker-panel .hk-ev[class*="-failed"] .k { color: rgb(var(--gt-alarm)); }

/* ── The bench: cards on the right ── */
.hkp-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--gt-line);
  background: var(--gt-glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

/* Switches, not checkboxes: the setting reads as on or off at a glance. */
.hkp-switch { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; cursor: pointer; }
.hkp-switch + .hkp-switch { border-top: 1px solid rgba(255, 255, 255, .05); padding-top: 12px; }
.hkp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.hkp-switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin-top: 1px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
  transition: background .2s ease, box-shadow .2s ease;
}
.hkp-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f4efe6, #c9c2b6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  transition: transform .22s cubic-bezier(.3, 1.4, .5, 1);
}
.hkp-switch input:checked + .hkp-switch-track { background: linear-gradient(180deg, rgba(var(--gt-ember), .85), rgba(180, 83, 9, .8)); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3), 0 0 12px -3px rgba(var(--gt-ember), .7); }
.hkp-switch input:checked + .hkp-switch-track::after { transform: translateX(16px); background: linear-gradient(180deg, #fff8ec, #f3d9a8); }
.hkp-switch input:focus-visible + .hkp-switch-track { outline: 2px solid rgb(var(--gt-ember)); outline-offset: 2px; }
.hkp-switch-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hkp-switch-text b { font-size: 13.5px; font-weight: 650; color: var(--text); }
.hkp-switch-text small { font-size: 12px; line-height: 1.45; color: var(--text-mute); text-wrap: pretty; }

/* Plans as rows you can open. */
#hooker-panel .hkp-plans { display: flex; flex-direction: column; gap: 6px; }
#hooker-panel .hkp-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--gt-line);
  background: rgba(0, 0, 0, .22);
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
#hooker-panel .hkp-plan:hover { background: rgba(var(--gt-brass), .07); border-color: rgba(var(--gt-brass), .3); }
#hooker-panel .hkp-plan .counts { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-mute); }

/* The hook-a-session command. */
.hkp-cmd { display: flex; gap: 8px; align-items: stretch; }
#hooker-panel .hkp-cmd .hk-hookup {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  overflow-wrap: anywhere;
  font-size: 11.5px;
  line-height: 1.45;
  color: #f3dfbd;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(var(--gt-brass), .25);
}

/* ── Narrow: one column, the stage first ── */
@media (max-width: 860px) {
  .hkp-grid { grid-template-columns: minmax(0, 1fr); }
  .hkp-head { padding: 20px 64px 16px 18px; gap: 14px; }
  .hkp-medal { width: 52px; height: 52px; }
  .hkp-medal img { width: 32px; height: 32px; }
  #hooker-panel .hkp-head h2 { font-size: 19px; }
  #hooker-panel .hkp-body { padding: 18px; }
  .hkp-stage-row { padding: 14px; gap: 14px; align-items: flex-start; }
  .hkp-cover { width: 84px; }
  .hkp-now-title { font-size: 19px; }
  .hkp-stage.is-empty { grid-template-columns: minmax(0, 1fr); text-align: left; }
  .hkp-empty-art { width: 64px; height: 64px; }
}
@media (pointer: coarse) {
  .hkp-actions .btn, .hkp-card .btn { min-height: 44px; }
  .hkp-switch { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .hkp-head[data-state="live"] .hkp-medal::after { animation: none; }
  .hkp-switch-track, .hkp-switch-track::after { transition: none; }
}

/* ── Out-ranking the older rules this panel still carries (styles.css) ──
   `.hkp-section h3` made every heading a small uppercase label (the game's
   own title included), `.modal-panel label` stacks every label in a modal
   (the switches), and the old sections carried margins of their own. */
#hooker-panel .hkp-section { margin: 0; }
#hooker-panel h3.hkp-now-title {
  display: block;
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -.015em;
  text-transform: none;
  color: #fff9ee;
}
#hooker-panel .hkp-stage.is-empty h3.hkp-now-title { font-size: 18px; }
#hooker-panel h3.hkp-h { margin: 0 0 10px; color: rgb(var(--gt-brass)); }
#hooker-panel .modal-panel label.hkp-switch,
#hooker-panel label.hkp-switch { display: flex; flex-direction: row; align-items: flex-start; margin: 0; }
#hooker-panel .hk-stat span { white-space: normal; overflow: visible; text-overflow: clip; }
#hooker-panel .hk-ev time { width: auto; min-width: 5.6em; white-space: nowrap; }

/* The two columns end together: the event timeline takes what the left side
   has left over, its box reaching the foot of the bench beside it. */
.hkp-grid { align-items: stretch; }
.hkp-main { min-height: 100%; }
.hkp-main > .hkp-events { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#hooker-panel .hkp-main > .hkp-events .hk-events { flex: 1; max-height: none; }
.hkp-main > .hkp-events > .hkp-quiet {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, .09);
  background: rgba(0, 0, 0, .14);
  text-align: center;
}
@media (max-width: 860px) {
  .hkp-main > .hkp-events > .hkp-quiet { min-height: 0; }
}
