body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; margin: 0; background: #0b0f14; color: #e8eef6; }
.bar { display:flex; align-items:center; justify-content:space-between; padding: 12px 16px; background:#121a24; border-bottom:1px solid #1e2a3a; gap: 16px; flex-wrap: wrap;}
.title { font-weight:700; letter-spacing:0.2px; }
.controls { display:flex; align-items:center; gap: 10px; flex-wrap: wrap;}
.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; }
.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; }
.board { width: 520px; max-width: 90vw; }
.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:inline-flex; gap:6px; }
.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; }
.savedRow input, .savedRow select {
  min-width: 180px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #223046;
  background: #0b0f14;
  color: #e8eef6;
}
.savedRow select { min-width: 280px; }
.savedRow button { background:#334155; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.pgn { background:#121a24; border:1px solid #1e2a3a; border-radius:12px; padding:10px; overflow:auto; max-height: 300px;}
.pgnTitle { font-weight:600; margin-bottom:6px; }
.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; }
.coachHeader #askAdvice { background: #2563eb; }
.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; }
.coachHeader button { background:#2ea043; border:0; color:white; padding:8px 10px; border-radius:10px; cursor:pointer; }
.coachHeader button:disabled { opacity: .65; cursor: wait; }
.coachPanels { display:grid; grid-template-columns: 1fr; gap: 10px; }
.coachPanel { display:flex; flex-direction:column; gap: 6px; min-height: 0; }
.coachSubTitle { font-size: 12px; opacity: .85; }
.coachText { white-space: pre-wrap; background:#0b0f14; border:1px solid #223046; border-radius:12px; padding:10px; min-height: 130px; overflow:auto; margin: 0; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } .board { width: 100%; } }

.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; }
