/* TJK-Chess v14.7.2 optional dark appearance. Chessboard square colors stay unchanged. */
html[data-theme="dark"]{
  color-scheme:dark;
  --site-blue:#72a8ff;
  --site-blue-dark:#4d8cf4;
  --site-border:#364257;
  --site-muted:#a8b3c5;
  --tjk-navy:#eef4ff;
  --tjk-blue:#72a8ff;
  --tjk-blue-strong:#4d8cf4;
  --tjk-blue-soft:#172b4d;
  --tjk-gold:#e6bd55;
  --tjk-gold-soft:#3a3016;
  --tjk-surface:#171d27;
  --tjk-bg:#0f141c;
  --tjk-border:#354154;
  --tjk-muted:#a8b3c5;
  --tjk-shadow:0 16px 45px rgba(0,0,0,.28);
}
html[data-theme="dark"] body{background:#0f141c;color:#e9eef7}
html[data-theme="dark"] .site-header{background:rgba(18,24,34,.97);border-color:#303b4d;box-shadow:0 2px 16px rgba(0,0,0,.32)}
html[data-theme="dark"] .site-brand,html[data-theme="dark"] .site-nav button,html[data-theme="dark"] .site-actions,html[data-theme="dark"] .site-profile-button{color:#e9eef7}
html[data-theme="dark"] .site-brand-mark{background:#1a2d4e}
html[data-theme="dark"] .site-language,html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#141b26;color:#edf3fb;border-color:#3a4659}
html[data-theme="dark"] .site-icon-button,html[data-theme="dark"] .site-menu-toggle{background:#171f2b;color:#e9eef7;border-color:#3a4659}
html[data-theme="dark"] .site-nav-dropdown,html[data-theme="dark"] .course-search-popover{background:#171e29;border-color:#354154;box-shadow:0 20px 45px rgba(0,0,0,.38)}
html[data-theme="dark"] .site-nav-dropdown button:hover{background:#202b3b}
html[data-theme="dark"] .home-hero,html[data-theme="dark"] .course-hero{background:radial-gradient(circle at 78% 30%,rgba(54,101,175,.25),transparent 32%),linear-gradient(125deg,#111721,#172235)}
html[data-theme="dark"] .home-hero p,html[data-theme="dark"] .course-hero p,html[data-theme="dark"] .tool-description,html[data-theme="dark"] .play-heading p{color:#aab5c7}
html[data-theme="dark"] .home-hero-board{background:rgba(24,33,47,.82);border-color:#3a4659}
html[data-theme="dark"] .home-mini-badge{background:#242415;border-color:#725f28}
html[data-theme="dark"] .home-quick-card,html[data-theme="dark"] .standalone-course-card,html[data-theme="dark"] .standalone-card,html[data-theme="dark"] .play-card,html[data-theme="dark"] .tools-tabs,html[data-theme="dark"] .tool-panel,html[data-theme="dark"] .feature-strip div{background:#171e29;border-color:#354154;color:#edf3fb}
html[data-theme="dark"] .home-status-strip{background:#171e29;border-color:#354154}
html[data-theme="dark"] .feature-strip{background:#354154;border-color:#354154}
html[data-theme="dark"] .button,html[data-theme="dark"] .workspace-commandbar button,html[data-theme="dark"] .tools-tabs button,html[data-theme="dark"] .play-secondary{background:#1a2330;color:#e9eef7;border-color:#3d4a5f}
html[data-theme="dark"] .button-primary,html[data-theme="dark"] .workspace-commandbar .button-primary{background:#1767df;border-color:#1767df;color:white}
html[data-theme="dark"] .workspace-panel,html[data-theme="dark"] .tools-workspace,html[data-theme="dark"] .play-workspace,html[data-theme="dark"] .puzzle-workspace,html[data-theme="dark"] .endgame-studies-workspace{color:#e9eef7}
html[data-theme="dark"] .icc-admin-settings,html[data-theme="dark"] .icc-admin-chapter,html[data-theme="dark"] .icc-admin-editor,html[data-theme="dark"] .icc-course-shell,html[data-theme="dark"] .icc-course-side-panel,html[data-theme="dark"] .icc-course-header{background:#171e29;color:#e9eef7;border-color:#354154}
html[data-theme="dark"] .icc-admin-move-row,html[data-theme="dark"] .icc-course-navigation,html[data-theme="dark"] .icc-course-status,html[data-theme="dark"] .icc-course-nav-chapter button:hover,html[data-theme="dark"] .icc-course-nav-chapter button.is-active{background:#202937;color:#e9eef7;border-color:#3a475b}
html[data-theme="dark"] .study-app{background:#121923;border-color:#354154}
html[data-theme="dark"] .study-main{background:#121923}
html[data-theme="dark"] .study-notation,html[data-theme="dark"] .study-engine-panel,html[data-theme="dark"] .study-notation-head,html[data-theme="dark"] .study-comment-inspector{background:#171e29;color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .study-toolbar button,html[data-theme="dark"] .study-toolbar select,html[data-theme="dark"] .study-engine-controls button,html[data-theme="dark"] .study-engine-controls select{background:#1d2634;color:#edf3fb;border-color:#3d4a5f}
html[data-theme="dark"] .study-tree,html[data-theme="dark"] .study-comment-panel{background:#171e29;color:#edf3fb}
html[data-theme="dark"] .study-move,html[data-theme="dark"] .study-move-delete{color:#e9eef7}
html[data-theme="dark"] .study-variation{background:#202937}
html[data-theme="dark"] .study-move-context-menu{background:#202937;border-color:#46536a}
html[data-theme="dark"] .puzzle-board-card,html[data-theme="dark"] .puzzle-side-card,html[data-theme="dark"] .puzzle-install,html[data-theme="dark"] .endgame-study-board-card,html[data-theme="dark"] .endgame-study-side,html[data-theme="dark"] .endgame-study-loading{background:#171e29;color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .puzzle-stat,html[data-theme="dark"] .endgame-study-stat{background:#171e29;border-color:#354154}
html[data-theme="dark"] .puzzle-stat b,html[data-theme="dark"] .endgame-study-stat b{color:#edf3fb}
html[data-theme="dark"] .puzzle-filterbar,html[data-theme="dark"] .endgame-study-sourcebar{background:#151d29;border-color:#354154;color:#aab5c7}
html[data-theme="dark"] .puzzle-message,html[data-theme="dark"] .endgame-study-message{background:#202937;border-color:#3e4b60;color:#e9eef7}
html[data-theme="dark"] .puzzle-pattern-main,html[data-theme="dark"] .endgame-study-features span{background:#203659;color:#9fc2ff}
html[data-theme="dark"] .puzzle-tags span{background:#252e3d;color:#bdc7d6}
html[data-theme="dark"] .puzzle-engine,html[data-theme="dark"] .endgame-study-review,html[data-theme="dark"] .endgame-study-engine{background:#151d29;border-color:#354154}
html[data-theme="dark"] .endgame-study-review-nav,html[data-theme="dark"] .endgame-study-moves,html[data-theme="dark"] .endgame-study-engine-lines>div,html[data-theme="dark"] .endgame-study-engine-line,html[data-theme="dark"] .puzzle-engine-line{background:#1b2431;border-color:#3d4a5f;color:#edf3fb}
html[data-theme="dark"] .endgame-study-review-nav button,html[data-theme="dark"] .endgame-study-engine button,html[data-theme="dark"] .endgame-study-engine select,html[data-theme="dark"] .puzzle-actions button{background:#202a38;color:#edf3fb;border-color:#46536a}
html[data-theme="dark"] .play-empty{background:linear-gradient(145deg,#171e29,#111925)}
html[data-theme="dark"] .live-player-card,html[data-theme="dark"] .live-side-panel,html[data-theme="dark"] .computer-player-card,html[data-theme="dark"] .computer-side-panel{background:#171e29;color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .live-game-head,html[data-theme="dark"] .computer-game-head{background:#202937;border-color:#354154}
html[data-theme="dark"] .analysis-board-app,html[data-theme="dark"] .analysis-side-panel,html[data-theme="dark"] .analysis-engine-panel,html[data-theme="dark"] .position-builder,html[data-theme="dark"] .position-panel{background:#171e29;color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .analysis-controls button,html[data-theme="dark"] .analysis-controls select,html[data-theme="dark"] .position-builder button{background:#202a38;color:#edf3fb;border-color:#46536a}
html[data-theme="dark"] .account-overlay{background:rgba(4,8,14,.72)}
html[data-theme="dark"] .account-dialog,html[data-theme="dark"] .account-card{background:#171e29;color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .account-dialog-header{border-color:#354154}
html[data-theme="dark"] .game-review-dialog,html[data-theme="dark"] .game-review-panel{background:#171e29;color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .position-play-workspace,html[data-theme="dark"] .position-play-panel{color:#edf3fb}
html[data-theme="dark"] ::selection{background:#285da8;color:#fff}
@media(max-width:900px){html[data-theme="dark"] .site-nav{background:#171e29;border-color:#354154}}


/* v14.7.5 — complete contrast repair for dropdowns, engine lines and dashboard cards. */
html[data-theme="dark"] .site-nav-dropdown button{background:#171e29!important;color:#edf3fb!important}
html[data-theme="dark"] .site-nav-dropdown button:hover,
html[data-theme="dark"] .site-nav-dropdown button:focus-visible{background:#26344a!important;color:#fff!important}
html[data-theme="dark"] .site-nav-dropdown strong{color:#f3f7ff!important}
html[data-theme="dark"] .site-nav-dropdown span{color:#aebbd0!important}
html[data-theme="dark"] .home-status-strip>div{background:#171e29;color:#edf3fb}
html[data-theme="dark"] .home-status-strip strong{color:#edf3fb}
html[data-theme="dark"] .home-secondary-action{background:#1a2330;color:#edf3fb;border-color:#43516a}
html[data-theme="dark"] .home-secondary-action:hover{background:#26344a}
html[data-theme="dark"] .analysis-card,
html[data-theme="dark"] .analysis-database-card,
html[data-theme="dark"] .analysis-card-heading,
html[data-theme="dark"] .analysis-db-filters,
html[data-theme="dark"] .analysis-pv-row,
html[data-theme="dark"] .analysis-pv-row.is-loading{background:#171e29!important;color:#edf3fb!important;border-color:#354154!important}
html[data-theme="dark"] .analysis-pv-row:hover{background:#25344a!important;border-color:#5d78a5!important}
html[data-theme="dark"] .analysis-pv-score{color:#8fb7ff!important}
html[data-theme="dark"] .analysis-pv-line,
html[data-theme="dark"] .analysis-card-heading h2{color:#edf3fb!important}
html[data-theme="dark"] .analysis-pv-row small,
html[data-theme="dark"] .analysis-engine-state,
html[data-theme="dark"] .analysis-engine-note{color:#aeb9ca!important}
html[data-theme="dark"] .analysis-engine-settings label{color:#bdc8d9!important}
html[data-theme="dark"] .analysis-engine-settings select,
html[data-theme="dark"] .analysis-engine-settings button,
html[data-theme="dark"] .analysis-board-controls button,
html[data-theme="dark"] .analysis-fen-row button{background:#202a38!important;color:#edf3fb!important;border-color:#46536a!important}
html[data-theme="dark"] .analysis-db-tabs{background:#20304a;color:#a9c7ff;border-color:#3b4d69}
html[data-theme="dark"] .analysis-db-filter-row{color:#c5cfdd}
html[data-theme="dark"] .analysis-db-filter-row input{background:#111925;color:#edf3fb;border-color:#46536a}
html[data-theme="dark"] .analysis-db-row{color:#edf3fb;border-color:#354154}
html[data-theme="dark"] .analysis-db-row:hover{background:#25344a}
html[data-theme="dark"] .position-play-board-card,
html[data-theme="dark"] .position-play-options,
html[data-theme="dark"] .position-play-engine,
html[data-theme="dark"] .position-play-eval,
html[data-theme="dark"] .position-play-moves{background:#171e29!important;color:#edf3fb!important;border-color:#354154!important}
html[data-theme="dark"] .position-play-options h2,
html[data-theme="dark"] .position-play-field,
html[data-theme="dark"] .position-play-move-row button,
html[data-theme="dark"] .position-play-engine-line>span{color:#edf3fb!important}
html[data-theme="dark"] .position-play-options>p,
html[data-theme="dark"] .position-play-message,
html[data-theme="dark"] .position-play-engine-state,
html[data-theme="dark"] .position-play-engine-line>small{color:#aeb9ca!important}
html[data-theme="dark"] .position-play-field select,
html[data-theme="dark"] .position-play-board-footer button,
html[data-theme="dark"] .position-play-engine-controls select,
html[data-theme="dark"] .position-play-engine-controls button,
html[data-theme="dark"] .position-play-engine-line{background:#202a38!important;color:#edf3fb!important;border-color:#46536a!important}
html[data-theme="dark"] .position-play-engine-line:hover,
html[data-theme="dark"] .position-play-move-row button:hover{background:#293851!important}
html[data-theme="dark"] .position-play-engine-line>b,
html[data-theme="dark"] .position-play-eval b{color:#8fb7ff!important}
html[data-theme="dark"] .position-play-message{background:#17263d;border-color:#3d5274}
html[data-theme="dark"] .position-play-empty-board{background:linear-gradient(145deg,#171e29,#111925)}
html[data-theme="dark"] .course-media-editor,
html[data-theme="dark"] .course-media-panel,
html[data-theme="dark"] .course-checkpoint{background:#171e29!important;color:#edf3fb!important;border-color:#354154!important}
html[data-theme="dark"] .course-media-empty,
html[data-theme="dark"] .course-media-upload-status{background:#202a38!important;color:#bdc8d9!important;border-color:#46536a!important}
html[data-theme="dark"] .course-media-panel h2,
html[data-theme="dark"] .course-media-panel h3,
html[data-theme="dark"] .course-checkpoint strong{color:#edf3fb!important}


/* v14.7.6 — Opening Lab engine contrast and remaining form surfaces. */
html[data-theme="dark"] .study-engine-lines,
html[data-theme="dark"] .study-engine-line-placeholder{background:#171e29!important;color:#edf3fb!important}
html[data-theme="dark"] .study-engine-lines button,
html[data-theme="dark"] .study-engine-line-placeholder{
  background:#202a38!important;
  color:#edf3fb!important;
  border-color:#3f4d63!important;
}
html[data-theme="dark"] .study-engine-lines button:hover,
html[data-theme="dark"] .study-engine-lines button:focus-visible{background:#2a3850!important;border-color:#6685b6!important}
html[data-theme="dark"] .study-engine-lines b,
html[data-theme="dark"] .study-engine-line-placeholder b{color:#91b8ff!important}
html[data-theme="dark"] .study-engine-lines span,
html[data-theme="dark"] .study-engine-line-placeholder span{color:#edf3fb!important}
html[data-theme="dark"] .study-engine-lines small,
html[data-theme="dark"] .study-engine-line-placeholder small,
html[data-theme="dark"] .study-engine-empty{color:#aeb9ca!important}
html[data-theme="dark"] .study-notation-head strong,
html[data-theme="dark"] .study-comment-panel-head .study-inspector-move,
html[data-theme="dark"] .study-inspector-move{color:#edf3fb!important}
html[data-theme="dark"] .study-notation-head small,
html[data-theme="dark"] .study-comment-panel-head,
html[data-theme="dark"] .study-move-inspector label{color:#aeb9ca!important}
html[data-theme="dark"] .study-comment-panel textarea,
html[data-theme="dark"] .study-move-inspector select{background:#111925!important;color:#edf3fb!important;border-color:#46536a!important}

/* v15.0.1 — connected training hub and study-difficulty contrast. */
html[data-theme="dark"]{
  --panel:#171e29;
  --line:#354154;
  --muted:#aeb9ca;
}
html[data-theme="dark"] .training-hub-workspace,
html[data-theme="dark"] .training-system-head,
html[data-theme="dark"] .training-system-content{color:#edf3fb}
html[data-theme="dark"] .training-duration,
html[data-theme="dark"] .training-system-tabs,
html[data-theme="dark"] .training-summary-grid article,
html[data-theme="dark"] .training-plan-card,
html[data-theme="dark"] .training-challenges article,
html[data-theme="dark"] .training-section-card,
html[data-theme="dark"] .training-review-card,
html[data-theme="dark"] .plan-task-grid article,
html[data-theme="dark"] .endgame-lesson-grid article,
html[data-theme="dark"] .progress-panel,
html[data-theme="dark"] .coach-panel,
html[data-theme="dark"] .training-modal-dialog{background:#171e29!important;color:#edf3fb!important;border-color:#354154!important}
html[data-theme="dark"] .training-brand-card,
html[data-theme="dark"] .weekly-study-card{background:linear-gradient(135deg,rgba(230,189,85,.12),rgba(54,101,175,.13))!important;color:#edf3fb;border-color:#3c4a60}
html[data-theme="dark"] .training-brand-meta span,
html[data-theme="dark"] .training-explanation,
html[data-theme="dark"] .plan-result,
html[data-theme="dark"] .plan-instruction{background:#202a38!important;color:#edf3fb!important}
html[data-theme="dark"] .training-system-tabs button,
html[data-theme="dark"] .training-duration button,
html[data-theme="dark"] .training-plan-list>button,
html[data-theme="dark"] .plan-choice-list button,
html[data-theme="dark"] .training-filter-row button{color:#edf3fb;border-color:#46536a}
html[data-theme="dark"] .training-system-tabs button:not(.is-active):hover,
html[data-theme="dark"] .training-duration button:not(.is-active):hover,
html[data-theme="dark"] .training-plan-list>button:hover,
html[data-theme="dark"] .plan-choice-list button:hover{background:#26344a!important;color:#fff!important}
html[data-theme="dark"] .training-section-header p,
html[data-theme="dark"] .training-system-head p,
html[data-theme="dark"] .training-plan-v2 header p,
html[data-theme="dark"] .training-summary-grid small,
html[data-theme="dark"] .training-review-card p,
html[data-theme="dark"] .plan-task-grid p,
html[data-theme="dark"] .endgame-lesson-grid p,
html[data-theme="dark"] .training-empty p,
html[data-theme="dark"] .coach-row small{color:#aeb9ca!important}
html[data-theme="dark"] .endgame-study-difficulty{background:#171e29;color:#aeb9ca;border-color:#354154}
html[data-theme="dark"] .endgame-study-difficulty select{background:#111925;color:#edf3fb;border-color:#46536a}

/* v15.0.2 — final contrast rules for training answers and dialogs. */
html[data-theme="dark"] .plan-choice-list button,
html[data-theme="dark"] .plan-text-answer textarea,
html[data-theme="dark"] .plan-self-grade button,
html[data-theme="dark"] .training-modal-dialog>header>button[data-training-modal-close]{background:#202a38!important;color:#edf3fb!important;border-color:#52617a!important}
html[data-theme="dark"] .plan-choice-list button:hover:not(:disabled),
html[data-theme="dark"] .plan-choice-list button:focus-visible:not(:disabled){background:#2a3850!important;border-color:#6f8cb8!important}
html[data-theme="dark"] .plan-choice-list button.is-correct{background:#173b2b!important;border-color:#45a879!important;color:#f2fff7!important}
html[data-theme="dark"] .plan-choice-list button.is-wrong{background:#442326!important;border-color:#c7666f!important;color:#fff4f5!important}
html[data-theme="dark"] .plan-choice-list button small,
html[data-theme="dark"] .plan-text-answer small{color:#bdc8d9!important}
html[data-theme="dark"] .plan-choice-list button.is-correct small{color:#b9f0d2!important}
html[data-theme="dark"] .plan-choice-list button.is-wrong small{color:#ffc6ca!important}
html[data-theme="dark"] .plan-result{background:#222d3d!important;color:#edf3fb!important;border:1px solid #46536a}
html[data-theme="dark"] .training-modal-dialog>header{background:#171e29}

html[data-theme="dark"] .training-offline-banner{background:#352a0e;border-color:#d2a62f;color:#fff3c4}

html[data-theme="dark"] .site-nav > .site-nav-link{color:#e9eef7}html[data-theme="dark"] .site-nav > .site-nav-link:hover{color:#8ca6ff}

html[data-theme="dark"] .puzzle-engine-line:hover,html[data-theme="dark"] .puzzle-engine-line:focus-visible,html[data-theme="dark"] .endgame-study-engine-line:hover,html[data-theme="dark"] .endgame-study-engine-line:focus-visible{background:#25344a!important;border-color:#5d78a5!important}
