/* Reset simple */
body, html {
    margin: 0; padding: 0; height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f0f0;
    display: flex; 
    flex-direction: column;
    width: 100vw;
  }
  header {
    background: #004d40;
    color: white;
    padding: 0px 16px;
    font-size: 1.3em;
    text-align: center;
    font-weight: bold;
    user-select: none;
  }
  main {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  button {
    background: #00796b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
  }
  button:disabled {
    background: #999;
    cursor: not-allowed;
  }
  button:hover:not(:disabled) {
    background: #004d40;
  }
  #mapPret, #mapPretReady, #mapNav {
    height: 341px;
    border-radius: 12px;
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
  }
  label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
  }
  input[type="file"] {
    display: none;
  }
  .file-upload-label {
    background: #009688;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-block;
    user-select: none;
  }
  .switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
  }
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 12px;
  }
  .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
  }
  input:checked + .slider {
    background-color: #00796b;
  }
  input:checked + .slider:before {
    transform: translateX(24px);
  }
  .section {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 0 6px rgba(0,0,0,0.1);
  }
  .centered-text {
    text-align: center;
    color: #777;
  }
  #navStepInfo {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
  }
  .switch-container {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .btn-row {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
  .app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333;
    color: white;
    padding: 2px 16px;
  }
  
  .app-header h1 {
    font-size: 1.2em;
    margin: 0;
  }
  
  .setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
  }
  
  .setting-item label {
    flex: 1;
    margin: 0;
    font-weight: bold;
  }
  
  .setting-item input,
  .setting-item select {
    flex: 1;
    max-width: 200px;
  }

  .settings-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 6px 0px;
  }
  
  .settings-button svg {
    fill: white;
    transition: transform 0.2s ease;
  }
  
  .settings-button:hover svg {
    transform: rotate(20deg);
  }

  #gps {
    font-size: 25pt;
    display: block;
    line-height: 50px;
  }

  #gps .nav-icon {
    width: 50px;
    height: 50px;
    vertical-align: middle;
  }

  #gps .nav-text {
    font-weight: bold;
    font-size: 25pt;
    line-height: 50px;
  }

  #gps svg {
    vertical-align: middle;
  }

  .gauge-container {
    position: relative;
    gap: 10px;
    z-index: 9999;
    float: right;
  }

  .gauge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 6px solid #444;
    background: #111;
    color: #0f0;
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 15px rgba(0,0,0,0.7);
  }

  .gauge-label {
    position: absolute;
    bottom: -22px;
    font-size: 14px;
    color: #111;
  }

  #stopUpdatePosBtn {
    --stop-duration: 5s; /* durée par défaut */
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 1000;
  }

  /* pause symbol */
  .pause {
    position: relative;
    width: 20px;
    height: 30px;
  }
  .pause::before,
  .pause::after {
    content: "";
    position: absolute;
    top: 0;
    width: 6px;
    height: 100%;
    background: white;
    border-radius: 2px;
  }
  .pause::before {
    left: 0;
  }
  .pause::after {
    right: 0;
  }
  
  .progress-ring {
    position: absolute;
    top: -5px;
    left: -5px;
    transform: rotate(-90deg); /* démarrage en haut */
  }

  .progress-ring__circle {
    stroke-dasharray: 214; /* périmètre = 2πr ≈ 2*3.14*34 */
    stroke-dashoffset: 214;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--stop-duration) linear, stroke var(--stop-duration) linear;
  }

  #stopNavBtn {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: black;
    border: 3px solid red;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 1000;
  }

  /* symbole carré STOP */
  .stop-symbol {
    display: block;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 4px;
  }

  #mapPretInfo {
    position: absolute;
    top: 84px;
    right: 30px;
  }

  .progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    position: relative;
    overflow: hidden;
  }
  .progress-bar::after {
    content: "";
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff3a3a, #ffb43a);
    transition: width var(--outtrack--timer, 5s) linear;
    will-change: width;
    /* Durée par défaut, sera écrasée dynamiquement */
    transition-duration: var(--outtrack--timer, 5s);
  }
  .progress-bar.animating::after {
    width: 0%;
  }

  .progress-bar::after {
    content: "";
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff3a3a, #ffb43a);
    transition: width var(--outtrack--timer, 5s) linear;
    will-change: width;
    /* Durée par défaut, sera écrasée dynamiquement */
    transition-duration: var(--outtrack--timer, 5s);
  }  

  .progress-bar.animating-raz::after {
    width: 100%;
  }

  .moto-progress-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: black;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    cursor: pointer;
  }

  .moto-progress-button svg {
    width: 100%;
    height: 100%;
  }

  /* Cercle de fond (vert clair fixe) */
  .progress-bg {
    stroke: #0f0;
    opacity: 0.3;
  }

  /* Cercle animé (rouge -> vert) */
  .progress-circle {
    stroke: url(#grad);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s linear;
  }

  /* Icône moto au centre */
  .moto-icon {
    position: absolute;
    width: 32px;
    height: 32px;
    color: #0f0;
  }
  .moto-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .info {
    display: flex;
    align-items: center;
    gap: 5px; /* Espace entre le carré et la légende */
  }

  .info .square {
      width: 16px;
      height: 32px;
      background-color: transparent; /* Carré bleu */
      border-radius: 5px; /* Coins arrondis */
  }

  .info .label {
      font-size: 13px;
      font-weight:bold;
      color: #333;
  }

  /* Responsive */
  @media (min-width: 600px) {
    main {
      max-width: 600px;
      margin: 0 auto;
    }
  }
  