:root {
    --bg-color: #0d0f14;
    --panel-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-green: #00f2a1;
    --accent-blue: #00d2ff;
    --accent-gray: #4a5568;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --board-size: 500px;
    --grid-count: 5;
    --cell-size: calc(var(--board-size) / var(--grid-count));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #151821;
    color: var(--text-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0, 242, 161, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 210, 255, 0.08) 0%, transparent 50%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 30px 30px, 30px 30px;
    background-position: 0 0, 0 0, -1px -1px, -1px -1px;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    width: 100%;
    max-width: 600px;
    perspective: 1200px;
}

header {
    text-align: center;
    width: 100%;
}

.game-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 15px rgba(0, 210, 255, 0.2));
}

.level-info {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

.board-container {
    position: relative;
    width: var(--board-size);
    height: var(--board-size);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(0, 0, 0, 0.5) 100%);
    border: 12px solid #1f2533;
    border-radius: 1.5rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.8), 
        0 0 40px rgba(0, 242, 161, 0.1),
        inset 0 4px 15px rgba(255, 255, 255, 0.1),
        inset 0 -10px 30px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.17, 0.67, 0.83, 0.67), box-shadow 0.3s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.board-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    box-shadow: inset 0 0 60px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 20;
}

.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--grid-count), 1fr);
    grid-template-rows: repeat(var(--grid-count), 1fr);
}

.grid-cell {
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-top: 1px solid rgba(0, 0, 0, 0.5);
    border-left: 1px solid rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.15);
    box-shadow: inset 3px 3px 8px rgba(0, 0, 0, 0.4), inset -1px -1px 3px rgba(255, 255, 255, 0.03);
}

.hole {
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    background: radial-gradient(circle at center, #000 30%, #0d0f14 100%);
    border-radius: 50%;
    box-shadow: inset 0 10px 25px rgba(0, 0, 0, 1), 0 2px 5px rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.disc {
    position: absolute;
    width: var(--cell-size);
    height: var(--cell-size);
    padding: 12px;
    z-index: 10;
    transition: transform 0.4s cubic-bezier(0.45, 0.05, 0.55, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
}

.disc-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

.disc-inner::before {
    content: '';
    position: absolute;
    top: 12%;
    left: 15%;
    width: 45%;
    height: 35%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 70%);
    z-index: 2;
    transform: rotate(-15deg);
}

.disc-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: inset -5px -5px 15px rgba(0, 0, 0, 0.6), inset 2px 2px 8px rgba(255, 255, 255, 0.4);
}

.disc.green .disc-inner {
    background: radial-gradient(circle at 35% 35%, #50ffc1 0%, #00a870 70%, #004d33 100%);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 242, 161, 0.4);
}

.disc.blue .disc-inner {
    background: radial-gradient(circle at 35% 35%, #4ae5ff 0%, #0090cc 70%, #003d57 100%);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 210, 255, 0.4);
}

.block {
    position: absolute;
    width: var(--cell-size);
    height: var(--cell-size);
    padding: 4px;
    z-index: 5;
}

.block-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4a5568 0%, #1a202c 100%);
    border-radius: 8px;
    border-top: 2px solid rgba(255, 255, 255, 0.4);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    border-bottom: 2px solid rgba(0, 0, 0, 0.8);
    border-right: 2px solid rgba(0, 0, 0, 0.8);
    box-shadow: 3px 6px 15px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}

.block-inner::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent);
    pointer-events: none;
}

.ui-panel {
    width: 100%;
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
}

#hint-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.controls-hint {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

button {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 10px;
}

button:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    border-color: rgba(255, 255, 255, 0.2);
}

.overlay-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

/* Mobile Adjustments */
@media (max-width: 550px) {
    :root {
        --board-size: 90vw;
    }

    #app {
        gap: 1rem;
    }

    h1 {
        font-size: 2rem;
    }
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.overlay-content {
    text-align: center;
}

.overlay h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.permission-banner {
    position: fixed;
    bottom: 2rem;
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem 2rem;
    border-radius: 2rem;
    z-index: 200;
    display: none;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--accent-green);
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.icon-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.help-content h2 {
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(0, 210, 255, 0.3);
}

.rules-list {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 400px;
}

.rules-list p {
    font-size: 1rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.text-green {
    color: var(--accent-green);
    font-weight: 700;
}

.text-blue {
    color: var(--accent-blue);
    font-weight: 700;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-green);
    margin-top: 0.2rem;
    text-shadow: 0 0 10px rgba(0, 242, 161, 0.3);
    align-items: center;
}

.star-goal {
    color: #ffcc00;
    font-size: 0.9rem;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 204, 0, 0.2);
}

#total-stars {
    color: #ffcc00;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.star {
    font-size: 3.5rem;
    color: rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.star.active {
    color: #ffcc00;
    text-shadow: 0 0 20px rgba(255, 204, 0, 0.6);
    animation: starPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes starPop {
    0% {
        transform: scale(0) rotate(-30deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.2) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.level-stats {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
}

.level-stats strong {
    color: var(--text-primary);
}