/* --- VARIÁVEIS DE COR P3R --- */
:root {
    --p3-blue-dark: #000a1a;
    --p3-blue-deep: #001a33;
    --p3-blue-mid: #003366;
    --p3-blue-bright: #00aaff;
    --p3-blue-glow: #4dffff;
    --p3-moon-white: #e6f2ff;
    --p3-glass: rgba(0, 20, 40, 0.7);
}

body {
    font-family: 'Exo 2', sans-serif;
    color: var(--p3-moon-white);
    padding-top: 120px;
    padding-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: var(--p3-blue-dark);
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(0, 85, 255, 0.2) 0%, transparent 70%),
        linear-gradient(180deg, #000510 0%, #001a33 100%);
    background-attachment: fixed;
}

/* Ondas e Bolhas do Fundo */
body::before {
    content: ""; position: fixed; bottom: 0; left: 0; width: 100%; height: 30vh;
    background: linear-gradient(to top, rgba(0, 170, 255, 0.1), transparent);
    filter: blur(5px); z-index: -2; pointer-events: none;
    animation: pulseGlow 5s infinite alternate;
}
@keyframes pulseGlow {
    from { opacity: 0.3; height: 30vh; }
    to { opacity: 0.6; height: 35vh; }
}

body::after {
    content: ""; position: fixed; bottom: -100%; left: 0; width: 100%; height: 200%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(77, 255, 255, 0.15) 2px, transparent 4px),
        radial-gradient(circle at 80% 40%, rgba(77, 255, 255, 0.1) 1px, transparent 2px),
        radial-gradient(circle at 40% 60%, rgba(77, 255, 255, 0.2) 3px, transparent 5px),
        radial-gradient(circle at 60% 20%, rgba(77, 255, 255, 0.1) 2px, transparent 3px);
    background-size: 100% 100%; animation: risingBubbles 15s linear infinite;
    z-index: -1; pointer-events: none;
}
@keyframes risingBubbles {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(-30%); opacity: 0; }
}

/* --- LOADER DARK HOUR --- */
#loader-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000;
    background-image: radial-gradient(circle at center, #001a00 0%, #000 70%);
    z-index: 9999; display: flex; justify-content: center; align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s;
}
#loader-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.clock-container { position: relative; width: 150px; height: 150px; }
.clock-circle {
    width: 100%; height: 100%; border: 4px solid #ccff00; border-radius: 50%;
    position: relative; box-shadow: 0 0 20px rgba(204, 255, 0, 0.4), inset 0 0 20px rgba(204, 255, 0, 0.2);
    background: rgba(0, 20, 0, 0.8);
}
.clock-number {
    position: absolute; color: #ccff00; font-family: 'Exo 2', sans-serif;
    font-weight: 900; font-size: 1.2em; text-shadow: 0 0 5px #ccff00;
}
.n12 { top: 5px; left: 50%; transform: translateX(-50%); }
.n6  { bottom: 5px; left: 50%; transform: translateX(-50%); }
.n3  { right: 10px; top: 50%; transform: translateY(-50%); }
.n9  { left: 10px; top: 50%; transform: translateY(-50%); }

.hand {
    position: absolute; bottom: 50%; left: 50%; transform-origin: bottom center;
    background-color: #ccff00; box-shadow: 0 0 5px #ccff00; border-radius: 2px;
}
.hour-hand { width: 4px; height: 35px; animation: spinClock 4s linear infinite; }
.minute-hand { width: 2px; height: 55px; animation: spinClock 0.5s linear infinite; }
.center-dot {
    position: absolute; top: 50%; left: 50%; width: 8px; height: 8px;
    background-color: #ccff00; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 10px #ccff00;
}
.loading-text {
    position: absolute; bottom: -70px; width: 100%; text-align: center;
    color: #ccff00; font-family: 'Exo 2', sans-serif; font-weight: 700;
    letter-spacing: 3px; animation: blinkText 1s infinite alternate;
}
@keyframes spinClock { from { transform: translateX(-50%) rotate(0deg); } to { transform: translateX(-50%) rotate(360deg); } }
@keyframes blinkText { from { opacity: 0.4; } to { opacity: 1; } }

/* --- HEADER ANGULAR --- */
header {
    background: rgba(0, 10, 25, 0.85); backdrop-filter: blur(10px);
    padding: 15px 40px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(77, 255, 255, 0.3); box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    width: 100%; position: fixed; top: 0; left: 0; z-index: 100;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 98% 100%, 0 100%);
}
.logo {
    font-size: 1.8em; font-weight: 900; font-style: italic; text-transform: uppercase;
    color: var(--p3-blue-glow); text-shadow: 0 0 15px rgba(77, 255, 255, 0.5); letter-spacing: 1px;
}

/* Navegação */
nav ul { list-style: none; display: flex; gap: 30px; align-items: center; }
nav a {
    color: rgba(255, 255, 255, 0.6); text-decoration: none; font-weight: 700;
    text-transform: uppercase; font-size: 0.9em; padding: 8px 12px; position: relative; transition: all 0.3s ease; border-radius: 4px;
}
nav a::after {
    content: ''; position: absolute; width: 0; height: 2px; bottom: 0; left: 50%;
    background-color: var(--p3-blue-glow); transition: all 0.3s ease; transform: translateX(-50%); box-shadow: 0 0 8px var(--p3-blue-glow);
}
nav a:hover { color: var(--p3-white); text-shadow: 0 0 8px var(--p3-blue-bright); background-color: rgba(255, 255, 255, 0.05); }
nav a:hover::after { width: 100%; }
nav a.active {
    color: var(--p3-blue-glow); text-shadow: 0 0 10px var(--p3-blue-glow);
    background-color: rgba(0, 85, 255, 0.15); border: 1px solid rgba(77, 255, 255, 0.3);
}
nav a.active::after { width: 100%; background-color: var(--p3-blue-glow); }

.minigame-nav-link {
    color: var(--p3-blue-glow) !important;
}

.hamburger { display: none; flex-direction: column; gap: 6px; background: none; border: none; cursor: pointer; }
.hamburger span { width: 30px; height: 3px; background: var(--p3-white); box-shadow: 0 0 5px var(--p3-blue-glow); }

/* --- BOTÃO BANNER MINIGAME --- */
.minigame-banner-btn {
    display: inline-block;
    background: linear-gradient(90deg, rgba(0, 51, 102, 0.8), rgba(0, 26, 51, 0.9));
    color: var(--p3-blue-glow);
    border: 2px solid var(--p3-blue-glow);
    padding: 15px 40px;
    font-family: 'Exo 2', sans-serif;
    font-size: 1.2em;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 1px;
    margin: 10px auto 30px auto; 
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    width: 90%;
    max-width: 900px;
    text-align: center;
}
.minigame-banner-btn:hover {
    background: var(--p3-blue-glow);
    color: var(--p3-blue-dark);
    box-shadow: 0 0 25px var(--p3-blue-glow);
    transform: scale(1.03) translateY(-3px);
}

/* --- WRAPPER DAS CALCULADORAS --- */
.calculators-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

/* --- CONTAINERS E INPUTS --- */
.calculator-container, .reverse-calculator-container {
    background: linear-gradient(145deg, rgba(0, 15, 30, 0.7) 0%, rgba(0, 5, 10, 0.8) 100%);
    backdrop-filter: blur(8px); padding: 40px; border: 1px solid rgba(77, 255, 255, 0.15);
    border-top: 1px solid rgba(77, 255, 255, 0.4);
    clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
    text-align: center; max-width: 800px; width: 90%; margin-bottom: 40px; position: relative; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}
h1, h2 {
    font-weight: 900; font-style: italic; color: var(--p3-white); text-transform: uppercase;
    margin-bottom: 10px; text-shadow: 2px 2px 0px rgba(0, 85, 255, 0.5); letter-spacing: 1px;
}
p { color: #b3d9ff; font-size: 0.95em; margin-bottom: 30px; }

.selection-area { display: flex; justify-content: space-between; align-items: center; margin: 30px 0; gap: 15px; }
.search-container { position: relative; width: 45%; display: flex; flex-direction: column; }
.search-container label { font-weight: 700; text-transform: uppercase; color: var(--p3-blue-bright); margin-bottom: 5px; text-align: left; }
.search-input {
    padding: 15px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(77, 255, 255, 0.3); border-bottom: 2px solid var(--p3-blue-bright);
    color: #fff; font-family: 'Exo 2', sans-serif; font-size: 1.1em; font-weight: 700; text-align: center; transition: all 0.3s ease;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 95% 100%, 0 100%);
}
.search-input:focus { outline: none; border-color: var(--p3-blue-glow); background: rgba(0, 20, 50, 0.8); box-shadow: 0 0 15px rgba(0, 170, 255, 0.3); }

.plus-sign { font-size: 2.5em; color: var(--p3-blue-glow); font-weight: 100; opacity: 0.8; text-shadow: 0 0 10px var(--p3-blue-bright); }

button {
    background: transparent; color: var(--p3-blue-glow); border: 2px solid var(--p3-blue-glow);
    padding: 15px 50px; font-family: 'Exo 2', sans-serif; font-size: 1.1em; font-weight: 800; font-style: italic;
    text-transform: uppercase; cursor: pointer; position: relative; overflow: hidden; transition: all 0.3s ease; margin-top: 25px;
    letter-spacing: 2px; z-index: 1; clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
button::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: var(--p3-blue-glow); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); z-index: -1; transform: skewX(-20deg);
}
button:hover { color: #000; box-shadow: 0 0 20px rgba(77, 255, 255, 0.5); border-color: var(--p3-white); }
button:hover::before { left: 0; }

.results-container {
    display: none; position: absolute; top: 100%; left: 0; right: 0; background: rgba(5, 15, 30, 0.98);
    border: 1px solid var(--p3-blue-mid); max-height: 250px; overflow-y: auto; z-index: 20; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}
.result-item { padding: 12px 20px; color: #ccc; cursor: pointer; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 0.9em; transition: all 0.2s; }
.result-item:hover { background: linear-gradient(90deg, rgba(0, 170, 255, 0.2), transparent); color: var(--p3-white); padding-left: 25px; border-left: 3px solid var(--p3-blue-glow); }

#result-area, #reverse-result-area {
    margin-top: 40px; background: rgba(0, 0, 0, 0.3); padding: 25px; border-left: 3px solid var(--p3-blue-bright); position: relative;
}
#result-text { font-size: 1.4em; font-weight: 700; color: var(--p3-white); }

/* CLASSE UNIFICADA PARA PERSONAS CLICÁVEIS (Novo) */
.clickable-persona, #result-text span { 
    color: var(--p3-blue-glow); 
    border-bottom: 1px dashed var(--p3-blue-glow); 
    transition: all 0.3s; 
    cursor: pointer; 
}
.clickable-persona:hover, #result-text span:hover { 
    background: var(--p3-blue-glow); 
    color: #000; 
    box-shadow: 0 0 15px var(--p3-blue-glow); 
}

#reverse-recipes-list { list-style: none; padding: 0; text-align: left; }
#reverse-recipes-list li { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: #ccc; }

/* --- MODAL DA API --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 5, 10, 0.95);
    backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 2000; opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.open { display: flex; opacity: 1; }

.modal-content {
    background: linear-gradient(160deg, #001a33, #000); padding: 40px; border: 1px solid var(--p3-blue-mid);
    box-shadow: 0 0 50px rgba(0, 170, 255, 0.3); width: 90%; max-width: 900px; position: relative; max-height: 90vh; overflow-y: auto;
    clip-path: polygon(40px 0, 100% 0, 100% calc(100% - 40px), calc(100% - 40px) 100%, 0 100%, 0 40px);
}

.close-modal { 
    position: absolute; top: 15px; right: 20px; background: transparent; border: none; 
    color: var(--p3-blue-bright); font-size: 2.8em; cursor: pointer; transition: all 0.3s ease; 
    z-index: 100; width: 45px; height: 45px; display: flex; justify-content: center; align-items: center;
    border-radius: 50%;
}
.close-modal:hover { 
    color: var(--p3-blue-dark) !important;
    background-color: var(--p3-blue-glow);
    transform: rotate(90deg); 
    box-shadow: 0 0 15px var(--p3-blue-glow);
}

/* Organização Imagem e Lore */
.modal-header-content {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    border-bottom: 2px solid var(--p3-blue-mid);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

#modal-persona-image {
    width: 180px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.2);
    object-fit: contain;
    background: rgba(0, 0, 0, 0.5); 
    padding: 10px;
    border: 1px solid var(--p3-blue-mid);
}

.modal-header-text { 
    flex: 1; 
    text-align: left; 
    padding-right: 50px; 
}

#modal-persona-name { font-size: 2.5em; text-shadow: 0 0 20px rgba(0, 170, 255, 0.5); font-style: italic; display: inline-block; margin-right: 15px;}
.level-badge { 
    background: var(--p3-blue-glow); color: #000; padding: 2px 8px; 
    border-radius: 4px; font-weight: 900; vertical-align: middle; 
}

.persona-desc {
    margin-top: 15px; font-size: 0.95em; color: #aaccff;
    line-height: 1.6; font-style: italic; text-align: justify;
}

.modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.modal-section h3 {
    color: var(--p3-blue-bright); border-left: 4px solid var(--p3-blue-bright);
    padding-left: 10px; margin-bottom: 15px; background: linear-gradient(90deg, rgba(0,170,255,0.1), transparent);
}
.modal-section li {
    display: flex; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.95em;
}
/* Estilo do Tutorial Overlay - Tema P3R Glassmorphism */
.tutorial-overlay {
    --p3-blue: #0088ff;
    --p3-cyan: #00e5ff;
    --p3-bg: #030816;
    --p3-panel: #0a1128;
    --p3-border: rgba(0, 229, 255, 0.3);
    --p3-text: #cbd5e1;
    --p3-white: #ffffff;
    
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(3, 8, 22, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}

.tutorial-card {
    background-color: var(--p3-panel);
    border: 2px solid var(--p3-cyan);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.2);
    width: 90%;
    max-width: 600px;
    padding: 30px;
    position: relative;
    border-radius: 12px;
    color: var(--p3-text);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Barra de progresso em neon azul */
.tut-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #1e293b;
    border-radius: 3px;
    overflow: hidden;
}

.tut-progress-fill {
    width: 0%;
    height: 100%;
    background-color: var(--p3-cyan);
    box-shadow: 0 0 10px var(--p3-cyan);
    transition: width 0.3s ease;
}

/* Slides */
.tut-slides-wrapper {
    min-height: 280px;
    position: relative;
}

.tut-slide {
    display: none;
    flex-direction: column;
    gap: 15px;
    animation: fadeInTut 0.3s ease-in-out forwards;
}

.tut-slide.active {
    display: flex;
}

@keyframes fadeInTut {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tut-speaker-tag {
    font-size: 0.9em;
    font-weight: bold;
    color: var(--p3-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.5);
}

.tut-icon {
    font-size: 1.5em;
    color: var(--p3-cyan);
}

.tut-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 1.8em;
    font-weight: 900;
    color: var(--p3-white);
}

.tut-body {
    font-size: 1.05em;
    line-height: 1.6;
    color: #94a3b8;
}

.tut-flavor {
    font-style: italic;
    font-size: 0.9em;
    color: #64748b;
    border-left: 2px solid var(--p3-blue);
    padding-left: 10px;
}

.tut-arcana-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tut-arcana-preview span {
    background-color: #1e293b;
    color: var(--p3-cyan);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    border: 1px solid rgba(0, 229, 255, 0.1);
}

/* Indicadores */
.tut-step-indicator {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.tut-dot {
    width: 10px;
    height: 10px;
    background-color: #1e293b;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.2s ease;
    border: 1px solid var(--p3-border);
}

.tut-dot.active {
    background-color: var(--p3-cyan);
    box-shadow: 0 0 8px var(--p3-cyan);
    transform: scale(1.2);
}

/* Elementos de etapas do tutorial */
.tut-steps-visual {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.tut-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tut-step-num {
    background-color: var(--p3-cyan);
    color: #000;
    font-weight: bold;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.tut-remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #64748b;
    cursor: pointer;
    margin-top: 10px;
}

/* Navegação do tutorial */
.tut-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tut-btn {
    background: transparent;
    border: 1px solid var(--p3-cyan);
    color: var(--p3-cyan);
    padding: 10px 20px;
    font-family: 'Exo 2', sans-serif;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tut-btn:hover:not(:disabled) {
    background-color: var(--p3-cyan);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.tut-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #334155;
    color: #334155;
}

.tut-btn-skip {
    border-color: transparent;
    color: #64748b;
}

.tut-btn-skip:hover {
    color: var(--p3-white);
}

/* Partículas Decorativas de Shards */
.tut-bg-shards {
    position: absolute; width: 100%; height: 100%; top: 0; left: 0; overflow: hidden; pointer-events: none; z-index: -1;
}
.tut-bg-shards span {
    position: absolute; display: block; width: 8px; height: 8px; background: rgba(0, 229, 255, 0.1); transform: rotate(45deg); bottom: -10px; animation: shardsUp 8s infinite linear;
}
.tut-bg-shards span:nth-child(1) { left: 10%; width: 12px; height: 12px; animation-delay: 0s; }
.tut-bg-shards span:nth-child(2) { left: 30%; animation-delay: 2s; animation-duration: 10s; }
.tut-bg-shards span:nth-child(3) { left: 50%; width: 6px; height: 6px; animation-delay: 4s; }
.tut-bg-shards span:nth-child(4) { left: 70%; animation-delay: 1s; }
.tut-bg-shards span:nth-child(5) { left: 85%; width: 14px; height: 14px; animation-delay: 5s; }

@keyframes shardsUp {
    0% { transform: translateY(0) rotate(45deg); opacity: 0; }
    50% { opacity: 0.7; }
    100% { transform: translateY(-110vh) rotate(405deg); opacity: 0; }
}

/* Responsividade */
@media (min-width: 992px) {
    .calculators-wrapper {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        gap: 40px;
        padding: 0 40px;
        max-width: 1600px;
    }
    
    .calculator-container, .reverse-calculator-container { 
        width: 45%; 
        margin-top: 0; 
        margin-bottom: 0;
    }
    
    .minigame-banner-btn { 
        width: 100%; 
    } 
}

@media (max-width: 820px) {
    body { padding-top: 100px; justify-content: flex-start; }
    header { padding: 15px 20px; clip-path: none; border-bottom: 2px solid var(--p3-blue-bright); }
    .hamburger { display: flex; }
    nav ul { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: rgba(0, 10, 20, 0.98); border-bottom: 2px solid var(--p3-blue-bright); flex-direction: column; text-align: center; padding: 20px 0; }
    nav ul.open { display: flex; }
    nav a { display: block; border-radius: 0; padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); margin: 0; }
    nav a::after { display: none; }
    .selection-area { flex-direction: column; gap: 30px; }
    .search-container { width: 100%; }
    .modal-body { grid-template-columns: 1fr; }
    .modal-header-content { flex-direction: column; align-items: center; text-align: center; }
    .modal-header-text { text-align: center; padding-right: 0; }
    .close-modal { top: 10px; right: 10px; }
    .minigame-banner-btn { width: 90%; font-size: 1em; padding: 15px 20px; }
}