/* ============================================================
   XQChess — boards embedded in other websites (views/embed/*).
   The whole frame is one column of fixed height: the board takes
   what is left and replay.js / xq-board.js (fitHeight) size the
   canvas to it, so nothing scrolls inside a frame of any size.
   ============================================================ */
html, body { height: 100%; }
.em-body {
  padding: 8px 10px 6px;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ground);
}
.em-main { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.em-replay, .em-puzzle { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }

.em-head { min-width: 0; }
.em-head--row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.em-head .replay-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-head .replay-meta { font-size: 12px; color: var(--text-faint); margin: 0; display: flex; align-items: center; gap: .4rem; }
.replay-error { margin: 4px 0 0; padding: .35rem .6rem; border: 1px solid #C06060; border-radius: 6px; color: #E59A9A; font-size: 12px; }

/* The board area gets the leftover height; the canvas never pushes it */
.em-board {
  flex: 1 1 0;
  min-height: 120px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.em-board canvas { display: block; }
#pz-canvas { cursor: pointer; touch-action: manipulation; }

.em-player { display: flex; align-items: center; gap: .45rem; font-size: 13px; color: var(--text); padding: 2px 4px; border-radius: 6px; }
.em-player.gp--active-turn { background: color-mix(in srgb, var(--jade-l) 14%, transparent); }
.em-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-elo { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.em-time { margin-left: auto; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.rp-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--border-h); }
.rp-dot--red   { background: #C00000; }
.rp-dot--black { background: #1C1C1C; }
.em-turn { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--border-h); }
.em-turn--red   { background: #C00000; }
.em-turn--black { background: #1C1C1C; }
.em-move-info { margin: 0; min-height: 1.3em; font-size: 12px; color: var(--text-dim); text-align: center; }

/* Controls (same look as public/css/replay.css, a size smaller) */
.rp-controls { display: flex; gap: .3rem; align-items: center; }
.rp-btn, .rp-speed {
  background: var(--ground-2); border: 1px solid var(--border-h); border-radius: 7px;
  padding: .35rem .55rem; font: 600 .8rem var(--font-body); color: var(--text-dim);
  cursor: pointer; min-width: 2.2rem; min-height: 32px; white-space: nowrap;
}
.rp-btn:hover:not(:disabled), .rp-speed:hover { border-color: var(--text-dim); color: var(--text); }
.rp-btn:disabled { opacity: .4; cursor: default; }
.rp-btn:focus-visible, .rp-speed:focus-visible { outline: 2px solid var(--jade-l); outline-offset: 2px; }
.rp-btn--play { flex: 1; color: var(--text); border-color: var(--jade-l); background: color-mix(in srgb, var(--jade-l) 12%, var(--ground-2)); }
.rp-btn[hidden] { display: none; }
.rp-scrub { display: flex; align-items: center; gap: .6rem; }
.rp-scrub input[type=range] { flex: 1; min-width: 0; accent-color: var(--jade-l); }
.rp-counter { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.em-counter { flex: 1; text-align: center; }

/* Puzzle panel: fixed-height lists that scroll, so the board keeps its room */
.em-panel { display: flex; flex-direction: column; gap: 6px; }
.em-panel[hidden] { display: none; }
.pz-status {
  padding: .4rem .65rem; border-radius: 7px; font-size: 13px; line-height: 1.4;
  border: 1px solid var(--border-h); background: var(--ground-2); color: var(--text);
}
.pz-status--ok      { border-color: var(--jade-l); background: color-mix(in srgb, var(--jade-l) 10%, var(--ground-2)); }
.pz-status--success { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--ground-2)); font-weight: 600; }
.pz-status--wrong,
.pz-status--error   { border-color: #C06060; background: color-mix(in srgb, #C06060 10%, var(--ground-2)); color: #F0B0B0; }
.em-played { list-style: none; margin: 0; padding: 0; max-height: 4.6em; overflow-y: auto; font-size: 12px; }
.em-played:empty { display: none; }
.pz-step { padding: .15rem .4rem; color: var(--text-dim); }
.pz-step--red { color: #E07A7A; }
.pz-step.is-wrong { color: #E59A9A; text-decoration: line-through; }
.em-steps .pz-step { cursor: pointer; }
.pz-step.is-current { background: color-mix(in srgb, var(--jade-l) 16%, var(--ground-2)); color: var(--text); font-weight: 600; }
.em-actions { display: flex; gap: .3rem; }
.em-actions .rp-btn { flex: 1; }

/* Footer: where the board comes from */
.em-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: 6px; font-size: 12px; }
.em-brand { display: inline-flex; align-items: center; gap: .35rem; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .5px; }
.em-seal { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #F6E7C8; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.em-open { color: var(--gold); text-decoration: none; }
.em-open:hover, .em-brand:hover { text-decoration: underline; }

.em-unavailable { margin: auto; padding: 1rem; text-align: center; color: var(--text-dim); font-size: 14px; }
