#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: var(--primary-color);
    font-family: 'Impact', sans-serif;
    letter-spacing: 2px;
}

.loader-logo {
    width: 120px;
    animation: loader-pulse 2s infinite ease-in-out;
}

.loader-bar {
    width: 250px;
    height: 10px;
    background: #111;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    overflow: hidden;
}

.loader-progress {
    width: 0%;
    height: 100%;
    background: var(--primary-color);
    animation: load-progress 1s forwards cubic-bezier(0.1, 1, 0.1, 1);
}

@keyframes loader-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes load-progress {
    to {
        width: 100%;
    }
}

:root {
    --primary-color: #C89B3C;
    --secondary-color: #FF3333;
    --ready-color: #00FF00;
    --bg-dark: #0F0F0F;
    --card-bg: #222;
    --glass-bg: rgba(34, 34, 34, 0.9);
    --border-color: #333;
    --text-color: #F0E6D2;
    --debug-color: #A020F0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: url('assets/images/background.jpg') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
    overflow-x: hidden;
    height: 100vh;
}

#app {
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.82);
    /* Dark overlay from Python code (good port xd) */
    display: flex;
    flex-direction: column;
}

/* --- HEADER --- */
header {
    height: 180px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3rem;
    border-bottom: 2px solid var(--border-color);
    background: rgba(0, 0, 0, 0.4);
}

#mic-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

#mic-permission-notice {
    position: absolute;
    top: 120px;
    /* Lower than before */
    left: 20px;
    background: rgba(200, 155, 60, 0.95);
    color: #000;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: bold;
    width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    border: 2px solid #000;
    pointer-events: none;
    animation: bounce 2s infinite;
}

.mic-arrow {
    font-size: 1.5rem;
    line-height: 1;
    animation: pulse-arrow 1s infinite alternate;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-arrow {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.3);
    }
}

.label-text {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9rem;
}

.mic-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#mic-gif {
    height: 80px;
}

#voice-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ready-color);
    font-weight: bold;
}

#voice-indicator.idle {
    color: #888;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
}

#voice-indicator.active .dot {
    animation: pulse 1.5s infinite;
}

#btn-mute {
    background: #444;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
    text-transform: uppercase;
    font-family: Arial, sans-serif;
}

#btn-mute:hover {
    background: var(--primary-color);
    color: #000;
}

#btn-mute.muted {
    background: #e74c3c;
    border-color: #c0392b;
    color: #fff;
}

#title-container {
    text-align: center;
    background: url('assets/images/cronobarrel.png') no-repeat center;
    background-size: contain;
    padding: 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

h1 {
    font-family: 'Impact', sans-serif;
    font-size: 4rem;
    color: var(--primary-color);
    letter-spacing: 2px;
    margin: 0;
    position: relative;
    display: inline-block;
}

.web-version-tag {
    position: absolute;
    top: -10px;
    right: -80px;
    font-size: 0.9rem;
    font-family: 'Segoe UI', sans-serif;
    background: #e74c3c;
    color: #fff;
    padding: 2px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0;
    transform: rotate(-15deg);
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid #fff;
    animation: label-float 3s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes label-float {

    0%,
    100% {
        transform: rotate(-15deg) translateY(0);
    }

    50% {
        transform: rotate(-15deg) translateY(-8px);
    }
}

.sub-brand {
    color: var(--ready-color);
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: -0.5rem;
}

#gragas-header-container {
    position: relative;
    display: flex;
    align-items: center;
}

#gragas-portrait {
    width: 160px;
    height: 160px;
    object-fit: contain;
}

#gragas-portrait.shake {
    animation: shake 0.1s infinite;
}

@keyframes shake {
    0% {
        transform: translate(2px, 2px);
    }

    25% {
        transform: translate(-2px, -2px);
    }

    50% {
        transform: translate(2px, -2px);
    }

    75% {
        transform: translate(-2px, 2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* --- SETTINGS BAR --- */
#settings-bar {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 3rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

label {
    font-weight: bold;
    font-size: 0.9rem;
}

select,
input[type="number"] {
    background: #333;
    color: #fff;
    border: 1px solid var(--primary-color);
    padding: 2px 5px;
    border-radius: 4px;
}

#volume-slider {
    width: 150px;
    accent-color: var(--primary-color);
}

#game-timer-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

#game-timer-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    font-family: 'Segoe UI', sans-serif;
    min-width: 120px;
    text-align: center;
    text-shadow: 2px 2px 4px #000;
}

.btn-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--primary-color);
    background: rgba(0, 0, 0, 0.6);
    color: var(--primary-color);
    cursor: pointer;
}

.game-timer-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-timer-controls button {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

#btn-game-start {
    border: 2px solid var(--ready-color);
    background: #111;
    color: var(--ready-color);
}

#btn-game-reset {
    border: 2px solid var(--primary-color);
    background: #111;
    color: var(--primary-color);
}

#unleashed-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
    background: #1a1a1a;
}

/* --- MAIN CONTENT --- */
main {
    flex: 1;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

#lanes-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.lane-row {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s;
}

.lane-row:hover {
    border-color: #fff;
}

.lane-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
}

.lane-boots {
    display: flex;
    gap: 10px;
}

.boot-btn {
    width: 50px;
    height: 50px;
    background-size: cover;
    border: 2px solid #333;
    border-radius: 5px;
    background-color: #111;
    cursor: pointer;
}

.boot-btn.active {
    border-color: var(--ready-color);
    background-color: #222;
}

.boot-btn.disabled {
    opacity: 0.3;
}

.spells-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.spell-box {
    background: #111;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.spell-box:hover {
    border-color: var(--primary-color);
}

.spell-icon {
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.spell-box.on-cd .spell-icon {
    opacity: 0.3;
}

.spell-timer {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--ready-color);
    font-family: 'Courier New', Courier, monospace;
}

.on-cd .spell-timer {
    color: var(--secondary-color);
}

/* --- BOTTOM CONTROLS --- */
#bottom-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-bottom: 2rem;
}

#btn-reset-all {
    width: 200px;
    height: 45px;
    background: #111;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

#btn-reset-all:hover {
    background: #900;
    color: #fff;
    border-color: #f00;
}

#last-heard-console {
    background: #1a1a1a;
    padding: 8px 20px;
    border-radius: 5px;
    border: 1px solid #444;
    color: #AAA;
    font-family: Consolas, monospace;
    font-size: 0.9rem;
    min-width: 400px;
    text-align: center;
}

#last-heard-text {
    font-style: italic;
}

/* --- SPEECH BUBBLE --- */
.speech-bubble {
    position: absolute;
    right: 170px;
    top: 10px;
    background: #FFFDE7;
    color: #333;
    padding: 10px 15px;
    border-radius: 15px;
    border: 2px solid #333;
    min-width: 200px;
    max-width: 300px;
    display: none;
    font-family: 'Comic Sans MS', cursive;
    font-size: 1rem;
    z-index: 100;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 12px solid #333;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.speech-bubble.show {
    display: block;
}

/* --- FOOTER --- */
footer {
    padding: 1rem 3rem;
    background: rgba(0, 0, 0, 0.8);
    border-top: 2px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    font-size: 0.8rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.credits-link {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.60rem;
    margin-left: 15px; /* Fixed spacing */
    opacity: 0.7;
    transition: all 0.2s;
}

.credits-link:hover {
    opacity: 1;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

.muted-text {
    color: #ff4d4d !important;
}

.social-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;

}

.kofi-icon {
    width: 48px !important;
}

#debug-toggle-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

#debug-status-label {
    color: var(--debug-color);
    font-weight: bold;
    display: none;
}

#debug-toggle-container.active #debug-status-label {
    display: inline;
}

.social-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.social-links a {
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.social-links a:hover {
    transform: scale(1.2);
}

.social-icon {
    width: 32px;
    cursor: pointer;
}

/* Custom Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: tooltip-in 0.1s ease-out;
}

@keyframes tooltip-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

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

/* by Rener - Easter Egg */
#scared-container {
    position: fixed;
    right: -400px;
    bottom: 10%;
    width: 380px;
    transition: right 0.8s ease-in-out;
    z-index: 9999;
    pointer-events: none;
}

#scared-container img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.8));
}

#scared-container.scared-visible {
    right: 0px;
}

#scared-container.scared-hidden {
    right: -400px;
}

/* --- RESPONSIVE & MOBILE (by Rener) --- */


button:active,
.spell-box:active,
.boot-btn:active,
.credits-link:active,
.social-icon:active {
    transform: scale(0.95);
    filter: brightness(1.2);
}

.boot-btn {
    min-width: 44px;
    min-height: 44px;

}


#voice-indicator.idle {
    animation: blink-red 2s infinite;
}

@keyframes blink-red {

    0%,
    100% {
        background: rgba(231, 76, 60, 0.1);
        color: #888;
    }

    50% {
        background: rgba(231, 76, 60, 0.3);
        color: #e74c3c;
    }
}

/* --- tablets and medium screens :) --- */
@media (max-width: 1024px) {
    #app {
        padding: 0;
    }

    header {
        padding: 0 1rem;
    }

    .lane-name {
        font-size: 1.2em;
    }
}


@media (max-width: 768px) {


    .lane-row {
        flex-direction: column;
        align-items: center;
        padding: 15px 5px;
        margin-bottom: 20px;
        border: 1px solid rgba(200, 155, 60, 0.2);
        border-radius: 8px;
    }

    .lane-info {
        width: 100%;
        justify-content: space-around;
        margin-bottom: 15px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 10px;
    }

    .spells-container {
        width: 100%;
        justify-content: center;
        gap: 20px;
    }

    .spell-box {
        width: 80px;
        height: 80px;
    }

    .spell-timer {
        font-size: 1.5rem !important;
    }


    #gragas-portrait {
        width: 120px;
        height: 120px;
    }

    h1 {
        font-size: 2rem;
    }

    .web-version-tag {
        font-size: 0.7rem;
        right: -60px;
        top: -5px;
    }


    footer {
        padding: 20px 10px;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer-brand {
        flex-direction: column;
    }

    #settings-bar {
        flex-wrap: wrap;
        padding: 1rem;
        justify-content: center;
    }
}


@media (max-width: 480px) {
    .spell-box {
        width: 70px;
        height: 70px;
    }

    .lane-name {
        font-size: 1em;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* --- ONBOARDING HINTS (by Rener) --- */
#hints-container {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
}

.onboarding-hint {
    background: rgba(200, 155, 60, 0.15);
    border-left: 4px solid var(--primary-color);
    color: #fff;
    padding: 12px 20px;
    border-radius: 0 8px 8px 0;
    backdrop-filter: blur(8px);
    font-size: 0.95rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: hint-in 0.6s forwards;
    width: fit-content;
}

@keyframes hint-in {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}