:root {
  --bg: #312e2b;
  --surface: #262421;
  --surface-2: #383531;
  --nav-bg: #211f1c;
  --border: #45413c;
  --text: #f3f3f2;
  --muted: #a6a39e;
  --accent: #81b64c;
  --accent-hover: #96c95d;
  --primary: #4b7399;
  --primary-hover: #5b86af;
  --sq-light: #eeeed2;
  --sq-dark: #769656;
  --sq-selected: rgba(255, 255, 51, 0.52);
  --sq-last: rgba(246, 246, 105, 0.58);
  --sq-check: rgba(235, 97, 80, 0.85);
}

body.theme-wood {
  --sq-light: #f0d9b5;
  --sq-dark: #b58863;
}

body.theme-slate {
  --sq-light: #dee3e6;
  --sq-dark: #8ca2ad;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ====== CHESS.COM TARZI ANA KABUK (SIDEBAR + İÇERİK) ====== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.nav-rail {
  width: 205px;
  flex-shrink: 0;
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.nav-logo { font-size: 28px; color: var(--accent); line-height: 1; }
.nav-brand-text { display: flex; flex-direction: column; }
.nav-title { font-size: 1.05rem; letter-spacing: -0.2px; }
.nav-sub { font-size: 0.68rem; color: var(--muted); }

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #cfccc7;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: #ffffff; }
.nav-item.active {
  background: rgba(129, 182, 76, 0.18);
  color: #ffffff;
  border-left: 3px solid var(--accent);
}
.nav-ico { font-size: 1.15rem; width: 22px; text-align: center; }

.nav-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.nav-controls-row { display: flex; gap: 6px; align-items: center; }
.nav-controls-row .theme-select { flex: 1; min-width: 0; }

.mobile-topbar {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 25;
}
.mobile-brand { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.mobile-topbar-actions { display: flex; align-items: center; gap: 6px; }

.main-area {
  flex: 1;
  min-width: 0;
  padding: 14px 20px;
}

.view-section.hidden { display: none !important; }

.theme-select, .engine-status {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.78rem;
}
.icon-btn { font-size: 0.95rem; line-height: 1; padding: 5px 9px; }

.engine-status {
  display: flex;
  align-items: center;
  gap: 7px;
}
.engine-status.compact .engine-status-txt { display: none; }
.engine-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; flex-shrink: 0; }
.engine-status.ready .dot { background: var(--accent); }
.engine-status.error .dot { background: #ef4444; }

/* ====== ANA SAYFA DASHBOARD (CHESS.COM GÖRÜNÜMÜ) ====== */
.home-container { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.home-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}
.home-welcome { display: flex; align-items: center; gap: 12px; }
.user-avatar-badge {
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--accent); color: #16220b;
  font-size: 26px; display: flex; align-items: center; justify-content: center;
}
.home-welcome h2 { font-size: 1.2rem; }
.home-welcome p { font-size: 0.82rem; color: var(--muted); }

.home-stats-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 20px; font-size: 0.84rem;
}

.home-main-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 16px;
  align-items: stretch;
}

.home-play-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.home-play-card h3 { font-size: 1rem; }

.quick-tc-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tc-pill {
  padding: 6px 4px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.76rem;
  cursor: pointer;
}
.tc-pill.active { background: var(--surface-2); color: #ffffff; border-color: var(--accent); }

.home-start-btn {
  padding: 12px;
  font-size: 1.02rem;
  font-weight: 800;
  border-radius: 7px;
  box-shadow: 0 4px 0 #5b8831;
}

.home-action-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.home-action-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 11px;
  color: var(--text); cursor: pointer; text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.home-action-item:hover { background: #47433e; border-color: var(--accent); }
.hai-ico { font-size: 1.3rem; }
.hai-text { flex: 1; display: flex; flex-direction: column; }
.hai-text strong { font-size: 0.86rem; }
.hai-text span { font-size: 0.72rem; color: var(--muted); }
.hai-arrow { font-size: 1.2rem; color: var(--muted); }

.home-cards-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.home-feature-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  gap: 10px;
}
.mini-board-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.mini-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%; height: 100%;
}
.mini-sq { display: flex; align-items: center; justify-content: center; }
.mini-sq.light { background: var(--sq-light); }
.mini-sq.dark { background: var(--sq-dark); }
.mini-sq svg { width: 86%; height: 86%; }

.hfc-body { display: flex; flex-direction: column; gap: 5px; }
.hfc-badge { font-size: 0.74rem; color: var(--accent); font-weight: 700; }
.hfc-body h4 { font-size: 0.96rem; }
.hfc-body p { font-size: 0.76rem; color: var(--muted); min-height: 20px; }

.home-bottom-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; gap: 8px;
}
.muted-small { font-size: 0.76rem; color: var(--muted); }

.home-bots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bot-mini-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color 0.15s, transform 0.1s;
}
.bot-mini-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.bmc-top { display: flex; align-items: center; gap: 7px; }
.bmc-avatar { font-size: 1.5rem; display: inline-flex; align-items: center; justify-content: center; }
.bot-avatar-img { border-radius: 6px; object-fit: cover; vertical-align: middle; flex-shrink: 0; border: 1px solid var(--border); }
.player-name { display: inline-flex; align-items: center; gap: 6px; }
.bmc-name { font-weight: 700; font-size: 0.82rem; }
.bmc-elo { font-size: 0.72rem; color: var(--accent); font-weight: 700; }
.bmc-style { font-size: 0.7rem; color: var(--muted); }

.home-recent-list { display: flex; flex-direction: column; gap: 7px; }
.recent-game-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; gap: 8px;
}
.rgr-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rgr-title { font-size: 0.84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rgr-meta { font-size: 0.72rem; color: var(--muted); }
.empty-state { color: var(--muted); font-size: 0.82rem; padding: 14px; text-align: center; background: var(--bg); border-radius: 6px; }

/* ====== ORTAK TAHTA & ÇALIŞMA ALANI ====== */
.workspace {
  display: grid;
  grid-template-columns: auto minmax(480px, 660px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.sub-workspace {
  display: grid;
  grid-template-columns: auto minmax(340px, 470px);
  gap: 20px;
  align-items: start;
  justify-content: center;
}
.sub-board-col { display: flex; flex-direction: column; gap: 6px; }

.board-section { display: flex; gap: 10px; align-items: stretch; }

.eval-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 34px;
  padding: 32px 0;
  gap: 5px;
}
.eval-bar-wrap.flipped { flex-direction: column-reverse; }
.eval-bar-wrap.flipped .eval-bar { justify-content: flex-start; }
.eval-bar-wrap.eval-hidden { opacity: 0.15; pointer-events: none; }

.eval-bar {
  flex: 1;
  width: 22px;
  background: #403d39;
  border: 1px solid #1f1d1b;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.eval-fill-white {
  background: #ffffff;
  width: 100%;
  transition: height 0.25s ease;
}

.eval-score-top, .eval-score-bot {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  min-height: 15px;
}

.board-container { display: flex; flex-direction: column; gap: 6px; }

.player-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background: var(--surface);
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 600;
}
.player-left { display: flex; align-items: center; gap: 8px; }
.captured-pieces { font-size: 0.95rem; letter-spacing: 1px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.mat-diff { font-size: 0.76rem; font-weight: 800; color: var(--accent); background: rgba(129, 182, 76, 0.16); padding: 1px 5px; border-radius: 4px; letter-spacing: 0; }

.clock-badge {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
}
.clock-badge.active { background: #ffffff; color: #1a1917; }
.clock-badge.low { background: #ca3431; color: white; }

.board-wrapper {
  position: relative;
  width: min(76vh, 560px);
  height: min(76vh, 560px);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  user-select: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.square.light { background: var(--sq-light); color: #769656; }
.square.dark { background: var(--sq-dark); color: #eeeed2; }
.square.last-move::after { content: ''; position: absolute; inset: 0; background: var(--sq-last); pointer-events: none; }
.square.selected::after { content: ''; position: absolute; inset: 0; background: var(--sq-selected); pointer-events: none; }
.square.in-check { background: var(--sq-check) !important; }
.square.premove { background: rgba(235, 97, 80, 0.52) !important; }
.square.user-mark { background: rgba(235, 97, 80, 0.72) !important; }

.piece {
  position: relative;
  z-index: 2;
  width: 85%;
  height: 85%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.32));
}
.piece svg { width: 100%; height: 100%; }

.legal-dot {
  position: relative;
  z-index: 3;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  pointer-events: none;
}
.square.has-piece .legal-dot {
  position: absolute;
  inset: 5%;
  width: auto;
  height: auto;
  background: transparent;
  border: 4px solid rgba(0, 0, 0, 0.24);
}

.sq-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 5;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.45);
  pointer-events: none;
}

.coord-rank { position: absolute; top: 2px; left: 4px; font-size: 10px; font-weight: 700; z-index: 1; }
.coord-file { position: absolute; bottom: 2px; right: 4px; font-size: 10px; font-weight: 700; z-index: 1; }

.arrow-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 30px);
  overflow-y: auto;
  padding-right: 2px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.compact-card { padding: 8px 10px; }

.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.tab-btn {
  padding: 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}
.tab-btn.active { background: var(--accent); color: #16220b; border-color: var(--accent); }

.bot-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg);
  border-radius: 5px;
  font-size: 0.78rem;
}
.full-span { grid-column: 1 / -1; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.setting-row select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; flex: 1; max-width: 190px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.78rem; }

.bot-chat-bubble {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 7px 9px;
}
.bot-chat-avatar { font-size: 1.55rem; line-height: 1; }
.bot-chat-body strong { display: block; font-size: 0.78rem; color: var(--accent); margin-bottom: 2px; }
.bot-chat-body p { font-size: 0.76rem; color: #e2e0dc; line-height: 1.3; }

.action-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.action-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.action-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }

.btn {
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn:hover { background: #47433e; }
.btn.primary { background: var(--primary); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #16220b; }
.btn.accent:hover { background: var(--accent-hover); }
.btn.small { padding: 4px 8px; font-size: 0.76rem; }
.btn.full-btn { width: 100%; }
.btn.active-tool { border-color: var(--accent); background: rgba(129, 182, 76, 0.22); color: #ffffff; }
.btn.toggle-on { background: var(--accent); border-color: var(--accent); color: #16220b; }
.btn.toggle-off { background: var(--surface-2); border-color: var(--border); color: var(--muted); }

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.panel-title { font-size: 0.95rem; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 6px; }

.eval-pill {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: #ffffff;
  color: #1a1917;
}

.eval-graph-wrap {
  background: #3d3a36;
  border-radius: 4px;
  height: 46px;
  overflow: hidden;
  margin-bottom: 6px;
  border: 1px solid var(--border);
}
#evalGraph { width: 100%; height: 100%; display: block; cursor: pointer; }

.pv-list { display: flex; flex-direction: column; gap: 3px; font-size: 0.78rem; margin-bottom: 8px; }
.pv-line {
  background: var(--bg);
  padding: 4px 7px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pv-score {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  font-weight: 800;
  background: #ffffff;
  color: #1a1917;
  border-radius: 3px;
  padding: 0 4px;
  margin-right: 6px;
}
.pv-score.neg { background: #1a1917; color: #f3f3f2; }
.pv-empty { color: var(--muted); font-style: italic; padding: 4px 0; }

.opening-depth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 0.78rem;
}
.opening-left { display: flex; align-items: center; gap: 6px; overflow: hidden; }
.eco-code {
  font-size: 0.72rem; font-weight: 800;
  background: var(--surface-2); color: var(--accent);
  padding: 1px 5px; border-radius: 3px;
}
.opening-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.depth-badge { color: var(--muted); white-space: nowrap; }

.engine-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}
.eng-ctrl { display: flex; flex-direction: column; gap: 2px; }
.eng-ctrl strong { color: var(--text); }
.eng-ctrl input[type="range"] { width: 100%; accent-color: var(--accent); }

.move-coach {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.coach-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.coach-title { font-weight: 700; font-size: 0.82rem; display: flex; align-items: center; gap: 6px; }
.coach-eval-shift {
  font-family: monospace;
  font-size: 0.74rem;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}
.coach-desc { color: #e2e0dc; line-height: 1.38; }
.coach-pv { font-family: monospace; font-size: 0.74rem; color: var(--accent); background: var(--surface); padding: 4px 6px; border-radius: 4px; }
.coach-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.coach-retry-msg { font-weight: 700; padding: 4px 7px; border-radius: 4px; }
.coach-retry-msg.ok { background: rgba(129, 182, 76, 0.2); color: #a3e635; }
.coach-retry-msg.bad { background: rgba(202, 52, 49, 0.22); color: #fca5a5; }

.moves-inline {
  background: var(--bg);
  border-radius: 4px;
  padding: 5px 8px;
  max-height: 92px;
  overflow-y: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  margin-bottom: 6px;
}
.mv-num { color: var(--muted); margin-right: 3px; }
.mv-item {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  cursor: pointer;
  margin-right: 4px;
  font-weight: 600;
}
.mv-item:hover { background: var(--surface-2); }
.mv-item.active { background: #5a5650; color: #ffffff; }

.q-book { color: #d4a373; }
.q-brilliant { color: #26c6da; }
.q-great { color: #5c9ce6; }
.q-best { color: #81b64c; }
.q-good { color: #96bc4b; }
.q-inacc { color: #f0c15c; }
.q-mistake { color: #e58f2a; }
.q-blunder { color: #ca3431; }

.bg-book { background: #a88865; color: #ffffff; }
.bg-brilliant { background: #1baca6; color: #ffffff; }
.bg-great { background: #5c8bb0; color: #ffffff; }
.bg-best { background: #81b64c; color: #ffffff; }
.bg-good { background: #96bc4b; color: #ffffff; }
.bg-inacc { background: #f0c15c; color: #1a1917; }
.bg-mistake { background: #e58f2a; color: #ffffff; }
.bg-blunder { background: #ca3431; color: #ffffff; }

.review-box {
  background: var(--bg);
  border-radius: 5px;
  padding: 7px 9px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: 185px 1fr;
  gap: 10px;
  align-items: center;
}
.accuracy-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 5px;
}
.acc-card {
  text-align: center;
  padding: 5px 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}
.acc-card strong { font-size: 1.05rem; }
.acc-card span { font-size: 0.7rem; opacity: 0.85; }
.acc-elo { font-size: 0.72rem; font-weight: 800; color: var(--accent); margin-top: 2px; min-height: 14px; }
.white-acc .acc-elo { color: #4d7c0f; }
.white-acc { background: #ffffff; color: #1a1917; }
.black-acc { background: #383531; color: #f3f3f2; border: 1px solid var(--border); }
.result-mid { font-size: 0.85rem; font-weight: 700; color: var(--muted); }

.breakdown-table { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 0.76rem; }
.bd-row {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  text-align: center;
}
.bd-label { display: flex; align-items: center; justify-content: center; gap: 5px; font-weight: 600; }
.bd-dot { width: 15px; height: 15px; border-radius: 50%; font-size: 9px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; }

.nav-review-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nav-row { display: flex; gap: 4px; flex: 1; }
.nav-row .btn { flex: 1; }

.analysis-progress { margin-bottom: 6px; font-size: 0.76rem; color: var(--muted); }
.progress-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }

.pgn-row { display: flex; gap: 5px; }
.pgn-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.78rem;
}
.turn-status-line { font-size: 0.75rem; color: var(--muted); margin-top: 5px; text-align: right; }

/* ====== BULMACALAR, AÇILIŞ, EDİTÖR, GEÇMİŞ STİLLERİ ====== */
.badge-pill {
  background: var(--surface-2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}
.stat-mini { font-size: 0.78rem; color: var(--muted); }
.stat-mini strong { color: var(--accent); }

.filter-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px; }
.puzzle-info-box { margin-bottom: 8px; }
.puzzle-info-box h3 { font-size: 1rem; }

.coach-box {
  background: var(--bg);
  border-left: 3px solid var(--primary);
  padding: 9px 11px;
  border-radius: 5px;
  font-size: 0.82rem;
  line-height: 1.4;
}
.coach-box.ok { border-left-color: var(--accent); background: rgba(129, 182, 76, 0.14); color: #d9f99d; }
.coach-box.bad { border-left-color: #ef4444; background: rgba(202, 52, 49, 0.18); color: #fecaca; }

.puzzle-list-scroll, .opening-cards-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.list-item-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
  font-size: 0.8rem;
}
.list-item-btn:hover { background: var(--surface-2); }
.list-item-btn.active { border-color: var(--accent); background: rgba(129, 182, 76, 0.14); }
.list-item-sub { font-size: 0.72rem; color: var(--muted); }

/* Tahta Editörü Paleti */
.palette-group { margin-bottom: 8px; }
.piece-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-top: 4px; }
.palette-btn {
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px;
  display: flex; align-items: center; justify-content: center;
}
.palette-btn:hover { border-color: var(--muted); }
.palette-btn.active { border-color: var(--accent); background: rgba(129, 182, 76, 0.2); }
.palette-btn svg { width: 100%; height: 100%; }

.editor-options {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.78rem;
}
.castling-checks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.castling-checks label { display: flex; align-items: center; gap: 4px; cursor: pointer; }

.endgame-drills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.drill-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s;
}
.drill-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.drill-btn strong { font-size: 0.78rem; color: var(--accent); }
.drill-btn span { font-size: 0.7rem; color: var(--muted); }

/* Oyun Geçmişi */
.history-container { max-width: 1100px; margin: 0 auto; }
.history-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.history-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 14px;
}
.hc-left { display: flex; align-items: center; gap: 12px; }
.hc-result-badge {
  min-width: 48px; text-align: center; font-weight: 800; font-size: 0.82rem;
  padding: 5px 7px; border-radius: 5px; background: var(--surface-2);
}
.hc-result-badge.win { background: rgba(129, 182, 76, 0.25); color: #a3e635; }
.hc-result-badge.loss { background: rgba(202, 52, 49, 0.25); color: #fca5a5; }
.hc-actions { display: flex; gap: 6px; }

.hidden { display: none !important; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; text-align: center;
}
.promo-choices { display: flex; gap: 10px; margin-top: 12px; }
.promo-btn {
  font-size: 36px; padding: 8px 14px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
}
.promo-btn:hover { background: var(--primary); }

.game-over-box { min-width: 300px; max-width: 360px; padding: 20px; }
.game-over-icon { font-size: 40px; margin-bottom: 6px; }
.game-over-box h2 { font-size: 1.3rem; margin-bottom: 4px; }
.game-over-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }
.game-over-actions { display: flex; flex-direction: column; gap: 7px; }

/* ====== RESPONSIVE & MOBİL GÖRÜNÜM ====== */
@media (max-width: 1120px) {
  .nav-rail { width: 72px; padding: 12px 6px; align-items: center; }
  .nav-brand-text, .nav-lbl, .nav-footer .engine-status-txt { display: none; }
  .nav-item { justify-content: center; padding: 10px 6px; }
  .nav-controls-row { flex-direction: column; }
  .nav-controls-row .theme-select { width: 58px; font-size: 0.68rem; padding: 3px; }
  .home-main-grid { grid-template-columns: 1fr; }
  .home-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  html, body, .app-shell { overflow-x: hidden; max-width: 100%; }
  .app-shell { flex-direction: column; padding-bottom: 64px; }
  .mobile-topbar { display: flex; }

  .nav-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 60px;
    flex-direction: row;
    padding: 4px 6px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .nav-brand, .nav-footer { display: none; }
  .nav-links {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 2px;
  }
  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border-left: none !important;
    border-radius: 6px;
    font-size: 0.66rem;
  }
  .nav-item.active {
    background: rgba(129, 182, 76, 0.18);
    color: var(--accent);
  }
  .nav-lbl { display: block; font-size: 0.64rem; white-space: nowrap; }
  .nav-ico { font-size: 1.1rem; }

  .main-area { padding: 8px 10px; max-width: 100vw; overflow-x: hidden; }
  .workspace, .sub-workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; width: 100%; }
  .board-section, .sub-board-col { justify-content: center; align-items: center; max-width: 100%; }
  .board-section { gap: 6px; }
  .eval-bar-wrap { width: 22px; padding: 28px 0; }
  .eval-bar { width: 14px; }
  .board-wrapper { width: min(calc(100vw - 72px), 460px); height: min(calc(100vw - 72px), 460px); }
  #view-puzzles .board-wrapper,
  #view-openings .board-wrapper,
  #view-editor .board-wrapper { width: min(calc(100vw - 40px), 460px); height: min(calc(100vw - 40px), 460px); }
  .sidebar { max-height: none; overflow-y: visible; width: 100%; max-width: 100%; min-width: 0; padding-right: 0; }
  .card { max-width: 100%; min-width: 0; }
  .pgn-row { flex-wrap: wrap; }
  .board, .square { touch-action: manipulation; }

  .home-cards-trio { grid-template-columns: 1fr; }
  .home-bots-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .bot-settings { grid-template-columns: 1fr; }
  .review-box { grid-template-columns: 1fr; }
  .breakdown-table { grid-template-columns: 1fr 1fr; }
  .nav-review-row { flex-direction: column; align-items: stretch; }
  .btn { padding: 8px 10px; }
  .home-bots-grid { grid-template-columns: 1fr 1fr; }
  .castling-checks { grid-template-columns: repeat(2, 1fr); }
}
