/* /play, the app screen. Tokens and shared parts come from system.css. Everything here is prefixed pl-. */

.app { --pl-tile-h: 92px; }

/* ---- layout ---- */
.pl-main { display: grid; gap: 24px; padding: 24px; max-width: 1600px; margin: 0 auto; }
.pl-top { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.pl-left { grid-template-columns: minmax(0, 1fr); display: grid; gap: 24px; min-width: 0; }
.pl-ticket { position: sticky; top: calc(var(--head) + 24px); }
.is-real .pl-ticket { position: static; }
@media (min-height: 1000px) and (min-width: 961px) { .is-real .pl-ticket { position: sticky; } }

/* ---- panel heads ---- */
.pl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--hair); }
.pl-title { font: 500 17px/1.3 var(--sans); letter-spacing: -0.01em; white-space: nowrap; }
.pl-title .fig { font-weight: 500; }
.pl-utc { color: var(--text-2); font: 400 13px/1 var(--mono); }
.pl-unit { font: 400 13px/1.4 var(--sans); color: var(--text-2); }
.pl-head > :last-child { margin-left: auto; }
.pl-head .pl-feed { margin-left: auto; }
.pl-head .pl-result:not([hidden]) + .pl-feed { margin-left: 0; }
.pl-result { margin-left: auto; height: 28px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: var(--r); background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 500; white-space: nowrap; animation: pl-in 0.24s var(--ease); }
.pl-feed .dot.wait { background: var(--text-3); }
.pl-feed.is-off { color: var(--down); border-color: rgba(255, 125, 110, 0.4); }

/* ---- chart ---- */
.pl-frame { position: relative; padding: 12px 8px 8px 4px; }
.pl-frame canvas { width: 100%; aspect-ratio: 16 / 6; min-height: 300px; touch-action: pan-y; }
.pl-frame-note { position: absolute; inset: 0; display: grid; place-items: center; font: 400 13px/1 var(--sans); color: var(--text-2); pointer-events: none; }
.pl-paused { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: var(--r); background: var(--panel-2); border: 1px solid rgba(255, 125, 110, 0.4); font-size: 13px; color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); animation: pl-in 0.24s var(--ease); }

/* ---- board ---- */
.pl-board { padding-bottom: 20px; }
.pl-board .pl-head { gap: 16px; }
.pl-count { font: 400 13px/1 var(--sans); color: var(--text-2); margin-left: auto; white-space: nowrap; }
.pl-count + .btn { margin-left: 0; }
.pl-hint { padding: 14px 20px 0; font-size: 13px; color: var(--text-2); max-width: 80ch; }
.pl-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 14px 20px 0; }

.pl-tile {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 28px auto;
  align-content: start;
  gap: 6px;
  min-height: var(--pl-tile-h);
  min-width: 0;
  padding: 10px 12px 10px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
.pl-tile:active { transform: scale(0.985); }
.pl-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r); z-index: 1; }
.pl-row1 { display: flex; align-items: center; gap: 6px; min-width: 0; height: 20px; }
.pl-tick { font: 500 15px/1.2 var(--sans); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pl-you { width: 2px; height: 12px; border-radius: 1px; background: var(--text); flex: none; display: none; }
.pl-mark { margin-left: auto; width: 18px; height: 18px; flex: none; display: none; place-items: center; border-radius: 5px; background: var(--text); color: var(--ground); }
.pl-mark svg { width: 12px; height: 12px; }
.pl-row2 { display: flex; align-items: center; min-width: 0; font: 400 15px/1.2 var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.pl-row2 .tri { margin-right: 6px; }
.pl-row2 .tri.flat { border: 0; width: 8px; height: 6px; }
.pl-lab-r { margin-left: auto; font: 400 13px/1 var(--sans); color: var(--text-2); padding-left: 6px; }
.pl-spark { width: 100%; height: 28px; }
.pl-row4 { display: flex; justify-content: space-between; gap: 6px; font: 400 12px/1.2 var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; min-width: 0; }
.pl-row4 .pl-mine { color: var(--text); }

/* states, see SPEC section 4 */
.pl-tile.is-lead { box-shadow: inset 0 0 0 1px var(--accent); }
.pl-tile.is-lead .pl-row2 { color: var(--accent); }
.pl-tile.is-lead .pl-lab-r { color: var(--accent); }
.pl-tile.is-pick { background: var(--panel-2); box-shadow: inset 0 0 0 1.5px var(--text); }
.pl-tile.is-pick .pl-mark { display: grid; }
.pl-tile.is-pick.is-lead { box-shadow: inset 0 0 0 1.5px var(--text), inset 0 0 0 2.5px var(--accent); }
.pl-tile.is-locked .pl-mark { display: grid; background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-2); }
.pl-tile.is-play .pl-you { display: block; }
.pl-tile.is-won { background: rgba(111, 205, 232, 0.14); box-shadow: inset 0 0 0 1px var(--accent); }
.pl-tile.is-won .pl-row2 { color: var(--accent); }
.pl-tile.is-won .pl-lab-r { color: var(--accent); font-weight: 500; }
.pl-tile.is-dim { opacity: 0.45; }

/* skeleton */
.pl-skel { min-height: var(--pl-tile-h); border-radius: var(--r); background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); padding: 12px; display: grid; gap: 10px; align-content: start; }
.pl-skel i { display: block; height: 10px; border-radius: 3px; background: var(--panel-2); }
.pl-skel i:nth-child(1) { width: 46%; }
.pl-skel i:nth-child(2) { width: 62%; }
.pl-skel i:nth-child(3) { width: 100%; height: 20px; }

.pl-fail { margin: 14px 20px 0; padding: 32px 24px; border-radius: var(--r); border: 1px dashed var(--hair-2); display: grid; gap: 8px; justify-items: start; }
.pl-fail-title { font: 500 17px/1.3 var(--sans); }
.pl-fail .btn { margin-top: 8px; }

/* ---- ticket ---- */
.pl-tk { display: grid; }
.pl-clock { padding: 20px 20px 18px; display: grid; gap: 4px; border-bottom: 1px solid var(--hair); }
.pl-lab { font: 400 13px/1.4 var(--sans); color: var(--text-2); }
.pl-big { font: 400 44px/1.05 var(--mono); letter-spacing: -0.02em; color: var(--text); transition: color 0.15s var(--ease); }
.pl-track { display: block; height: 2px; margin-top: 10px; background: var(--hair); border-radius: 1px; }
.pl-track i { display: block; height: 100%; width: 100%; background: var(--text-2); transform-origin: left center; transform: scaleX(0); transition: transform 0.25s linear, background-color 0.15s var(--ease); }
.pl-clock.is-urgent .pl-big { color: var(--down); }
.pl-clock.is-urgent .pl-track i { background: var(--down); }

.pl-sec { padding: 16px 20px; border-bottom: 1px solid var(--hair); display: grid; gap: 10px; }
.pl-sec-title { font: 500 15px/1.3 var(--sans); display: flex; gap: 8px; align-items: baseline; }
.pl-sec-title .fig { font-size: 13px; font-weight: 400; }
.pl-facts { display: grid; gap: 6px; }
.pl-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-height: 22px; }
.pl-facts dt { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.pl-facts dd { font-size: 13px; color: var(--text); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.pl-facts dd.fig { font-size: 13px; }
.pl-facts .up { color: var(--up); }

.pl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-chip { display: inline-flex; align-items: center; height: 32px; padding: 0 4px 0 10px; gap: 2px; border-radius: var(--r); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--hair-2); font-size: 13px; font-weight: 500; }
.pl-chip button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-2); border-radius: 6px; cursor: pointer; position: relative; }
.pl-chip button::before { content: ""; position: absolute; inset: -8px -4px; }
.pl-chip button svg { width: 10px; height: 10px; }
.pl-empty { font-size: 13px; color: var(--text-2); }

.pl-amount label { display: block; }
.pl-input { position: relative; }
.pl-input input { width: 100%; height: 48px; padding: 0 64px 0 14px; border-radius: var(--r); border: 1px solid var(--hair-2); background: var(--ground); font-size: 20px; color: var(--text); outline: none; transition: border-color 0.15s var(--ease); }
.pl-input input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-input input[aria-invalid="true"] { border-color: var(--down); }
.pl-sym { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 400 13px/1 var(--mono); color: var(--text-2); pointer-events: none; }
.pl-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pl-quick .btn { height: 36px; font-family: var(--mono); font-weight: 400; }
.pl-quick .btn[aria-pressed="true"] { border-color: var(--text-2); background: var(--panel-2); }
.pl-sum { padding-top: 4px; }
.pl-total dt, .pl-total dd { color: var(--text); font-weight: 500; }

.pl-act { padding: 16px 20px; display: grid; gap: 10px; border-bottom: 1px solid var(--hair); }
.pl-act .btn.lg { font-size: 15px; }
.pl-status { font-size: 13px; color: var(--text-2); min-height: 20px; }
.pl-status:empty { display: none; }
.pl-status.is-bad { color: var(--down); }
.pl-status.is-good { color: var(--accent); }
.pl-practice { font-size: 13px; color: var(--text-2); }
.pl-money { border-bottom: 0; }
.pl-record { border-bottom: 0; font-size: 13px; }
.pl-record p { display: flex; justify-content: space-between; gap: 12px; }
.pl-record #record { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }

/* ---- log ---- */
.pl-log { overflow-x: auto; }
.pl-table { font-size: 14px; table-layout: fixed; }
.pl-table th:nth-child(1) { width: 112px; }
.pl-table th:nth-child(3), .pl-table th:nth-child(4), .pl-table th:nth-child(5), .pl-table th:nth-child(6) { width: 15%; }
.pl-table th:last-child { width: 120px; }
.pl-table th:first-child, .pl-table td:first-child { padding-left: 20px; }
.pl-table th:last-child, .pl-table td:last-child { padding-right: 20px; }
.pl-table td.pl-coin { font-weight: 500; }
.pl-table td .tri { margin-right: 6px; }
.pl-table .is-won { color: var(--up); }
.pl-table .is-hit { color: var(--accent); }
.pl-table tr.is-mine td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.pl-table tr.is-new td { animation: pl-row 1.2s var(--ease); }
.pl-table tr.pl-skrow td { color: transparent; }
.pl-table tr.pl-skrow td::after { content: ""; display: block; height: 10px; width: 60%; border-radius: 3px; background: var(--panel-2); margin-left: auto; }
.pl-table tr.pl-skrow td:first-child::after, .pl-table tr.pl-skrow td:nth-child(2)::after { margin-left: 0; }
.pl-table .muted, .pl-record .muted, .pl-sec-title .muted, .pl-amount .muted { color: var(--text-2); }
.pl-log-empty { padding: 20px; font-size: 14px; color: var(--text-2); }
.pl-sk { display: none; }

/* ---- phone parts ---- */
.pl-strip, .pl-bar { display: none; }

@keyframes pl-in { from { opacity: 0; transform: translateY(8px); } }
.pl-paused { animation-name: pl-in-c; }
@keyframes pl-in-c { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes pl-row { from { background: rgba(111, 205, 232, 0.12); } }

@media (hover: hover) {
  .pl-tile:hover { box-shadow: inset 0 0 0 1px var(--text-3); }
  .pl-tile.is-lead:hover { box-shadow: inset 0 0 0 1px var(--accent); }
  .pl-tile.is-pick:hover { box-shadow: inset 0 0 0 1.5px var(--text); background: #0e2330; }
  .pl-chip button:hover { color: var(--text); background: rgba(160, 220, 240, 0.08); }
}

/* ---- tablet and phone ---- */
@media (max-width: 1080px) {
  .pl-main, .pl-top { gap: 20px; }
  .pl-main { padding: 20px; }
  .pl-top { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 960px) {
  .app { --pl-tile-h: 78px; }
  .pl-main, .pl-top { gap: 16px; }
  .pl-main { padding: 16px 16px 24px; }
  .pl-top { grid-template-columns: minmax(0, 1fr); }
  .pl-left { gap: 16px; }
  .pl-ticket { position: static; }
  .pl-clock { display: none; }

  .pl-strip { display: flex; position: sticky; top: var(--head); z-index: 40; align-items: center; justify-content: space-between; gap: 16px; height: 52px; padding: 0 20px; background: rgba(3, 7, 13, 0.92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--hair); }
  .pl-strip-time, .pl-strip-lead { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  .pl-strip-time > .fig { font: 400 24px/1 var(--mono); letter-spacing: -0.02em; }
  .pl-strip-lead .fig { font: 500 15px/1 var(--mono); color: var(--accent); white-space: nowrap; }
  .pl-strip-lab { font-size: 13px; color: var(--text-2); white-space: nowrap; }
  .pl-strip-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text-2); transform-origin: left center; transform: scaleX(0); transition: transform 0.25s linear; }
  .pl-strip.is-urgent .pl-strip-time .fig { color: var(--down); }
  .pl-strip.is-urgent .pl-strip-bar { background: var(--down); }

  .pl-bar:not([hidden]) { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; align-items: center; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(7, 19, 26, 0.96); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--hair-2); animation: pl-in 0.24s var(--ease); }
  .pl-bar-sum { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
  .pl-bar .btn { height: 48px; flex: none; max-width: 64%; overflow: hidden; text-overflow: ellipsis; }
  body.has-bar .site-foot { padding-bottom: 120px; }
}

@media (max-width: 600px) {
  .head-right:has(.pl-addr, .pl-wallet:not([hidden])) [data-mode] { display: none; }
  .pl-main { padding: 12px 0 20px; }
  .pl-main, .pl-top { gap: 12px; }
  .pl-left { gap: 12px; }
  .panel.pl-chart, .panel.pl-board, .pl-tk, .panel.pl-log { border-radius: 0; border-left: 0; border-right: 0; }
  .pl-head { padding: 10px 16px; min-height: 52px; gap: 10px; }
  .pl-unit { display: none; }
  .pl-chart .pl-unit { display: inline; }
  .pl-head:has(.pl-result:not([hidden])) .pl-unit { display: none; }
  .pl-result { font-size: 12px; padding: 0 8px; }
  .pl-frame { padding: 8px 4px 4px 0; }
  .pl-frame canvas { aspect-ratio: auto; height: 240px; min-height: 0; }
  .pl-paused { top: 16px; font-size: 13px; width: calc(100% - 32px); }
  .pl-hint { padding: 12px 16px 0; }
  .pl-grid { gap: 6px; padding: 12px 16px 0; }
  .pl-board { padding-bottom: 16px; }
  .pl-tile { padding: 8px 7px; gap: 4px; grid-template-rows: auto auto 20px auto; }
  .pl-tick { font-size: 13px; letter-spacing: -0.01em; }
  .pl-tile { padding: 8px 6px; }
  .pl-utc { display: none; }
  .pl-row1 { height: 18px; gap: 4px; }
  .pl-mark { width: 14px; height: 14px; border-radius: 4px; position: absolute; top: 6px; right: 6px; }
  .pl-mark svg { width: 9px; height: 9px; }
  .pl-row2 { font-size: 12px; }
  .pl-row2 .tri { margin-right: 3px; border-left-width: 3px; border-right-width: 3px; }
  .pl-lab-r { display: none; }
  .pl-tile.is-won .pl-val { display: none; }
  .pl-tile.is-won .pl-lab-r { display: inline; margin-left: 0; padding-left: 0; }
  .pl-spark { height: 20px; }
  .pl-tile.has-mine .pl-tot { display: none; }
  .pl-row4 { font-size: 12px; }
  .pl-sec, .pl-act { padding: 14px 16px; }
  .pl-fail { margin: 12px 16px 0; }

  /* the log becomes stacked cards */
  .pl-log { overflow: visible; }
  .pl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pl-table, .pl-table tbody { display: block; table-layout: auto; }
  .pl-table tr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "time coin you" "move usual read" "pot pot pot"; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
  .pl-table tr:last-child { border-bottom: 0; }
  .pl-table td { display: block; height: auto; padding: 0 !important; border: 0; white-space: normal; font-size: 14px; }
  .pl-table td.c-time { grid-area: time; }
  .pl-table td.c-coin { grid-area: coin; }
  .pl-table td.c-move { grid-area: move; text-align: left; }
  .pl-table td.c-usual { grid-area: usual; text-align: left; color: var(--text-2); }
  .pl-table td.c-read { grid-area: read; }
  .pl-table td.c-pot { grid-area: pot; text-align: left; color: var(--text-2); }
  .pl-table td.c-you { grid-area: you; }
  .pl-table td[data-k]::before { content: attr(data-k) " "; color: var(--text-2); font: 400 13px/1 var(--sans); }
  .pl-table tr.is-mine td:first-child { box-shadow: none; }
  .pl-table tr.is-mine { box-shadow: inset 2px 0 0 var(--accent); }
  .pl-table tr.pl-skrow td::after { width: 48px; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pl-track i, .pl-strip-bar { transition: none; }
}

/* The feed is only mentioned when it is not live. */
.pl-feed.is-live { display: none; }
/* Desktop: chart and all five board rows fit a 900 px tall screen. */
@media (min-width: 961px) {
  .app { --pl-tile-h: 76px; }
  .pl-frame canvas { aspect-ratio: auto; height: 236px; min-height: 0; }
  .pl-hint { padding-top: 10px; }
  .pl-grid { padding-top: 10px; }
  .pl-board { padding-bottom: 16px; }
  .pl-main { padding-top: 16px; gap: 16px; }
  .pl-top { gap: 16px; }
}

/* Desktop tiles: name and move on one line, the trace under them, so five rows fit under the chart on a laptop. */
@media (min-width: 961px) {
  .app { --pl-tile-h: 64px; }
  .pl-tile { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 20px 22px auto; gap: 4px 8px; padding: 9px 12px 8px; }
  .pl-row1 { grid-column: 1; grid-row: 1; }
  .pl-row2 { grid-column: 2; grid-row: 1; font-size: 14px; height: 20px; }
  .pl-spark { grid-column: 1 / -1; grid-row: 2; height: 22px; }
  .pl-row4 { grid-column: 1 / -1; grid-row: 3; }
  .pl-row4:not(:has(span:not(:empty))) { display: none; }
  .pl-hint { max-width: none; }
  .pl-frame canvas { height: 228px; }
}

/* Long market names (CASHCAT, FARTCOIN) are set a little smaller so they are not cut off. */
.pl-tick.is-long { font-size: 13px; letter-spacing: -0.01em; }
@media (max-width: 720px) { .pl-tick.is-long { font-size: 12px; letter-spacing: -0.035em; } }
