:root {
    --primary-color: rgba(255, 255, 255, 0.7);
    --bg-gradient-start: #e6d5b8;
    --bg-gradient-end: #c2a370;
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --text-color: #333;
    --glow-color: rgba(255, 255, 255, 0.8);
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    overflow: hidden;
    color: var(--text-color);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Liquid Panel Base */
.liquid-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
}

/* Screens */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 5;
}

#home-screen {
    max-width: 400px;
    height: auto;
    padding: 40px;
    text-align: center;
}

.glow-text {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: #1e3a8a;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.5);
}

.glow-text.success {
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}

.glow-text.danger {
    color: #F44336;
    text-shadow: 0 0 10px rgba(244, 67, 54, 0.8);
}

/* Inputs & Buttons */
.input-group {
    margin-bottom: 25px;
    width: 100%;
}

input[type="text"] {
    width: 100%;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    text-align: center;
}

input[type="text"]:focus {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.glass-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.glass-btn:active {
    transform: translateY(1px);
}

.glass-btn.primary { background: rgba(76, 175, 80, 0.6); }
.glass-btn.danger { background: rgba(244, 67, 54, 0.6); }

/* Game Screen Layout */
#game-screen {
    justify-content: space-between;
    padding: 20px 10px;
    max-width: 600px;
    margin: 0 auto;
}

.top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(0, 0, 0, 0.6);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
}

.icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin: 0;
}

.target-info {
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Game Board */
.board-container {
    padding: 10px;
    width: 100%;
    max-width: 400px; /* Constrain max size */
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-board {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    position: relative;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 4px;
}

/* Tiles */
.tile {
    width: 100%;
    height: 100%;
    border-radius: 20%; /* Cute rounded tiles */
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.4), 0 4px 6px rgba(0,0,0,0.2);
    cursor: grab;
    position: relative;
    z-index: 10;
    /* transition: transform 0.2s ease-in-out, top 0.2s ease-in, left 0.2s ease-in; */
}

.tile:active {
    cursor: grabbing;
    transform: scale(0.9);
}

.tile::after {
    content: '';
    position: absolute;
    top: 5%;
    left: 10%;
    width: 40%;
    height: 30%;
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
    pointer-events: none;
}

.tile.blasting {
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.tile.comet-blasting {
    transform: scale(1.5);
    opacity: 0;
    filter: brightness(2) blur(2px);
    transition: all 0.4s ease-out;
}

/* Overlays & Modals */
.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    padding: 40px;
    width: 90%;
    max-width: 350px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.hidden {
    display: none;
    transform: scale(0.8);
}

.modal h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.modal p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

/* Magic Sparkles */
.sparkle-star {
    position: absolute;
    pointer-events: none;
    background: radial-gradient(circle, #ffffff 10%, transparent 60%);
    box-shadow: 0 0 10px #fff, 0 0 15px #ffeb3b;
    border-radius: 50%;
    z-index: 100;
    opacity: 0;
    animation: sparkle-anim 0.5s ease-out forwards;
}

.sparkle-star::before, .sparkle-star::after {
    content: '';
    position: absolute;
    background: #fff;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 8px #ffeb3b;
}

.sparkle-star::before {
    width: 150%; height: 15%;
}

.sparkle-star::after {
    width: 15%; height: 150%;
}

@keyframes sparkle-anim {
    0% { transform: scale(0) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(45deg); opacity: 1; }
    100% { transform: scale(0) rotate(90deg); opacity: 0; }
}

/* Web3 Styles */
.web3-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wallet-status {
    margin-top: 10px;
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.7);
    word-break: break-all;
}

.glass-btn.secondary { background: rgba(33, 150, 243, 0.6); }

.hidden {
    display: none !important;
}
