/* TJK-Chess v16.0.10 — near-black dark mode. Boards keep their board colors; text is white. */
html[data-theme="dark"]{
  color-scheme:dark;
  --tjk-bg:#070a0f;--tjk-surface:#0d1118;--tjk-surface-2:#121823;--tjk-surface-3:#182131;
  --tjk-border:#2a3443;--tjk-muted:#b9c3d1;--tjk-navy:#fff;--site-muted:#b9c3d1;
  --v1607-navy:#fff;--v1607-muted:#b9c3d1;--v1607-line:#2a3443;--v1607-soft:#0d1118;
}
html[data-theme="dark"] body,html[data-theme="dark"] main,html[data-theme="dark"] .app-shell,html[data-theme="dark"] .site-main{background:#070a0f!important;color:#fff!important}
html[data-theme="dark"] .site-header,html[data-theme="dark"] .site-footer{background:#090d13!important;color:#fff!important;border-color:#252f3d!important}
html[data-theme="dark"] :is(h1,h2,h3,h4,h5,h6,strong,b,label,legend,.eyebrow,.analysis-kicker,.puzzle-kicker,.play-kicker){color:#fff!important}
html[data-theme="dark"] :is(p,small,.muted,.subtitle,.tool-description,.analysis-engine-state,.analysis-engine-note,.v276-lobby-summary,.v276-lobby-head p){color:#b9c3d1!important}
html[data-theme="dark"] :is(button,input,select,textarea){color:#fff!important;border-color:#344154!important}
html[data-theme="dark"] :is(input,select,textarea){background:#0d131d!important}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#7f8da1!important}
html[data-theme="dark"] :is(.site-language-picker-button,.site-language-picker-option,.site-icon-button,.site-menu-toggle,.button,.play-secondary,.workspace-commandbar button){background:#111823!important;color:#fff!important;border-color:#344154!important}
html[data-theme="dark"] :is(.site-nav-dropdown,.site-language-picker-list,.course-search-popover,.account-dialog,.account-card,.v276-move-menu){background:#0d1118!important;color:#fff!important;border-color:#2d3949!important;box-shadow:0 18px 48px rgba(0,0,0,.55)!important}
html[data-theme="dark"] .site-nav-dropdown button,html[data-theme="dark"] .site-language-picker-option{background:#0d1118!important;color:#fff!important}
html[data-theme="dark"] .site-nav-dropdown button:hover,html[data-theme="dark"] .site-language-picker-option:hover{background:#182131!important}

/* Cards / panels / workspaces: dark by default, without touching chessboard squares. */
html[data-theme="dark"] :is(
.home-hero,.home-card,.home-quick-card,.home-daily-card,.home-section-card,.home-status-strip,.feature-strip,
.play-card,.play-workspace,.bot-gallery-card,.bot-options-card,.v276-online-lobby-card,.v268-game-setup,.v276-online-lobby,
.v266-position-list,.v266-position-board-card,.v266-position-detail,.v266-engine,.v275-position-moves,
.analysis-board-app,.analysis-card,.analysis-database-card,.analysis-engine-card,.analysis-moves-card,.analysis-side-panel,.analysis-engine-panel,
.puzzle-workspace,.puzzle-board-card,.puzzle-side-card,.puzzle-filterbar,.puzzle-message,.puzzle-engine,.puzzle-stat,
.training-hub,.training-card,.training-panel,.training-session,.training-plan,.training-summary,
.study-app,.study-main,.study-sidebar,.study-panel,.study-notation,.study-engine-panel,.study-comment-inspector,
.icc-admin-editor,.icc-admin-settings,.icc-admin-chapter,.icc-course-shell,.icc-course-side-panel,.icc-course-header,.icc-course-navigation,
.broadcast-shell,.broadcast-panel,.broadcast-card,.broadcast-sidebar,.broadcast-main,.broadcast-toolbar,.broadcast-game-card,
.course-video-editor,.course-video-shell,.course-video-stage,.course-video-sidebar,.course-media-editor,.video-editor-panel,.video-editor-sidebar,
.game-review-dialog,.game-review-panel,.position-builder,.position-panel,.endgame-studies-workspace,.endgame-study-board-card,.endgame-study-side,
.live-player-card,.live-side-panel,.computer-player-card,.computer-side-panel
){background:#0d1118!important;color:#fff!important;border-color:#2a3443!important;box-shadow:none!important}

/* Secondary rows and selectable items. */
html[data-theme="dark"] :is(
.v276-lobby-offers>button,.v278-lobby-game,.v268-preset-row button,.v275-computer-preset-row button,.v268-game-mode button,
.v266-position-items>button,.v266-chapter,.v275-engine-line,.analysis-pv-row,.analysis-db-row,.analysis-db-source-row,.analysis-db-game-row,
.puzzle-message,.puzzle-engine-line,.endgame-study-engine-line,.study-variation,.icc-admin-move-row,.icc-course-status,
.broadcast-row,.broadcast-game-row,.broadcast-filter-button,.training-task,.training-row
){background:#121823!important;color:#fff!important;border-color:#2f3b4d!important}
html[data-theme="dark"] :is(.v276-lobby-offers>button:hover,.v275-engine-line:hover,.analysis-pv-row:hover,.analysis-db-row:hover,.broadcast-game-row:hover){background:#1a2433!important}
html[data-theme="dark"] :is(.v1607-play-tabs,.v266-position-tabs,.tools-tabs){background:#0d1118!important;border-color:#2a3443!important}
html[data-theme="dark"] :is(.v1607-play-tabs button,.v266-position-tabs button,.tools-tabs button){background:#0d1118!important;color:#dfe7f3!important;border-color:#2a3443!important}
html[data-theme="dark"] :is(.v1607-play-tabs button.is-active,.v266-position-tabs button.is-active,.tools-tabs button.is-active){background:#176ee8!important;color:#fff!important}
html[data-theme="dark"] :is(.v266-engine .analysis-card-heading,.v275-position-moves .analysis-card-heading,.analysis-card-heading,.puzzle-side-head){background:#0a0f16!important;border-color:#293546!important;color:#fff!important}
html[data-theme="dark"] .v275-engine-line span,html[data-theme="dark"] .v266-position-items>button,html[data-theme="dark"] .v266-chapter>button:first-child{color:#fff!important}
html[data-theme="dark"] .v275-engine-line small,html[data-theme="dark"] .v276-lobby-offers>button small,html[data-theme="dark"] .v276-lobby-offers>button em{color:#aeb9c8!important}

/* Video: almost entirely dark; board and recorded video itself remain untouched. */
html[data-theme="dark"] :is(.video-editor-shell,.video-editor-controls,.course-video-controls,.course-video-info,.course-video-card,.course-video-timeline-wrap,.media-editor-controls,.media-editor-panel){background:#090d13!important;color:#fff!important;border-color:#283445!important}
html[data-theme="dark"] :is(.video-editor-controls button,.course-video-controls button,.media-editor-controls button){background:#121923!important;color:#fff!important;border-color:#344154!important}
html[data-theme="dark"] :is(.video-editor-controls button:hover,.course-video-controls button:hover,.media-editor-controls button:hover){background:#1b2636!important}

/* Keep all actual chessboard fields unchanged. */
html[data-theme="dark"] :is(.analysis-square,.puzzle-square,.study-square,.board-square,.chess-square,.v266-analysis-board>div,[data-square]){color:inherit}
html[data-theme="dark"] :is(.analysis-chessboard,.puzzle-board,.study-board,.v266-analysis-board,.course-video-board,.board-grid){background:transparent!important}

/* White text on dark surfaces, blue/green semantic accents retained. */
html[data-theme="dark"] a{color:#86b7ff}
html[data-theme="dark"] :is(.primary,.button-primary,.v268-create-lobby,.is-active){--dark-active-text:#fff}
html[data-theme="dark"] .button-primary,html[data-theme="dark"] button.primary,html[data-theme="dark"] .v268-create-lobby{color:#fff!important}
html[data-theme="dark"] hr{border-color:#2a3443!important}
