/* Play the fly: board + live brain. Uses the post's tokens (--ink, --rule, --wash, --blue-fill…). */
.playfly { position: relative; border: 1px solid var(--rule); border-radius: 4px; background: #fff; overflow: hidden; margin: var(--s6) 0 var(--s7); font-family: var(--sans); }
.pf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; padding: 16px 20px 0; }
.pf-head h4 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.pf-head span { font-size: 14px; color: var(--muted); }
.pf-grid { display: grid; grid-template-columns: 1fr; gap: 20px; padding: 16px 20px 20px; }
@media (min-width: 820px) { .pf-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }

/* board: a warm light grey and a mid grey; blue marks the last move and the selection */
.pf-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; outline: 1px solid var(--rule-2); }
.pf-sq { position: relative; display: grid; place-items: center; border: 0; padding: 0; background: #efeee9; color: var(--ink); cursor: default; font: 400 clamp(1.5rem, 5.4vw, 2.5rem)/1 "Noto Sans Symbols 2", "Apple Symbols", "Segoe UI Symbol", serif; }
.pf-sq.dk { background: var(--grey-2); }
.pf-sq.last { background: #dfe8f7; } .pf-sq.dk.last { background: #b8cbec; }
.pf-sq.sel { background: var(--blue-fill); }
.pf-sq.can { cursor: pointer; }
.pf-sq.tgt::after { content: ""; position: absolute; width: 26%; height: 26%; border-radius: 50%; background: rgba(32,32,32,.26); }
.pf-sq.tgt.cap::after { width: 84%; height: 84%; background: none; border: 4px solid rgba(32,32,32,.26); }
.pf-sq.check { background: radial-gradient(circle, rgba(213,174,59,.9) 0%, rgba(255,210,76,.25) 70%), #efeee9; }
.pf-p { position: relative; z-index: 1; transition: transform 160ms var(--spring, cubic-bezier(.32, .72, 0, 1)); pointer-events: none; }
.pf-p.w { color: #fff; -webkit-text-stroke: 1.3px var(--ink); paint-order: stroke fill; }
.pf-p.b { color: var(--ink); }
.pf-sq.sel .pf-p { transform: scale(1.08); }
.pf-coord { position: absolute; font: 600 .58rem/1 var(--sans); color: rgba(32,32,32,.45); pointer-events: none; }
.pf-coord.f { right: 4px; bottom: 3px; } .pf-coord.r { left: 4px; top: 4px; }

.pf-status { display: flex; align-items: center; gap: 10px; margin-top: 12px; min-height: 28px; font-size: 14px; color: var(--ink-2); }
.pf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rule-2); flex: none; }
.pf-dot.think { background: var(--ink); animation: pfpulse 900ms ease-in-out infinite; }
.pf-dot.you { background: var(--blue); }
@keyframes pfpulse { 50% { opacity: .35; transform: scale(.8); } }

.pf-brain { position: relative; aspect-ratio: 4 / 3; background: var(--wash); overflow: hidden; cursor: grab; touch-action: pan-y; }
.pf-brain canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pf-tick { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; align-items: center; gap: 10px; font: 500 12px/1 var(--mono, ui-monospace, Menlo, monospace); color: var(--muted); }
.pf-tick .bar { flex: 1; height: 3px; background: var(--rule); overflow: hidden; }
.pf-tick .bar i { display: block; height: 100%; width: 100%; background: var(--blue); transform-origin: left; transform: scaleX(0); }
.pf-legend { position: absolute; right: 12px; top: 10px; display: flex; gap: 12px; font-size: 13px; color: var(--ink-2); }
.pf-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }

.pf-cands { margin-top: 16px; }
.pf-cands h5 { margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.pf-cands ol { list-style: none; margin: 0; padding: 0; }
.pf-cands li { display: grid; grid-template-columns: 54px 1fr 44px; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pf-cands li b { font-weight: 600; color: var(--ink); font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 13px; }
.pf-cands li .bar { height: 8px; border-radius: 2px; background: #efefef; overflow: hidden; }
.pf-cands li .bar i { display: block; height: 100%; border-radius: 2px; background: var(--grey-2); transition: width 400ms var(--spring, cubic-bezier(.32, .72, 0, 1)); }
.pf-cands li.pick .bar i { background: var(--blue-fill); }
.pf-cands li span:last-child { text-align: right; color: var(--muted); }
.pf-cands .empty { font-size: 13px; color: var(--muted); }
.pf-val { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* buttons: the reference's .btn, primary = ink */
.pf-ctl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pf-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); border-radius: 4px; background: #fff; padding: 6px 12px; font-size: 14px; line-height: 1.4; color: var(--ink); }
.pf-btn:hover { background: var(--wash); }
.pf-btn:disabled { border-color: var(--rule-2); color: var(--grey); background: #fff; cursor: default; }
.pf-btn.primary { padding: 8px 16px; background: var(--ink); border-color: var(--ink); color: #fff; }
.pf-btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.pf-btn.primary:disabled { background: var(--ink); border-color: var(--ink); color: #fff; opacity: .5; }

/* the gate: nothing heavy loads until the reader asks */
.pf-gate { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: rgba(255,255,255,.93); }
.pf-gate.gone { display: none; }
.pf-card { max-width: 380px; text-align: left; background: #fff; border: 1px solid var(--rule-2); border-radius: 4px; padding: 24px; }
.pf-card h4 { margin: 0 0 8px; font-family: var(--serif); font-weight: 300; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); }
.pf-card p { margin: 0 0 16px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.pf-card small { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pf-load { width: 100%; height: 4px; background: var(--rule); overflow: hidden; margin-top: 16px; display: none; }
.pf-load i { display: block; height: 100%; background: var(--blue); transform-origin: left; transform: scaleX(0); transition: transform 120ms linear; }
.pf-gate.loading .pf-load { display: block; }
@media (prefers-reduced-motion: reduce) { .pf-dot.think { animation: none; } }
