/* ============================================================
   LINTUJEN TUNNISTUS – birdstyle.css
   ============================================================ */

/* --- Google Font import ------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Lato:wght@400;700&display=swap');

/* --- CSS-muuttujat ---------------------------------------- */
:root {
    --gold:        #f5c842;
    --gold-dark:   #c9a01a;
    --green:       #2d6a4f;
    --green-light: #52b788;
    --red:         #c1121f;
    --blue:        #1d6fa4;
    --blue-hover:  #e87722;   /* oranssi hover */
    --purple:      #6a0dad;
    --card-bg:     rgba(10, 25, 15, 0.72);
    --card-border: rgba(245, 200, 66, 0.25);
    --radius:      14px;
    --font-head:   'Playfair Display', Georgia, serif;
    --font-body:   'Lato', sans-serif;
}

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

body {
    background-image: url('sulka.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
    color: white;
    font-family: var(--font-body);
    min-height: 100vh;
}

/* Semi-läpinäkyvä tummennus koko sivulle */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(5, 20, 10, 0.45);
    z-index: 0;
    pointer-events: none;
}

.page-wrapper {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* --- Kielenvalinta ---------------------------------------- */
.lang-switcher {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 4px;
}

.lang-btn {
    background: rgba(20, 50, 30, 0.85);
    border: 2px solid rgba(255,255,255,0.35);
    color: white;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    background: rgba(245,200,66,0.25);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: var(--gold-dark);
    border-color: var(--gold);
    color: #000;
}

/* --- Sivuotsikko ------------------------------------------ */
.site-header {
    text-align: center;
    padding: 28px 0 10px;
}

.site-header h1 {
    font-family: var(--font-head);
    font-size: clamp(2rem, 6vw, 3.2rem);
    color: var(--gold);
    text-shadow: 2px 3px 10px rgba(0,0,0,0.8), 0 0 30px rgba(245,200,66,0.3);
    letter-spacing: 2px;
}

/* --- Kortti-pohja ----------------------------------------- */
.card-container {
    display: flex;
    justify-content: center;
    padding: 12px 0;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    padding: 28px 24px;
    width: 100%;
}

.card-title {
    font-family: var(--font-head);
    font-size: 1.7rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 18px;
    text-shadow: 1px 2px 6px rgba(0,0,0,0.7);
}

/* --- Tervetulokortti -------------------------------------- */
.welcome-card {
    max-width: 480px;
    text-align: center;
}

.welcome-text {
    font-size: 1rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.88);
    margin-bottom: 22px;
}

.input-group-custom {
    margin-bottom: 22px;
}

.input-group-custom label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 7px;
    color: rgba(255,255,255,0.9);
}

.input-group-custom input[type="text"] {
    width: 100%;
    max-width: 280px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.2s;
}

.input-group-custom input[type="text"]::placeholder { color: rgba(255,255,255,0.45); }
.input-group-custom input[type="text"]:focus { border-color: var(--gold); }

/* --- Napit ------------------------------------------------ */
.btn-main,
.btn-secondary {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid var(--purple);
    transition: background-color 0.25s, transform 0.15s, border-color 0.25s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.btn-main {
    background-color: var(--blue);
    color: white;
    margin: 6px;
}

.btn-secondary {
    background-color: var(--green);
    color: white;
    margin: 6px;
}

.btn-main:hover,
.btn-secondary:hover {
    background-color: var(--blue-hover);
    border-color: var(--purple);
    transform: translateY(-2px);
    color: white;
}

/* --- Alaviite --------------------------------------------- */
#alaviite {
    margin-top: 22px;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
}

/* ============================================================
   TILAPALKKI – näkyy koko pelin ajan
   ============================================================ */
.status-bar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: rgba(10, 30, 15, 0.82);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin: 14px 0 4px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.45);
}

.status-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border-right: 1px solid var(--card-border);
}

.status-item:last-child { border-right: none; }

.status-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.55);
    margin-bottom: 3px;
}

.status-value {
    font-family: var(--font-head);
    font-size: 1.05rem;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(245,200,66,0.5);
    line-height: 1;
}

/* Elämät: sydämet animoituvat kun häviää */
#status-lives {
    font-size: 0.95rem;
    letter-spacing: 2px;
    transition: transform 0.2s;
}

#status-lives.heartbeat {
    animation: heartbeat 0.4s ease;
}

@keyframes heartbeat {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.25); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* ============================================================
   LINTUKORTTI
   ============================================================ */
.bird-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.bird-image-wrapper {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.bird-image-wrapper img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 10px;
    display: block;
}

/* --- Vastausvaihtoehdot ------------------------------------ */
.options {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.options button {
    padding: 10px 20px;
    font-size: 0.97rem;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    background-color: var(--blue);
    color: white;
    border: 2px solid var(--purple);
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    transition: background-color 0.25s, transform 0.15s, border-color 0.25s;
}

.options button:hover:not(:disabled) {
    background-color: var(--blue-hover);
    transform: translateY(-2px);
}

/* --- Palaute ----------------------------------------------- */
.result {
    font-weight: 700;
    font-size: 1.05rem;
    min-height: 1.4em;
    text-align: center;
}

#game-error {
    color: #ff6b6b;
    font-weight: bold;
    text-align: center;
}

/* --- Visuaalinen palaute napeille -------------------------- */
.correct-answer-feedback {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    animation: fadeOutCorrect 1.2s forwards;
}

.incorrect-answer-feedback {
    background-color: var(--red) !important;
    border-color: var(--red) !important;
}

.correct-option-reveal {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: black !important;
    animation: pulseYellow 1.2s infinite alternate;
}

@keyframes fadeOutCorrect {
    0%   { opacity: 1; transform: scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0.4; transform: scale(0.95); }
}

@keyframes pulseYellow {
    0%   { transform: scale(1); }
    100% { transform: scale(1.06); }
}

.disabled-button {
    opacity: 0.55;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ============================================================
   LOPPUTULOSKORTTI
   ============================================================ */
.result-card {
    max-width: 480px;
    text-align: center;
}

#score-message {
    font-family: var(--font-head);
    font-size: 1.25rem;
    color: var(--gold);
    text-shadow: 1px 1px 4px rgba(0,0,0,0.7);
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 12px;
}

#incorrect-attempts-message {
    font-size: 1rem;
    color: #ffcc66;
    margin-bottom: 22px;
}

.result-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

/* ============================================================
   INFOKORTTI — näytetään oikean vastauksen jälkeen
   ============================================================ */
.info-card {
    animation: fadeInUp 0.4s ease;
    max-width: 560px;
    margin: 0 auto;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.info-card-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-name {
    font-family: var(--font-head);
    font-size: 1.5rem;
    color: var(--gold);
    text-shadow: 1px 2px 6px rgba(0,0,0,0.7);
    text-align: center;
}

.info-scientific {
    text-align: center;
    font-style: italic;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.5);
    margin-top: -8px;
}

.info-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 12px 16px;
}

.info-row {
    display: flex;
    gap: 10px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.88);
}

.info-label {
    font-weight: 700;
    color: var(--green-light);
    min-width: 100px;
    flex-shrink: 0;
}

.info-fact {
    background: rgba(245,200,66,0.1);
    border-left: 3px solid var(--gold);
    border-radius: 0 6px 6px 0;
    padding: 10px 14px;
    font-size: 0.92rem;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
}

.info-next-btn {
    align-self: center;
    margin-top: 4px;
}

/* ============================================================
   MOBIILI
   ============================================================ */
@media (max-width: 480px) {
    .site-header { padding: 18px 0 8px; }
    .game-card { padding: 18px 14px; }
    .status-value { font-size: 0.95rem; }
    #status-lives { font-size: 0.8rem; letter-spacing: 1px; }
    .options button { padding: 9px 14px; font-size: 0.9rem; }
}
