body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; background: #18212c; color: #e8eef6; }
.bar { display:flex; flex-direction:column; align-items:flex-start; padding: 12px 16px; background:#121a24; border-bottom:1px solid #1e2a3a; gap: 12px; }
.title { font-weight:700; letter-spacing:0.2px; }
.headerMain { display:flex; flex-direction:column; gap:10px; min-width:0; }
.headerRow { display:flex; align-items:center; justify-content:flex-start; gap:12px; flex-wrap:wrap; width:100%; }
.controls { display:flex; align-items:center; gap: 10px; flex-wrap: wrap;}
.controlsPrimary { row-gap: 10px; }
.controlsPlayActions { row-gap: 10px; }
.controlsSecondary { row-gap: 8px; }
.controls button { background:#1f6feb; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.controls button:hover { filter: brightness(1.05); }
.controls button:disabled { opacity: .65; cursor: wait; }
.controls input { width: 60px; padding:6px; border-radius:8px; border:1px solid #223046; background:#0b0f14; color:#e8eef6; }
.controlsSecondary .settingLabel { padding: 6px 10px; background:#0f1620; border:1px solid #1f2b3a; border-radius:12px; }
.controlsSecondary .settingLabel input,
.controlsSecondary .settingLabel select { height: 34px; box-sizing: border-box; }
.controlsSecondary #fideRating { width: 96px; }
.adaptiveLabel input[type="checkbox"] { width: auto; height: auto; }
.adaptiveStatus { display:inline-flex; align-items:center; gap:8px; color:#9ecbff; font-size:12px; font-weight:700; min-width: 96px; }
.opponentAvatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid #3b4b61;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  background:
    linear-gradient(90deg, transparent 42%, rgba(255,255,255,.35) 42% 54%, transparent 54%),
    linear-gradient(0deg, transparent 42%, rgba(255,255,255,.28) 42% 54%, transparent 54%),
    linear-gradient(135deg, var(--tartan-a), var(--tartan-b));
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.opponentMeta { display:flex; flex-direction:column; line-height:1.15; min-width:0; }
.opponentName { color:#e8eef6; white-space:nowrap; }
.opponentRange { color:#8fa1b6; font-size:11px; white-space:nowrap; }
.authArea { display:flex; align-items:center; gap:10px; }
.authBtn { background:#334155; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.authUser { opacity:.9; white-space:nowrap; }
.aiBusy { font-size: 13px; color: #9ecbff; min-height: 1em; }
.aiBusy.isBusy::after {
  display:inline-block;
  content: "...";
  overflow: hidden;
  vertical-align: bottom;
  width: 0;
  animation: dots 1.2s steps(4, end) infinite;
}
.fenLabel { display: inline-flex; align-items: center; gap: 8px; }
.fenLabel input {
  width: min(460px, 58vw);
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #223046;
  background: #0b0f14;
  color: #e8eef6;
}
.settingLabel { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.infoTip {
  display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; border-radius:50%;
  border:1px solid #325278; color:#9ecbff; font-size:11px; font-weight:700;
  cursor: help; user-select: none; line-height:1;
}
.infoTip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2b3e57;
  background: #0f1620;
  color: #dbe9f8;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 30;
}
.infoTip:hover::after, .infoTip:focus-visible::after { opacity: 1; transform: translateY(0); }
.layout { display:grid; grid-template-columns: 520px 1fr; gap: 16px; padding: 16px; }
.boardWrap { display:flex; flex-direction:column; gap: 12px; }
.playerCards {
  width: 520px;
  max-width: 90vw;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.playerCard,
.opponentCard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #223046;
  background: #0f1620;
  box-sizing: border-box;
}
.playerCard .playerAvatar,
.opponentCard .opponentAvatar {
  width: 42px;
  height: 42px;
  font-size: 14px;
}
.playerAvatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid #3b4b61;
  color: #08111c;
  font-weight: 900;
  background: linear-gradient(135deg, #9ecbff, #2ea043);
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.playerCardBody,
.opponentCardBody { display:flex; flex-direction:column; gap:2px; min-width:0; }
.playerCardKicker,
.opponentCardKicker { color:#8fa1b6; font-size:11px; font-weight:800; text-transform:uppercase; }
.playerName,
.opponentCard .opponentName { font-size:16px; font-weight:800; }
.playerRange,
.opponentCard .opponentRange { font-size:12px; }
.board { width: 520px; max-width: 90vw; position: relative; }
.adviceOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: hidden;
}
.adviceArrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: .78;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4));
}
.adviceGhostPiece {
  position: absolute;
  opacity: .48;
  transform: scale(.92);
  border: 3px solid;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  box-sizing: border-box;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .45));
}

.boardFeedbackCheck {
  position: absolute;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transform: scale(.88);
  transition: opacity .18s ease, transform .18s ease;
}

.boardFeedbackCheck.isVisible {
  opacity: 1;
  transform: scale(1);
}

.boardFeedbackIcon,
.boardFeedbackText {
  box-shadow: 0 12px 34px rgba(15, 23, 42, .24);
}

.boardFeedbackIcon {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #16a34a;
  color: #ffffff;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.boardFeedbackText {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: #ffffff;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-weight: 900;
}
.boardActions { display:flex; align-items:center; gap:10px; }
.boardActions button { background:#1f6feb; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.boardActions button:disabled { opacity:.65; cursor:wait; }
#board [data-square].selected {
  box-shadow: inset 0 0 0 4px rgba(255, 196, 0, 0.9);
}
.editorTools { display:flex; gap:8px; }
.editorTools button { background:#0e7490; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.editorPanel { background:#121a24; border:1px solid #1e2a3a; border-radius:12px; padding:10px; display:flex; flex-direction:column; gap:10px; }
.editorHelp { font-size:12px; opacity:.9; }
.editorBoard { width: 360px; max-width: 85vw; }
.editorMeta { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.editorMeta label { display:inline-flex; align-items:center; gap:6px; }
.editorMeta input, .editorMeta select { padding:6px; border-radius:8px; border:1px solid #223046; background:#0b0f14; color:#e8eef6; }
.editorMeta #editorEp { width:60px; }
.editorMeta #editorHalfmove, .editorMeta #editorFullmove { width:70px; }
.castles { display:flex; flex-direction:column; gap:6px; align-items:flex-start; }
.castles label { display:flex; align-items:center; gap:8px; }
.editorActions { display:flex; gap:8px; flex-wrap:wrap; }
.editorActions button { background:#334155; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.editorFenRow { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.status { background:#121a24; border:1px solid #1e2a3a; border-radius:12px; padding:10px; }
.savedPanel { background:#121a24; border:1px solid #1e2a3a; border-radius:12px; padding:10px; display:flex; flex-direction:column; gap:8px; }
.savedTitle { font-weight:600; font-size:13px; opacity:.9; }
.savedRow { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.savedRowPrimary { display:grid; grid-template-columns: minmax(0, 1fr) auto; }
.savedRowSelect { display:block; }
.savedRowActions { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.savedRowActionsTwo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.savedRow input, .savedRow select {
  min-width: 180px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #223046;
  background: #0b0f14;
  color: #e8eef6;
}
.savedRowPrimary input,
.savedRowSelect select { width: 100%; min-width: 0; box-sizing: border-box; }
.savedRowActions button { width: 100%; }
.savedRow select { min-width: 280px; }
.savedRow button { background:#334155; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.savedMetaMuted { font-size: 12px; color:#8fa1b6; }
.adminPanel { gap: 14px; }
.adminSection { display:flex; flex-direction:column; gap:8px; padding-top:4px; }
.adminSection + .adminSection { border-top:1px solid #1f2b3a; padding-top:12px; }
.adminSectionTitle { font-weight:600; font-size:13px; color:#dbe9f8; }
.adminGrid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:8px; }
.adminGrid input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #223046;
  background: #0b0f14;
  color: #e8eef6;
}
.adminCheck { display:flex; align-items:center; gap:8px; font-size:13px; }
.adminChecks {
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:8px;
  margin-top:6px;
}
.adminChecks .adminCheck {
  padding: 8px 10px;
  border: 1px solid #223046;
  border-radius: 10px;
  background: #0f1620;
}
.pgn { background:#121a24; border:1px solid #1e2a3a; border-radius:12px; overflow:hidden; }
.pgn[open] { padding-bottom:10px; }
.pgnSummary {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  list-style:none;
  cursor:pointer;
  padding:10px 12px;
}
.pgnSummary::-webkit-details-marker { display:none; }
.pgnTitle { font-weight:600; }
.pgnHint { font-size:12px; opacity:.75; }
.pgn pre {
  margin: 0;
  padding: 0 12px;
  overflow:auto;
  max-height: 260px;
}
.coach { background:#121a24; border:1px solid #1e2a3a; border-radius:16px; padding:12px; display:flex; flex-direction:column; gap:10px; min-height: 520px;}
.coachHeader { display:flex; align-items:center; justify-content:space-between; gap: 8px; }
.coachTitle { font-weight:700; }
.coachBusy { flex: 1 1 auto; text-align: right; font-size: 13px; color: #9ecbff; min-height: 1em; }
.coachBusy.isBusy::after {
  display:inline-block;
  content: "...";
  overflow: hidden;
  vertical-align: bottom;
  width: 0;
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  from { width: 0; }
  to { width: 1.2em; }
}
.coach textarea { width: 100%; resize: vertical; border-radius:12px; border:1px solid #223046; padding:10px; background:#0b0f14; color:#e8eef6; box-sizing: border-box; }
.coachHeader button { background:#2ea043; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.coachHeader button:disabled { opacity: .65; cursor: wait; }
.chatPanel { display:flex; flex-direction:column; gap:10px; background:#0f1620; border:1px solid #1f2b3a; border-radius:14px; padding:12px; }
.panelHeader { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:8px; border-bottom:1px solid #223046; margin-bottom:2px; }
.panelTitle { font-size: 14px; font-weight: 700; letter-spacing: 0.2px; color:#dbe9f8; }
.chatHistory { display:flex; flex-direction:column; gap:10px; min-height: 160px; max-height: 280px; overflow:auto; padding-right:4px; }
.chatEmpty { color:#8fa1b6; font-size:13px; }
.chatMessage { width: 80%; max-width: 80%; padding:10px 12px; border-radius:14px; line-height:1.45; white-space:pre-wrap; box-sizing:border-box; }
.chatMessageUser { align-self:flex-end; margin-left:20%; background:#1f6feb; color:#fff; border-bottom-right-radius:6px; }
.chatMessageAssistant { align-self:flex-start; margin-right:20%; background:#0b0f14; border:1px solid #223046; color:#dbe9f8; border-bottom-left-radius:6px; }
.chatComposer { display:grid; grid-template-columns: minmax(0, 1fr) auto; gap:10px; align-items:end; }
.chatComposer button { background:#2ea043; border:0; color:white; padding:10px 14px; border-radius:12px; cursor:pointer; height: fit-content; }
.coachPanels { display:grid; grid-template-columns: 1fr; gap: 10px; }
.coachPanel { display:flex; flex-direction:column; gap: 6px; min-height: 0; }
.coachPanelHeader { display:flex; align-items:center; justify-content:flex-start; gap:12px; flex-wrap:wrap; }
.coachSubTitle { font-size: 12px; opacity: .85; }
.autoCoachToggle {
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12px;
  opacity:.9;
  line-height:1.35;
}
.autoCoachToggle input { flex:0 0 auto; order:-1; }
.coachText { white-space: pre-wrap; background:#0b0f14; border:1px solid #223046; border-radius:12px; padding:10px; min-height: 130px; overflow:auto; margin: 0; }
.adviceList {
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.adviceEval {
  color: #dbe9f8;
  font-size: 13px;
  font-weight: 700;
}
.adviceMoves {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adviceList .adviceMove {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(70px, 1fr) auto;
  grid-template-areas:
    "rank move score"
    "rank uci uci";
  gap: 2px 10px;
  align-items: center;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #223046;
  border-left: 4px solid var(--advice-color);
  background: #0f1620 !important;
  color: #e8eef6 !important;
  cursor: pointer;
}
.adviceList .adviceMove:hover,
.adviceList .adviceMove.isSelected {
  border-color: var(--advice-color);
  background: #142033 !important;
}
.adviceRank {
  grid-area: rank;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--advice-color);
  color: #08111c;
  font-weight: 800;
  font-size: 12px;
}
.adviceMoveText {
  grid-area: move;
  font-weight: 800;
}
.adviceScore {
  grid-area: score;
  color: #9ecbff;
  font-size: 12px;
}
.adviceUci {
  grid-area: uci;
  color: #8fa1b6;
  font-size: 12px;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .playerCards { width: 100%; grid-template-columns: 1fr; }
  .board { width: 100%; }
  .headerRow { align-items:flex-start; }
  .savedRowPrimary,
  .chatComposer { grid-template-columns: 1fr; }
  .savedRowActions { grid-template-columns: 1fr; }
  .adminGrid { grid-template-columns: 1fr; }
  .adminChecks { grid-template-columns: 1fr; }
  .chatMessage,
  .chatMessageUser,
  .chatMessageAssistant { width: 100%; max-width: 100%; margin-left:0; margin-right:0; }
}

.modeBtn { background:#30363d !important; }
.modeBtn.active { background:#1f6feb !important; }
.puzzleBar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.puzzleBar button { background:#8b5cf6; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.puzzleBar button:hover { filter: brightness(1.05); }
.puzzleMeta { opacity:0.9; font-size: 13px; }

.modalBackdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(4, 8, 12, 0.82);
  backdrop-filter: blur(6px);
  z-index: 1000;
}
.modalBackdrop.isOpen {
  display: grid;
}
.modalCard {
  width: min(420px, 100%);
  background: #121a24;
  border: 1px solid #223046;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.modalTitle {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}
.modalForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modalForm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modalForm input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #223046;
  background: #0b0f14;
  color: #e8eef6;
}
.modalError {
  min-height: 1.2em;
  color: #ff9b9b;
  font-size: 13px;
}
.modalActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modalActions button {
  background: #334155;
  border: 0;
  color: white;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.modalActions button[type="submit"] {
  background: #1f6feb;
}

.profileModalCard {
  width: min(560px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
}
.profileBalance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid #223046;
  border-bottom: 1px solid #223046;
}
.profileBalance span,
.profileSectionTitle {
  color: #9fb3c8;
  font-size: 13px;
  font-weight: 700;
}
.profileBalance strong {
  font-size: 30px;
  line-height: 1;
}
.profileSectionTitle {
  margin: 18px 0 8px;
}
.tokenPackages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tokenPackageBtn {
  min-height: 42px;
  border: 1px solid #2d3d52;
  background: #172233;
  color: #e8eef6;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.tokenTransactions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tokenTransaction,
.tokenTransactionEmpty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #223046;
}
.tokenTransactionTitle {
  font-weight: 700;
}
.tokenTransactionMeta {
  color: #9fb3c8;
  font-size: 12px;
}
.tokenPlus {
  color: #34d399;
  font-weight: 800;
}
.tokenMinus {
  color: #f87171;
  font-weight: 800;
}

/* Light UI refresh */
[hidden] { display: none !important; }

body {
  background: #eef3f8;
  color: #18212f;
}

.bar {
  background: #ffffff;
  border-bottom: 1px solid #d8e0ea;
  box-shadow: 0 1px 10px rgba(25, 38, 58, .06);
}

.title {
  color: #111827;
}

.headerMain {
  width: 100%;
}

.headerRowSecondary {
  justify-content: space-between;
}

.controls button,
.boardActions button,
.chatComposer button,
.coachHeader button,
.savedRow button,
.editorTools button,
.editorActions button,
.modalActions button,
.settingsBtn {
  background: #2563eb;
  color: #fff;
  border: 0;
  box-shadow: 0 1px 2px rgba(20, 36, 64, .12);
}

.modeBtn {
  background: #e8edf5 !important;
  color: #243449 !important;
}

.modeBtn.active {
  background: #2563eb !important;
  color: #fff !important;
}

.playActionsTitle {
  color: #52657d;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.controlsPlayActions {
  align-items: stretch;
}

.controlsPlayActions .colorChoice {
  min-width: 156px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
}

.colorChoiceWhite {
  background: #ffffff !important;
  color: #172033 !important;
  border: 1px solid #cfd8e3 !important;
}

.colorChoiceBlack {
  background: #172033 !important;
  color: #ffffff !important;
}

.settingsBtn,
.authBtn {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.authBtn {
  background: #475569;
  color: #fff;
}

.authUser {
  color: #334155;
  font-weight: 700;
}

.layout {
  grid-template-columns: minmax(620px, 720px) minmax(320px, 420px);
  align-items: start;
  justify-content: center;
  gap: 20px;
}

.board,
.playerCards,
.reviewPanel,
.savedPanel,
.pgn,
.status,
.editorPanel {
  width: min(720px, calc(100vw - 32px));
  max-width: none;
}

.boardWrap {
  align-items: flex-start;
}

.playerCard,
.opponentCard,
.savedPanel,
.status,
.pgn,
.reviewPanel,
.chatPanel,
.coachPanel,
.editorPanel {
  background: #ffffff;
  border: 1px solid #d8e0ea;
  color: #1f2937;
  box-shadow: 0 1px 6px rgba(25, 38, 58, .05);
}

.playerCard,
.opponentCard {
  border-radius: 8px;
}

.opponentName,
.playerName,
.panelTitle,
.adminSectionTitle {
  color: #172033;
}

.opponentRange,
.playerRange,
.savedMetaMuted,
.chatEmpty,
.pgnHint {
  color: #64748b;
}

.status {
  border-radius: 8px;
  font-weight: 700;
}

.boardActions,
.editorTools {
  width: min(720px, calc(100vw - 32px));
}

.boardActions button {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.boardActions #undoMove {
  background: #64748b;
}

.boardActions #offerDraw {
  background: #0f766e;
}

.boardActions #resignGame {
  background: #dc2626;
}

.coach {
  background: #ffffff;
  border: 1px solid #d8e0ea;
  color: #1f2937;
  border-radius: 8px;
  min-height: 0;
  box-shadow: 0 1px 8px rgba(25, 38, 58, .06);
}

.coachTitle,
.savedTitle,
.pgnTitle {
  color: #172033;
}

.chatPanel {
  border-radius: 8px;
}

.chatHistory {
  min-height: 120px;
  max-height: 210px;
}

.coachText {
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  color: #1f2937;
  min-height: 110px;
}

.coach textarea,
.savedRow input,
.savedRow select,
.adminGrid input,
.editorMeta input,
.editorMeta select,
.fenLabel input,
.modalForm input,
.controls input,
.controls select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #172033;
}

.chatMessageAssistant {
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  color: #1f2937;
}

.chatMessageUser {
  background: #2563eb;
}

.panelHeader {
  border-bottom-color: #d8e0ea;
}

.pgn pre {
  color: #334155;
}

.adviceList .adviceMove {
  background: #ffffff !important;
  color: #172033 !important;
  border-color: #d8e0ea;
}

.adviceList .adviceMove:hover,
.adviceList .adviceMove.isSelected {
  background: #eef6ff !important;
}

.adviceScore {
  color: #2563eb;
}

.adviceUci {
  color: #64748b;
}

.modalBackdrop {
  background: rgba(15, 23, 42, .42);
}

.modalCard,
.settingsCard {
  background: #ffffff;
  color: #172033;
  border: 1px solid #d8e0ea;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .22);
}

.adminMenuBtn {
  background: #0f766e;
}

.adminModalCard {
  width: min(1120px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #ffffff;
  color: #172033;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .22);
}

.adminModalCard .adminPanel {
  width: 100%;
  max-width: none;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.adminModalCard .adminSection {
  border-color: #d8e0ea;
}

.adminModalCard .adminSectionTitle,
.adminModalCard .savedTitle {
  color: #172033;
}

.adminModalCard .adminChecks .adminCheck,
.adminModalCard .adminCheck {
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  color: #1f2937;
}

.puzzleBar {
  width: min(720px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(25, 38, 58, .05);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.puzzleBarPrimary,
.puzzleBarSecondary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

.puzzleBar button {
  background: #2563eb;
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}

.puzzleBar .puzzlePrimaryBtn {
  background: #0f766e;
}

.puzzleMeta {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.puzzleMeta input,
.puzzleMeta select {
  min-height: 40px;
  min-width: 120px;
  max-width: 220px;
  background: #ffffff;
  color: #172033;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 9px;
  font: inherit;
}

.puzzleMeta input[type="file"] {
  max-width: 260px;
  padding: 7px;
}

.puzzleCheck {
  flex-direction: row;
  align-items: center;
  min-height: 40px;
}

.puzzleCheck input {
  min-width: auto;
  min-height: auto;
}

.puzzleIdMeta {
  min-width: 220px;
}

.puzzleIdLoad {
  display: flex;
  gap: 6px;
  align-items: center;
}

.puzzleIdLoad input {
  min-width: 120px;
  max-width: 150px;
}

.puzzleIdLoad button {
  min-height: 40px;
  padding: 8px 11px;
}

.puzzleProgress {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.puzzleProgressHeader,
.puzzleProgressList {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.puzzleProgressHeader {
  color: #334155;
  font-weight: 900;
  margin-bottom: 8px;
}

.progressPuzzle {
  background: #f8fafc !important;
  color: #172033 !important;
  border: 1px solid #d8e0ea !important;
  min-height: 34px !important;
  padding: 6px 9px !important;
  font-size: 12px;
}

.progressPuzzle.isSolved {
  border-color: #86efac !important;
}

.progressPuzzle span {
  color: #64748b;
  font-weight: 700;
}

.puzzleProgressEmpty {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.puzzleSeriesTools,
.puzzleAdminTools {
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
}

.puzzleSeriesTools summary,
.puzzleAdminTools summary {
  color: #334155;
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 8px;
}

.puzzleStatus {
  display: grid;
  gap: 10px;
}

.puzzleStatusTop,
.puzzleStatusMain,
.puzzleStatusMeta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.puzzleBadge {
  background: #0f766e;
  color: #ffffff;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.puzzleStatusMessage {
  color: #172033;
  font-weight: 900;
}

.puzzleStatusMain {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.puzzleStatusLabel {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.puzzleStatusValue {
  color: #172033;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.puzzleStatusMeta {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.puzzleStatusMeta span {
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 8px;
}

.puzzleStatus.isSuccess .puzzleBadge {
  background: #16a34a;
}

.puzzleStatus.isError .puzzleBadge {
  background: #dc2626;
}

.puzzleStatus.isError .puzzleStatusMessage {
  color: #b91c1c;
}

.reviewPanel {
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.reviewPanel[hidden] {
  display: none;
}

.reviewHeader,
.reviewGrid,
.reviewSliderRow,
.reviewAsk {
  display: flex;
  gap: 10px;
  align-items: end;
}

.reviewHeader {
  justify-content: space-between;
  align-items: center;
}

.reviewField {
  display: grid;
  gap: 5px;
  flex: 1;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.reviewField select,
.reviewAsk textarea {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #172033;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.reviewPanel button {
  background: #2563eb;
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}

.reviewSliderRow input {
  flex: 1;
}

#reviewMoveLabel {
  min-width: 150px;
  color: #334155;
  font-weight: 900;
}

.reviewEval {
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.reviewEvalScore {
  color: #172033;
  font-size: 17px;
  font-weight: 900;
}

.reviewEvalQuality {
  color: #64748b;
  font-weight: 800;
}

.reviewAsk textarea {
  flex: 1;
  resize: vertical;
}

.reviewCoachText {
  min-height: 90px;
}

.reviewPuzzleProgress {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.learnPanel {
  width: min(720px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(25, 38, 58, .05);
  padding: 14px;
  display: grid;
  gap: 14px;
  color: #1f2937;
}

.learnPanel[hidden] {
  display: none;
}

.learnHeader,
.learnExerciseHeader,
.learnActions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.learnHeader button,
.learnExerciseHeader button,
.learnActions button,
.learnQuizOptions button {
  background: #2563eb;
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}

.learnProgressSummary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #334155;
  font-weight: 900;
}

.learnProgressPill {
  background: #f1f5f9;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}

.learnLessonLayout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
}

.learnLessonList {
  display: grid;
  gap: 8px;
  align-content: start;
}

.learnLessonList button {
  width: 100%;
  min-height: 42px;
  text-align: left;
  background: #f8fafc;
  color: #172033;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 800;
  cursor: pointer;
}

.learnLessonList button.isActive {
  border-color: #2563eb;
  background: #eef6ff;
}

.learnLessonList button.isDone::after {
  content: " klaar";
  color: #16a34a;
  font-size: 12px;
}

.learnLessonCard {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.learnLessonTitle {
  color: #172033;
  font-size: 18px;
  font-weight: 900;
}

.learnLessonConcept,
.learnExercisePrompt,
.learnExerciseResult,
.learnQuizQuestion {
  line-height: 1.45;
}

.learnLessonConcept,
.learnExerciseResult {
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 10px;
}

.learnLessonSteps {
  margin: 0;
  padding-left: 22px;
  color: #334155;
}

.learnExerciseTitle,
.learnQuizQuestion {
  color: #172033;
  font-weight: 900;
}

.learnQuiz {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  display: grid;
  gap: 10px;
}

.learnQuizOptions {
  display: grid;
  gap: 8px;
}

.learnQuizOptions button {
  background: #f8fafc;
  color: #172033;
  border: 1px solid #d8e0ea;
  text-align: left;
}

.learnQuizOptions button.isCorrect {
  border-color: #86efac;
  background: #ecfdf5;
}

.learnQuizOptions button.isWrong {
  border-color: #fecaca;
  background: #fef2f2;
}

@media (max-width: 760px) {
  .puzzleStatusMain {
    grid-template-columns: 1fr;
  }

  .puzzleMeta input,
  .puzzleMeta select,
  .puzzleBar button {
    width: 100%;
  }

  .puzzleIdLoad {
    width: 100%;
  }

  .puzzleMeta {
    width: 100%;
  }

  .reviewHeader,
  .reviewGrid,
  .reviewSliderRow,
  .reviewAsk,
  .learnHeader,
  .learnExerciseHeader,
  .learnActions {
    align-items: stretch;
    flex-direction: column;
  }

  .learnLessonLayout {
    grid-template-columns: 1fr;
  }

  #reviewMoveLabel {
    min-width: 0;
  }
}

.adminModalCard .adminChecks .adminCheck {
  min-height: 38px;
}

.adminModalCard .adminCheck input {
  accent-color: #2563eb;
}

.adminModalCard .adminGrid input,
.adminModalCard .savedRow input,
.adminModalCard .savedRow select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #172033;
}

.adminModalCard .savedRow button {
  background: #2563eb;
  color: #ffffff;
}

.adminModalCard #adminDeleteUserBtn,
.adminModalCard #adminDeleteGroupBtn {
  background: #dc2626;
}

.settingsCard {
  width: min(760px, 100%);
  border-radius: 12px;
  padding: 22px;
}

.settingsHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settingsSubtitle {
  color: #64748b;
  font-size: 13px;
  margin-top: 3px;
}

.modalClose {
  background: #e8edf5;
  color: #172033;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
}

.settingsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settingsGrid .settingLabel {
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 10px 12px;
}

.settingsGrid button {
  border-radius: 8px;
  min-height: 44px;
}

.adaptiveStatus {
  color: #2563eb;
}

.infoTip {
  border-color: #cbd5e1;
  color: #2563eb;
}

.infoTip::after {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .16);
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .board,
  .playerCards,
  .savedPanel,
  .pgn,
  .status,
  .editorPanel,
  .boardActions,
  .editorTools {
    width: min(720px, calc(100vw - 32px));
  }
  .coach {
    width: min(720px, calc(100vw - 32px));
  }
}

@media (max-width: 720px) {
  .settingsGrid,
  .playerCards {
    grid-template-columns: 1fr;
  }
  .controlsPlayActions .colorChoice {
    min-width: 0;
    width: 100%;
  }
}
