/* assets/css/frontend-course.css */
.icc-course-player {
  --icc-light: #eeeecf;
  --icc-dark: #789b59;
  --icc-blue: #1769aa;
  --icc-border: #d8dde3;
  --icc-panel: #f7f8fa;
  --icc-board-size: 620px;
  width: 100%;
  margin: .75rem auto 1.5rem;
  color: #20252b;
  font-family: Arial, Helvetica, sans-serif;
}

.icc-course-shell {
  overflow: hidden;
  border: 1px solid var(--icc-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0,0,0,.07);
}

.icc-course-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--icc-border);
}

.icc-course-header h2 {
  margin: 0 0 4px;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
}

.icc-course-description {
  color: #5e6874;
  font-size: .92rem;
}
.icc-course-description > :first-child { margin-top: 0; }
.icc-course-description > :last-child { margin-bottom: 0; }

.icc-course-stats {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.icc-course-stats span {
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--icc-panel);
  white-space: nowrap;
}

.icc-course-layout {
  display: grid;
  grid-template-columns: minmax(190px, 235px) minmax(0, 1fr);
  align-items: stretch;
}

.icc-course-navigation {
  min-height: 100%;
  padding: 15px;
  border-right: 1px solid var(--icc-border);
  background: var(--icc-panel);
  overflow: auto;
}

.icc-course-nav-chapter { margin-bottom: 16px; }
.icc-course-nav-chapter h3 {
  margin: 0 0 7px;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.icc-course-nav-chapter button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0 0 5px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.icc-course-nav-chapter button:hover,
.icc-course-nav-chapter button.is-active {
  border-color: #b9cce0;
  background: #fff;
}

.icc-course-nav-chapter button.is-active { box-shadow: inset 3px 0 0 var(--icc-blue); }
.icc-course-nav-chapter small { color: #66717d; white-space: nowrap; }

.icc-course-training {
  display: grid;
  grid-template-columns: minmax(320px, var(--icc-board-size)) minmax(280px, 420px);
  justify-content: start;
  align-items: start;
  gap: 20px;
  min-width: 0;
  padding: 16px 18px 18px;
  box-sizing: border-box;
}

.icc-course-board-column {
  width: var(--icc-board-size);
  max-width: 100%;
  min-width: 0;
}

.icc-course-variation-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.icc-course-variation-heading span:first-child { color: #66717d; font-size: .88rem; }
.icc-course-variation-heading h3 { margin: 2px 0 0; font-size: 1.2rem; }
.icc-course-move-count {
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--icc-panel);
  color: #66717d;
  white-space: nowrap;
}

.icc-course-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: var(--icc-board-size);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid #31363b;
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  container-type: inline-size;
}

.icc-course-square {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.icc-course-square.is-light { background: var(--icc-light); }
.icc-course-square.is-dark { background: var(--icc-dark); }
.icc-course-square.is-legal-hover { box-shadow: inset 0 0 0 5px #2ea44f; }
.icc-course-square.is-hint,
.icc-course-square.is-hint-source { box-shadow: inset 0 0 0 5px #f0a500; }

.icc-course-piece,
.icc-course-drag-ghost {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: "Segoe UI Symbol", "DejaVu Sans", sans-serif;
  font-size: clamp(32px, 10cqw, 74px);
  line-height: 1;
  font-weight: 400;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.45));
}

.icc-course-piece { position: relative; z-index: 2; }
.icc-course-piece.is-draggable { cursor: grab; }
.icc-course-piece.is-hidden { visibility: hidden; }
.icc-course-drag-ghost {
  position: fixed;
  z-index: 2147483647;
  top: 0;
  left: 0;
  pointer-events: none;
  filter: drop-shadow(0 5px 4px rgba(0,0,0,.3));
}

.icc-course-coordinate {
  position: absolute;
  z-index: 2;
  font-size: clamp(9px, 1.4cqw, 13px);
  line-height: 1;
  font-weight: 700;
  pointer-events: none;
}
.icc-course-file { right: 3px; bottom: 2px; }
.icc-course-rank { left: 3px; top: 2px; }
.icc-course-square.is-light .icc-course-coordinate { color: var(--icc-dark); }
.icc-course-square.is-dark .icc-course-coordinate { color: var(--icc-light); }

.icc-course-annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.icc-course-side-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--icc-board-size);
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--icc-border);
  border-radius: 8px;
  background: #fff;
}

.icc-course-side-heading {
  padding: 13px 15px;
  border-bottom: 1px solid var(--icc-border);
  font-size: 1.08rem;
  font-weight: 700;
}

.icc-course-status {
  margin: 12px 14px 0;
  padding: 11px 13px;
  border: 1px solid var(--icc-border);
  border-radius: 6px;
  background: var(--icc-panel);
  font-size: 1rem;
}

.icc-course-status[data-state="correct"],
.icc-course-status[data-state="complete"] { border-color: #4c9a5d; background: #f1fbf3; }
.icc-course-status[data-state="wrong"],
.icc-course-status[data-state="illegal"] { border-color: #c25555; background: #fff4f4; }
.icc-course-status[data-state="hint"] { border-color: #d99d00; background: #fff9e7; }
.icc-course-status[data-state="demonstration"] { border-color: #4b75c5; background: #f2f6ff; }

.icc-course-notes {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px;
}
.icc-course-notes[hidden] { display: none; }

.icc-course-note {
  margin: 0 0 13px;
  padding: 12px 13px;
  border-left: 4px solid var(--icc-blue);
  border-radius: 4px;
  background: #f8fafc;
  font-size: 1.06rem;
  line-height: 1.55;
}
.icc-course-note:last-child { margin-bottom: 0; }
.icc-course-note-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: #394553;
  font-size: .94rem;
  font-weight: 700;
}
.icc-course-note-body > :first-child { margin-top: 0; }
.icc-course-note-body > :last-child { margin-bottom: 0; }
.icc-course-note-diagram {
  color: #567044;
  font-size: .9rem;
  font-style: italic;
}

.icc-course-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--icc-border);
  background: var(--icc-panel);
}

.icc-course-controls button {
  padding: 8px 12px;
  border: 1px solid #8c969f;
  border-radius: 5px;
  background: #fff;
  color: #20252b;
  font: inherit;
  cursor: pointer;
}
.icc-course-controls button:hover,
.icc-course-controls button:focus-visible { background: #eef1f4; }
.icc-course-controls button.icc-primary { border-color: var(--icc-blue); background: var(--icc-blue); color: #fff; }

.icc-course-mode { font-weight: 700; }
.icc-course-mode[data-mode="learn"] { background: #eaf4ff; color: #125b93; }
.icc-course-mode[data-mode="repeat"] { background: #f0ecff; color: #5235b8; }

.icc-error {
  margin: 1rem 0;
  padding: 12px;
  border: 1px solid #c25555;
  border-radius: 5px;
  background: #fff4f4;
  color: #721c24;
}

@media (max-width: 1180px) {
  .icc-course-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .icc-course-training { grid-template-columns: minmax(320px, var(--icc-board-size)) minmax(250px, 1fr); gap: 14px; }
}

@media (max-width: 980px) {
  .icc-course-layout { grid-template-columns: 1fr; }
  .icc-course-navigation {
    border-right: 0;
    border-bottom: 1px solid var(--icc-border);
    max-height: 190px;
  }
  .icc-course-training { grid-template-columns: 1fr; }
  .icc-course-board-column { margin: 0 auto; }
  .icc-course-side-panel { height: auto; min-height: 260px; }
}

@media (max-width: 620px) {
  .icc-course-header { flex-direction: column; padding: 12px; }
  .icc-course-stats { width: 100%; flex-wrap: wrap; }
  .icc-course-stats span { flex: 1; text-align: center; }
  .icc-course-training { padding: 12px; }
  .icc-course-board-column,
  .icc-course-board { width: 100%; }
  .icc-course-note { font-size: 1rem; }
}

/* Version 4: full clickable move history and reference subvariations. */
.icc-course-status[data-state="review"] {
  border-color: #4b75c5;
  background: #f2f6ff;
}

.icc-course-notes {
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.icc-course-note {
  position: relative;
  font-size: 1.12rem;
  line-height: 1.62;
  transition: background .15s ease, border-color .15s ease;
}

.icc-course-note.is-current {
  border-left-color: #185abd;
  background: #edf5ff;
}

button.icc-course-note-title {
  display: block;
  width: 100%;
  margin: 0 0 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1c4f91;
  font: inherit;
  font-size: .98rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

button.icc-course-note-title:hover,
button.icc-course-note-title:focus-visible {
  color: #0b63ce;
  text-decoration: underline;
}

.icc-course-note-body {
  color: #20252b;
}

.icc-course-subvariation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.icc-course-subvariation-links button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1769d2;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.icc-subvariation-review {
  margin-top: 15px;
  padding: 11px;
  border: 1px solid #8db8eb;
  border-radius: 6px;
  background: #f2f7ff;
}

.icc-subvariation-review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: #14589c;
}

.icc-subvariation-review-heading button {
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #14589c;
  font-size: 1.25rem;
  cursor: pointer;
}

.icc-subvariation-move {
  margin: 7px 0;
  padding: 8px 9px;
  border-left: 3px solid #78a8df;
  background: #fff;
}

.icc-subvariation-move.is-current {
  border-left-color: #155fb0;
  background: #e5f1ff;
}

.icc-subvariation-move > button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1769d2;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.icc-course-controls [data-action="continue-demo"] {
  margin-left: auto;
  min-width: 92px;
}

/* Version 5: inline clickable reference lines and square references in comments. */
.icc-inline-reference-line {
  display: inline;
  margin: 0;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #1769d2;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.icc-inline-reference-line:hover,
.icc-inline-reference-line:focus-visible {
  color: #084fae;
  background: #e8f2ff;
  border-radius: 3px;
}

.icc-inline-reference-legacy {
  display: block;
  margin-top: 6px;
}

.icc-square-reference {
  color: #1769d2;
  font-weight: 600;
  cursor: default;
}

.icc-course-square.is-text-reference::after {
  content: "";
  position: absolute;
  z-index: 7;
  inset: 11%;
  box-sizing: border-box;
  border: max(2px, .055em) solid rgba(54, 147, 69, .92);
  border-radius: 50%;
  pointer-events: none;
}

/* Version 7: study-first workflow and inline PGN reference lines */
.icc-course-player {
  --icc-blue: #0d5bd7;
  margin: 0 auto 1.5rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.icc-course-shell { border-radius: 12px; box-shadow: 0 8px 28px rgba(15,23,42,.08); }
.icc-course-training { grid-template-columns: minmax(320px, var(--icc-board-size)) minmax(300px, 460px); }
.icc-course-status[data-state="study"] { border-color: #8db6ef; background: #f1f6ff; }
.icc-study-navigation {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #d5dce6;
  border-radius: 7px;
  background: #d5dce6;
}
.icc-study-navigation[hidden] { display: none; }
.icc-study-navigation button {
  min-height: 40px;
  border: 0;
  background: #f8fafc;
  color: #506074;
  cursor: pointer;
  font-size: 1.05rem;
}
.icc-study-navigation button:hover { background: #eaf2ff; color: #0d5bd7; }
.icc-course-note-title { color: #174f9f !important; }
.icc-course-note-body { font-size: 1.08rem; line-height: 1.62; }
.icc-inline-comment-move {
  display: inline;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #145fd0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.icc-inline-comment-move:hover,
.icc-inline-comment-move:focus-visible { background: #e5f0ff; color: #064ba8; }
.icc-course-empty-notes,
.icc-course-test-note { margin: 0; padding: 18px 8px; color: #758195; line-height: 1.5; }
.icc-course-side-panel { border-radius: 10px; }
.icc-course-controls [data-action="start-test"] { margin-left: auto; min-width: 92px; }
.icc-course-square.is-text-reference::after {
  inset: 12%;
  border-width: max(2px, .055em);
}
@media (max-width: 1180px) {
  .icc-course-training { grid-template-columns: minmax(320px, var(--icc-board-size)) minmax(270px, 1fr); }
}
@media (max-width: 980px) {
  .icc-course-training { grid-template-columns: 1fr; }
  .icc-course-side-panel { height: min(520px, 60vh); }
}


/* Version 8: larger focused study layout and persistent reference-line text. */
body.is-training-preview .icc-course-player {
  --icc-board-size: 680px;
  width: 100%;
  max-width: none;
  margin-bottom: 0;
}
body.is-training-preview .icc-course-shell {
  border-radius: 10px;
}
body.is-training-preview .icc-course-header {
  align-items: center;
  padding: 9px 14px;
}
body.is-training-preview .icc-course-header h2 {
  margin: 0;
  font-size: 1.22rem;
}
body.is-training-preview .icc-course-description {
  display: none;
}
body.is-training-preview .icc-course-stats span {
  padding: 5px 8px;
  font-size: .88rem;
}
body.is-training-preview .icc-course-layout {
  grid-template-columns: minmax(160px, 195px) minmax(0, 1fr);
}
body.is-training-preview .icc-course-navigation {
  padding: 12px 10px;
}
body.is-training-preview .icc-course-training {
  grid-template-columns: minmax(440px, var(--icc-board-size)) minmax(390px, 1fr);
  gap: clamp(18px, 2vw, 30px);
  padding: 12px 16px 16px;
}
body.is-training-preview .icc-course-board-column {
  width: var(--icc-board-size);
}
body.is-training-preview .icc-course-side-panel {
  height: var(--icc-board-size);
  min-width: 0;
}
body.is-training-preview .icc-course-side-heading {
  padding: 14px 18px;
  font-size: 1.24rem;
}
body.is-training-preview .icc-course-status {
  margin: 12px 16px 0;
  padding: 12px 14px;
  font-size: 1.05rem;
}
body.is-training-preview .icc-course-notes {
  padding: 14px 16px;
}
body.is-training-preview .icc-course-note {
  padding: 14px 15px;
  font-size: 1.2rem;
  line-height: 1.67;
}
body.is-training-preview .icc-course-note-title,
body.is-training-preview button.icc-course-note-title {
  font-size: 1.06rem;
}
body.is-training-preview .icc-course-note-body {
  font-size: 1.18rem;
  line-height: 1.67;
}
.icc-course-note.is-reference-source {
  border-left-color: #7c3aed;
  background: #f5f1ff;
}
.icc-course-player.is-reviewing-reference .icc-course-note.is-reference-source {
  box-shadow: inset 0 0 0 1px rgba(124,58,237,.12);
}

@media (max-width: 1279px) {
  body.is-training-preview .icc-course-layout { grid-template-columns: 165px minmax(0, 1fr); }
  body.is-training-preview .icc-course-training { grid-template-columns: minmax(400px, var(--icc-board-size)) minmax(340px, 1fr); }
}
@media (max-width: 980px) {
  body.is-training-preview .icc-course-layout { grid-template-columns: 1fr; }
  body.is-training-preview .icc-course-training { grid-template-columns: 1fr; }
  body.is-training-preview .icc-course-board-column { width: min(100%, 680px); margin: 0 auto; }
  body.is-training-preview .icc-course-side-panel { width: min(100%, 680px); height: min(560px, 65vh); margin: 0 auto; }
}

/* v13.5: automatic engine review after a wrong repertoire-test move. */
.icc-course-engine-review {
  margin: 0 14px 12px;
  padding: 11px;
  border: 1px solid #b9cff5;
  border-radius: 9px;
  background: #f4f8ff;
}
.icc-course-engine-review[hidden] { display: none; }
.icc-course-engine-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.icc-course-engine-heading button,
.icc-course-engine-review > button {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #b9c7dc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.icc-course-engine-heading button.is-active { background: #e4efff; border-color: #72a1ed; color: #0a55c9; }
.icc-course-engine-state { margin: 7px 0; color: #64748b; font-size: .82rem; }
.icc-course-engine-lines { display: grid; gap: 4px; margin-bottom: 8px; }
.icc-course-engine-lines > div { display: grid; grid-template-columns: 54px 1fr auto; gap: 7px; padding: 5px 7px; border-radius: 5px; background: #fff; }
.icc-course-engine-lines b { color: #0e4da4; }
.icc-course-engine-lines span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; }
.icc-course-engine-lines small { color: #718096; }

/* v13.6: manual Stockfish launch from learning and testing. */
.icc-course-stockfish-launch {
  flex: 0 0 auto;
  padding: 0 14px 12px;
  background: #fff;
}
.icc-course-stockfish-launch button {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 8px 11px;
  border: 1px solid #cad7ea;
  border-radius: 8px;
  background: #f6f9ff;
  color: #163b73;
  text-align: left;
  cursor: pointer;
}
.icc-course-stockfish-launch button:hover,
.icc-course-stockfish-launch button:focus-visible {
  border-color: #7aa4e6;
  background: #edf4ff;
}
.icc-course-stockfish-launch svg {
  grid-row: 1 / 3;
  width: 25px;
  height: 25px;
  fill: #2364d2;
}
.icc-course-stockfish-launch span {
  font-size: .92rem;
  font-weight: 750;
}
.icc-course-stockfish-launch small {
  color: #687b98;
  font-size: .73rem;
}


/* v15.1.122: Variation Preview uses the same compact notation language as Opening Lab. */
.icc-course-notes.course-opening-notation{display:block!important;padding:10px 12px!important;line-height:1.85!important;overflow:auto!important}
.course-preview-mainline{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 3px}
.course-preview-inline-comment{display:inline;white-space:normal;margin:0 5px 0 2px}
.course-opening-notation .study-move{font:inherit;cursor:pointer}
.course-opening-notation .study-move.is-reference-source{box-shadow:inset 0 0 0 2px rgba(23,95,185,.28)}

/* v15.1.124 — Variation Preview uses a Chessable-like reading layout:
   move chunks flow inline, comments occupy their own full-width paragraphs. */
.icc-course-notes.course-chessable-notation{
  display:block!important;
  padding:14px 16px!important;
  overflow:auto!important;
  background:#fff;
  color:#434343;
  font-size:16px;
  line-height:1.55;
}
.course-reading-moves{
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:3px 5px;
  margin:0 0 10px;
}
.course-reading-move-unit{display:inline-flex;align-items:baseline}
.course-reading-move{
  display:inline-flex;
  align-items:baseline;
  gap:4px;
  border:0;
  border-radius:4px;
  background:transparent;
  color:#555;
  padding:2px 4px;
  font:650 17px/1.35 inherit;
  cursor:pointer;
}
.course-reading-move:hover{background:#eef1f5;color:#262626}
.course-reading-move.is-current{background:#d7d9dd;color:#303030}
.course-reading-move.is-reference-source{box-shadow:inset 0 0 0 2px rgba(44,128,208,.30)}
.course-reading-number{font-weight:650;color:inherit}
.course-reading-san{font-weight:650;color:inherit}
.course-reading-comment{
  display:block;
  width:100%;
  box-sizing:border-box;
  margin:2px 0 18px;
  color:#444;
  font-size:16px;
  font-weight:400;
  line-height:1.58;
  white-space:normal;
  overflow-wrap:anywhere;
}
.course-reading-comment .icc-inline-comment-move{
  color:#2f82c9;
  font-weight:650;
  text-decoration:none;
}
html[data-theme="dark"] .icc-course-notes.course-chessable-notation{background:#151515;color:#d0d0d0}
html[data-theme="dark"] .course-reading-move{color:#c8c8c8}
html[data-theme="dark"] .course-reading-move:hover{background:#2a2a2a;color:#fff}
html[data-theme="dark"] .course-reading-move.is-current{background:#444;color:#fff}
html[data-theme="dark"] .course-reading-comment{color:#c9c9c9}
html[data-theme="dark"] .course-reading-comment .icc-inline-comment-move{color:#58a8ea}
@media(max-width:720px){
  .icc-course-notes.course-chessable-notation{padding:11px 12px!important;font-size:15px}
  .course-reading-move{font-size:16px}
  .course-reading-comment{font-size:15px;margin-bottom:14px}
}


/* v15.1.125 — wider variation navigation, compact Chessable-like notes panel, legal-move targets. */
@media (min-width: 1100px){
  .icc-course-layout{grid-template-columns:minmax(230px,280px) minmax(0,1fr)}
  .icc-course-training{grid-template-columns:minmax(360px,var(--icc-board-size)) minmax(380px,520px);gap:16px}
  .icc-course-side-panel{height:calc(var(--icc-board-size) + 42px);max-height:calc(var(--icc-board-size) + 42px)}
  .icc-course-notes{padding:10px 14px}
}
.icc-course-square.is-legal-target::after{content:"";position:absolute;z-index:3;width:22%;aspect-ratio:1;border-radius:50%;background:rgba(20,30,40,.28);pointer-events:none}
.icc-course-square.is-legal-hover::after{background:rgba(33,160,79,.52)}
html[data-theme="dark"] .icc-course-square.is-legal-target::after{background:rgba(255,255,255,.32)}

.puzzle-message[data-state="soft"],.icc-course-status[data-state="soft"]{background:#eef6ff;color:#22538f;border-color:#bdd5f4}

/* v15.1.127 — preview panel aligns with the board navigation; compact analysis actions. */
@media (min-width:981px){
  body.is-training-preview .icc-course-training{align-items:stretch}
  body.is-training-preview .icc-course-side-panel{height:auto!important;max-height:none!important;align-self:stretch}
}
.icc-course-stockfish-launch{display:flex;align-items:center;gap:8px;padding:7px 14px 10px}
.icc-course-stockfish-launch .icc-course-icon-action{
  display:grid;place-items:center;width:38px;height:38px;min-height:38px;padding:0;border:1px solid #cad7ea;border-radius:8px;background:#f6f9ff;color:#163b73;cursor:pointer
}
.icc-course-stockfish-launch .icc-course-icon-action svg{grid-row:auto;width:21px;height:21px;fill:#2364d2}
.icc-course-stockfish-launch .icc-course-study-return{font-size:21px;line-height:1}
.icc-course-stockfish-launch .icc-course-icon-action[hidden]{display:none}
.course-reading-move-unit{gap:2px}
.course-reading-comment-edit{display:inline-grid;place-items:center;width:22px;height:22px;padding:0;border:0;background:transparent;color:#7b8794;border-radius:4px;font-size:13px;line-height:1;opacity:.28;cursor:pointer;vertical-align:middle}
.course-reading-move-unit:hover .course-reading-comment-edit,.course-reading-comment-edit:focus-visible{opacity:1;background:#eef2f6}
.course-reading-comment.is-preview-comment{border-left:3px solid rgba(35,100,210,.28);padding-left:10px}
html[data-theme="dark"] .course-reading-comment-edit{color:#aab4c0}
html[data-theme="dark"] .course-reading-comment-edit:hover,html[data-theme="dark"] .course-reading-comment-edit:focus-visible{background:#30343a}

/* v15.1.128 — persistent Study toggle, editable navigation and full-height notes. */
@media (min-width:981px){
  .icc-course-training{align-items:stretch!important}
  .icc-course-side-panel{height:auto!important;max-height:none!important;align-self:stretch!important}
}
.icc-course-stockfish-launch .icc-course-study-return{display:grid!important;opacity:.62;filter:grayscale(.2)}
.icc-course-stockfish-launch .icc-course-study-return.is-active{opacity:1;background:#e5efff;border-color:#78a4e9;box-shadow:inset 0 0 0 1px rgba(35,100,210,.12)}
.icc-course-nav-chapter-title{display:block;width:100%;padding:4px 8px;margin:0;border:0;background:transparent;color:inherit;text-align:left;font:inherit;font-weight:800;cursor:text;border-radius:5px}
.icc-course-nav-chapter-title:hover,.icc-course-nav-chapter-title:focus-visible{background:rgba(80,105,135,.09);outline:none}
.icc-course-nav-variation-title{cursor:text;border-radius:4px;padding:1px 3px;margin:-1px -3px}
.icc-course-nav-variation-title:hover{background:rgba(80,105,135,.10)}
.icc-course-square.is-selected-square{box-shadow:inset 0 0 0 4px rgba(242,194,26,.95)}
.icc-course-square.is-capture-target::after{width:78%!important;background:transparent!important;border:5px solid rgba(45,55,65,.36);box-sizing:border-box}

/* v15.1.137 — course review engine lines share the Analysis Board component. */
.icc-course-engine-lines{display:grid;gap:3px;margin-bottom:8px;padding:0}
.icc-course-engine-lines>.analysis-pv-row{
  display:grid;grid-template-columns:56px minmax(0,1fr) auto;gap:7px;align-items:center;width:100%;
  min-height:34px;padding:5px 7px;border:1px solid transparent;border-radius:7px;background:#fff;
  color:inherit;text-align:left;cursor:pointer;font:inherit;font-size:.84rem;box-sizing:border-box;
}
.icc-course-engine-lines>.analysis-pv-row:hover{border-color:#bcd0ff;background:#edf3ff}
.icc-course-engine-lines>.analysis-pv-row .analysis-pv-score{color:#0f3c8f;font-weight:900}
.icc-course-engine-lines>.analysis-pv-row .analysis-pv-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}
.icc-course-engine-lines>.analysis-pv-row small{color:#64748b;font-size:.72rem}


/* v15.1.142 — unified Variation Preview comments, rename control and readable selection. */
.icc-course-nav-tools{display:flex;align-items:center;justify-content:flex-start;padding:0 4px 7px;margin-bottom:4px;border-bottom:1px solid rgba(120,140,165,.18)}
.icc-course-nav-tools button{min-height:28px;padding:4px 9px;border:1px solid #c8d4e3;border-radius:6px;background:#fff;color:#29415f;font:750 11px/1.2 inherit;cursor:pointer}
.icc-course-nav-tools button:hover{border-color:#7ea5df;background:#f2f6fc}
html[data-theme="dark"] .icc-course-nav-tools button{background:#1c2632;border-color:#465467;color:#eef3fa}

/* Preview comments are one logical field regardless of where they were first entered. */
.course-reading-comment.is-preview-comment{border-left:0!important;padding-left:0!important}

/* Unannotated current moves: darker neutral selection with dark, legible notation. */
.course-reading-move.is-current{background:#c9cdd3!important;color:#222b35!important}
html[data-theme="dark"] .course-reading-move.is-current{background:#4a515a!important;color:#f4f6f8!important}

/* Annotated current moves keep the annotation colour and receive a subtle matching tint. */
.course-reading-move.is-current:has(.tjk-nag-good),.course-reading-move.is-current:has(.tjk-nag-only){background:#eef8e9!important;color:#4da514!important}
.course-reading-move.is-current:has(.tjk-nag-brilliant){background:#e8f8f9!important;color:#12aeb8!important}
.course-reading-move.is-current:has(.tjk-nag-interesting){background:#fbecf5!important;color:#d653a0!important}
.course-reading-move.is-current:has(.tjk-nag-dubious){background:#eaf3fc!important;color:#3185d8!important}
.course-reading-move.is-current:has(.tjk-nag-mistake){background:#fff5e5!important;color:#d98a16!important}
.course-reading-move.is-current:has(.tjk-nag-blunder){background:#fdecec!important;color:#d64545!important}
.course-reading-move.is-current:has(.tjk-nag-good) .tjk-move-annotation,.course-reading-move.is-current:has(.tjk-nag-only) .tjk-move-annotation,.course-reading-move.is-current:has(.tjk-nag-brilliant) .tjk-move-annotation,.course-reading-move.is-current:has(.tjk-nag-interesting) .tjk-move-annotation,.course-reading-move.is-current:has(.tjk-nag-dubious) .tjk-move-annotation,.course-reading-move.is-current:has(.tjk-nag-mistake) .tjk-move-annotation,.course-reading-move.is-current:has(.tjk-nag-blunder) .tjk-move-annotation{color:inherit!important}


/* v15.1.150 — Variation Preview comments are opened from a move context menu, not pencil icons. */
.course-reading-comment-edit{display:none!important}
.course-preview-move-context-menu{
  position:fixed;z-index:12050;min-width:150px;padding:5px;border:1px solid #cbd5e1;border-radius:7px;
  background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.20)
}
.course-preview-move-context-menu button{
  display:block;width:100%;padding:7px 10px;border:0;border-radius:5px;background:transparent;color:#26364d;
  text-align:left;font:700 12px/1.3 inherit;cursor:pointer
}
.course-preview-move-context-menu button:hover,.course-preview-move-context-menu button:focus-visible{background:#eef4ff;color:#1459bd;outline:0}
html[data-theme="dark"] .course-preview-move-context-menu{background:#202833;border-color:#465365}
html[data-theme="dark"] .course-preview-move-context-menu button{color:#e7edf5}
html[data-theme="dark"] .course-preview-move-context-menu button:hover,html[data-theme="dark"] .course-preview-move-context-menu button:focus-visible{background:#2c3d56;color:#fff}


/* v15.1.152 — long Variation Preview libraries scroll only inside the left
   navigation. Test mode supports visible queued premoves. */
@media (min-width:981px){
  body.is-training-preview .icc-course-layout{align-items:start!important}
  body.is-training-preview .icc-course-navigation{
    min-height:0!important;
    height:min(calc(var(--icc-board-size) + 92px),calc(100dvh - 150px))!important;
    max-height:min(calc(var(--icc-board-size) + 92px),calc(100dvh - 150px))!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
}
.icc-course-square.is-premove-source{
  box-shadow:inset 0 0 0 4px rgba(58,137,214,.90)!important;
}
.icc-course-square.is-premove-target{
  box-shadow:inset 0 0 0 999px rgba(86,162,226,.22),inset 0 0 0 4px rgba(58,137,214,.90)!important;
}


/* v15.1.153 — wrong-move remediation / add-to-training control. */
.icc-course-wrong-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:7px}
.icc-course-wrong-actions[hidden]{display:none!important}
.icc-course-wrong-actions button{min-height:30px;padding:5px 9px;border:1px solid #c8d7ef;border-radius:7px;background:#f4f8ff;color:#174f9c;font:750 11px/1.2 inherit;cursor:pointer}
.icc-course-wrong-actions button:hover{border-color:#7fa9e6;background:#eaf2ff}
.icc-course-wrong-actions button:disabled{opacity:.55;cursor:default}
.icc-course-wrong-actions small{color:#65748a;font-size:.72rem;font-weight:650}
html[data-theme="dark"] .icc-course-wrong-actions button{background:#1d2a3a;border-color:#455b78;color:#dbe9ff}

/* v15.1.154 — stable Variation Preview sizing and clearer column balance. */
@media (min-width:1280px){
  body.is-training-preview .icc-course-layout{
    grid-template-columns:minmax(220px,250px) minmax(0,1fr)!important;
  }
  body.is-training-preview .icc-course-training{
    grid-template-columns:minmax(440px,var(--icc-board-size)) minmax(360px,650px)!important;
    gap:16px!important;
  }
}
@media (min-width:981px) and (max-width:1279px){
  body.is-training-preview .icc-course-layout{
    grid-template-columns:minmax(195px,225px) minmax(0,1fr)!important;
  }
  body.is-training-preview .icc-course-training{
    grid-template-columns:minmax(400px,var(--icc-board-size)) minmax(300px,1fr)!important;
    gap:14px!important;
  }
}
@media (min-width:981px){
  /* A definite block size keeps all eight CSS-grid ranks allocated even while
     Study/Test mode is being switched and the surrounding controls reflow. */
  body.is-training-preview .icc-course-board{
    width:var(--icc-board-size)!important;
    height:var(--icc-board-size)!important;
    aspect-ratio:auto!important;
  }
}
.icc-course-nav-variation-title{cursor:pointer!important}
.icc-course-alternative-review{
  margin:2px 0 8px;padding:12px 13px;border:1px solid #b8d3f4;border-radius:8px;background:#f2f7ff;color:#25364c
}
.icc-course-alternative-review strong{display:block;margin-bottom:6px;color:#174f9c}
.icc-course-alternative-review p{margin:0 0 7px;white-space:pre-wrap;line-height:1.45}
.icc-course-alternative-review small{color:#63758d}
html[data-theme="dark"] .icc-course-alternative-review{background:#1c2a3b;border-color:#405c80;color:#edf4ff}
html[data-theme="dark"] .icc-course-alternative-review strong{color:#9fc2ff}
