/* style.css — Checkers game styles */
:root {
  --bg: #111118;
  --surface: #1a1a24;
  --surface2: #22222e;
  --text: #e8e8f0;
  --text2: #9999aa;
  --accent: #ffd700;
  --accent2: #b8922a;
  --red: #e74c3c;
  --green: #4caf50;
  --border: #2a2a3a;
  --shadow: rgba(0,0,0,0.4);
  --radius: 12px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f0f0f5; --surface: #ffffff; --surface2: #f5f5fa;
    --text: #222233; --text2: #666677;
    --accent: #b8922a; --accent2: #d4a53a;
    --border: #d0d0dd; --shadow: rgba(0,0,0,0.12);
    color-scheme: light;
  }
}

html[data-theme="dark"] {
  --bg: #111118; --surface: #1a1a24; --surface2: #22222e;
  --text: #e8e8f0; --text2: #9999aa; --accent: #ffd700; --accent2: #b8922a;
  --border: #2a2a3a; --shadow: rgba(0,0,0,0.4); color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f0f0f5; --surface: #ffffff; --surface2: #f5f5fa;
  --text: #222233; --text2: #666677; --accent: #b8922a; --accent2: #d4a53a;
  --border: #d0d0dd; --shadow: rgba(0,0,0,0.12); color-scheme: light;
}

* { margin:0; padding:0; box-sizing:border-box; }
html,body { margin:0; padding:0; height:100%; height:100dvh; overflow:hidden; }
body {
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
  background:var(--bg); color:var(--text); height:100%;
  overflow:hidden; touch-action:manipulation;
}
#app { height:100%; display:flex; flex-direction:column; }

/* TOPBAR */
.topbar {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 16px; background:var(--surface);
  border-bottom:2px solid var(--border); min-height:48px; flex-shrink:0; z-index:10;
}
.topbar-logo { font-weight:700; font-size:16px; color:var(--accent); letter-spacing:0.5px; }
.topbar-center { text-align:center; flex:1; }
.game-status { font-size:14px; font-weight:600; color:var(--text); transition:color 0.3s; }
.game-status.win { color:var(--accent); }
.game-status.loss { color:var(--red); }
.icon-btn {
  background:none; border:none; font-size:22px; color:var(--text2);
  cursor:pointer; padding:6px; transition:all 0.2s;
}
.icon-btn:hover, .icon-btn:active { color:var(--text); transform:scale(1.1); }

/* LAYOUT */
.layout { display:flex; flex:1; min-height:0; overflow:hidden; }
.sidebar-left, .sidebar-right {
  flex:0 0 150px; padding:12px; display:flex; flex-direction:column; gap:12px; overflow-y:auto;
}
.main-area {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:12px; min-width:0; gap:4px;
}
.panel {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px;
}
.panel-title {
  font-size:12px; font-weight:700; text-transform:uppercase;
  letter-spacing:1px; color:var(--text2); margin-bottom:10px;
}

/* SCORE / SIDE PANELS */
.score-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 0; font-size:14px;
}
.score-label { font-weight:500; }
.score-val {
  background:var(--surface2); width:32px; height:32px;
  display:flex; align-items:center; justify-content:center;
  border-radius:8px; font-weight:700; font-size:16px;
}
.captured-section { margin-top:10px; padding-top:10px; border-top:1px solid var(--border); }
.captured-line { display:flex; justify-content:space-between; align-items:center; font-size:11px; padding:3px 0; }
.cap-label { color:var(--text2); }
.cap-dots { color:var(--red); letter-spacing:1px; }

.last-move { font-size:13px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.lm-color { font-weight:700; padding:2px 6px; border-radius:4px; font-size:11px; }
.lm-color.red { background:rgba(231,76,60,0.2); color:#e74c3c; }
.lm-color.black { background:rgba(80,80,100,0.3); color:var(--text2); }
.lm-sq { font-family:monospace; font-size:13px; }
.lm-extra { color:var(--accent); font-size:12px; }
.empty-hint { font-size:12px; color:var(--text2); font-style:italic; }
.move-num { font-size:22px; font-weight:700; color:var(--accent); }

/* BOARD */
.board-area {
  position:relative;
  width:min(56vmax,56vw,520px); height:min(56vmax,56vw,520px);
  max-width:520px; max-height:520px;
}
#game-canvas {
  width:100%; height:100%; border-radius:var(--radius);
  box-shadow:0 4px 24px var(--shadow); touch-action:none;
  cursor:pointer; background:#333; display:block;
  user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;
}
.board-overlay { position:absolute; inset:0; border-radius:var(--radius); pointer-events:none; }

/* ACTION BAR */
.action-bar { display:flex; gap:8px; padding:8px; flex-wrap:wrap; justify-content:center; }
.action-btn {
  background:var(--surface); border:1px solid var(--border); color:var(--text);
  padding:8px 16px; border-radius:8px; font-size:13px; font-weight:500;
  cursor:pointer; transition:all 0.2s;
}
.action-btn:hover, .action-btn:active {
  background:var(--surface2); border-color:var(--accent); color:var(--accent);
  transform:translateY(-1px); box-shadow:0 2px 8px var(--shadow);
}

/* MODAL */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:100;
  display:flex; align-items:center; justify-content:center; padding:20px;
  backdrop-filter:blur(4px);
}
.modal-overlay.hidden { display:none; }
.modal {
  background:var(--surface); border:1px solid var(--border); border-radius:16px;
  padding:24px; max-width:380px; width:100%; max-height:85vh; overflow-y:auto;
  box-shadow:0 12px 48px var(--shadow); animation:fadeIn 0.2s ease-out;
}
.settings-grid { display:flex; flex-direction:column; gap:16px; }
.setting-group { display:flex; flex-direction:column; gap:8px; }
.setting-label {
  font-size:12px; font-weight:700; text-transform:uppercase;
  letter-spacing:0.5px; color:var(--text2);
}
.mode-tabs { display:flex; gap:6px; flex-wrap:wrap; }
.mode-tab {
  flex:1; min-width:0; background:var(--surface2); border:1px solid var(--border);
  color:var(--text); padding:8px 6px; border-radius:8px; font-size:12px;
  font-weight:500; cursor:pointer; transition:all 0.2s; text-align:center;
  white-space:normal; line-height:1.2;
}
.mode-tab.active { background:var(--accent); color:#111; border-color:var(--accent); font-weight:700; }
.mode-tab:hover:not(.active) { border-color:var(--accent2); }

.opp-list { display:flex; flex-direction:column; gap:6px; }
.opp-btn {
  display:flex; align-items:center; gap:10px; background:var(--surface2);
  border:1px solid var(--border); color:var(--text); padding:10px; border-radius:10px;
  font-size:13px; cursor:pointer; transition:all 0.2s; text-align:left;
}
.opp-btn.active { border-color:var(--accent); background:rgba(255,215,0,0.1); }
.opp-btn:hover { border-color:var(--accent2); }
.opp-name { font-weight:600; min-width:100px; }
.opp-desc { font-size:11px; color:var(--text2); flex:1; }
.opp-level { font-size:11px; color:var(--accent); letter-spacing:1px; }

.theme-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.theme-btn {
  aspect-ratio:1; border:2px solid var(--border); border-radius:10px;
  color:white; font-size:10px; font-weight:600; cursor:pointer; transition:all 0.2s;
  display:flex; align-items:center; justify-content:center; text-align:center;
  text-shadow:0 1px 3px rgba(0,0,0,0.6); padding:4px; line-height:1.2;
}
.theme-btn.active { border-color:var(--accent); outline:2px solid var(--accent); outline-offset:2px; }
.theme-btn:hover:not(.active) { border-color:var(--accent2); transform:translateY(-2px); }

.toggle-row { display:flex; align-items:center; justify-content:space-between; font-size:13px; color:var(--text); }
.toggle-btn {
  background:var(--surface2); border:1px solid var(--border); color:var(--text2);
  padding:6px 14px; border-radius:6px; font-size:12px; font-weight:600;
  cursor:pointer; transition:all 0.2s;
}
.toggle-btn.on { background:var(--green); color:white; border-color:var(--green); }
.toggle-btn:hover { transform:scale(1.05); }

.modal-actions { display:flex; gap:8px; padding-top:12px; border-top:1px solid var(--border); }
.btn-primary {
  flex:1; background:var(--accent); color:#111; border:none; padding:10px;
  border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; transition:all 0.2s;
}
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 3px 12px rgba(255,215,0,0.3); }
.btn-secondary {
  flex:1; background:var(--surface2); color:var(--text); border:1px solid var(--border);
  padding:10px; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; transition:all 0.2s;
}
.btn-secondary:hover { background:var(--border); }

/* RESPONSIVE */
@media (max-width:640px) {
  .sidebar-left, .sidebar-right { display:none; }
  .board-area { width:min(88vw,88vmin,400px); height:min(88vw,88vmin,400px); }
  .modal { max-width:92vw; padding:18px; }
  .theme-grid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:380px) {
  .board-area { width:92vw; height:92vw; }
  .action-btn { padding:6px 10px; font-size:12px; }
}

@keyframes fadeIn { from{opacity:0;transform:scale(0.95)} to{opacity:1;transform:scale(1)} }

.modal::-webkit-scrollbar, .sidebar-left::-webkit-scrollbar, .sidebar-right::-webkit-scrollbar { width:4px; }
.modal::-webkit-scrollbar-thumb, .sidebar-left::-webkit-scrollbar-thumb, .sidebar-right::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
button:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
