/* Pathfinding lab. Shared palette, buttons, panels and the how-it-works section come from style.css and
   app.css; this file styles the map editor, the racer panels, the leaderboard and the hover card. */

[hidden] { display: none !important; }

/* Map editor: a neon frame like the Pac-Man maze, with the tool row above it. */
.pf-stage { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; width: 100%; min-width: 0; }
.pf-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; }
.pf-tool .btn-txt { white-space: nowrap; }
.pf-tool[aria-pressed="true"] { box-shadow: 0 0 14px rgba(0, 245, 255, 0.55), inset 0 0 10px rgba(0, 245, 255, 0.18); }
.pf-tool[aria-pressed="true"].green { box-shadow: 0 0 14px rgba(0, 255, 136, 0.55); }
.pf-tool[aria-pressed="true"].pink { box-shadow: 0 0 14px rgba(255, 0, 160, 0.55); }
.pf-frame {
  position: relative;
  padding: 10px;
  max-width: 100%;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: radial-gradient(ellipse at center, rgba(0, 245, 255, 0.07), #020610 70%);
  box-shadow: 0 0 22px rgba(0, 245, 255, 0.35), 0 0 60px rgba(155, 0, 255, 0.2), inset 0 0 30px rgba(0, 245, 255, 0.08);
}
.pf-frame::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 4px;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
}
#pf-grid { display: block; width: min(100%, 620px); height: auto; aspect-ratio: 1 / 1; touch-action: none; cursor: crosshair; }
.pf-controls .cyber-btn { min-width: 8.5rem; }
.pf-controls .cyber-btn:disabled { opacity: 0.45; cursor: default; }

/* Race header: section title on the left, the panel/focus switch on the right. */
.pf-race-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 1.6rem; }
.pf-race-head .section-title { margin: 0; }
.pf-view { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.pf-view [aria-pressed="true"] { box-shadow: 0 0 14px rgba(0, 245, 255, 0.55); }

/* Panels: one per racer, side by side on wide screens, stacked on a phone. */
.pf-panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
  min-width: 0;
}
.pf-panel {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(0, 245, 255, 0.3);
  background: rgba(2, 6, 16, 0.85);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.pf-panel.is-best { border-color: var(--green); box-shadow: 0 0 16px rgba(0, 255, 136, 0.35); }
.pf-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.4rem; min-width: 0; }
.pf-panel-title { font-family: var(--orb); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-panel canvas { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; background: #020610; }
.pf-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.5rem; margin: 0; font-family: var(--mono); font-size: 0.68rem; }
.pf-stats div { display: flex; justify-content: space-between; gap: 0.3rem; min-width: 0; border-bottom: 1px dashed rgba(0, 245, 255, 0.12); padding-bottom: 0.15rem; }
.pf-stats dt { color: var(--dim); letter-spacing: 0.06em; }
.pf-stats dd { margin: 0; color: var(--text); font-weight: 700; white-space: nowrap; }
.pf-badge { font-family: var(--mono); font-size: 0.66rem; padding: 0.1rem 0.4rem; border: 1px solid currentColor; white-space: nowrap; }
.pf-badge.ok { color: var(--green); }
.pf-badge.bad { color: var(--pink); }
.pf-badge.wait { color: var(--dim); }

/* Focus: one search large, with its counters above it. */
.pf-focus { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: center; min-width: 0; }
.pf-focus-stats { width: min(100%, 620px); display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-family: var(--mono); font-size: 0.75rem; }
.pf-focus-stats b { color: var(--cyan); font-weight: 700; }
#pf-focus-canvas { display: block; width: min(100%, 620px); height: auto; aspect-ratio: 1 / 1; background: #020610; border: 1px solid rgba(0, 245, 255, 0.35); box-shadow: 0 0 22px rgba(0, 245, 255, 0.25); }

/* Leaderboard. */
.pf-board-wrap { margin-top: 1.6rem; min-width: 0; }
.pf-scroll { overflow-x: auto; }
.pf-board { max-width: 100%; }
.pf-board td:nth-child(2) { color: var(--cyan); white-space: nowrap; }

/* Control column. */
.pf-card { margin-top: 0.4rem; padding: 0.55rem; }
.pf-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.pf-two > div { min-width: 0; }
.pf-algos { border: 1px solid rgba(0, 245, 255, 0.2); padding: 0.5rem 0.7rem 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; margin: 0; min-width: 0; }
.pf-algos legend { padding: 0 0.3rem; }
.pf-algos label, .pf-check { display: flex; align-items: center; gap: 0.45rem; font-family: var(--raj); font-size: 0.95rem; color: var(--text); cursor: pointer; }
.pf-algos input, .pf-check input { accent-color: var(--cyan); width: 1rem; height: 1rem; margin: 0; }
.pf-explain { display: flex; flex-direction: column; gap: 0.5rem; }
#heur-note { min-height: 1em; }
#heur-note.warn { color: var(--yellow); }

/* Hover card. Follows the pointer; pointer-events off so it never blocks the map. */
.pf-tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  max-width: 260px;
  padding: 0.5rem 0.6rem;
  background: rgba(2, 6, 16, 0.95);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.35);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text);
}
.pf-tip b { color: var(--cyan); }
.pf-tip .pf-tip-note { color: var(--dim); display: block; margin-top: 0.25rem; }

.pf-page .hiw-table td { font-size: 0.9rem; }

/* Grid tracks may shrink below their content, so nothing wider than the screen pushes the page sideways. */
.pf-page .proj-body { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); }
.pf-page .proj-game-col, .pf-page .proj-ctrl-col { min-width: 0; }
.pf-controls { flex-wrap: wrap; }
@media (max-width: 1000px) {
  .pf-page .proj-body { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .pf-two { grid-template-columns: 1fr; }
  .pf-panels { grid-template-columns: 1fr; }
  .pf-tool .btn-txt { font-size: 0.7rem; }
  .pf-controls .cyber-btn { min-width: 0; flex: 1 1 8rem; }
}
