/* ============================================================
   Taquin — Styles responsive
   ============================================================ */

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

h1 {
  font-size: 1.6rem;
  background: linear-gradient(90deg, #58a6ff, #bc8cff, #f778ba);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle { font-size: 0.8rem; color: #8b949e; margin-bottom: 16px; }

/* Layout */
.layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 780px;
  width: 100%;
}

.game-area {
  flex-shrink: 0;
}

canvas {
  border: 2px solid #30363d;
  border-radius: 8px;
  display: block;
  touch-action: manipulation;
}

/* Panel */
.panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel h2 { font-size: 0.8rem; color: #8b949e; }

/* Size switch */
.size-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.size-btn {
  padding: 6px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #30363d;
  background: #21262d;
  color: #8b949e;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.size-btn.active { background: #1f6feb; border-color: #58a6ff; color: #fff; }
.size-btn:hover:not(.active) { background: #30363d; color: #c9d1d9; }

/* Mode switch */
.mode-switch { display: flex; gap: 4px; }

.mode-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 1rem;
  border: 1px solid #30363d;
  background: #21262d;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-btn.active { background: #1f6feb; border-color: #58a6ff; }
.mode-btn:hover:not(.active) { background: #30363d; }

/* Status */
#moveCounter { font-size: 1.3rem; font-weight: bold; color: #58a6ff; }
#statusDisplay { font-size: 0.75rem; color: #8b949e; min-height: 1em; }

/* Boutons */
.btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
  width: 100%;
}
.btn:hover { background: #30363d; }
.btn.primary { background: #238636; border-color: #2ea043; color: #fff; }
.btn.primary:hover { background: #2ea043; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 100; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 24px; max-width: 480px; max-height: 85vh; overflow-y: auto; margin: 16px;
}
.modal h2 { color: #58a6ff; margin-bottom: 12px; }
.modal h3 { color: #bc8cff; margin: 14px 0 6px; font-size: 0.9rem; }
.modal p, .modal li { font-size: 0.8rem; line-height: 1.5; color: #8b949e; }
.modal table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.75rem; }
.modal th { text-align: left; color: #c9d1d9; padding: 4px 8px; border-bottom: 1px solid #30363d; }
.modal td { padding: 4px 8px; border-bottom: 1px solid #21262d; color: #8b949e; }
.modal-close { float: right; background: none; border: none; color: #8b949e; font-size: 1.3rem; cursor: pointer; }
.modal-close:hover { color: #f85149; }

/* Responsive */
@media (max-width: 640px) {
  .layout { flex-direction: column; align-items: center; }
  .panel { width: 100%; max-width: 400px; }
}
