/* DunceAI – Rabbit Takeaway */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --orange: #FF6B35;
    --blue:   #3D5A80;
    --cream:  #FFF8E7;
    --green:  #4CAF50;
    --red:    #E74C3C;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, var(--cream) 0%, #FFE4C4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow), 0 0 0 4px var(--orange);
    width: 100%;
    max-width: 680px;
    padding: 20px 24px 28px;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.logo { font-size: 1.4rem; font-weight: bold; }
.logo-dunce { color: var(--orange); }
.logo-ai    { color: var(--blue); }
.game-header h1 { color: #2C3E50; font-size: 1.3rem; }
.back-link { color: var(--blue); text-decoration: none; font-size: 0.9rem; font-weight: bold; }
.back-link:hover { text-decoration: underline; }

/* ── Intro ── */
#introScreen {
    text-align: center;
    padding: 20px 10px 10px;
}
.intro-content h2 {
    color: var(--blue);
    font-size: 1.5rem;
    margin: 18px 0 8px;
    line-height: 1.4;
}
.intro-hint { color: #666; font-size: 1rem; margin-bottom: 28px; }
.intro-rabbits {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

/* ── Score bar ── */
.score-bar {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(135deg, #E8F4FD 0%, #D0E8F8 100%);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 1rem;
    color: #2C3E50;
    margin-bottom: 14px;
}
.score-item strong { color: var(--blue); font-size: 1.15rem; }

/* ── Question box ── */
.question-box {
    background: #ffff99;
    border: 2px solid #000;
    border-radius: 10px;
    padding: 10px 20px;
    text-align: center;
    font-size: 1.2rem;
    color: #330000;
    margin-bottom: 16px;
}
.question-box strong { color: #990000; font-size: 1.4rem; }

/* ── Meadow ── */
.meadow-wrapper {
    margin-bottom: 18px;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid #5a9e2f;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.rabbit-count {
    background: rgba(255,255,255,0.55);
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: #1a4a00;
    padding: 6px 12px;
}

.sum-display {
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    color: #1a4a00;
    padding: 4px 12px;
    min-height: 0;
    background: rgba(255,255,255,0.45);
}
.sum-display:empty { display: none; }

.meadow {
    background: linear-gradient(180deg, #a8d96c 0%, #7bc843 60%, #5a9e2f 100%);
    min-height: 130px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-end;
    justify-content: center;
    padding: 10px 12px 4px;
    gap: 6px;
    position: relative;
}
.grass {
    background: #4a8a22;
    height: 14px;
    position: relative;
    overflow: hidden;
}
.grass::before {
    content: '';
    position: absolute;
    top: -8px; left: 0; right: 0;
    height: 16px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px, transparent 10px,
        #4a8a22 10px, #4a8a22 11px,
        transparent 11px, transparent 14px,
        #3d7518 14px, #3d7518 15px
    );
}

/* ── Individual rabbit ── */
.rabbit {
    display: inline-block;
    transform-origin: center bottom;
    transition: transform 0.2s;
    cursor: default;
    flex-shrink: 0;
}
.rabbit.gone {
    visibility: hidden;
}

/* Hop-away animation */
@keyframes hopAway {
    0%   { transform: translate(0,    0px);  opacity: 1; }
    18%  { transform: translate(30px, -24px); opacity: 1; }
    35%  { transform: translate(65px,  0px);  opacity: 1; }
    52%  { transform: translate(100px,-20px); opacity: 0.9; }
    68%  { transform: translate(140px,  0px); opacity: 0.7; }
    82%  { transform: translate(175px,-12px); opacity: 0.4; }
    100% { transform: translate(215px,  0px); opacity: 0; }
}
.rabbit.running {
    animation: hopAway 1.3s ease-in forwards;
    pointer-events: none;
}

/* Gentle idle bounce for remaining rabbits after answer */
@keyframes happyBounce {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-8px); }
}
.rabbit.happy {
    animation: happyBounce 0.5s ease 2;
}

/* ── Answer buttons ── */
.answer-section {
    margin-bottom: 14px;
    text-align: center;
}
.answer-label {
    font-size: 1rem;
    font-weight: bold;
    color: #444;
    margin-bottom: 10px;
}
.answer-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}
.ans-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid var(--blue);
    background: white;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--blue);
    cursor: pointer;
    transition: all 0.15s ease;
}
.ans-btn:hover:not(:disabled) {
    background: var(--blue);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(61,90,128,0.35);
}
.ans-btn:disabled { cursor: not-allowed; }
.ans-btn.correct {
    background: var(--green);
    border-color: #388E3C;
    color: white;
    transform: scale(1.15);
}
.ans-btn.wrong {
    background: var(--red);
    border-color: #C0392B;
    color: white;
}
.ans-btn.reveal {
    background: var(--green);
    border-color: #388E3C;
    color: white;
    transform: scale(1.12);
}

/* ── Feedback row ── */
.feedback-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}
.result-badge {
    font-size: 2.2rem;
    min-width: 48px;
    text-align: center;
    padding-top: 6px;
}
.dunce-panel {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}
.dunce-character { flex-shrink: 0; }
.speech-bubble {
    background: white;
    border: 2px solid var(--orange);
    border-radius: 12px;
    padding: 10px 14px;
    position: relative;
    font-size: 0.95rem;
    color: #2C3E50;
    flex: 1;
    line-height: 1.4;
}
.speech-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 14px;
    border: 6px solid transparent;
    border-right-color: var(--orange);
}
.speech-bubble::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 15px;
    border: 5px solid transparent;
    border-right-color: white;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 12px 28px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}
.btn-start {
    background: linear-gradient(135deg, var(--green), #388E3C);
    color: white;
    box-shadow: 0 4px 0 #2E7D32;
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #2E7D32; }
.btn-next {
    background: linear-gradient(135deg, var(--blue), #2C4A6E);
    color: white;
    box-shadow: 0 4px 0 #1E3A5F;
    display: block;
    width: 100%;
    text-align: center;
}
.btn-next:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #1E3A5F; }

/* ── End screen ── */
#endScreen { text-align: center; padding: 16px 10px 10px; }
.end-content h2 { color: var(--blue); font-size: 1.6rem; margin-bottom: 10px; }
.end-score { font-size: 1.2rem; margin-bottom: 8px; color: #2C3E50; }
.end-score strong { font-size: 1.5rem; color: var(--orange); }
.end-comment { font-size: 1rem; color: #555; margin-bottom: 24px; font-style: italic; line-height: 1.5; }
.end-rabbits {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.btn-back-home {
    background: linear-gradient(135deg, #888, #555);
    color: white;
    box-shadow: 0 4px 0 #333;
    margin-left: 12px;
}
.btn-back-home:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #333; }
