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

:root {
    --green-1: #2f6b3a;
    --green-2: #4c9a5b;
    --green-light: #e8f5e9;
    --brown: #7a5230;
    --danger: #c0392b;
    --orange: #d98324;
    --blue: #2d7dd2;
    --ok: #2e7d32;
    --text: #26312a;
    --card-radius: 18px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--green-1) 0%, var(--green-2) 60%, #8bc34a 100%);
    min-height: 100vh;
    color: var(--text);
}

.app {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    justify-content: center;
}

.card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    padding: 32px 28px;
    width: 100%;
    max-width: 480px;
}

.card h1 {
    font-size: 1.7em;
    color: var(--green-1);
    margin-bottom: 8px;
    text-align: center;
}

.credit-auteur {
    text-align: center;
    color: #8a9690;
    font-size: 0.95em;
	font-weight: 700;
    font-style: italic;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #5b6b60;
    margin-bottom: 24px;
}

.card-wide {
    max-width: 560px;
}

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

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.1em;
    border: 2px solid #d7e3d8;
    border-radius: 10px;
    margin-bottom: 8px;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--green-2);
}

.hint {
    font-size: 0.85em;
    color: #6b7b70;
    margin-bottom: 20px;
}

.error {
    color: var(--danger);
    margin-top: 10px;
    font-weight: 600;
    min-height: 1.2em;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    font-size: 1.15em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--green-1), var(--green-2));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 8px 20px rgba(47,107,58,0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(47,107,58,0.45);
}

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

.btn-link {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 14px;
    background: none;
    border: none;
    color: var(--green-1);
    font-size: 0.95em;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px;
}

/* --- Config screen --- */
.stats-line {
    text-align: center;
    color: #5b6b60;
    margin-bottom: 26px;
    font-size: 1.05em;
}

.duree-picker {
    margin-bottom: 28px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--green-2);
    height: 30px;
}

.duree-value {
    text-align: center;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--green-1);
    margin-top: 6px;
}

.filtres-section {
    margin: 28px 0;
    padding-top: 20px;
    border-top: 1px solid #e2ece3;
}

.filtres-titre {
    font-weight: 700;
    color: var(--green-1);
    margin-bottom: 14px;
}

.filtres-section label {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 8px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.checkbox-group:last-child {
    margin-bottom: 0;
}

.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--green-light);
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s;
}

.checkbox-pill:has(input:checked) {
    background: var(--green-2);
    color: #fff;
    border-color: var(--green-1);
}

.checkbox-pill input {
    accent-color: var(--green-1);
    cursor: pointer;
}

.filtres-empty {
    font-size: 0.85em;
    color: #8a9690;
    font-style: italic;
}

/* --- Game screen --- */
#screen-game.active {
    display: block;
}

.game-topbar {
    max-width: 560px;
    margin: 0 auto 12px auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.92);
    border-radius: 14px;
    padding: 10px 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    gap: 10px;
    flex-wrap: wrap;
}

.timer {
    font-size: 1.3em;
    font-weight: 800;
    color: var(--green-1);
    font-variant-numeric: tabular-nums;
}

.timer.low {
    color: var(--danger);
}

.counter {
    color: #5b6b60;
    font-size: 0.95em;
}

.btn-end {
    padding: 10px 18px;
    background: #fff;
    border: 2px solid var(--danger);
    color: var(--danger);
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.btn-end:hover {
    background: var(--danger);
    color: #fff;
}

.card-game {
    max-width: 560px;
    padding: 20px;
    margin: 0 auto;
}

.photos-grid {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.photo-item {
    border-radius: 14px;
    overflow: hidden;
    background: var(--green-light);
    cursor: pointer;
    border: 4px solid var(--green-light);
    transition: border-color 0.15s, transform 0.15s;
}

.photo-item:hover {
    border-color: var(--green-2);
}

.photo-item.clicked {
    border-color: var(--green-1);
}

.photo-item img {
    width: 100%;
    height: 260px;
    object-fit: contain;
    object-position: center;
    display: block;
    background: var(--green-light);
}

.tap-hint {
    text-align: center;
    color: #5b6b60;
    font-size: 0.95em;
    margin: 10px 0 0 0;
}

.credit {
    text-align: center;
    font-size: 0.8em;
    color: #8a9690;
    font-style: italic;
    margin: 6px 4px 0 4px;
    min-height: 1.2em;
}

.trouver-info {
    margin-top: 14px;
    padding: 10px 16px;
    background: var(--green-light);
    color: var(--text);
    border-radius: 10px;
    font-size: 0.88em;
    text-align: center;
}

.trouver-info strong {
    color: var(--green-1);
}

.reveal {
    margin-top: 18px;
    text-align: center;
}

.reveal h2 {
    color: var(--green-1);
    font-size: 1.5em;
    font-style: italic;
}

.filtres-aide {
    font-size: 0.82em;
    color: #6b7b70;
    font-style: italic;
    margin: -10px 0 18px 0;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 22px;
}

.rating-btn {
    padding: 14px 6px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform 0.12s;
}

.rating-btn:hover {
    transform: translateY(-3px);
}

.rating-label {
    font-size: 0.85em;
}

.rating-delay {
    font-size: 0.78em;
    opacity: 0.9;
    font-weight: 500;
}

.rating-again { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.rating-hard  { background: linear-gradient(135deg, #d98324, #f0a942); }
.rating-good  { background: linear-gradient(135deg, #2d7dd2, #4fa3f0); }
.rating-easy  { background: linear-gradient(135deg, #2e7d32, #4c9a5b); }

/* --- Summary screen --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 20px 0;
}

.stat-tile {
    background: var(--green-light);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
}

.stat-number {
    font-size: 1.9em;
    font-weight: 800;
    color: var(--green-1);
}

.stat-label {
    font-size: 0.85em;
    color: #5b6b60;
    margin-top: 4px;
}

.repartition {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.rep-badge {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    color: #fff;
}

.section-title {
    color: var(--green-1);
    margin-bottom: 10px;
    font-size: 1.05em;
}

.especes-list {
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #e2ece3;
    border-radius: 10px;
}

.especes-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #eef4ee;
    font-size: 0.92em;
    gap: 8px;
}

.especes-list li:last-child {
    border-bottom: none;
}

.especes-list .esp-nom {
    font-style: italic;
    flex: 1;
}

.especes-list .esp-badge {
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.78em;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.especes-list .esp-delay {
    color: #8a9690;
    font-size: 0.85em;
    white-space: nowrap;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .card { padding: 24px 18px; }
    .photo-item img { height: 220px; }
    .rating-buttons { grid-template-columns: repeat(2, 1fr); }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .game-topbar { justify-content: space-between; }
}

@media (min-width: 700px) {
    .card-game { max-width: 1000px; }
    .photos-grid { flex-direction: row; flex-wrap: wrap; }
    .photo-item { width: 460px; flex: none; }
    .photo-item img { width: 460px; height: 300px; }
}

@media (min-width: 1000px) {
    .card-game { max-width: 1160px; }
    .photo-item { width: 540px; }
    .photo-item img { width: 540px; height: 380px; }
}

/* Si une seule photo est disponible pour l'espèce, on resserre le cadre autour */
@media (min-width: 700px) {
    .card-game:has(.photos-grid > .photo-item:only-child) { max-width: 620px; }
}

@media (min-width: 1000px) {
    .card-game:has(.photos-grid > .photo-item:only-child) { max-width: 700px; }
}
