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

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.7;
  font-size: 18px;
  color: #222;
  background: #f8f9fa;
  padding: 0 15px;
  overflow-x: hidden; /* Pour éviter tout débordement horizontal */
}

/* ------------------------------
   Général
--------------------------------*/
header, section {
  width: 100%;
  max-width: 1200px; 
  margin: 0 auto 30px auto;
  background: #fff;
  padding: 35px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

header {
  margin-top: 40px;
  text-align: center;
}

h1 {
  font-size: 1.8em;
  margin-bottom: 15px;
  color: #343a40;
}

h2 {
  font-size: 1.9em;
  margin: 5px 0 15px;
  color: #495057;
  text-align: center;
}

h3 {
  font-size: 1.3em;
  margin: 20px 0 10px;
  color: #495057;
}

h4 {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

p, li {
  margin-bottom: 15px;
}

ul {
  margin-left: 20px;
}

a {
  color: rgb(204, 1, 255);
  text-decoration: none;
  font-weight: bold;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: large;
  transition: color 0.3s;
}

a:hover {
  text-decoration: underline;
}

/* ------------------------------
   Boutons
--------------------------------*/
button, input[type="button"] {
  cursor: pointer;
  margin-top: 0.6rem;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background 0.3s, transform 0.2s;
}

input[type="button"] {
  width: 150px;
  height: 25px;
  text-align: center;
  margin: 0 auto;
  padding: 8px 8px 20px 8px;
}

/* Bouton principal / CTA */
a.button, a.cta {
  display: inline-block;
  background: #0056d2;
  color: #fff !important;
  padding: 14px 26px;
  margin-top: 10px;
  font-size: 1.1em;
  border-radius: 10px;
  transition: 0.3s all;
  font-weight: bold;
}

a.button:hover, a.cta:hover {
  background: #003c99;
  transform: translateY(-2px);
}

/* ------------------------------
   Layout et conteneurs
--------------------------------*/
.container {
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

.flex-container {
  display: flex;
  flex-wrap: wrap;
}

.flex-container > div {
  margin: auto;
}

/* Connexion */
.connexion {
  text-align: end;
  margin-top: -3rem;
  font-size: 1.2rem;
}

/* Grille Sudoku */
#grille_tot {
  text-align: center;
}

table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  border: 3px solid black;
  margin: 0 auto;
}

.tbl_niveau{ 
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 20px 20px 0 0;
}

td {
  width: 32px;
  height: 32px;
  text-align: center;
}

#reset {
  text-align: center;
}

/* Niveau couleurs et hover Light Mode */
.td_lv_facile {
  background-color: #D4E3D1;
  padding: 5px;
}

.td_lv_moyen {
  background-color: #E3D9D1;
  padding: 5px;
}

.td_lv_difficile {
  background-color: #E3D1D1;
  padding: 5px;
}

.td_lv_facile_h, .td_lv_moyen_h, .td_lv_difficile_h {
  border: 1px solid black;
  border-radius: 20px 20px 0 0;
}

.td_lv_space {
  width: 30px;
  border: none;
}

/* ------------------------------
   Inputs (number / tel)
--------------------------------*/
input[type="number"],
input[type="tel"] {
  width: 32px;
  height: 32px;
  text-align: center;
  border: none;
  margin: -1px 1px 3px 1px;
  font-size: 18px;
}

.tbl_niveau .td_lv_facile input[type="tel"] {
  background-color: #D4E3D1;
  padding: 5px;
}

.tbl_niveau .td_lv_moyen input[type="tel"] {
  background-color: #E3D9D1;
  padding: 5px;
}

.tbl_niveau .td_lv_difficile input[type="tel"] {
  background-color: #E3D1D1;
  padding: 5px;
}

#tableau input[type="tel"] {
  background-color: white;
}

/* Disable arrows in number inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button,
input[type=tel]::-webkit-inner-spin-button,
input[type=tel]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-apparance: textfield;
}

input[type=tel] {
  -moz-apparance: textfield;
}

/* ------------------------------
   Responsive
--------------------------------*/

@media screen and (min-width: 465px) {
  .tbl_niveau {
    border: none;
    margin: 10px;
  }

  td {
    border: 1px solid black;
    /* width: 32px;
    height: 32px; */
    font-size: 1.1em;
  }
}

@media screen and (max-width: 700px) {
  body {
    font-size: 17px;
    padding: 0 10px;
  }

  h1 {
    font-size: 1.9em;
  }

  h2 {
    font-size: 1.5em;
  }

  header, section {
    padding: 15px;
  }

  a.button, a.cta {
    width: 100%;
    display: block;
    text-align: center;
  }
  td {
    border: 1px solid black;
    width: 44px;
    height: 44px; 
    font-size: 22px;
  }
  input[type="tel"] {
    width: 41px;
    height: 41px;
    font-size: 22px;
  }
}

@media screen and (max-width: 465px) {
  .container {
    margin-left: 3vw;
    margin-right: 3vw;
  }

  .tbl_niveau {
    border: none;
    margin-top: 10px;
  }

  input[type="tel"] {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  td {
    border: 1px solid black;
    width: 31px;
    height: 31px; 
    /* border-width: 1px; */
    font-size: 16px;
  }

  a.button, a.cta {
    width: 100%;
    display: block;
    text-align: center;
  }
}

/* ------------------------------
   Pied de page
--------------------------------*/
footer {
  max-width: 900px;
  margin: 40px auto;
  text-align: center;
  color: #666;
  padding: 20px;
  font-size: 0.9em;
}

/* ------------------------------
   Bouton Dark Mode
--------------------------------*/
#theme-toggle {
  background: #e9ecef;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  margin-top: 15px;
  transition: 0.3s;
}

#theme-toggle:hover {
  background: #d6d8db;
}

/* ------------------------------
   Dark Mode
--------------------------------*/
body.dark {
  background: #121212;
  color: #e4e4e4;
}

body.dark header, 
body.dark section {
  background: #1e1e1e;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

body.dark h1,
body.dark h2,
body.dark h3 {
  color: #ffffff;
}

body.dark a {
  color: #80b6ff;
}

body.dark a.button, 
body.dark a.cta {
  background: #0b63e6;
}

body.dark a.button:hover,
body.dark a.cta:hover {
  background: #084db9;
}

/* Niveau couleurs et hover Dark Mode */
body.dark .td_lv_facile {
  background-color: #2E4F32;
}

body.dark .td_lv_moyen {
  background-color: #5A3F34;
}

body.dark .td_lv_difficile {
  background-color: #5A3333;
}

body.dark .tbl_niveau .td_lv_facile input[type="tel"] {
  background-color: #2E4F32;
}

body.dark .tbl_niveau .td_lv_moyen input[type="tel"] {
  background-color: #5A3F34;
}

body.dark .tbl_niveau .td_lv_difficile input[type="tel"] {
  background-color: #5A3333;
}

body.dark #tableau input[type="tel"] {
  background-color: #1e1e1e;
  color: #f1f1f1;
  /* color: red */
}

body.dark #theme-toggle {
  background: #2a2a2a;
  color: #f1f1f1;
}

body.dark #theme-toggle:hover {
  background: #3a3a3a;
}
