:root {
    --primary: #A2D2FF;
    /* Soft Blue */
    --secondary: #C3B1E1;
    /* Pastel Purple */
    --accent: #FDE2E4;
    /* Light Pink */
    --text: #5D5D5D;
    --background: linear-gradient(135deg, #FFD1DC 0%, #C1E1C1 100%);
    /* Pink to Green gradient */
    --white-trans: rgba(255, 255, 255, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.6);
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Quicksand', sans-serif;

    /* Peg Colors - distinct palette */
    --color-1: #FF6B6B;
    /* Vibrant Red */
    --color-2: #4ECDC4;
    /* Teal */
    --color-3: #FFE66D;
    /* Yellow */
    --color-4: #1A535C;
    /* Dark Cyan */
    --color-5: #FF9F1C;
    /* Orange */
    --color-6: #9B5DE5;
    /* Purple */
}

/* Reset & Basics */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background: var(--background);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* App Container */
#app {
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Screens */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 20px;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Top Nav */
/* Top Nav */
.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 20px;
    z-index: 20;
    pointer-events: none;
    gap: 20px;
    /* Add space between elements */
}

.top-nav>* {
    pointer-events: auto;
}

.home-link {
    /* Removed absolute positioning */
    display: flex;
    align-items: center;
}

.home-logo {
    height: 50px;
    transition: transform 0.2s;
}

.home-logo:hover {
    transform: scale(1.1) rotate(-5deg);
}

.nav-controls {
    /* Removed absolute positioning */
    display: flex;
    gap: 10px;
}

button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-heading);
}

.lang-btn,
.sound-toggle-mini {
    background: var(--white-trans);
    border-radius: 12px;
    padding: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.lang-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.lang-btn.active {
    border: 2px solid var(--primary);
    transform: scale(1.1);
}

/* Menu Screen */
#menu-screen {
    justify-content: center;
    background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2) 2px, transparent 2px);
    background-size: 30px 30px;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
    background: var(--glass-bg);
    padding: 30px 50px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    border: 3px solid var(--glass-border);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.logo-emoji {
    font-size: 5rem;
    animation: float 3s ease-in-out infinite;
}

#main-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 0 var(--primary);
    margin-top: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: white;
    font-weight: 700;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
}

.menu-btn {
    padding: 15px 20px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    transition: all 0.2s;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.secondary-btn {
    background: var(--white-trans);
    color: var(--text);
}

.menu-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.btn-sub {
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.9;
}

/* Rules Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 25px;
    max-width: 90%;
    width: 400px;
    text-align: center;
    position: relative;
    border: 5px solid var(--secondary);
}

.rules-text {
    text-align: left;
    margin: 20px 0;
    font-size: 1rem;
    line-height: 1.5;
}

.rule-example {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-weight: bold;
}

.close-btn {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    top: -15px;
    right: -15px;
}

#kofi-container {
    margin-bottom: 20px;
    /* Space between Ko-fi and menu buttons */
}

/* Game Screen */
#game-screen {
    padding-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Ensure vertical stack is centered */
    justify-content: space-between;
}

.game-header {
    width: 100%;
    max-width: 400px;
    /* Reduced width to bring elements closer */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 10px;
}

.mini-btn {
    background: var(--white-trans);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1.2rem;
}

.stats {
    background: var(--white-trans);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    color: var(--primary);
}

/* Game Board */
.game-board-container {
    flex: 1;
    width: 100%;
    max-width: 500px;
    overflow-y: auto;
    background: var(--glass-bg);
    border-radius: 20px;
    border: 2px solid var(--glass-border);
    margin-bottom: 20px;
    /* Space for control panel */
    padding: 10px;
}

.game-board {
    display: flex;
    flex-direction: column-reverse;
    /* Newest at bottom visually */
    gap: 5px;
    min-height: 100%;
}

.board-row {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    padding: 8px;
    border-radius: 15px;
    gap: 10px;
}

.board-row.current {
    background: white;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.row-number {
    font-weight: bold;
    color: var(--text);
    opacity: 0.5;
    font-size: 0.9rem;
    width: 20px;
}

.pegs-area {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.guess-peg {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eee;
    border: 2px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.feedback-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 24px;
    height: 24px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.feedback-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
}

/* Feedback Styles */
.peg.correct {
    background: var(--text);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.peg.misplaced {
    background: white;
    border: 1px solid var(--text);
}

/* Control Panel */
.control-panel {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 30px;
    padding: 15px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Color Picker */
.color-picker {
    display: flex;
    justify-content: space-around;
    gap: 5px;
}

.color-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.color-btn:active {
    transform: scale(0.9);
}

/* Colors */
.c-1 {
    background: var(--color-1);
}

.c-2 {
    background: var(--color-2);
}

.c-3 {
    background: var(--color-3);
}

.c-4 {
    background: var(--color-4);
}

.c-5 {
    background: var(--color-5);
}

.c-6 {
    background: var(--color-6);
}

/* Current Guess Preview */
.current-guess-preview {
    display: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border-radius: 20px;
    background: #f0f0f0;
    font-size: 1.5rem;
    color: var(--text);
    transition: all 0.2s;
}

.check-btn {
    background: var(--accent);
    color: var(--text);
    flex: 2;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn:not(:disabled):active {
    transform: scale(0.95);
}

/* Results Screen */
.results-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.results-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.result-emoji {
    font-size: 5rem;
    margin-bottom: 10px;
}

.secret-reveal {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 15px;
}

.revealed-peg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

/* Scrollbar */
.game-board-container::-webkit-scrollbar {
    width: 6px;
}

.game-board-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Responsive */
@media (max-height: 700px) {
    .logo-container {
        padding: 15px 30px;
    }

    #main-title {
        font-size: 2.2rem;
    }

    .logo-emoji {
        font-size: 3rem;
    }

    .game-board-container {
        margin-bottom: 10px;
    }

    .color-btn {
        width: 35px;
        height: 35px;
    }
}

/* Animations & Decorations */
.decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.cloud,
.star {
    position: absolute;
    opacity: 0.8;
}

.cloud {
    font-size: 3rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.star {
    font-size: 1.5rem;
    animation: twinkle 3s infinite alternate;
}

.c1 {
    top: 10%;
    left: 10%;
    animation: floatSlow 20s infinite alternate;
}

.c2 {
    top: 15%;
    right: 15%;
    animation: floatSlow 25s infinite alternate-reverse;
}

.s1 {
    top: 20%;
    left: 25%;
    animation-delay: 0s;
}

.s2 {
    top: 60%;
    left: 5%;
    animation-delay: 1s;
}

.s3 {
    top: 30%;
    right: 20%;
    animation-delay: 2s;
}

@keyframes floatSlow {
    from {
        transform: translateX(-20px);
    }

    to {
        transform: translateX(20px);
    }
}

@keyframes twinkle {
    0% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.2) rotate(20deg);
        opacity: 1;
    }
}

.game-logo-img {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    /* Adjust as needed */
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
    animation: bounceSoft 3s infinite ease-in-out;
    margin-bottom: 10px;
    border-radius: 15px;
}

@keyframes bounceSoft {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}
#app {
    width: 100%;
    height: 90vh; /* Constrain game area */
    position: relative;
    overflow: hidden; /* Keep game clipped */
    border-bottom: 5px solid white;
}

#app {
    width: 100%;
    height: 90vh;
    position: relative;
    overflow: hidden;
    border-bottom: 5px solid white;
}
