/* Lettertypen: zie fonts/fonts.css, gelinkt vanuit index.html. */

:root {
  --sq: 40px;   /* bordvakgrootte — wordt dynamisch aangepast via JS */
  /* SMRA kleuren */
  --ink:          #1a1209;
  --ink-soft:     #3d2f1a;
  --ink-muted:    #7a6a55;
  --paper:        #f5eedf;
  --paper-dark:   #ede4cf;
  --paper-mid:    #e4d8bf;
  --paper-shadow: #d6c9aa;
  --rule:         #c8b89a;
  --rule-heavy:   #8c7355;
  --gold:         #b8892a;
  --gold-light:   #d4af37;
  --title-color:  #6b1414;
  --red-accent:   #6b1414;

  /* Mapping naar de app-variabelen */
  --bg:        var(--paper-dark);
  --surface:   var(--paper);
  --surface2:  var(--paper-mid);
  --border:    var(--rule);
  --accent:    var(--gold);
  --accent2:   var(--gold-light);
  --text:      var(--ink);
  --text-muted: var(--ink-muted);
  --white-sq:  #f0d9b5;
  --black-sq:  #b58863;
  --my-move:   var(--title-color);
  --opp-move:  #2a5a8c;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Globale scrollbar-stijl (webkit) ─────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--paper-dark); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--rule-heavy); }
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--rule) var(--paper-dark); }

body {
  font-family: 'Libre Baskerville', Georgia, serif;
  background: var(--paper-dark);
  color: var(--ink);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
  opacity: 0.5;
}

header {
  background: var(--paper);
  border-bottom: 4px double var(--rule-heavy);
  padding: 8px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  gap: 12px;
}

header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rule-heavy), var(--gold-light), var(--rule-heavy));
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo-icon {
  width: 52px;
  height: 52px;
  background-color: var(--ink);
  background-image: url('images/logo-icon.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 55%;
  flex-shrink: 0;
  border: 2px solid var(--rule-heavy);
}

.header-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}

.header-logo-text .logo-main {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  font-variant-caps: all-small-caps;
  color: var(--title-color);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.header-logo-text .logo-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
}

header h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--title-color);
  letter-spacing: 0.08em;
  font-variant-caps: small-caps;
  font-feature-settings: "smcp" 1;
  text-align: center;
  justify-self: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.lang-selector {
  display: flex;
  gap: 2px;
}

.lang-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}

.lang-btn:hover {
  background: var(--paper-mid);
  border-color: var(--rule-heavy);
  color: var(--ink);
}

.lang-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.info-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.info-btn:hover {
  background: var(--title-color);
}

/* ── INFO MODAL ── */
.info-modal {
  width: 420px;
}
.info-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Libre Baskerville', serif;
  font-size: 0.85rem;
  color: var(--ink);
}
.info-label {
  font-weight: 700;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  min-width: 110px;
}
.info-links {
  gap: 14px;
  padding-top: 4px;
  border-top: 1px solid var(--rule);
}
.info-link {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--title-color);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.info-link:hover { text-decoration: underline; }
.info-copyright {
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.72rem;
  color: var(--ink-muted);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── BOARD PANEL ── */
.board-panel {
  width: calc(8 * var(--sq) + 16px + 50px);
  min-width: calc(8 * var(--sq) + 16px + 50px);
  background: var(--paper);
  border-right: 2px solid var(--rule);
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  gap: 11px;
  overflow-y: auto;
  min-height: 0;
}

.board-outer { display: flex; }

.rank-labels {
  display: flex;
  flex-direction: column;
  width: 16px;
  flex-shrink: 0;
}

.rank-labels span {
  height: var(--sq);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-col { display: flex; flex-direction: column; }

#chessboard {
  display: grid;
  grid-template-columns: repeat(8, var(--sq));
  grid-template-rows: repeat(8, var(--sq));
  border: 3px solid var(--rule-heavy);
  box-shadow: 3px 3px 12px rgba(26,18,9,0.25);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.file-labels {
  display: flex;
  padding-left: 0;
}

.file-labels span {
  width: var(--sq);
  height: 15px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sq {
  width: var(--sq); height: var(--sq);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}

.sq.light { background: var(--white-sq); }
.sq.dark  { background: var(--black-sq); }
.sq.selected { background: rgba(184,137,42,0.55) !important; outline: 3px inset rgba(184,137,42,0.85); }
.sq.last-from { background: rgba(100,149,60,0.45) !important; }
.sq.last-to   { background: rgba(100,149,60,0.65) !important; }

.sq.possible::after {
  content: '';
  position: absolute;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: rgba(26,18,9,0.2);
  pointer-events: none;
  z-index: 1;
}

.sq.possible.cap::after {
  width: 100%; height: 100%;
  border-radius: 0;
  background: transparent;
  border: 3px solid rgba(26,18,9,0.25);
}

.piece {
  position: relative; z-index: 2;
  width: calc(var(--sq) * 0.9); height: calc(var(--sq) * 0.9);
  pointer-events: none;
  display: block;
}

/* Stuk dat op dit moment van dit veld weggesleept wordt: alleen als vertrekpunt
   zichtbaar houden, de .drag-ghost aan de muis is het "echte" stuk. */
.piece.dragging-from {
  opacity: 0.25;
}

.drag-ghost {
  position: fixed; pointer-events: none; z-index: 9999;
  width: calc(var(--sq) * 1.1); height: calc(var(--sq) * 1.1);
  transform: translate(-50%,-50%);
  opacity: 0.88;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.65));
}

.board-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Montserrat', sans-serif; font-size: 0.68rem;
  padding-left: 16px; 
}

.turn-badge {
  padding: 3px 8px;
  border: 1px solid var(--rule-heavy);
  background: var(--paper-mid);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.62rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.board-btns { display: flex; gap: 5px; }

.btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 5px;
  border: 1px solid var(--rule-heavy);
  background: var(--paper-mid);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.13s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn.primary:hover {
  background: var(--title-color);
  border-color: var(--title-color);
}

.status-box {
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  padding: 9px 11px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  line-height: 1.65;
  flex-shrink: 0;
}

.status-box .lbl {
  color: var(--ink-muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.status-box .path {
  color: var(--title-color);
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  min-height: 16px;
  word-break: break-all;
}

.status-box .info { color: var(--ink); font-size: 0.65rem; }

/* ── TREE PANEL ── */
.tree-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper-dark);
  min-height: 0; 
}

/* ── Nieuwe Tree Header Layout (2 Rijen) ── */
.tree-header {
  display: flex;
  flex-direction: column;
  padding: 10px 18px;
  border-bottom: 2px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
  gap: 10px;
}

.th-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.th-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Uniforme select-boxen */
.styled-select {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 8px;
  border: 1px solid var(--rule-heavy);
  background: var(--paper-mid);
  color: var(--ink);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  max-width: 240px;
  text-overflow: ellipsis;
}
.styled-select:focus { border-color: var(--gold); }

.v-sep {
  width: 1px;
  height: 16px;
  background: var(--rule-heavy);
  margin: 0 4px;
  opacity: 0.5;
}

.tree-fold-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 7px;
  border: 1px solid var(--rule);
  background: var(--paper-mid);
  color: var(--ink-soft);
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
}

.tree-fold-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.tree-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  min-height: 0; 
}

.tree-body::-webkit-scrollbar { width: 7px; }

.tree-empty {
  color: var(--ink-muted);
  font-family: 'Libre Baskerville', serif;
  font-style: italic;
  font-size: 0.88rem;
  text-align: center;
  margin-top: 50px;
  line-height: 2.3;
}

.tree-empty-watermark {
  display: block;
  width: 180px;
  margin: 0 auto 24px;
  pointer-events: none;
  user-select: none;
}

.tree-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.88rem;
  line-height: 2.1;
  gap: 0;
}

.mv-num {
  color: var(--ink-muted);
  font-size: 0.76rem;
  margin-right: 2px;
  flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}

.mv {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px 1px 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.1s;
  gap: 2px;
  margin-right: 1px;
}

.mv.mine {
  color: var(--title-color);
  font-weight: 700;
}

.mv.opp {
  color: #2a5a8c;
  font-weight: 400;
}

/* ── Oefenstatus-stip in de boom ── */
.drill-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 2px;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}
.drill-dot--mastered   { background: #2a6b2a; }
.drill-dot--practicing { background: #c8980a; }

.mv:hover {
  background: var(--paper-shadow);
  border-color: var(--rule);
}

.mv.active {
  background: var(--paper-shadow);
  border-color: var(--gold) !important;
  border-bottom-width: 2px;
}

.mv img {
  width: 1.1em;
  height: 1.1em;
  display: block;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.mv.anno-selected {
  background: rgba(184,137,42,0.12) !important;
  border-color: var(--gold) !important;
  border-style: dashed !important;
}

.mv .x {
  display: none;
  font-size: 1rem;
  color: var(--ink-soft);
  padding: 0 1px;
  line-height: 1;
}

.mv:hover .x { display: inline; }

.branches {
  margin-left: 16px;
  padding-left: 11px;
  border-left: 2px solid var(--rule);
  margin-top: 1px;
  margin-bottom: 3px;
}

.branch-toggle {
  display: inline-block;
  margin: 2px 0 1px 16px;
  padding: 1px 7px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  transition: all 0.1s;
}

.branch-toggle:hover {
  background: var(--paper-shadow);
  color: var(--ink);
  border-color: var(--rule-heavy);
}

.legend {
  display: flex; gap: 12px;
  padding: 6px 18px;
  border-top: 2px solid var(--rule);
  flex-shrink: 0;
  background: var(--paper);
}

.leg {
  display: flex; align-items: center; gap: 5px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.leg-dot { width: 7px; height: 7px; border-radius: 50%; }
.leg-dot.m { background: var(--title-color); }
.leg-dot.o { background: #2a5a8c; }

/* Zetannotaties in boom */
.anno-move {
  font-weight: 700;
  font-size: 0.85em;
  color: inherit;
}

.anno-pos {
  font-weight: 600;
  font-size: 0.82em;
  font-family: 'Montserrat', sans-serif;
  margin-left: 1px;
  color: var(--ink-soft);
}

/* Werkbalk onderaan de boom */
.anno-toolbar {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 2px;
  min-height: 36px;
}

.anno-toolbar-sep {
  width: 1px;
  height: 16px;
  background: var(--rule);
  margin: 0 6px;
  flex-shrink: 0;
}

.anno-toolbar-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-right: 3px;
  white-space: nowrap;
}

.anno-btn {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 2px 5px;
  cursor: pointer;
  color: var(--ink-muted);
  border: 1px solid transparent;
  border-radius: 2px;
  transition: all 0.1s;
  white-space: nowrap;
  background: none;
  line-height: 1.4;
}
.anno-btn:hover  { background: var(--paper-mid); color: var(--ink); border-color: var(--rule); }
.anno-btn.active { background: var(--paper-shadow); color: var(--ink); border-color: var(--rule-heavy); }

.toolbar-action-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 7px;
  line-height: 1.4;
  cursor: pointer;
  border: 1px solid var(--rule-heavy);
  background: var(--paper-mid);
  color: var(--ink-soft);
  border-radius: 2px;
  transition: all 0.1s;
  white-space: nowrap;
  box-sizing: border-box;
}
.toolbar-action-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.toolbar-action-btn.danger:hover { background: var(--title-color); border-color: var(--title-color); color: var(--paper); }

/* Overlays en Modals */
.overlay {
  position: fixed; inset: 0;
  background: rgba(26,18,9,0.78);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.17s;
}

.overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--paper);
  border: 1px solid var(--rule-heavy);
  border-top: 4px solid var(--title-color);
  padding: 22px;
  width: 460px; max-width: 92vw;
  box-shadow: 0 8px 32px rgba(26,18,9,0.35);
}

.confirm-modal {
  width: 360px;
}

.confirm-modal p {
  font-family: 'Libre Baskerville', serif;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.6;
  margin: 4px 0 8px;
}

.modal h3 {
  font-family: 'Playfair Display', serif;
  color: var(--title-color);
  margin-bottom: 12px;
  font-size: 1rem;
}

.modal textarea {
  width: 100%; height: 170px;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: 'Montserrat', monospace;
  font-size: 0.74rem;
  padding: 9px;
  resize: vertical; margin-bottom: 9px;
}

.modal-btns { display: flex; gap: 6px; justify-content: flex-end; }

/* ── NOTITIE OVERLAY ── */
.note-overlay {
  position: fixed; inset: 0;
  background: rgba(26,18,9,0.75);
  z-index: 920;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.note-overlay.open { opacity: 1; pointer-events: all; }

.note-box {
  background: var(--paper);
  border: 1px solid var(--rule-heavy);
  border-top: 4px solid var(--gold);
  padding: 20px;
  width: 400px; max-width: 92vw;
  box-shadow: 0 8px 28px rgba(26,18,9,0.35);
}

.note-box h3 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.note-box textarea {
  width: 100%; height: 120px;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 9px;
  resize: vertical;
  margin-bottom: 10px;
}

/* Toasts */
.toast {
  position: fixed; bottom: 16px; right: 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  z-index: 1000;
  border-left: 3px solid var(--gold);
  opacity: 0; transform: translateY(8px);
  transition: all 0.17s;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* Lichess en Eco (niet aangeraakt) */
.lichess-panel {
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  border-left: 3px solid #6b9bc8;
  padding: 8px 11px;
  flex-shrink: 0;
}
.lichess-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.lichess-source { font-family: 'Montserrat', sans-serif; font-size: 0.6rem; color: var(--ink); font-style: italic; flex: 1; }
.lichess-toggle { display: flex; align-items: center; gap: 4px; font-family: 'Montserrat', sans-serif; font-size: 0.62rem; color: var(--ink); cursor: pointer; white-space: nowrap; }
.lichess-toggle input { cursor: pointer; accent-color: #6b9bc8; }
.lichess-moves { display: flex; flex-direction: column; gap: 3px; }
.eval-bar { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.eval-label { font-family: 'Montserrat', sans-serif; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); flex-shrink: 0; }
.eval-score { font-family: 'Libre Baskerville', serif; font-weight: 700; font-size: 0.9rem; min-width: 3em; flex-shrink: 0; }
.eval-score.white  { color: #2a7a2a; }   
.eval-score.black  { color: #8b1a1a; }   
.eval-score.equal  { color: var(--ink); }
.eval-score.mate   { color: #8b1a1a; font-style: italic; }
.eval-depth { font-family: 'Montserrat', sans-serif; font-size: 0.58rem; color: var(--ink); flex-shrink: 0; }
.eval-best { font-family: 'Libre Baskerville', serif; font-size: 0.72rem; color: var(--ink-soft); font-style: italic; }
.lichess-move-row { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 3px 5px; border-radius: 3px; transition: background 0.1s; border: 1px solid transparent; }
.lichess-move-row:hover { background: var(--paper-shadow); border-color: var(--rule); }
.lichess-san { font-family: 'Libre Baskerville', serif; font-weight: 700; font-size: 0.82rem; color: var(--ink); min-width: 36px; }
.lichess-bar-wrap { flex: 1; height: 8px; background: var(--paper-shadow); border-radius: 4px; overflow: hidden; position: relative; }
.lichess-bar-w { height: 100%; background: #f5f0e8; float: left; }
.lichess-bar-d { height: 100%; background: #aaa;     float: left; }
.lichess-bar-b { height: 100%; background: #2a2a2a;  float: left; }
.lichess-pct { font-family: 'Montserrat', sans-serif; font-size: 0.8rem; color: var(--ink); white-space: nowrap; min-width: 60px; text-align: right; }
.lichess-count { font-family: 'Montserrat', sans-serif; font-size: 0.8rem; color: var(--ink); min-width: 38px; text-align: right; }
.lichess-hint { font-family: 'Libre Baskerville', serif; font-style: italic; font-size: 0.8rem; color: var(--ink); padding: 4px 0; }
.lichess-add-btn { font-family: 'Montserrat', sans-serif; font-size: 9px; font-weight: 700; padding: 1px 5px; border: 1px solid #6b9bc8; background: none; color: #6b9bc8; border-radius: 2px; cursor: pointer; white-space: nowrap; transition: all 0.1s; }
.lichess-add-btn:hover { background: #6b9bc8; color: white; }
.lichess-add-btn.in-tree { border-color: var(--rule); color: var(--ink-muted); background: var(--paper-shadow); cursor: default; }
.eco-display { font-family: 'Montserrat', sans-serif; font-size: 0.75rem; color: var(--ink); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); min-height: 1em; }
.eco-display .eco-code { font-weight: 700; color: var(--title-color); margin-right: 5px; }

/* Games Panel (Tab 3) */
.games-panel { display: none; flex-direction: column; flex: 1; overflow: hidden; padding: 8px 12px; }
body.games-mode #gamesPanel { display: flex !important; }
body.games-mode .tree-header,
body.games-mode #treeBody,
body.games-mode #infoPanel,
body.games-mode #annoToolbar,
body.games-mode .print-title,
body.games-mode .legend { display: none !important; }
body.games-mode #lichessPanel { display: none !important; }
.games-header { padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.games-eco-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 0.85rem; color: var(--title-color); }
.games-count { font-family: 'Montserrat', sans-serif; font-size: 0.65rem; color: var(--ink-muted); margin-top: 2px; }
.games-list { flex: 1; overflow-y: auto; }
.games-row { padding: 6px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; transition: background 0.1s; }
.games-row:hover { background: var(--paper-shadow); }
.games-players { font-family: 'Libre Baskerville', serif; font-size: 0.78rem; color: var(--ink); }
.games-meta { font-family: 'Montserrat', sans-serif; font-size: 0.65rem; color: var(--ink-muted); margin-top: 2px; }
.games-hint { font-family: 'Libre Baskerville', serif; font-style: italic; font-size: 0.8rem; color: var(--ink); padding: 8px 0; }
.games-viewer { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.games-viewer-bar { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.games-game-info { font-family: 'Montserrat', sans-serif; font-size: 1rem; color: var(--ink); flex: 1; }
.games-nav-bar { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.games-nav-btn { font-size: 0.85rem; padding: 3px 9px; border: 1px solid var(--rule); background: none; cursor: pointer; border-radius: 2px; color: var(--ink); transition: background 0.1s; }
.games-nav-btn:hover { background: var(--paper-shadow); }
.games-move-counter { font-family: 'Montserrat', sans-serif; font-size: 0.65rem; color: var(--ink-muted); margin-left: 6px; }
.games-moves { flex: 1; overflow-y: auto; font-family: 'Libre Baskerville', serif; font-size: 0.82rem; line-height: 2; color: var(--ink); }
.gm-pair { display: inline; }
.gm-num { color: var(--ink-muted); font-size: 0.72rem; margin-left: 4px; }
.gm-move { cursor: pointer; padding: 1px 4px; border-radius: 2px; display: inline-block; }
.gm-move:hover { background: var(--paper-shadow); }
.gm-move.active { background: var(--title-color); color: var(--paper); }
.gm-move.repertoire { color: #3a7535; font-weight: 700; }
.gm-move.repertoire.active { background: var(--title-color); color: var(--paper); }
.games-rep-legend { font-family: 'Montserrat', sans-serif; font-size: 0.62rem; color: #3a7535; margin-bottom: 6px; }

/* Drill Mode */
.drill-btn { background: var(--ink) !important; color: var(--paper) !important; border-color: var(--ink) !important; }
.drill-btn:hover { background: var(--title-color) !important; border-color: var(--title-color) !important; }
.drill-btn.active { background: var(--title-color) !important; border-color: var(--title-color) !important; }
.drill-panel { background: var(--paper-mid); border: 1px solid var(--rule); border-left: 3px solid var(--title-color); padding: 10px 12px; flex-shrink: 0; }
.drill-path { font-family: 'Libre Baskerville', serif; font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 4px; min-height: 18px; font-style: italic; }
.drill-status { font-family: 'Playfair Display', serif; font-size: 0.88rem; color: var(--ink); margin-bottom: 6px; font-weight: 600; }
.drill-feedback { font-family: 'Libre Baskerville', serif; font-size: 0.82rem; min-height: 20px; margin-bottom: 8px; font-style: italic; }
.drill-feedback.correct { color: #2a6b2a; }
.drill-feedback.wrong   { color: var(--title-color); }
.drill-feedback.info    { color: var(--ink-soft); }
.drill-btns { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.drill-score { font-family: 'Montserrat', sans-serif; font-size: 0.65rem; color: var(--ink-muted); letter-spacing: 0.05em; }

body.drill-mode .tree-body { visibility: hidden; }
body.drill-mode .mv { opacity: 0.3; }
body.drill-mode .mv.active { opacity: 1; }
body.drill-mode .mv.drill-played { opacity: 1; }
body.drill-mode .anno-toolbar { display: none !important; }
body.drill-mode #lichessPanel { display: none !important; }
body.drill-mode #evalBar      { display: none !important; }
body.drill-mode #sfPanel      { display: none !important; }
body.drill-mode .export-btns .btn:not(.drill-btn) { opacity: 0.4; pointer-events: none; }

.divider { width: 8px; background: var(--rule); cursor: col-resize; flex-shrink: 0; position: relative; transition: background 0.15s; touch-action: none; user-select: none; -webkit-user-select: none; }
.divider:hover, .divider.dragging { background: var(--gold); }

/* Notes */
.note-icon { display: none; font-size: 1rem; margin-left: 2px; color: var(--ink-soft); cursor: pointer; vertical-align: middle; }
.mv:hover .note-icon { display: inline; }
.mv.has-note .note-icon { display: inline; color: var(--gold); }
.note-preview { font-family: 'Libre Baskerville', serif; font-style: italic; font-size: 0.78rem; color: var(--ink-muted); margin-top: 2px; padding: 3px 0 3px 8px; border-left: 2px solid var(--gold); display: none; }
.mv.has-note + .note-preview, .note-preview.visible { display: block; }
.import-file-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pgn-filename { font-family: 'Libre Baskerville', serif; font-style: italic; font-size: 0.78rem; color: var(--ink-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Schaak maar raak Academy Repertoire Builder
   ═══════════════════════════════════════════════════════════════ */

/* ── 1080px hoogte: compact voor 1920x1080 desktops ─────────── */
@media (max-height: 1080px) and (min-width: 769px) {
  :root { --sq: 37px; }

  /* Header */
  header { padding: 4px 20px; }

  /* Board panel — minder padding en gap tussen onderdelen */
  .board-panel { padding: 10px 14px; gap: 7px; }

  /* Status-box */
  .status-box { padding: 5px 11px; line-height: 1.45; }

  /* Lichess panel */
  .lichess-panel { padding: 5px 11px; }
  .lichess-header { margin-bottom: 3px; }
  .lichess-moves { gap: 1px; }
  .lichess-move-row { padding: 1px 0; }
  .eval-bar { margin-top: 4px; padding-top: 3px; }

  /* Stockfish panel */
  .sf-panel { padding: 5px 11px; }
  .sf-header { margin-bottom: 3px; }
  #sfLines { gap: 2px; }
  .sf-line { padding: 2px 5px; }

  /* Practice mode — minder padding zodat tekst onder bord zichtbaar blijft */
  body.practice-mode .board-panel { padding: 12px 20px 10px; gap: 7px; }
  .practice-panel { padding: 8px 14px; gap: 4px; }
  .practice-header { padding-bottom: 7px; }
}

/* ── 1024px: tablet liggend ──────────────────────────────────── */
@media (max-width: 1024px) {
  .logo-main { font-size: 0.85rem !important; }
  .logo-sub  { letter-spacing: 0.25em; }
  header h1  { font-size: 0.95rem; }
  .btn { padding: 5px 7px; font-size: 0.62rem; }
  .tree-fold-btn { font-size: 0.56rem; padding: 4px 6px; }
  .lichess-count { display: none; }

  /* Tab 3 Partijen — games nav knoppen iets groter voor touch */
  .games-nav-btn { padding: 6px 12px; font-size: 0.85rem; }
}

/* ── 768px: tablet staand — bord boven boom ──────────────────── */
@media (max-width: 768px) {
  body { height: auto; min-height: 100vh; overflow-x: hidden; overflow-y: auto; }
  .main { flex-direction: column; overflow: visible; height: auto; }

  /* Board-panel en tree-panel worden op mobiel visueel transparant:
     hun kinderen worden allemaal directe flex-items van .main, waardoor we
     ze via `order` in elke gewenste volgorde kunnen zetten. */
  .board-panel { display: contents; }
  .tree-panel  { display: contents; }

  /* Volgorde op mobiel:
     1 tree-header (workspace + notation + knoppen bovenaan),
     2 bord,
     3 bord-knoppen,
     4 tree-body (zetten direct onder bord),
     5-6 practice/spelen (tab-specifiek),
     7 status,
     8 anno-toolbar,
     9 lichess,
     10 sfPanel (Stockfish),
     11 info-panel (Opening info onderaan). */
  .tree-header     { order: 1; padding: 8px 10px;
                     border-bottom: 1px solid var(--rule); }
  .board-outer     { order: 2; justify-content: center; padding-top: 12px; }
  .board-meta      { order: 3; padding-left: 0; justify-content: center; gap: 10px;
                     border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
  .tree-body       { order: 4; overflow: visible; min-height: 200px;
                     padding: 8px 10px; }
  .practice-panel  { order: 5; }
  .spelen-panel    { order: 6; }
  .status-box      { order: 7; padding: 7px 9px; }
  .anno-toolbar    { order: 8; }
  .lichess-panel   { order: 9; }
  .sf-panel        { order: 10; }
  .info-panel      { order: 11; }
  .print-title     { order: 0; }

  .divider { display: none; }
  .anno-toolbar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .header-logo-text { display: none; }
  header { padding: 6px 12px; gap: 8px; }
  header h1 { font-size: 0.82rem; }
  .lichess-pct { display: none; }

  /* Touch targets vergroten */
  .lang-btn { padding: 7px 10px; font-size: 0.72rem; }
  .info-btn  { width: 34px; height: 34px; font-size: 1rem; }

  /* Tab 3 Partijen — gestapelde layout op tablet */
  .games-panel { padding: 6px 10px; }
  .games-viewer-bar { flex-wrap: wrap; gap: 6px; }
  .games-game-info { font-size: 0.85rem; width: 100%; }
  .games-nav-bar { flex-wrap: wrap; gap: 6px; }
  .games-nav-btn { padding: 8px 14px; }
  .games-moves { font-size: 0.8rem; line-height: 1.9; }
}

/* ── 480px: grote telefoon ───────────────────────────────────── */
@media (max-width: 480px) {
  header { grid-template-columns: auto 1fr; grid-template-rows: auto auto; padding: 5px 10px; gap: 5px 8px; }
  .header-logo-icon { width: 38px; height: 38px; }
  header h1 { font-size: 0.75rem; text-align: left; }
  .tabs { grid-column: 1 / -1; display: flex; gap: 4px; }
  .tab-btn { flex: 1; text-align: center; padding: 6px 8px; font-size: 0.68rem; }
  .board-panel { padding: 8px 6px; }
  .board-outer { justify-content: center; }
  .board-btns { gap: 3px; }
  .board-btns .btn { padding: 5px 6px; font-size: 0.6rem; }
  
  /* Maak th-row 100% breed op hele kleine schermen */
  .th-group { width: 100%; justify-content: space-between; }
  .styled-select { flex: 1; min-width: 0; }

  .btn { padding: 6px 8px; font-size: 0.62rem; }
  .drill-btn { flex: 1 1 100% !important; }
  .modal { width: 95vw; max-width: unset; padding: 14px; }
  .note-box { width: 95vw; max-width: unset; padding: 14px; }
  .anno-btn { font-size: 0.75rem; padding: 2px 4px; }
  .toolbar-action-btn { font-size: 8px; padding: 3px 5px; }
  .anno-toolbar-sep { margin: 0 3px; }

  /* Touch targets op kleine telefoons */
  .lang-btn { min-height: 36px; padding: 8px 10px; }
  .info-btn  { width: 38px; height: 38px; }

  /* Tab 3 Partijen — kleine telefoon */
  .games-panel { padding: 4px 8px; }
  .games-eco-title { font-size: 0.78rem; }
  .games-players { font-size: 0.72rem; }
  .games-nav-btn { padding: 9px 12px; font-size: 0.8rem; }
  .games-moves { font-size: 0.75rem; }
  .games-game-info { font-size: 0.78rem; }
}

/* ── Promotie-dialoog ── */
.promo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,18,9,0.82);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.promo-label {
  position: absolute;
  top: -30px;
  left: 0; right: 0;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
}

.promo-box {
  display: flex;
  gap: 6px;
  background: var(--paper);
  border: 2px solid var(--rule-heavy);
  border-top: 4px solid var(--title-color);
  padding: 14px;
  box-shadow: 0 8px 32px rgba(26,18,9,0.45);
}

.promo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 68px;
  gap: 2px;
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: all 0.13s;
}

.promo-btn:hover {
  background: var(--paper-shadow);
  border-color: var(--gold);
  outline: 2px solid var(--gold);
}

.promo-btn img {
  width: 38px;
  height: 38px;
  pointer-events: none;
}

.promo-btn-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

/* ── Onopgeslagen wijzigingen indicator ── */
@keyframes unsaved-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

#exportProfileBtn.has-changes {
  background: var(--gold) !important;
  border-color: var(--gold-light) !important;
  color: var(--paper) !important;
  animation: unsaved-breathe 2.2s ease-in-out infinite;
}

#exportProfileBtn.has-changes::after {
  content: ' ●';
  font-size: 0.5rem;
  vertical-align: middle;
}

.drill-scores {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.drill-score-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.55rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}
.drill-score-sep {
  color: var(--rule-heavy);
  font-size: 0.75rem;
  margin: 0 2px;
}

.drill-score-badge {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.drill-score-badge.good  { color: #2a6b2a; }
.drill-score-badge.mid   { color: var(--gold); }
.drill-score-badge.poor  { color: var(--title-color); }

/* ── Batch-voortgang (sterren onder het bord) ── */
.batch-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px 4px;
  border-top: 1px solid var(--rule);
}
.batch-counter {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  color: var(--ink-muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.batch-stars {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
}
.batch-star {
  font-size: clamp(1.1rem, 6.5vw, 3rem);
  line-height: 1;
  transition: color 0.2s;
}
.batch-star.correct { color: #c8980a; }
.batch-star.wrong   { color: #c0392b; }
.batch-star.empty   { color: var(--rule-heavy); opacity: 0.55; }

/* ── Batch-complete modal ── */
.batch-complete-modal { text-align: center; width: 500px; }
.batch-complete-score {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.batch-complete-stars {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-size: clamp(1.4rem, 6.5vw, 2.2rem);
}

/* ── Opening info paneel ── */
.info-panel {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}

.info-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.13s;
}

.info-panel-bar:hover {
  background: var(--paper-mid);
}

.info-panel-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.info-panel-toggle {
  font-size: 0.6rem;
  color: var(--ink-muted);
  transition: transform 0.2s;
}

.info-panel.collapsed .info-panel-toggle {
  transform: rotate(180deg);
}

.info-panel-body {
  padding: 0 12px 8px;
  overflow: hidden;
  max-height: 180px;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.info-panel.collapsed .info-panel-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.info-panel-textarea {
  width: 100%;
  height: 120px;
  max-height: 150px;
  resize: none;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: 'Libre Baskerville', serif;
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 8px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  -webkit-user-modify: read-write-plaintext-only;
}

.info-panel-textarea:focus {
  border-color: var(--gold);
}

/* ══════════════════════════════════════════════════════════════
   TAB BAR
   ══════════════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
  padding: 0 16px;
  flex-shrink: 0;
  gap: 0;
}

.tab-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 20px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.13s, border-color 0.13s, background 0.13s;
  position: relative;
  top: 2px;
}

.tab-btn:hover {
  color: var(--ink);
  background: var(--paper-dark);
}

.tab-btn.active {
  color: var(--title-color);
  border-bottom-color: var(--title-color);
  background: transparent;
}

/* ══════════════════════════════════════════════════════════════
   PRACTICE MODE — body.practice-mode
   ══════════════════════════════════════════════════════════════ */
body.practice-mode .tree-panel   { display: none !important; }
body.practice-mode .divider      { display: none !important; }
body.practice-mode .status-box   { display: none !important; }
body.practice-mode .lichess-panel { display: none !important; }
body.practice-mode .anno-toolbar  { display: none !important; }
body.practice-mode #sfPanel       { display: none !important; }

body.practice-mode .main {
  justify-content: center;
}

body.practice-mode .board-panel {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto;
  align-items: center;
  padding: 20px 20px 16px;
  gap: 10px;
  border-right: none;
}

body.practice-mode .board-meta {
  padding-left: 0;
  justify-content: center;
  gap: 8px;
}

/* ── PRACTICE PANEL ── */
.practice-panel {
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--title-color);
  padding: 12px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.practice-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2px;
}

.practice-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.practice-header-row .lbl {
  color: var(--ink-muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  white-space: nowrap;
}

.practice-modes {
  display: flex;
  gap: 6px;
}

.practice-mode-btn {
  flex: 1;
  text-align: center;
  font-size: 0.63rem !important;
}

.practice-mode-btn.running {
  background: var(--title-color) !important;
  color: var(--paper) !important;
  border-color: var(--title-color) !important;
}

/* ══════════════════════════════════════════════════════════════
   TAB 4 SPELEN
   ══════════════════════════════════════════════════════════════ */
body.spelen-mode .tree-panel    { display: none !important; }
body.spelen-mode .divider       { display: none !important; }
body.spelen-mode .status-box    { display: none !important; }
body.spelen-mode .lichess-panel { display: none !important; }
body.spelen-mode .anno-toolbar  { display: none !important; }
body.spelen-mode #sfPanel       { display: none !important; }

body.spelen-mode .main {
  justify-content: center;
}

body.spelen-mode .board-panel {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto;
  align-items: center;
  padding: 20px 20px 16px;
  gap: 10px;
  border-right: none;
}

body.spelen-mode .board-meta {
  padding-left: 0;
  justify-content: center;
  gap: 8px;
}

/* ── Spelen panel ── */
.spelen-panel {
  background: var(--paper-mid);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  padding: 12px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.spelen-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.spelen-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spelen-header-row .lbl {
  color: var(--ink-muted);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.spelen-header-row .styled-select {
  font-size: 0.78rem;
  padding: 3px 6px;
  max-width: 160px;
}

.spelen-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.spelen-status {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  color: var(--ink-muted);
  min-height: 18px;
}

.spelen-status.check {
  color: var(--title-color);
  font-weight: 700;
}

.spelen-book {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-height: 16px;
}

.spelen-book.in-book   { color: #2a7a3a; }
.spelen-book.out-book  { color: var(--gold); }

.spelen-off-book { box-shadow: inset 0 0 0 3px rgba(180, 60, 20, 0.7) !important; }

.spelen-moves {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.82rem;
  line-height: 1.8;
  max-height: 180px;
  overflow-y: auto;
}

.spelen-moves .sm-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-right: 2px;
}

.spelen-moves .sm-san {
  display: inline-block;
  padding: 0 3px;
  border-radius: 2px;
  margin-right: 3px;
}

.spelen-moves .sm-san.active {
  background: var(--gold-light);
  color: var(--ink);
}

.spelen-moves .sm-san.repertoire { color: #3a7535; font-weight: 700; }
.spelen-moves .sm-san.repertoire.active { background: var(--gold-light); color: #3a7535; }

/* ── Transpositie-waarschuwing ── */
.transpose-warning {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 40px));
  background: var(--paper);
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  padding: 16px 40px 16px 18px;
  z-index: 10000;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  animation: tw-pop-in 0.22s ease-out;
}
@keyframes tw-pop-in {
  from { transform: translate(-50%, -50%) scale(0.92); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}
.transpose-warning .tw-title {
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
}
.transpose-warning .tw-body {
  margin-bottom: 6px;
  color: var(--ink-muted);
}
.transpose-warning .tw-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.transpose-warning .tw-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--rule-light, #e6e0d1);
}
.transpose-warning .tw-list li:first-child { border-top: none; }
.transpose-warning .tw-path {
  flex: 1;
  font-family: 'Cardo', serif;
  color: var(--ink);
  word-break: break-word;
}
.transpose-warning .tw-go {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
}
.transpose-warning .tw-go:hover {
  background: var(--gold);
  color: var(--paper);
}
.transpose-warning .tw-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px 6px;
}
.transpose-warning .tw-close:hover { color: var(--ink); }

/* Game-over bericht in spelen-panel */
.spelen-gameover {
  background: var(--paper);
  border: 2px solid var(--rule-heavy);
  border-radius: 4px;
  padding: 12px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spelen-gameover-result {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--title-color);
}

.spelen-gameover-reason {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* Printtitel — normaal verborgen, zichtbaar bij printen */
.print-title { display: none; }

/* ── Print ─ */
@media print {
  .divider { display: none !important; }
  body { height: auto; overflow: visible; }
  .main { flex-direction: row; }
  header, .board-panel, .legend, .x, .note-icon, .anno-toolbar,
  .tree-header, .branch-toggle, .info-panel, .tab-bar { display: none !important; }
  html, body, * { color: black !important; background: white !important; border-color: #ccc !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  .mv.mine, .mv.mine * { color: #6b1414 !important; font-weight: bold; }
  .tree-panel { display: block; }
  .print-title {
    display: block !important;
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: black !important;
    padding: 8px 8px 4px;
    border-bottom: 2px solid #333;
    margin-bottom: 8px;
  }
  .tree-body { overflow: visible; padding: 8px; }
  .mv { border: none !important; box-shadow: none !important; }
  .drill-dot { display: none !important; }
  .mv.active, .mv.anno-selected { border: none !important; }
  .branches { border-left: 1px solid #aaa !important; }
}