/* Resets e Base */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: transparent;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Telas Base */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 20px 50px 20px; /* Adicionado padding inferior de segurança */
    box-sizing: border-box;
    background: rgba(10, 10, 20, 0.95);
    z-index: 100;
    overflow-y: auto;
}
.screen.active {
    display: flex;
}

/* Tipografia */
h1 {
    font-size: clamp(1.5em, 8vw, 3em);
    color: #4488ff;
    text-shadow: 0 0 20px rgba(68, 136, 255, 0.8), 0 0 5px rgba(255,255,255,0.5);
    margin-bottom: 20px;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-align: center;
}
h2 {
    color: #88bbff;
    margin-bottom: 20px;
    font-weight: normal;
    text-align: center;
    text-shadow: 0 0 10px rgba(136, 187, 255, 0.5);
}

/* Botões */
.btn {
    background: rgba(10, 30, 60, 0.6);
    backdrop-filter: blur(5px);
    color: #4488ff;
    border: 1px solid #4488ff;
    padding: 15px 20px;
    font-size: 1.1em;
    cursor: pointer;
    margin: 10px;
    width: 100%;
    max-width: 400px;
    transition: all 0.2s;
    text-transform: uppercase;
    font-weight: bold;
    border-radius: 4px;
    box-sizing: border-box;
    box-shadow: inset 0 0 10px rgba(68, 136, 255, 0.2);
}
.btn:hover {
    background: rgba(68, 136, 255, 0.3);
    color: #fff;
    box-shadow: 0 0 15px rgba(68, 136, 255, 0.8), inset 0 0 20px rgba(68, 136, 255, 0.5);
    transform: scale(1.02);
}
.btn:disabled {
    border-color: #444;
    color: #666;
    cursor: not-allowed;
    background: rgba(20,20,20,0.5);
    box-shadow: none;
    transform: none;
    text-shadow: none;
}
.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
    width: auto;
    margin: 5px;
    max-width: none;
}
.btn-back {
    position: fixed;
    top: 15px;
    left: 15px;
    width: auto;
    border-color: #5588cc;
    color: #88bbff;
    z-index: 110;
    padding: 8px 15px;
    font-size: 0.9em;
    background: rgba(10,20,40,0.6);
    backdrop-filter: blur(3px);
}
.btn-back:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(68, 136, 255, 0.4);
}

/* Inputs e Formulários */
.input-group {
    margin: 10px 0;
    width: 100%;
    max-width: 400px;
}
.input-group label {
    display: block;
    text-align: left;
    color: #88bbff;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
input[type="text"], input[type="number"], select {
    background: rgba(10, 20, 40, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid #4488ff;
    color: #fff;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px;
    font-size: 1em;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
    transition: all 0.2s;
}
input:focus, select:focus {
    border-color: #88bbff;
    outline: none;
    box-shadow: 0 0 10px rgba(68,136,255,0.5), inset 0 0 5px rgba(0,0,0,0.8);
}

/* Idiomas */
.lang-selector {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.lang-btn {
    font-size: 2em;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: 0.2s;
    background: rgba(255,255,255,0.05);
    padding: 5px;
}
.lang-btn:hover {
    background: rgba(68, 136, 255, 0.2);
    transform: scale(1.1);
}
.lang-btn.active {
    border-color: #4488ff;
    background: rgba(68, 136, 255, 0.4);
    box-shadow: 0 0 10px rgba(68,136,255,0.5);
}

/* Mensagens de Erro Flash */
.error-message {
    color: #ff6666;
    background: rgba(255, 0, 0, 0.2);
    backdrop-filter: blur(3px);
    border: 1px solid #ff4444;
    padding: 10px;
    margin-top: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    display: none;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-sizing: border-box;
    z-index: 150;
    box-shadow: 0 0 10px rgba(255,0,0,0.3);
}

.settings-grid-layout {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Responsividade Landscape para Configurações */
@media (min-width: 800px) {
    .settings-grid-layout .tab-content.active {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        align-items: start;
    }
    .settings-grid-layout .input-group {
        max-width: 100%;
    }
}

.tab-container {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid rgba(68, 136, 255, 0.3);
    padding-bottom: 10px;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 15px auto;
}

.tab-btn {
    background: none;
    border: none;
    color: #88bbff;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.3s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(68, 136, 255, 0.1);
}

.tab-btn.active {
    color: #fff;
    border-bottom: 2px solid #4488ff;
    text-shadow: 0 0 10px rgba(68, 136, 255, 0.8);
}

.tab-content {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Overlay de Cor */
#color-selection-overlay, .modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 500;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(10,20,40,0.95);
    border: 2px solid #4488ff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 30px rgba(68,136,255,0.5);
    max-width: 400px;
    width: 90%;
}

.modal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 25px;
}

.modal-buttons .btn {
    margin: 0;
    padding: 10px 20px;
}
/* Oficina e Upgrades */
.upgrade-category-title {
    font-size: 0.75em;
    color: #4488ff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 15px 0 8px 0;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(68, 136, 255, 0.2);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(68, 136, 255, 0.5);
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
}

.tech-btn {
    width: 100%;
    background: rgba(10, 30, 60, 0.6);
    border: 1px solid #4488ff;
    color: #fff;
    padding: 8px 5px;
    font-size: 0.8em;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
    font-weight: bold;
}

.tech-btn:hover:not(:disabled) {
    background: rgba(68, 136, 255, 0.3);
    box-shadow: 0 0 10px rgba(68, 136, 255, 0.5);
}

.tech-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #444;
}

.upgrade-info {
    font-size: 0.65em;
    color: #88bbff;
    margin-top: 3px;
    text-align: center;
    font-weight: bold;
    min-height: 1.2em;
}

.upgrade-cost {
    font-size: 0.65em;
    color: #ffdd00;
    text-align: center;
    margin-top: 1px;
}

/* Workshop Responsivo */
.workshop-side-by-side {
    display: flex;
    flex-direction: column;
    gap: 0;
}

@media (min-width: 600px) {
    .workshop-side-by-side {
        flex-direction: row;
        gap: 20px;
    }
    .workshop-side-by-side .category-column {
        flex: 1;
    }
}

#color-options {
    background: rgba(10,20,40,0.9);
    border: 2px solid #4488ff;
    padding: 20px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 10px;
    box-shadow: 0 0 20px rgba(68,136,255,0.5);
    width: 90%;
    max-width: 400px;
}