html, body {
    margin: 0; padding: 0; width: 100%; height: 100%;
}

body {
    background: linear-gradient(0.45turn, #3f87a6, #ebf8e1, #f69d3c);
    background-attachment: fixed;
    background-size: cover;
    font-family: 'Verdana', sans-serif;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#app { width: 100%; height: 100%; position: relative; }

/* Notification centrale */
.mdiv { position: absolute; top: 6em; left: 0; color: white; font-weight: bold; width: 100%; text-align: center; z-index: 100; text-shadow: 1px 1px 3px black; }

.grey_off { filter: grayscale(100%); opacity: 0.3; pointer-events: none; }
.processing { pointer-events: none; cursor: wait; }

/* Styles Boutons (repris de cdl) */
.bbutton, .pbutton, .rbutton {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; min-width: 160px; padding: 16px 28px; border-radius: 8px;
    font: bold 1.6em verdana; color: #ffffff; text-decoration: none; cursor: pointer;
    border: none;
}
.bbutton { background: linear-gradient(to bottom, #2076ff, #113fd8); border: 1px solid #113fd8; box-shadow: #268eff 0 0 10px; }
.pbutton { background: linear-gradient(to bottom, #ff2ead, #c31c6a); border: 1px solid #c31c6a; box-shadow: #ff2aa0 0 0 10px; }
.rbutton { background: linear-gradient(to bottom, #ff1d02, #cc0f01); border: 1px solid #cc0f01; box-shadow: #ff2302 0 0 10px; }

.last-label { font-size: 0.3em; font-weight: normal; display: block; margin-top: 6px; opacity: 0.85; }

/* --- FLIP CLOCK --- */
.po1-main { width: 100%; text-align: center; }
.flip-clock { font-size: 8vw; display: flex; justify-content: center; gap: 0.2em; font-family: 'Helvetica Neue', Helvetica, sans-serif; }
@media (max-width: 768px) { .flip-clock { font-size: 15vw; } }

.flip-unit {
    position: relative; width: 1.5em; height: 2em; font-size: 1em; font-weight: bold;
    line-height: 2em; border-radius: 0.15em; box-shadow: 0 0.1em 0.3em rgba(0,0,0,0.6);
    background: #333; perspective: 1000px;
}
.flip-top, .flip-bottom, .flip-top-next, .flip-bottom-next {
    position: absolute; left: 0; width: 100%; height: 50%; overflow: hidden; color: #fff;
    text-align: center; backface-visibility: hidden; transform-style: preserve-3d;
}
.flip-top, .flip-top-next {
    top: 0; border-radius: 0.15em 0.15em 0 0; transform-origin: bottom;
    background: linear-gradient(to bottom, #3a3a3a 0%, #222 100%);
}
.flip-top::after, .flip-top-next::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: #000; z-index: 5;
}
.flip-bottom, .flip-bottom-next {
    top: 50%; border-radius: 0 0 0.15em 0.15em; line-height: 0; transform-origin: top;
    background: linear-gradient(to bottom, #222 0%, #3a3a3a 100%);
}
.flip-top { z-index: 2; }
.flip-top-next { z-index: 1; }
.flip-bottom { z-index: 1; }
.flip-bottom-next { z-index: 2; transform: rotateX(90deg); }
.flip-unit.animating .flip-top { animation: turnTop 0.3s ease-in forwards; }
.flip-unit.animating .flip-bottom-next { animation: turnBottom 0.3s ease-out 0.3s forwards; }
@keyframes turnTop { 0% { transform: rotateX(0deg); } 100% { transform: rotateX(-90deg); } }
@keyframes turnBottom { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0deg); } }

/* --- Écrans app --- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4em; }
.hidden { display: none !important; }

.card {
    position: relative;
    background: rgba(255,255,255,0.92); border-radius: 16px; padding: 2em 2.4em;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25); width: min(90vw, 340px); text-align: center;
}
.card h1 { margin: 0 0 0.6em; font-size: 1.3em; color: #222; }

.panel-anchor { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.card input {
    width: 100%; box-sizing: border-box; padding: 0.7em 0.8em; margin-bottom: 0.7em;
    border-radius: 8px; border: 1px solid #ccc; font-size: 1em;
}
.card .actions { display: flex; flex-direction: column; gap: 0.6em; margin-top: 0.4em; }
.card .actions button { font-size: 1em; padding: 0.7em; }
.err { color: #c31c1c; font-size: 0.9em; min-height: 1.2em; }
.hint { color: #555; font-size: 0.8em; margin-top: 0.6em; }

.fp-btn { background: linear-gradient(to bottom, #2fbf71, #1c8a4f); border: 1px solid #1c8a4f; box-shadow: #35d17e 0 0 10px; }

.punch-name { font-size: 1.4em; font-weight: bold; color: #fff; text-shadow: 1px 1px 3px black; margin-bottom: 0.2em; }
.punch-sub { color: #fff; text-shadow: 1px 1px 3px black; font-size: 0.9em; margin-bottom: 1em; }

.top-links { position: absolute; top: 0.8em; left: 1em; z-index: 100; display: flex; gap: 1em; }
.top-links a { color: #fff; text-shadow: 1px 1px 3px black; font-size: 0.85em; text-decoration: none; }
.top-links a:hover { text-decoration: underline; }

.version-badge {
    position: absolute; top: -18px; right: -18px; z-index: 100;
    width: 44px; height: 44px; border-radius: 50%;
    background: #fff; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.version-badge:hover { transform: scale(1.06); }
.version-badge img { width: 26px; height: 26px; }

/* Modale changelog (contenu public/fonctionnel uniquement) */
.changelog-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 200; display: flex; align-items: center; justify-content: center; }
.changelog-modal.hidden { display: none; }
.changelog-panel {
    position: relative; background: #fff; color: #222; border-radius: 12px;
    width: min(92vw, 420px); max-height: 80vh; overflow-y: auto; padding: 1.6em 1.6em 1.2em;
    box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
.changelog-panel h2 { margin: 0 0 0.8em; font-size: 1.1em; }
.changelog-entry { margin-bottom: 1.1em; }
.changelog-entry .cl-version { font-weight: bold; font-size: 0.95em; }
.changelog-entry .cl-date { color: #777; font-size: 0.8em; margin-left: 0.4em; }
.changelog-entry ul { margin: 0.4em 0 0; padding-left: 1.2em; font-size: 0.9em; }
.changelog-entry li { margin-bottom: 0.3em; }
.changelog-close {
    position: absolute; top: 0.6em; right: 0.6em; width: 28px; height: 28px;
    border-radius: 50%; border: 1px solid #ddd; background: #fff; cursor: pointer; font-size: 0.9em;
}
.changelog-close:hover { background: #f2f2f2; }
