/* Creature Rules - Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green: #7ED957;
    --green-dark: #5FB840;
    --blue: #4ECDC4;
    --purple: #A66DD4;
    --orange: #FF9F43;
    --red: #FF6B6B;
    --yellow: #FFD93D;
    --pink: #FF6B9D;
    --bg: #1a1a3e;
    --bg-light: #2a2a5e;
    --text: #fff;
    --text-muted: #b0b0d0;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

h1, h2, h3 {
    font-family: 'Fredoka', sans-serif;
}

/* Screen system */
.screen {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* TITLE SCREEN */
.title-container {
    text-align: center;
    max-width: 500px;
}

.game-title {
    font-size: 3.5rem;
    color: var(--green);
    text-shadow: 3px 3px 0 rgba(0,0,0,0.3);
    margin-bottom: 8px;
    animation: bounceIn 0.6s ease-out;
}

.game-subtitle {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.title-creatures {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.title-creature {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 50%;
    background: var(--bg-light);
    padding: 8px;
    animation: float 3s ease-in-out infinite;
}

.title-creature.tc-2 { animation-delay: 0.5s; }
.title-creature.tc-3 { animation-delay: 1s; }

/* Buttons */
.btn-primary {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    background: var(--green);
    border: none;
    border-radius: 50px;
    padding: 16px 60px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 0 var(--green-dark), 0 6px 20px rgba(0,0,0,0.3);
    display: block;
    margin: 0 auto 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--green-dark), 0 8px 25px rgba(0,0,0,0.3);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--green-dark), 0 3px 10px rgba(0,0,0,0.3);
}

.btn-secondary {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-light);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    padding: 10px 30px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.1);
}

.btn-back {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    margin-top: 10px;
    transition: color 0.15s;
}

.btn-back:hover {
    color: var(--text);
}

.btn-icon {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: var(--text);
    background: var(--bg-light);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* LEVEL SELECT */
.levels-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.levels-container h2 {
    font-size: 2rem;
    color: var(--yellow);
    margin-bottom: 25px;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.level-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: white;
    background: var(--purple);
    border: none;
    border-radius: 16px;
    aspect-ratio: 1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 3px 0 rgba(0,0,0,0.2);
    position: relative;
}

.level-btn:hover:not(.locked) {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.2);
}

.level-btn.locked {
    background: #3a3a5a;
    color: #666;
    cursor: not-allowed;
}

.level-btn .level-stars {
    font-size: 0.65rem;
    letter-spacing: 1px;
}

/* GAME SCREEN */
.game-container {
    max-width: 600px;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 700px;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.level-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.score-display {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    color: var(--yellow);
}

/* Rule banner */
.rule-banner {
    background: linear-gradient(135deg, var(--bg-light), #33336a);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 16px 24px;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 16px;
}

.kw-if {
    color: var(--orange);
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.3em;
}

.kw-then {
    color: var(--green);
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 1.3em;
}

.kw-op {
    color: var(--pink);
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
}

.kw-attr {
    color: var(--yellow);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 4px;
}

/* Creature stage */
.creature-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 200px;
}

.creature-wrapper {
    text-align: center;
    animation: creatureEnter 0.4s ease-out;
}

.creature-img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border-radius: 30px;
    background: var(--bg-light);
    padding: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.creature-label {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Feedback overlay */
.feedback-overlay {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    gap: 8px;
    z-index: 10;
}

.feedback-overlay.show {
    display: flex;
    animation: feedbackPop 0.3s ease-out;
}

.feedback-overlay.correct {
    background: rgba(126, 217, 87, 0.15);
}

.feedback-overlay.wrong {
    background: rgba(255, 107, 107, 0.15);
}

.feedback-icon {
    font-size: 3rem;
}

.feedback-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
}

.feedback-overlay.correct .feedback-text { color: var(--green); }
.feedback-overlay.wrong .feedback-text { color: var(--red); }

/* Progress dots */
.progress-bar {
    margin: 12px 0;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.progress-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid rgba(255,255,255,0.2);
    transition: background 0.3s, border-color 0.3s;
}

.progress-dot.correct {
    background: var(--green);
    border-color: var(--green);
}

.progress-dot.wrong {
    background: var(--red);
    border-color: var(--red);
}

.progress-dot.current {
    border-color: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
}

/* Answer buttons */
.answer-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 10px 0;
}

.btn-answer {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 18px 40px;
    cursor: pointer;
    flex: 1;
    max-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-yes {
    background: var(--green);
    box-shadow: 0 4px 0 var(--green-dark), 0 6px 20px rgba(0,0,0,0.2);
}

.btn-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--green-dark), 0 8px 25px rgba(0,0,0,0.3);
}

.btn-no {
    background: var(--red);
    box-shadow: 0 4px 0 #E84D4D, 0 6px 20px rgba(0,0,0,0.2);
}

.btn-no:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #E84D4D, 0 8px 25px rgba(0,0,0,0.3);
}

.btn-answer:active {
    transform: translateY(2px);
}

.btn-answer:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-answer-icon {
    font-size: 1.2rem;
}

/* LEVEL COMPLETE */
.complete-container, .done-container {
    text-align: center;
    max-width: 450px;
}

.complete-title, .done-title {
    font-size: 2.5rem;
    color: var(--yellow);
    margin-bottom: 15px;
    animation: bounceIn 0.5s ease-out;
}

.done-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.stars-display {
    font-size: 3.5rem;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.star {
    display: inline-block;
    transition: transform 0.3s;
}

.star.earned {
    animation: starPop 0.4s ease-out backwards;
    color: var(--yellow);
    text-shadow: 0 0 20px rgba(255, 217, 61, 0.5);
}

.star.empty {
    opacity: 0.25;
}

.star:nth-child(2) { animation-delay: 0.15s; }
.star:nth-child(3) { animation-delay: 0.3s; }

.complete-score {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 25px;
}

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

.done-creatures {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.total-stars {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.3rem;
    color: var(--yellow);
    margin-bottom: 25px;
}

/* Animations */
@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes creatureEnter {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.1) rotate(3deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes feedbackPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes starPop {
    0% { transform: scale(0) rotate(-30deg); }
    60% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes slideOut {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-100px); opacity: 0; }
}

/* Responsive */
@media (max-width: 500px) {
    .game-title { font-size: 2.5rem; }
    .title-creature { width: 75px; height: 75px; }
    .creature-img { width: 140px; height: 140px; }
    .rule-banner { font-size: 1rem; padding: 12px 16px; }
    .btn-answer { font-size: 1.2rem; padding: 14px 24px; }
    .levels-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
    .level-btn { font-size: 1.1rem; border-radius: 12px; }
    .stars-display { font-size: 2.5rem; }
}

@media (max-height: 650px) {
    .creature-img { width: 130px; height: 130px; }
    .rule-banner { padding: 10px 16px; font-size: 0.95rem; margin-bottom: 8px; }
    .btn-answer { padding: 12px 20px; font-size: 1.1rem; }
    .title-creatures { margin-bottom: 15px; }
}
