:root {
    --blue: #00A3E0;
    --green: #73C92D;
    --grey: #91999F;
    --light-grey: #f4f6f8;
    --border-color: #ddd;
    --font-main: 'Trebuchet MS', sans-serif;
}

body {
    font-family: var(--font-main);
    margin: 0;
    background-color: #f9f9f9;
    color: #333;
    line-height: 1.6;
}

/* --- HEADER --- */
header {
    background-color: var(--blue);
    color: white;
    padding: 1rem 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

#admin-btn {
    cursor: pointer;
    font-size: 1.4rem;
    transition: transform 0.3s;
}
#admin-btn:hover {
    transform: rotate(90deg);
}

/* --- MAIN CONTAINER --- */
main {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    min-height: 80vh;
}

/* --- ACCUEIL & FORMULAIRE --- */
.stats-bubble {
    background: var(--green);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: var(--green) transparent;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--blue);
}

input[type="text"], 
input[type="password"], 
input[type="number"], 
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--grey);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
    transition: border 0.3s;
}

input:focus, select:focus {
    border-color: var(--blue);
}

/* Sélection PEGI (Carrés) */
.pegi-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pegi-option {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    border: 4px solid transparent;
    border-radius: 8px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transition: transform 0.2s, border-color 0.2s;
}

.pegi-option:hover {
    transform: translateY(-2px);
}

.pegi-option.selected {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}

/* --- BOUTONS --- */
button {
    cursor: pointer;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.3s, transform 0.2s;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--green);
    color: white;
    width: 100%;
    box-shadow: 0 4px 0 #5cb81c;
}
.btn-primary:hover {
    background-color: #63b023;
}

.btn-secondary {
    background-color: var(--grey);
    color: white;
    width: 100%;
    margin-top: 15px;
    box-shadow: 0 4px 0 #7a8288;
}
.btn-secondary:hover {
    background-color: #7a8288;
}

/* --- ECRAN HISTOIRE --- */
#story-title {
    color: var(--blue);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 20px;
}

.story-content {
    font-size: 1.2rem;
    line-height: 1.7;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.story-content::first-letter {
    font-size: 2em;
    font-weight: bold;
    color: var(--blue);
    float: left;
    margin-right: 8px;
    line-height: 1;
}

#story-image-container img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: block;
}

/* Choix */
.choice-btn {
    display: block;
    width: 100%;
    background: white;
    border: 2px solid var(--blue);
    color: var(--blue);
    margin-bottom: 15px;
    text-align: left;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 1.05rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.choice-btn:hover {
    background: var(--blue);
    color: white;
    transform: translateX(5px);
}

.story-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
    gap: 10px;
}

.story-controls button {
    flex: 1;
    font-size: 0.9rem;
    background: var(--grey);
    color: white;
    box-shadow: none;
    padding: 10px;
}
.story-controls button:first-child {
    background: var(--blue);
}

/* --- LOADING SCREEN (LA LINEA) --- */
#loading-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: white;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.la-linea-container {
    width: 300px;
    text-align: center;
}

.line-path {
    fill: none;
    stroke: var(--blue);
    stroke-width: 4;
    stroke-linecap: round;
}

.character {
    fill: var(--blue);
    animation: bounce 0.6s infinite alternate ease-in-out;
}

@keyframes bounce {
    from { cy: 90; r: 10; }
    to { cy: 75; r: 11; }
}

#loading-screen p {
    margin-top: 20px;
    color: var(--grey);
    font-style: italic;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    50% { opacity: 0.5; }
}

/* --- MODALES --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.hidden {
    display: none !important;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    padding: 25px;
}

.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--grey);
    transition: color 0.3s;
    z-index: 10;
}
.close-modal:hover { color: var(--blue); }

/* --- FILTRE PEGI (DANS MODAL) --- */
.pegi-filter-container {
    display: flex;
    gap: 10px;
    margin: 15px 0 20px 0;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.pegi-filter-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    opacity: 0.5;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.pegi-filter-option:hover {
    opacity: 0.8;
}

.pegi-filter-option.selected {
    opacity: 1;
    transform: scale(1.1);
    border-color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* --- TABLES --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th {
    text-align: left;
    background: var(--light-grey);
    padding: 12px;
    color: #555;
    font-size: 0.9rem;
    border-radius: 6px 6px 0 0;
}
td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }

.pegi-badge {
    padding: 4px 10px;
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
    min-width: 25px;
    text-align: center;
}

/* --- ADMIN PANEL DESIGN --- */
.admin-content {
    padding: 0; /* Reset padding for full header */
}

.admin-header {
    background-color: var(--blue);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
}
.admin-header h3 { margin: 0; font-size: 1.2rem; }

.admin-body {
    padding: 20px;
}

/* Onglets */
.admin-tabs {
    display: flex;
    background: #f0f0f0;
    border-bottom: 2px solid #ddd;
    margin: -20px -20px 20px -20px; /* Stretch to edges */
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: #666;
    border: none;
    border-radius: 0;
    padding: 15px;
    font-weight: bold;
    box-shadow: none;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--blue);
}

.tab-btn.active {
    background: white;
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.setting-row {
    margin-bottom: 20px;
}
.setting-row label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 { font-size: 1.2rem; }
    .story-controls { flex-direction: column; }
    .pegi-option { width: 40px; height: 40px; font-size: 0.9rem; }
}
