/* The perps board (hero map + agent console). Owned by the board pass, 2026-10-29.
   Loaded after site.css: everything here overrides or extends the .board rules there. */

/* head: title and live line on the left, window and colour controls on the right */
.board-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title ctl" "live ctl";
  align-items: center; gap: 4px 16px; padding: 9px 10px 9px 14px; min-height: 58px;
}
.board-title { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.board-title .b-area { color: var(--text-2); }
.live { grid-area: live; margin-left: 0; justify-self: start; max-width: 100%; text-align: left; color: var(--text-3); }
.live[data-state="live"] .live-text { color: var(--text-2); }
.board-ctl { grid-area: ctl; display: flex; align-items: center; gap: 14px; }
.wins { display: flex; gap: 2px; padding-right: 14px; border-right: 1px solid var(--line); }
.wins button {
  min-height: 34px; min-width: 40px; padding: 0 9px; border-radius: var(--radius);
  border: 1px solid transparent; background: none; color: var(--text-2);
  font: 500 12px/1 var(--mono); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: color .18s ease-out, border-color .18s ease-out, background-color .18s ease-out;
}
.wins button:hover { color: var(--text); }
.wins button[aria-pressed="true"] { border-color: var(--line-2); background: var(--panel-2); color: var(--accent); }
.wins button:focus-visible, .modes button:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }

/* cells: label sizes come from market.js (--fs name, --vfs values, --pad), fitted to each cell's width */
.cell {
  padding: var(--pad, 6px);
  contain: layout paint style;
  transition:
    left .6s cubic-bezier(.2, .7, .2, 1), top .6s cubic-bezier(.2, .7, .2, 1),
    width .6s cubic-bezier(.2, .7, .2, 1), height .6s cubic-bezier(.2, .7, .2, 1),
    background-color .5s ease-out, color .3s ease-out;
}
.board.still .cell { transition: background-color .5s ease-out, color .3s ease-out; }
.cell > span { position: relative; }
.cell .c-name { font-size: var(--fs, 11px); line-height: 1.12; font-weight: 700; letter-spacing: -.01em; overflow: visible; }
.cell .c-val { font-size: var(--vfs, 10px); line-height: 1.25; font-weight: 500; opacity: .9; margin-top: .2em; font-variant-numeric: tabular-nums; overflow: hidden; }
.cell .c-px { font-size: calc(var(--vfs, 10px) * .9); line-height: 1.25; font-weight: 400; opacity: .6; margin-top: .1em; font-variant-numeric: tabular-nums; overflow: hidden; }
.cell.lv-0 { padding: 0; }
.cell.lv-0 > span, .cell.lv-1 .c-val, .cell.lv-1 .c-px, .cell.lv-2 .c-px { display: none; }
.cell.dark .c-val { opacity: .85; }

/* no data for the window: a hatched neutral cell; it breathes while its candles are on the way */
.cell::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(135deg, rgba(232, 237, 242, .085) 0 1px, transparent 1px 7px);
  transition: opacity .5s ease-out;
}
.cell.nod { color: var(--text-2); }
.cell.nod::before { opacity: 1; }
.js .cell.nod.wait::before { animation: hatch 1.6s ease-in-out infinite; }
@keyframes hatch { 50% { opacity: .4; } }
.cell.hov { box-shadow: inset 0 0 0 1px rgba(232, 237, 242, .8); }

/* the pick tag sits in the cell's bottom left corner when the cell can hold it */
.pick.inside .pick-tag { left: 4px; bottom: 4px; }

/* foot: a two line readout (fixed height, so the map never jumps) and the legend */
/* line 1 (market, price, change, sparkline, the other windows) gets the full width; line 2 shares its row with the legend */
.board-foot {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "r1 r1" "r2 lg";
  align-items: center; gap: 2px 18px; padding: 2px 14px 10px; min-height: 0;
}
.readout { display: contents; font-size: 12px; line-height: 1.6; }
.readout .ro-1 { grid-area: r1; }
.readout .ro-2 { grid-area: r2; }
.readout .ro-1, .readout .ro-2 { display: flex; align-items: center; gap: .55em; white-space: nowrap; overflow: hidden; min-width: 0; height: 1.75em; font: 400 12px/1.6 var(--mono); color: var(--text); }
.readout .ro-2 { gap: 0; color: var(--text-2); }
.readout .ro-1.dim, .readout .ro-2.dim { color: var(--text-3); }
.readout .ro-2 .note { color: var(--accent); }
.readout .ro-1 b { font-size: 13px; }
.readout .px { color: var(--text-2); }
.readout .ro-wins { display: flex; gap: 1.1em; margin-left: .4em; color: var(--text-2); }
.readout .ro-w .dim { color: var(--text-3); }
.readout .sep { padding: 0 7px; }
.readout .up, .readout .dn { font-variant-numeric: tabular-nums; }
.spark { flex: none; margin: 0 .3em; overflow: visible; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.spark.dn polyline { stroke: var(--neg); }
.spark .sp-base { stroke: rgba(232, 237, 242, .22); stroke-width: 1; stroke-dasharray: 2 3; }
.legend { grid-area: lg; padding-top: 0; gap: 7px; }
.lg-note:not(:empty) { margin-right: 4px; color: var(--text-2); }
.lg-nod { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; }
.hatch {
  display: block; width: 16px; height: 8px; border-radius: 1px; background-color: #0e1520;
  background-image: repeating-linear-gradient(135deg, rgba(232, 237, 242, .3) 0 1px, transparent 1px 4px);
}

/* phone: title and live line share the first row; the window and colour controls take the second, 44 px tall */
@media (max-width: 760px) {
  .board-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title live" "ctl ctl"; gap: 8px 10px; padding: 9px 8px 8px 12px; }
  .board-title .dim { display: inline; }
  .board-title .b-pre { display: none; }
  .live { justify-self: end; flex-basis: auto; text-align: right; }
  .board-ctl { justify-content: space-between; gap: 8px; }
  .wins { padding-right: 0; border-right: 0; }
  .wins button { min-height: 44px; min-width: 44px; padding: 0 6px; }
  .modes { margin-left: 0; }
  .modes button { min-height: 44px; padding: 0 10px; }
  .board-foot { grid-template-columns: minmax(0, 1fr); grid-template-areas: "r1" "r2" "lg"; padding: 0 12px 8px; gap: 0; }
  .readout .ro-1, .readout .ro-2 { font-size: 11.5px; }
  .readout .ro-1 b { font-size: 12.5px; }
  .readout .ro-wins { display: none; }
  .readout .ro-2 { flex-wrap: wrap; align-content: flex-start; white-space: normal; height: 3.2em; line-height: 1.6; }
  .readout .ro-2 > * { white-space: nowrap; }
  .legend { padding-top: 4px; }
  .map { height: clamp(240px, 33svh, 290px); }
}

@media (prefers-reduced-motion: reduce) {
  .cell, .cell::before { transition: none; }
}
