@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

.navbar {
  background-color: #2c3e50;
  color: white;
  padding: 0.8rem 2rem;
  position: relative; 
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: white;
  z-index: 1001;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 15px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: white;
  padding: 10px 15px;
  border-radius: 4px;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown { position: relative; }

.dropdown-content {
  display: none;
  position: absolute;
  background: white;
  min-width: 180px;
  top: 100%;
  right: 0;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  border-radius: 4px;
  list-style: none;
  padding: 5px 0;
}

.dropdown-content a { 
  color: #333; 
  display: block; 
  padding: 10px 20px;
}

.dropdown-content a:hover { background: #f1f1f1; }

.dropdown:hover .dropdown-content { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  gap: 5px;
  padding: 5px;
  z-index: 1001;
}

.bar {
  width: 25px;
  height: 3px;
  background: white;
  border-radius: 2px;
  transition: 0.3s;
}

@media (max-width: 768px) {
  .nav-toggle { 
    display: flex; 
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #2c3e50;
    padding: 10px 0;
    gap: 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
  }

  .nav-links.active {
    display: flex; 
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 15px 25px;
    border-radius: 0;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .dropdown-content {
    position: static;
    background: #34495e;
    box-shadow: none;
    width: 100%;
    padding-left: 20px;
  }
  
  .dropbtn::after {
    content: " ▼";
    font-size: 0.8rem;
  }
}

.container {
    width: clamp(300px, 95%, 1400px);
    margin-inline: auto;
    padding: 2rem;
}

.all-games {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center; 
}

.game-cell {
    background-color: #f1f1f1;
    padding: 15px 20px;
    font-weight: bold;
    text-align: center;
    width: calc(33.33% - 15px);
    border-radius: 8px;
    transition: transform 0.2s;
}

.game-cell:hover { transform: translateY(-3px); }

.validation {
    text-align: center;
    padding-bottom: 3em;
}

@media (max-width: 900px) {
    .game-cell { width: calc(50% - 15px); } 
}

@media (max-width: 600px) {
    .game-cell { width: 100%; }
}

/* Binary Puzzle */
#tango-grid.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: none;
}

#tango-grid .rules {
    text-align: left;
    margin-bottom: 1rem;
}

#tango-grid .tango-grid {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    margin: 1rem auto;
    border: none;
}

#tango-grid td {
    padding: 0;
    position: relative;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

#tango-grid tr:last-child td {
    border-bottom: none;
}

#tango-grid td:last-child {
    border-right: none;
}

#tango-grid .cell-content {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-sizing: border-box;
    cursor: pointer;
    background-color: #f9f9f9;
    transition: background-color 0.2s ease;
}

#tango-grid .cell-content span {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 4.5vw, 28px);
    font-weight: bold;
    color: #333;
}

#tango-grid .border-right-fois::after,
#tango-grid .border-right-egal::after,
#tango-grid .border-bottom-fois::before,
#tango-grid .border-bottom-egal::before {
    content: "";
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    background-color: #333;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    pointer-events: none;
}

#tango-grid .border-right-fois::after,
#tango-grid .border-right-egal::after {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
}

#tango-grid .border-bottom-fois::before,
#tango-grid .border-bottom-egal::before {
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
}

#tango-grid .border-right-fois::after,
#tango-grid .border-bottom-fois::before {
    content: "×";
    background-color: #e74c3c;
}

#tango-grid .border-right-egal::after,
#tango-grid .border-bottom-egal::before {
    content: "=";
    background-color: #3498db;
}

#tango-grid .cell-locked {
    background-color: #eaeaea;
    cursor: not-allowed;
}

#tango-grid .cell-invalid {
    background-color: #fab1a9;
}

#tango-grid .cell-valid {
    background-color: #b1faa9;
}

#kakuro.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#kakuro .rules {
    text-align: left;
    margin-bottom: 1rem;
}

#kakuro table.kakuro {
    border-collapse: collapse;
    margin: 1rem auto;
    border: 2px solid #000;
}

#kakuro td.cell {
    width: 60px;
    height: 60px;
    border: 1px solid #000;
}

#kakuro td.white {
    background: white;
}

#kakuro td.black {
    background: #222;
    color: white;
    padding: 0;
}

#kakuro .black-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(to top right,
            transparent 48%,
            white 48%,
            white 52%,
            transparent 52%);
}

#kakuro .sum-right {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    line-height: 1;
}

#kakuro .sum-down {
    position: absolute;
    bottom: 4px;
    left: 6px;
    font-size: 14px;
    line-height: 1;
}

#maze.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#maze .rules {
    text-align: left;
    margin-bottom: 1rem;
}

#maze .maze-grid {
    border-collapse: collapse;
    border: none;
    margin: 1rem auto;
    width: 100%;
    table-layout: fixed;
}

#maze .cell {
    padding: 0;
    margin: 0;
    background-color: white;
    box-sizing: border-box;
}

#maze .cell-content {
    width: 100%;
    padding-bottom: 100%;
    height: 0;
}

#maze .masked-cell {
    background-color: white !important;
    border: none !important;
}

#maze .wall-top {
    border-top: 1px solid black;
}

#maze .wall-bottom {
    border-bottom: 1px solid black;
}

#maze .wall-left {
    border-left: 1px solid black;
}

#maze .wall-right {
    border-right: 1px solid black;
}

#maze .start-cell {
    background-color: #aaffaa !important;
}

#maze .end-cell {
    background-color: #ffaaaa !important;
}

#maze .path-cell {
    background-color: #ff0000 !important;
}

#maze .solution-container {
    page-break-before: always;
    text-align: center;
    width: 100%;
}

#cache.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#cache .rules {
    text-align: left;
    margin-bottom: 1rem;
}

#cache .cache-grid {
    margin: 1rem auto;
    border-collapse: collapse;
    border: 2px solid #000;
}

#cache .cell {
    width: 35px;
    height: 35px;
    text-align: center;
    font-size: 22px;
    border: 1px solid #000;
    text-transform: uppercase;
    background-color: #fff;
}

#cache .cell:hover {
    background-color: #ecf0f1;
}

#cache .word-to-find {
    font-weight: bold;
}

#nonogram-grid.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: sans-serif;
    page-break-inside: avoid;
    break-inside: avoid;
    user-select: none;
    -webkit-tap-highlight-color: none;
    -webkit-user-select: none;
}

#nonogram-grid.extreme {
    max-width: 600px;
    font-size: 0.85em;
}

#nonogram-grid .nonogram-grid {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    margin: 1rem auto;
}

#nonogram-grid td {
    padding: 0;
    border: 1px solid #333;
}

#nonogram-grid .cell {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

#nonogram-grid .cell.colored {
    background-color: #000;
}

#nonogram-grid .cell .content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 4vw, 26px);
    font-weight: bold;
}

#nonogram-grid .clue {
    background-color: #f8f8f8;
    font-size: clamp(12px, 2.5vw, 18px);
    border: 1px solid #333;
}

#nonogram-grid .col-clue {
    vertical-align: bottom;
    text-align: center;
    padding-bottom: 4px;
}

#nonogram-grid .row-clue {
    vertical-align: middle;
    text-align: right;
    padding-right: 8px;
    white-space: nowrap;
}

#nonogram-grid .row-clue .clue-number {
    margin-left: 6px;
}

#nonogram-grid .empty-corner {
    border: none;
    background-color: transparent;
}

#queens.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#queens .rules {
    text-align: left;
    margin-bottom: 1rem;
}

#queens .queens-grid {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    margin: 1rem auto;
    border: 2px solid #000;
}

#queens td {
    padding: 0;
    border: 1px solid #000;
    position: relative;
}

#queens .cell-content {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    box-sizing: border-box;
}

#queens .cell-content span {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 4.5vw, 28px);
    font-weight: 800;
    color: #000000;
    line-height: 1;
}

#queens .r0 {
    background: #f54d4c;
}

#queens .r1 {
    background: #fdd2a7;
}

#queens .r2 {
    background: #fdc745;
}

#queens .r3 {
    background: #90f88e;
}

#queens .r4 {
    background: #41b1ff;
}

#queens .r5 {
    background: #9c9dfc;
}

#queens .r6 {
    background: #fe9cff;
}

#queens .r7 {
    background: #fda6a6;
}

#queens .r8 {
    background: #b7f0ff;
}

#queens .r9 {
    background: #c9ffc1;
}

#queens .r10 {
    background: #ffd700;
}

#queens .r11 {
    background: #ff6b6b;
}

#queens .r12 {
    background: #4ecdc4;
}

#sudoku.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#sudoku .rules {
    text-align: left;
    margin-bottom: 1rem;
}

#sudoku .sudoku-grid {
    margin: 1rem auto;
    border-collapse: collapse;
    border: 2px solid #000;
}

#sudoku .cell {
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 20px;
    color: #000;
    border: 1px solid #000;
    cursor: default;
}

#sudoku .border-right {
    border-right: 3px solid #000;
}

#sudoku .border-bottom {
    border-bottom: 3px solid #000;
}

#sudoku .empty {
    color: transparent;
}

#mots_croises {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

#mots_croises .grille {
    margin: 0 0 30px 0;
    display: flex;
    justify-content: center;
}

#mots_croises table {
    width: 50vw;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    border-collapse: collapse;
    border: 2px solid #222222;
    table-layout: fixed;
}

#mots_croises td {
    border: 2px solid #222222;
    padding: 0;
    vertical-align: middle;
    text-align: center;
    font-size: 2vw;
    font-family: sans-serif;
    text-transform: uppercase;
    position: relative;
}

#mots_croises .pleine {
    background: #222222;
}

#mots_croises .lettre,
#mots_croises .vide {
    background: #fff;
}

#mots_croises .container-defs {
    display: flex;
    width: 48vw;
    max-width: 600px;
    margin: 0 auto;
    justify-content: start;
    gap: 10vw;
    background: #e2e2e2;
    text-align: start;
    padding: 2vw;
}

#mots_croises .type-definition {
    display: flex;
    flex-direction: column;
    font-size: 1.3vw;
    font-weight: bold;
}

#mots_croises .definitions {
    margin: 10px 0 0 0;
    padding: 0 0 0 30px;
    font-size: 1.1vw;
    font-weight: normal;
}

#mots_croises .indice {
    position: absolute;
    font-size: 1vw;
    font-weight: semi-bold;
    left: 0.18vw;
    top: 0;
}