/* css/prepare.css - shared by prepare.html (opponent info) and compare.html (player vs me) */
:root { --panel: #161b22; --border: #2a313c; --muted: #9aa4b2; --gold: #c59d5f; --win: #4caf50; --loss: #f44336; --draw: #8b949e; }
[hidden] { display: none !important; }
.wrap { margin: 0 auto; padding: calc(var(--hdr, 84px) + 16px) 24px 24px; font-family: 'Poppins', sans-serif; color: var(--text, #eee); }
#app section { padding: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
h1 { margin: 2px 0 0; font-size: 28px; color: #ffd60a; }
h2 { margin: 0 0 6px; font-size: 18px; color: var(--gold); }
small, .hint, .none { color: var(--muted); }
.hint { margin: 0 0 12px; font-size: 13px; }
.none { font-size: 13px; }
.w { color: var(--win) } .l { color: var(--loss) } .d { color: var(--draw) }
.sub { font-size: 14px; color: var(--muted); }
/* the file / opponent picker on the title line, to the right (pagelang.js moves [data-titlepick] there);
   full width below the title on narrow screens, or when it shows a longer text (first use, a list to correct) */
.titlerow .tpick { margin: 0 0 0 auto; padding: 8px 12px; max-width: 100%; }
.titlerow .tpick .picker, .titlerow .tpick .nfform { justify-content: flex-end; }
.titlerow .tpick #repInfo { margin: 6px 0 0 !important; text-align: right; font-size: 12px; }
.titlerow .tpick:has(> p.hint:not([hidden]):not(#repInfo), > details[open]:not([hidden])) { margin: 8px 0 0; flex-basis: 100%; }
.titlerow .tpick:has(> p.hint:not([hidden]):not(#repInfo), > details[open]:not([hidden])) .picker { justify-content: flex-start; }
@media (max-width: 900px) {
  .titlerow .tpick { margin: 8px 0 0; flex-basis: 100%; }
  .titlerow .tpick .picker, .titlerow .tpick .nfform { justify-content: flex-start; }
  .titlerow .tpick #repInfo { text-align: left; }
}
/* slim: no box, one row - the file's numbers (small) left of the picker; forms and longer texts on rows of their own */
.titlerow .tpick { background: none; border: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; column-gap: 14px; row-gap: 6px; }
.titlerow .tpick > * { flex-basis: 100%; }
.titlerow .tpick > .picker { flex-basis: auto; }
.titlerow .tpick > #repInfo { flex-basis: auto; order: -1; margin: 0 !important; color: var(--muted); }
@media (max-width: 900px) { .titlerow .tpick { justify-content: flex-start; } .titlerow .tpick > #repInfo { order: 1; } }
/* section tabs: one section at a time (Prepare, Compare, Repertoire explorer) */
.itabs { display: flex; gap: 4px; margin: 14px 0 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.itabs::-webkit-scrollbar { display: none; }
.itabs button { flex: none; padding: 9px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted);
  font: 600 14px 'Poppins', sans-serif; cursor: pointer; white-space: nowrap; }
.itabs button:hover { color: #e6edf3; }
.itabs button[aria-selected="true"] { color: var(--gold, #ffd60a); border-bottom-color: var(--gold, #ffd60a); }
.itabs button:focus-visible { outline: 2px solid #ffd60a; outline-offset: -2px; }
.itabs small { font-weight: 400; }
.tab-off { display: none !important; }
.sub b { color: #e6edf3; }
#status { font-size: 13px; color: var(--muted); margin: 6px 0; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--border); background: linear-gradient(#232b36, #181e27); color: inherit; font: 600 13px 'Poppins', sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: #ffd60a; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--gold); color: #111; border-color: var(--gold); }
.btn.sm { padding: 3px 11px; font-size: 12px; }
.btn:focus-visible, summary:focus-visible { outline: 2px solid #ffd60a; outline-offset: 2px; }
select, input, textarea { padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border); background: #0d1117; color: inherit; font: 14px 'Poppins', sans-serif; }
.picker { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#pick { min-width: 220px; max-width: min(100%, 320px); text-overflow: ellipsis; }
.lnk { color: var(--gold); font-size: 13px; text-decoration: none; }
.lnk:hover { text-decoration: underline; }
/* profile */
/* one row like My games: who he is (left) | his statistics (right); stacked on narrower screens */
.profile { display: flex; gap: 12px 20px; align-items: center; margin: 12px 0 0; }
.pwho { flex: 0 1 300px; min-width: 0; }
.pname { font-size: 22px; font-weight: 700; color: #f0d9a8; display: flex; gap: 4px 12px; align-items: baseline; flex-wrap: wrap; line-height: 1.25; }
.pname .lnk { font-size: 13px; font-weight: 400; }
.pnote { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pstats { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.sc { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.sl { font-weight: 600; font-size: 13px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rates { font-size: 12.5px; margin-top: 4px; }
.h2h { font-size: 12px; color: var(--muted); margin-top: 4px; }
@media (max-width: 1100px) { .profile { flex-wrap: wrap; } .pwho { flex-basis: 100%; } }
.h2h b { color: #e6edf3; }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #222a35; gap: 2px; }
.bar i.w { background: var(--win) } .bar i.d { background: var(--draw) } .bar i.l { background: var(--loss) }
/* colour tabs */
.tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.tab { border: 1px solid var(--border); background: transparent; color: inherit; border-radius: 999px; padding: 7px 18px; font: 600 14px 'Poppins', sans-serif; cursor: pointer; }
.tab.on { background: var(--gold); color: #111; border-color: var(--gold); }
/* plan + lines */
.plan { border-color: var(--gold); background: linear-gradient(rgba(197,157,95,.08), rgba(197,157,95,.02)); }
.plan ol { margin: 6px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.55; }
.plan li { margin-bottom: 6px; }
.plan b, .tip b { color: #f0d9a8; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cols2 .card { margin-bottom: 16px; }
.lrow { border-top: 1px solid var(--border); }
.lrow summary { list-style: none; cursor: pointer; padding: 9px 4px; border-radius: 6px; }
.lrow summary::-webkit-details-marker { display: none; }
.lrow summary:hover { background: rgba(255,255,255,.04); }
.lrow[open] summary { background: rgba(255,214,10,.06); }
.lhead { font-size: 14px; }
.prob { font-size: 12px; color: #111; background: var(--gold); border-radius: 999px; padding: 0 8px; margin-left: 6px; }
.lmoves { font-size: 12.5px; color: var(--muted); margin: 2px 0 5px; font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.lstats { display: flex; align-items: center; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }
.lstats .bar { flex: 0 0 90px; }
.tags { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag, .pub { font-size: 11.5px; border-radius: 999px; padding: 1px 8px; white-space: nowrap; border: 1px solid var(--border); color: #cdd5df; }
.tag.in { color: #7ee2a8; border-color: rgba(126,226,168,.45); }
.tag.new { color: #93c5fd; border-color: rgba(147,197,253,.45); }
.tag.his { color: #e8c88f; border-color: rgba(232,200,143,.45); }
.pub.known { color: #fbbf24; border-color: rgba(251,191,36,.45); }
.pub.hidden { color: #4ade80; border-color: rgba(74,222,128,.4); }
.ladvice { padding: 4px 6px 12px; font-size: 13px; }
.kids { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 6px; }
.kid { background: #0d1117; border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.tip { margin: 6px 0; line-height: 1.5; }
.glist { margin-top: 6px; }
.grow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; padding: 3px 0; border-top: 1px dashed rgba(255,255,255,.06); }
table.rep { border-collapse: collapse; width: 100%; font-size: 13px; }
.rep th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--border); }
.rep td { padding: 5px 6px; border-bottom: 1px solid var(--border); }
.barcell { width: 30%; }
.rep th.tip { cursor: help; text-decoration: underline dotted rgba(255,255,255,.3); text-underline-offset: 3px; }
.rep td.last { white-space: nowrap; color: var(--muted); }
.rep.ex tbody tr[data-ex] { cursor: pointer; }
.rep.ex tbody tr[data-ex]:hover { background: rgba(255,255,255,.05); }
.controls .btn.sm { align-self: flex-end; margin-bottom: 2px; }
/* move explorer: board | table; the board is sized to the screen height and stays in view while you scroll
   (also used by the Repertoire explorer) */
.exgrid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.exgrid { --exb: clamp(300px, calc(100vh - var(--hdr, 84px) - 260px), 720px); }
/* the board column is exactly the board's width, so engine lines and other content never resize the columns */
.exboardwrap { position: sticky; top: calc(var(--hdr, 84px) + 8px); width: var(--exb); min-width: 0; }
.exboardwrap > * { min-width: 0; max-width: 100%; }
#exBoard { width: var(--exb); }
.exnav { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
#exBox .controls { margin-top: 0; }
/* Prepare: what is above the board is known (title, profile row, tabs), so the board can be as large as the screen allows */
body[data-page="prepare"] .exgrid { --exb: clamp(300px, calc(100vh - var(--hdr, 84px) - 300px), 720px); }
.exright { min-width: 0; }
.exright > .tabs { margin-top: 0; }
@media (max-width: 900px) { .exright { display: contents; } .exright > .tabs { order: -1; } .exgrid { grid-template-columns: minmax(0, 1fr); } .exboardwrap { position: static; max-width: 520px; width: 100%; margin: 0 auto; } #exBoard { width: 100%; } }
/* strengths & weaknesses */
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 6px 0; }
.controls label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.qinfo { font-size: 13px; color: var(--muted); margin: 6px 0; }
.progress { height: 6px; background: #222a35; border-radius: 3px; overflow: hidden; margin: 6px 0 10px; }
#swBar { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.swrecs h3 { margin: 12px 0 6px; font-size: 15px; color: #e6edf3; }
.psub { margin: 18px 0 2px; font-size: 15px; color: #e6edf3; }
.psub:first-of-type { margin-top: 8px; }
.swrecs ul { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.swrecs li { font-size: 14px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; border-left: 3px solid #4ade80; background: rgba(74,222,128,.06); }
.swrecs li.avoid { border-left-color: #fbbf24; background: rgba(251,191,36,.06); }
.swrecs li b { color: #f0d9a8; }
.swgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.swc { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.swc.weak { border-color: #93c5fd; }
.swc.strong { border-color: rgba(126,226,168,.6); }
.swt { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.swb { font-size: 22px; font-weight: 700; margin: 4px 0; }
.swb small { font-size: 12px; font-weight: 400; color: var(--muted); }
.swl { font-size: 12.5px; color: var(--muted); }
@media (max-width: 900px) { .swgrid { grid-template-columns: 1fr; } }
/* dialogs */
dialog { border: 1px solid var(--border); border-radius: 14px; background: #161b22; color: var(--text, #eee); font-family: 'Poppins', sans-serif; }
dialog::backdrop { background: rgba(0,0,0,.7); }
#oppDlg { width: min(620px, calc(100vw - 24px)); padding: 22px 24px; }
#oppDlg h2 { color: var(--gold); }
.form { display: grid; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: #cdd5df; }
.form small { font-weight: 400; }
.oerror { min-height: 1.2em; color: #f87171; font-size: 13px; margin: 8px 0 0; }
/* his online games (Lichess / Chess.com) in the opponent dialog */
.oonline { border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px 10px; margin: 0; display: grid; gap: 8px; min-width: 0; }
.oonline legend { font-size: 12.5px; font-weight: 600; color: #cdd5df; padding: 0 4px; }
.orow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.form .oinl { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
#oUser { flex: 1 1 150px; min-width: 0; }
#oProg:empty, #oOnlineLast:empty { display: none; }
#oProg { margin: 0; }
#oOnlineLast .plink { all: unset; cursor: pointer; color: var(--gold); text-decoration: underline; }
.obtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
#viewDlg { width: min(1200px, calc(100vw - 24px)); height: min(900px, calc(100vh - 40px)); padding: 0; background: #0d1117; }
.vhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
#viewFrame { width: 100%; height: calc(100% - 46px); border: 0; }
@media (max-width: 1000px) { .cols2 { grid-template-columns: 1fr; } .pstats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .wrap { padding-left: 12px; padding-right: 12px; } .pstats { grid-template-columns: 1fr 1fr; }
  /* tables fit the screen: drop the Share and bar columns, smaller padding */
  .mv th:nth-child(3), .mv td:nth-child(3), .mv th:nth-child(4), .mv td:nth-child(4) { display: none; }
  .rep th, .rep td { padding: 5px 4px; }
  .mv small { display: block; }
  .rep.ex th:nth-child(6), .rep.ex td:nth-child(6) { display: none; }   /* last played: in the tooltip of "Your games" */
  .card { padding: 12px 10px; } }
/* FIDE search results in the opponent dialog */
.fidehits { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.fidehits:empty { display: none; }
.fidehit { text-align: left; background: #0d1117; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
  color: inherit; font: 13px 'Poppins', sans-serif; cursor: pointer; }
.fidehit:hover { border-color: #ffd60a; }
.fidehit span { color: var(--muted); font-size: 12px; }
/* move explorer: cross-check with your own games */
.you { white-space: nowrap; font-size: 12px; font-weight: 600; }
.you.in { color: #4ade80; }
.you.new { color: #93c5fd; }
span.you { border-radius: 999px; padding: 1px 8px; border: 1px solid currentColor; }
.lmoves span.you { margin-left: 2px; }
.rep.ex tbody tr.mine td:first-child b { color: #bbf7d0; }
.rep.ex tbody tr.notmine td:first-child b { color: #bfdbfe; }
/* move explorer: his games in the current line */
.exgames { margin-top: 14px; }
.exgames h3 { margin: 0 0 6px; font-size: 14px; color: #e6edf3; }
.exgames h3 small { font-weight: 400; margin-left: 6px; }
.exg { display: grid; grid-template-columns: 82px minmax(0, 1fr) 52px 74px minmax(0, .8fr); gap: 10px; align-items: center; width: 100%;
  text-align: left; background: none; border: 0; padding: 6px 4px; color: inherit;
  font: 12.5px 'Poppins', sans-serif; cursor: pointer; }
.exg:hover { background: rgba(255,255,255,.05); }
.exgrow { display: flex; align-items: center; border-top: 1px solid var(--border); }
.exgrow .exg { flex: 1; min-width: 0; }
.gdel { flex: none; width: 28px; height: 28px; margin-left: 4px; border: 1px solid var(--border); border-radius: 50%; background: none; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; }
.gdel:hover, .gdel:focus-visible { color: #fff; background: var(--loss); border-color: var(--loss); }
.grow .gdel { width: 24px; height: 24px; vertical-align: middle; }
.exg-date, .exg-event { color: var(--muted); }
.exg-who, .exg-event { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exg-next { font-family: ui-monospace, Consolas, monospace; color: #f0d9a8; }
.exgames .btn.sm { margin-top: 8px; }
@media (max-width: 600px) {
  .exg { grid-template-columns: 70px minmax(0, 1fr) 40px; row-gap: 2px; }
  .exg-next, .exg-event { display: none; }
}
/* move explorer: the move that → plays */
.rep.ex tbody tr.next td:first-child { box-shadow: inset 3px 0 0 #ffd60a; }
.rep.ex tbody tr.next td:first-child b::before { content: "▸ "; color: #ffd60a; }
.omode { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: -4px; }
.form .omode label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
/* move explorer: your prep for this line (modules/repforgame.js, as on My games) */
.gprep { margin: 4px 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.03); font-size: 13px; line-height: 1.5; }
.gprep .phead { font-weight: 600; margin-bottom: 2px; }
.gprep .phead small, .gprep .palt { color: var(--muted); font-weight: 400; }
.gprep .plink { all: unset; cursor: pointer; text-decoration: underline dotted; }
.gprep .plink:hover { color: #ffd60a; }
.gprep .pline { margin: 2px 0 4px; }
.gprep .lnk { font-size: 12.5px; color: #e8c88f; }
.gprep .lnk:hover { text-decoration: underline; }

/* the trainer against this opponent (train.html?opp=) */
.ptrain { font-size: 13px; color: var(--muted); margin-top: 6px; }
