@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@700&family=Press+Start+2P&display=swap');

/* --- Configurações Globais --- */
body {
    background-color: #1a1a1a;
    background-image: url("https://www.transparenttextures.com/patterns/dark-denim-3.png");
    color: #fff;
    overflow: hidden;
    font-family: 'Press Start 2P', cursive;
}

/* --- NOVA ESTRUTURA DE 3 COLUNAS --- */
.game-container {
    display: flex;
    flex-direction: row; /* A grande mudança: tudo em uma linha */
    height: 100vh;
}

/* --- Coluna 1: Painel da Esquerda (O Cookie) --- */
.left-panel {
    flex-basis: 35%;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    background: linear-gradient(to top, rgba(121, 28, 28, 0.7) 0%, rgba(121, 28, 28, 0) 50%);
}
.clicker-container { flex-grow: 1; display: flex; justify-content: center; align-items: center; }
.score-container { text-align: center; }
#score-display { font-family: 'Merriweather', serif; font-size: 2.8em; text-shadow: 2px 2px 2px #000, 4px 4px 5px rgba(0,0,0,0.7); }
#pps-display { font-size: 0.8em; text-shadow: 1px 1px 2px #000; }
#clicker-button { width: 256px; height: 256px; border-radius: 50%; cursor: pointer; transition: transform 0.05s ease-out; filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.15)); }
#clicker-button:active { transform: scale(0.95); }

/* --- Coluna 2: Painel do Meio (Edifícios) --- */
#rebirth-container {
    /* A MÁGICA COMEÇA AQUI */
    position: -webkit-sticky; /* Para compatibilidade com navegadores mais antigos (Safari) */
    position: sticky;
    top: 0; /* "Gruda" no topo do container pai (.middle-panel) */
    z-index: 10; /* Garante que ele fique por cima dos outros elementos ao rolar */
    background-color: #2a221c; /* Um fundo sólido para não ficar transparente sobre os edifícios */
    /* FIM DA MÁGICA */
    
    padding: 15px;
    border-bottom: 4px solid #1a120c;
    margin-bottom: 10px;
    opacity: 0;
    transition: opacity 0.5s;
}

#rebirth-container.hidden {
    display: none;
}

#rebirth-container.visible {
    opacity: 1;
}

.rebirth-label {
    font-size: 0.8em;
    text-align: center;
    margin-bottom: 8px;
    color: #e0d1b3;
    text-shadow: 1px 1px 2px #000;
}

/* A barra de progresso com o efeito de "fossa" (chanfro para dentro) */
.rebirth-bar {
    width: 100%;
    height: 20px;
    background-color: #000;
    border: 2px solid;
    border-color: #222 #555 #555 #222; /* top, right, bottom, left */
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.7); /* Sombra interna para profundidade */
    border-radius: 5px;
    padding: 3px;
}

/* O preenchimento da barra, agora com brilho */
.rebirth-progress {
    width: 0%; /* Começa em 0 */
    height: 100%;
    background: linear-gradient(90deg, #a100ff, #ff00de);
    border-radius: 3px;
    transition: width 0.3s ease-in-out;
    box-shadow: 0 0 8px #ff00de, inset 0 0 3px rgba(255, 255, 255, 0.5); /* Brilho externo e interno */
}

/* O botão de renascer com o efeito de botão 3D (chanfro para fora) */
#rebirth-button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    font-family: 'Merriweather', serif;
    font-size: 1.2em;
    background-color: #3d3d3d;
    color: white;
    text-shadow: 1px 1px 2px #000;
    cursor: pointer;
    border-style: solid;
    border-width: 3px;
    border-color: #888 #333 #333 #888; /* O chanfro mágico */
    transition: all 0.1s ease-out;
}

/* Efeito de botão pressionado */
#rebirth-button:active {
    border-color: #333 #888 #888 #333;
    transform: translateY(1px);
}

#rebirth-button.hidden {
    display: none;
}

.middle-panel {
    flex-basis: 40%;
    background-color: rgba(0, 0, 0, 0.4);
    border-left: 4px solid #1a120c;
    border-right: 4px solid #1a120c;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #8c6d52 #332317;
}
.middle-panel::-webkit-scrollbar { width: 12px; }
.middle-panel::-webkit-scrollbar-track { background: #332317; }
.middle-panel::-webkit-scrollbar-thumb { background-color: #8c6d52; border-radius: 6px; border: 2px solid #332317; }

.building-tier {
    display: flex;
    flex-direction: column; /* Para colocar o título em cima */
    min-height: 80px;
    padding: 10px;
    background-size: cover;
    background-position: center bottom;
    border-bottom: 2px solid #332317;
}
.building-tier-icons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.building-tier#farm-tier { background-image: url('https://i.imgur.com/g7vTfSg.png'); }
.building-tier#mine-tier { background-image: url('https://i.imgur.com/6U2M2eL.png'); }
.building-icon { width: 48px; height: 48px; image-rendering: pixelated; }

/* --- Coluna 3: Painel da Direita (A Loja) --- */
.right-panel {
    flex-basis: 25%;
    background-image: url("https://www.transparenttextures.com/patterns/wood-pattern.png");
    border-left: 4px solid #1a120c;
    display: flex;
    flex-direction: column;
}
.title-bar { text-align: center; padding: 10px; font-family: 'Merriweather', serif; font-size: 2em; color: #e0d1b3; text-shadow: 1px 1px 2px #000; background-image: url("https://www.transparenttextures.com/patterns/wood-planks.png"); border-bottom: 4px solid #2a1a0e; flex-shrink: 0; }
.window-body { padding: 10px; overflow-y: auto; flex-grow: 1; }

.upgrade { display: flex; align-items: center; margin-bottom: 5px; padding: 8px; background-color: rgba(0, 0, 0, 0.4); border-style: solid; border-width: 2px; border-color: #777 #222 #222 #777; cursor: not-allowed; transition: all 0.2s ease-in-out; opacity: 0.5; }
.upgrade.affordable { opacity: 1; background-color: rgba(30, 25, 20, 0.6); cursor: pointer; }
.upgrade.affordable:hover { transform: scale(1.02); box-shadow: 0 0 15px rgba(255, 223, 130, 0.5); }
.upgrade .details { flex-grow: 1; color: #ccc; }
.upgrade h3 { margin: 0 0 5px 0; font-size: 0.8em; color: #fff; }
.upgrade p { margin: 0; font-size: 0.6em; }
.upgrade .owned { font-family: 'Merriweather', serif; font-size: 2em; font-weight: bold; color: #fff; text-shadow: 1px 1px 2px #000; min-width: 50px; text-align: right; opacity: 0.6; }

.tier2-title { margin-top: 20px; padding-bottom: 5px; border-bottom: 2px solid #8c6d52; color: #e0d1b3; font-size: 0.9em; }
#tier2-store-container { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.tier2-upgrade { width: 48px; height: 48px; background-color: rgba(0, 0, 0, 0.5); cursor: not-allowed; opacity: 0.4; border: 4px solid #4a3623; box-shadow: inset 0 0 5px #000; transition: all 0.2s ease; position: relative; }
.tier2-upgrade.affordable { opacity: 1; cursor: pointer; border-color: #ffd700; }
.tier2-upgrade.affordable:hover { transform: scale(1.1); box-shadow: inset 0 0 5px #000, 0 0 10px #ffd700; }
.tier2-upgrade img { width: 100%; height: 100%; image-rendering: pixelated; }

/* --- Componentes Flutuantes --- */
#tooltip { position: absolute; width: 300px; background: #111; border: 2px solid #a1793a; border-radius: 4px; padding: 10px; z-index: 10001; box-shadow: 0 5px 15px rgba(0,0,0,0.5); pointer-events: none; opacity: 0; transition: opacity 0.2s; }
#tooltip.hidden { display: none; }
#tooltip.visible { opacity: 1; }
#tooltip .header { display: flex; align-items: flex-start; margin-bottom: 10px; }
#tooltip .icon { width: 48px; height: 48px; margin-right: 10px; image-rendering: pixelated; }
#tooltip .title-section { flex-grow: 1; }
#tooltip .name { font-family: 'Merriweather', serif; font-size: 1.2em; color: #fff; }
#tooltip .tag { background-color: #444; color: #ccc; font-size: 0.6em; padding: 2px 4px; border-radius: 3px; display: inline-block; }
#tooltip .cost { text-align: right; font-size: 1.1em; color: #ffd700; }
#tooltip .description { font-size: 0.8em; color: #ccc; border-top: 1px solid #444; padding-top: 10px; }
#tooltip .footer { font-size: 0.7em; color: #888; text-align: center; margin-top: 10px; }

.click-text { position: absolute; pointer-events: none; font-family: 'Merriweather', serif; font-weight: bold; font-size: 1.5em; color: white; text-shadow: 2px 2px 2px #000; z-index: 9999; animation: fade-up 1s forwards; }
@keyframes fade-up { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-50px); } }
#golden-cookie { position: absolute; width: 96px; height: 96px; z-index: 10000; cursor: pointer; animation: shimmer 1.5s infinite; filter: drop-shadow(0 0 25px gold); }
#golden-cookie-img { width: 100%; height: 100%; border-radius: 50%; filter: hue-rotate(-40deg) saturate(2) brightness(1.2); }
@keyframes shimmer { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.1); opacity: 1; } }

/* --- Órbita do Cursor --- */
#orbit-container { position: relative; display: flex; justify-content: center; align-items: center; animation: orbit 10s linear infinite; transform-style: preserve-3d; }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.orbit-spoke { position: absolute; width: 320px; height: 320px; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); transform: rotate(var(--angle)); pointer-events: none; }
.orbiting-cursor { position: absolute; width: 32px; height: 32px; background-image: url('https://openclipart.org/download/222074/simple-cursor.svg'); background-size: contain; background-repeat: no-repeat; pointer-events: auto; bottom: 100%; left: 50%; transform: translateX(-50%) rotate(180deg); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.orbiting-cursor.clicking { transform: translateX(-50%) translateY(60px) rotate(180deg); }