/* assets/styles.css */
:root {
  --cell-size: 32px;
  --gap: 2px;
  --radius: 6px;
  --bg: #f7f7fb;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #6a6f76;
  --brand: #2d6cdf;
  --danger: #d7263d;
  --ok: #0a7d36;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1214;
    --panel: #14181c;
    --ink: #d0d3d8;
    --muted: #8b929a;
    --brand: #6aa3ff;
    --danger: #ff5d73;
    --ok: #38c172;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.app-header,
.app-footer {
  max-width: min(1100px, 96vw);
  margin: 16px auto;
  padding: 8px 12px;
}

.app-header h1 { margin: 0; font-size: 1.6rem; }

.app {
  max-width: min(1100px, 96vw);
  margin: 0 auto 24px;
  display: grid;
  gap: 16px;
}

.controls,
.scores,
.board-wrap {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.controls .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.controls label { font-weight: 600; }
.controls select, .controls input, .controls button {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.15);
  background: transparent;
  color: inherit;
}
.controls button.primary {
  background: var(--brand);
  color: white;
  border-color: transparent;
}
.controls button.secondary {
  background: transparent;
  border-color: rgba(0,0,0,.25);
}

.custom-inputs {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.custom-inputs label {
  font-weight: 400;
}

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

.board-wrap { overflow: auto; }
.board {
  --rows: 9;
  --cols: 9;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell-size));
  grid-template-rows: repeat(var(--rows), var(--cell-size));
  gap: var(--gap);
  place-content: start center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 1px solid rgba(0,0,0,.2);
  border-radius: 4px;
  background: linear-gradient(#e8eaf2, #d8dbe6);
  color: #111;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}
@media (prefers-color-scheme: dark) {
  .cell {
    background: linear-gradient(#1f2328, #121417);
    color: #e0e4ea;
    border-color: rgba(255,255,255,.1);
  }
}

.cell:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.cell.revealed {
  background: #f7f7fb;
  border-color: rgba(0,0,0,.12);
  cursor: default;
}
@media (prefers-color-scheme: dark) {
  .cell.revealed {
    background: #0f1214;
    border-color: rgba(255,255,255,.1);
  }
}

.cell.mine.revealed {
  background: #ffd6dc;
  border-color: var(--danger);
  color: var(--danger);
}

.cell.flagged::after {
  content: "🚩";
  font-size: 18px;
}

.cell.mine::after {
  content: "💣";
  font-size: 18px;
  display: none;
}
.cell.mine.revealed::after { display: block; }

/* Couleurs des nombres */
.cell.n1 { color: #1976d2; }
.cell.n2 { color: #388e3c; }
.cell.n3 { color: #d32f2f; }
.cell.n4 { color: #512da8; }
.cell.n5 { color: #795548; }
.cell.n6 { color: #00897b; }
.cell.n7 { color: #212121; }
.cell.n8 { color: #616161; }

/* Scores */
.scores-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.scores-info { color: var(--muted); margin-bottom: 8px; }

.scores-table table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius);
}
.scores-table th, .scores-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  text-align: left;
  font-size: .95rem;
}
.scores-table th { background: rgba(0,0,0,.04); font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .scores-table th { background: rgba(255,255,255,.05); }
  .cell.revealed { background: #0f1214; }
}

.notice {
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 8px;
}
.notice.ok { border-color: var(--ok); }
.notice.err { border-color: var(--danger); }

.app-footer { color: var(--muted); }
