/* === Variables === */
:root {
    --primary: #0077cc;
    --secondary: #28a745;
    --error: #dc3545;
    --success: #28a745;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
  }
  
  /* === Structure générale === */
  body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f4f8 0%, #d4ecff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
  }
  
  .card {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 650px;
    text-align: center;
    transition: all 0.3s ease;
  }
  
  /* === Titres et texte === */
  h1 {
    color: var(--primary);
    font-size: 1.8em;
    margin-bottom: 10px;
  }
  
  .subtitle {
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: bold;
  }
  
  #important-number,
  #decomposition,
  #message {
    text-align: center;
  }
  
  #important-number {
    font-size: 1.5em;
    margin: 10px 0 20px;
    color: var(--dark);
    font-weight: bold;
  }
  
  #decomposition {
    font-size: 1.8em;
    margin: 25px auto;
  }
  
  #decomposition .reste {
    color: var(--error);
    font-weight: bold;
  }
  
  #decomposition .trouve {
    color: var(--primary);
  }
  
  #message {
    font-size: 1.2em;
    margin-top: 10px;
  }
  
  /* === Nombre === */
  #nombre {
    font-size: 3em;
    color: var(--primary);
    margin: 20px 0;
    font-weight: bold;
    min-height: 60px;
  }
  
  /* === Contrôles === */
  .controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
  }
  
  select,
  input[type="number"] {
    padding: 12px 15px;
    font-size: 1.1em;
    border-radius: 10px;
    border: 2px solid #ddd;
    margin: 5px;
    transition: border 0.3s;
  }
  
  select:focus,
  input[type="number"]:focus {
    border-color: var(--primary);
    outline: none;
  }
  
  /* === Boutons === */
  .btn {
    padding: 12px 25px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
  }
  
  .btn-primary {
    background-color: var(--secondary);
    color: white;
  }
  
  .btn-primary:hover {
    background-color: #218838;
    transform: translateY(-2px);
  }
  
  .btn-secondary {
    background-color: var(--primary);
    color: white;
  }
  
  .btn-secondary:hover {
    background-color: #005fa3;
    transform: translateY(-2px);
  }
  
  .btn-fullscreen {
    background-color: var(--dark);
    color: white;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
  }
  
  /* === Score + Stats === */
  .score-et-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 50px;
    flex: 1;
  }
  
  #score-container {
    text-align: center;
    font-size: 1.4em;
    font-weight: bold;
  }
  
  #score {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--dark);
  }
  
  /* === Stats-container === */
  .stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
  }
  
  .stats {
    display: flex;
    gap: 15px;
  }
  
  .stat-box {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    min-width: 80px;
  }
  
  .stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary);
  }
  
  .stat-label {
    font-size: 0.8em;
    color: #666;
  }
  
  /* === Progression === */
  .progression-serie {
    display: flex;
    margin-left: 40px;
    gap: 5px;
    align-items: center;
  }
  
  .etape-serie {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    transition: all 0.3s;
  }
  
  .etape-serie.active {
    background-color: var(--primary);
    color: white;
    transform: scale(1.1);
  }
  
  .etape-serie.completed {
    background-color: var(--success);
    color: white;
  }
  
  /* === Jokers === */
  .jokers-container {
    order: 4;
    gap: 15px;
    margin-left: auto;
    margin-right: 50px;
  }
  
  .joker {
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
  }
  
  .joker:hover {
    transform: scale(1.2);
  }
  
  .joker.used {
    opacity: 0.3;
    cursor: default;
  }
  
  
  /* === Bulles === */
  .bulles {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }
  
  .bulle {
    background: #e3f2fd;
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: bold;
    border: 2px solid var(--primary);
    color: var(--primary);
    animation: pop 0.3s ease;
  }
  
  @keyframes pop {
    0% {
      transform: scale(0.8);
      opacity: 0;
    }
  
    50% {
      transform: scale(1.1);
    }
  
    100% {
      transform: scale(1);
      opacity: 1;
    }
  }
  
  /* === Messages === */
  .message {
    margin: 15px 0;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    animation: fadeIn 0.5s;
    text-align: center;
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
  }
  
  .error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--error);
    border-left: 4px solid var(--error);
  }
  
  .info {
    background-color: rgba(23, 162, 184, 0.1);
    color: var(--info);
    border-left: 4px solid var(--info);
  }
  
  /* === Décomposition brute (code) === */
  .decomp {
    margin: 10px 0;
    font-size: 1.3em;
    color: var(--dark);
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    text-align: left;
  }
  
  /* === Timer === */
  .timer {
    font-size: 1.2em;
    color: var(--dark);
    margin-bottom: 15px;
    display: none;
  }
  
  /* === Plein écran === */
  body.fullscreen {
    padding: 0;
  }
  
  body.fullscreen .card {
    border-radius: 0;
    min-height: 100vh;
    max-width: 100%;
  }
  
  /* === Responsive === */
  @media (max-width: 600px) {
    .card {
      padding: 20px;
    }
  
    h1 {
      font-size: 1.5em;
    }
  
    #nombre {
      font-size: 2.5em;
    }
  
    .controls {
      flex-direction: column;
      align-items: center;
    }
  
    .btn {
      width: 100%;
    }
  
    .score-et-stats {
      flex-direction: column;
      gap: 15px;
    }
  
    .stats-container {
      flex-direction: column;
      gap: 20px;
    }
  
    .jokers-container {
      margin: auto;
    }
  }

  @keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
    100% { transform: translateX(0); }
  }

  .mode-label {
    font-size: 1.1em;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 10px;
}