/* ===================================
   Zombie Run - Nouveau Style UX
   =================================== */

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

:root {
    --color-bg-dark: #0a0a0a;
    --color-bg-card: #1a1a1a;
    --color-text: #e0e0e0;
    --color-text-dim: #9a9a9a;
    --color-primary: #dc2626;
    --color-secondary: #3b82f6;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg-dark);
    color: var(--color-text);
    min-height: 100vh;
    transition: background var(--transition-speed) ease;
}

body.danger {
    background: linear-gradient(135deg, #3d0814 0%, #1a0a0f 100%);
}

body.safe {
    background: linear-gradient(135deg, #0a2540 0%, #0a0a0a 100%);
}

/* ===================================
   Système d'écrans
   =================================== */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.screen.fade-in {
    animation: fadeIn var(--transition-speed) ease;
}

.screen.fade-out {
    animation: fadeOut var(--transition-speed) ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.screen-content {
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===================================
   Écran d'accueil
   =================================== */

.welcome-container {
    text-align: center;
    max-width: 500px;
}

.welcome-title {
    font-size: 4rem;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(220, 38, 38, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.welcome-subtitle {
    font-size: 1.5rem;
    color: var(--color-text-dim);
    margin-bottom: 40px;
}

.welcome-zombie-animation {
    margin: 40px 0;
}

.zombie-sleeping {
    font-size: 3rem;
    animation: sleep 3s ease-in-out infinite;
}


.version-info {
  text-align: center;
  color: darkgray;
  font-size: 4pt;
  padding: 0;
  position: fixed;
  left: 50%;
  bottom: 0px;
  transform: translate(-50%, -50%);
  margin: 0 auto;
}

@keyframes sleep {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===================================
   Écran de configuration
   =================================== */

.config-container {
    max-width: 500px;
    width: 100%;
    background: var(--color-bg-card);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.config-container h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.config-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.audio-test {
    margin: 0;
}

/* ===================================
   Écran de course
   =================================== */

.running-container {
    max-width: 600px;
    width: 100%;
    padding: 20px 0;
}

.speed-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.speed-box {
    background: var(--color-bg-card);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.speed-box.target {
    border: 2px solid var(--color-secondary);
}

.speed-label {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin-bottom: 10px;
}

.speed-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--color-primary);
}

.speed-box.target .speed-value {
    color: var(--color-secondary);
}

.speed-unit {
    font-size: 1.2rem;
    color: var(--color-text-dim);
}

.zombie-status {
    text-align: center;
    margin: 30px 0;
}

.zombie-distance {
    font-size: 2rem;
    font-weight: bold;
}

.zombie-icon {
    font-size: 2.5rem;
    animation: zombieWalk 1s ease-in-out infinite;
}

@keyframes zombieWalk {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.threat-container {
    margin: 30px 0;
}

.threat-label {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.threat-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
}

.threat-bar {
    height: 100%;
    width: 50%;
    background: var(--color-warning);
    transition: width 0.5s ease, background-color 0.5s ease;
    border-radius: 15px;
}

.running-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* ===================================
   Écran de résultat
   =================================== */

.result-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
    padding: 20px 0;
}

.result-container h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.result-message {
    font-size: 1.3rem;
    color: var(--color-text-dim);
    margin-bottom: 40px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-box {
    background: var(--color-bg-card);
    padding: 30px 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--color-primary);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ===================================
   Écran d'historique
   =================================== */

.history-container {
    max-width: 700px;
    width: 100%;
    padding: 20px 0;
}

.history-container h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.global-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--color-bg-card);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 30px;
}

.history-item {
    background: var(--color-bg-card);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.history-date {
    font-weight: bold;
    margin-bottom: 10px;
}

.history-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--color-text-dim);
}

/* ===================================
   Composants communs
   =================================== */

.control-group {
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--color-text);
}

.value-display {
    color: var(--color-primary);
    font-weight: bold;
    font-size: 1.2rem;
}

.speed-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.speed-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--color-text-dim);
}

.slider-labels span {
    text-align: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.help-text {
    font-size: 0.85rem;
    color: var(--color-text-dim);
    margin-top: 8px;
}

/* Boutons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #2563eb;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.2rem;
}



/* Hint casque */
.headphone-hint {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--color-bg-card);
    color: var(--color-text);
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: transform 0.3s ease;
    font-size: 1.1rem;
}

.headphone-hint.visible {
    transform: translateX(-50%) translateY(0);
}

/* ===================================
   Notification PWA Update
   =================================== */

.pwa-update-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    background: var(--color-bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 2000;
    opacity: 0;
    transform: translateX(450px);
    transition: all 0.3s ease;
}

.pwa-update-banner.show {
    opacity: 1;
    transform: translateX(0);
}

.update-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.update-icon {
    font-size: 2rem;
    text-align: center;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.update-text {
    text-align: center;
}

.update-text strong {
    font-size: 1.1rem;
    color: var(--color-text);
    display: block;
    margin-bottom: 8px;
}

.update-text p {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin: 0;
}

.update-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.btn-update,
.btn-dismiss {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-update {
    background: var(--color-primary);
    color: white;
}

.btn-update:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4);
}

.btn-dismiss {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
}

.btn-dismiss:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Version discrète (petite) */
.pwa-update-banner.compact {
    padding: 15px;
    max-width: 320px;
}

.pwa-update-banner.compact .update-icon {
    font-size: 1.5rem;
}

.pwa-update-banner.compact .update-text strong {
    font-size: 1rem;
}

.pwa-update-banner.compact .update-text p {
    font-size: 0.85rem;
}

.pwa-update-banner.compact .update-actions {
    flex-direction: column;
    gap: 8px;
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
    .welcome-title {
        font-size: 3rem;
    }

    .speed-display {
        grid-template-columns: 1fr;
    }

    /* Écran de configuration mobile */
    .config-container {
        padding: 30px 20px;
    }

    .config-container h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }

    .control-group {
        margin-bottom: 25px;
    }

    /* Écran de course mobile */
    .running-container {
        padding: 10px 0;
    }

    .speed-box {
        padding: 20px;
    }

    .speed-value {
        font-size: 2.5rem;
    }

    .zombie-distance {
        font-size: 1.8rem;
    }

    .zombie-icon {
        font-size: 2rem;
    }

    .threat-label {
        font-size: 1.1rem;
    }

    /* Écran d'historique mobile */
    .history-container {
        padding: 10px 0;
    }

    .history-container h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }

    .global-stats {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 25px;
    }

    .stat-item {
        padding: 15px;
    }

    .history-list {
        max-height: 300px;
    }

    .history-item {
        padding: 15px;
        margin-bottom: 12px;
    }

    /* Réduction densité écran résultats mobile */
    .result-container {
        padding: 10px 0;
    }

    .result-container h2 {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .result-message {
        font-size: 1.1rem;
        margin-bottom: 25px;
    }

    .result-stats {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }

    .stat-box {
        padding: 20px 15px;
    }

    .stat-icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .stat-label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .result-actions {
        gap: 12px;
    }

    .running-controls {
        flex-direction: column;
    }

    /* Notification PWA mobile */
    .pwa-update-banner {
        top: auto;
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
    }

    .pwa-update-banner.compact .update-actions {
        flex-direction: row;
    }
}

@media (max-width: 400px) {
    /* Écran d'accueil compact */
    .welcome-title {
        font-size: 2.5rem;
    }

    .welcome-subtitle {
        font-size: 1.2rem;
    }

    .zombie-sleeping {
        font-size: 2.5rem;
    }

    /* Écran de configuration compact */
    .config-container {
        padding: 25px 15px;
        border-radius: 15px;
    }

    .config-container h2 {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }

    .control-group {
        margin-bottom: 20px;
    }

    .value-display {
        font-size: 1.1rem;
    }

    .config-actions {
        margin-top: 25px;
        gap: 12px;
    }

    /* Écran de course compact */
    .running-container {
        padding: 5px 0;
    }

    .speed-display {
        gap: 15px;
        margin-bottom: 20px;
    }

    .speed-box {
        padding: 15px;
        border-radius: 12px;
    }

    .speed-label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .speed-value {
        font-size: 2rem;
    }

    .speed-unit {
        font-size: 1rem;
    }

    .zombie-status {
        margin: 20px 0;
    }

    .zombie-distance {
        font-size: 1.6rem;
    }

    .zombie-icon {
        font-size: 1.8rem;
    }

    .threat-container {
        margin: 20px 0;
    }

    .threat-label {
        font-size: 1rem;
        margin-bottom: 8px;
    }

    .threat-bar-bg {
        height: 25px;
    }

    .running-controls {
        margin-top: 20px;
        gap: 12px;
    }

    /* Écran d'historique compact */
    .history-container {
        padding: 5px 0;
    }

    .history-container h2 {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }

    .global-stats {
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-item {
        padding: 12px;
        gap: 8px;
    }

    .stat-item .stat-label {
        font-size: 0.85rem;
    }

    .stat-item .stat-value {
        font-size: 1.4rem;
    }

    .history-list {
        max-height: 250px;
        margin-bottom: 20px;
    }

    .history-item {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .history-date {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .history-stats {
        gap: 15px;
        font-size: 0.85rem;
    }

    /* Résultats très compact pour petits écrans */
    .screen-content {
        padding: 15px;
    }

    .result-container {
        padding: 5px 0;
    }

    .result-container h2 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .result-message {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .result-stats {
        gap: 12px;
        margin-bottom: 25px;
    }

    .stat-box {
        padding: 15px 12px;
    }

    .stat-icon {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }

    .stat-label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .result-actions {
        gap: 10px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}
