/* Reset e Configurações Gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-black: #000000;
    --color-red: #CC0000;
    --color-yellow: #FFCC00;
    --color-dark-bg: #0A0A0F;
    --color-terminal-bg: #1A1A2E;
    --color-terminal-text: #00FF88;
    --color-success: #00CC44;
    --color-error: #FF3333;
    --color-warning: #FF9900;
    --color-info: #0099FF;
    --color-border: #333344;
    --color-card-bg: #222233;
}

body {
    font-family: 'Courier New', monospace;
    background-color: var(--color-dark-bg);
    color: #FFFFFF;
    line-height: 1.6;
    overflow-x: hidden;
}

.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex: 1;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* TELA INICIAL */
.terminal-header {
    background: var(--color-terminal-bg);
    padding: 10px 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.terminal-dots {
    display: flex;
    gap: 8px;
}

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

.dot.red { background: var(--color-error); }
.dot.yellow { background: var(--color-warning); }
.dot.green { background: var(--color-success); }

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

.start-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.start-content h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: var(--color-red);
}

.code-tag {
    color: var(--color-terminal-text);
    font-size: 2.5rem;
}

.start-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--color-yellow);
}

.year {
    color: var(--color-terminal-text);
    background: var(--color-terminal-bg);
    padding: 2px 10px;
    border-radius: 5px;
    font-size: 1.5rem;
}

.subtitle {
    font-size: 1.3rem;
    margin-bottom: 40px;
    color: #AAAAAA;
}

.html-tag {
    color: var(--color-terminal-text);
    font-weight: bold;
    background: var(--color-terminal-bg);
    padding: 2px 8px;
    border-radius: 3px;
}

.avatar-container {
    margin: 30px 0;
}

.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-black) 0%, var(--color-terminal-bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 3px solid var(--color-red);
    box-shadow: 0 0 20px rgba(204, 0, 0, 0.5);
}

.avatar i {
    font-size: 4rem;
    color: var(--color-yellow);
    z-index: 2;
}

.flag-stripes {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    z-index: 1;
}

.stripe {
    height: 33.33%;
    width: 100%;
}

.stripe.black { background: var(--color-black); }
.stripe.red { background: var(--color-red); }
.stripe.yellow { background: var(--color-yellow); }

.instructions {
    background: var(--color-card-bg);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    max-width: 600px;
    width: 100%;
    border-left: 4px solid var(--color-red);
}

.instructions p {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions i {
    color: var(--color-yellow);
    font-size: 1.2rem;
}

.btn-connect {
    background: linear-gradient(to right, var(--color-red), var(--color-yellow));
    color: var(--color-black);
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    margin: 30px 0;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-connect:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(204, 0, 0, 0.4);
}

.code-line {
    background: var(--color-terminal-bg);
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 20px;
    text-align: left;
    width: 100%;
    max-width: 600px;
}

.prompt {
    color: var(--color-success);
    font-weight: bold;
}

.typing {
    color: #FFFFFF;
    animation: typing 3s steps(40) infinite;
}

@keyframes typing {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* TELA DO JOGO */
.game-header {
    background: var(--color-terminal-bg);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.game-info {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.status-box {
    background: var(--color-card-bg);
    padding: 8px 15px;
    border-radius: 5px;
    border-left: 3px solid var(--color-info);
    min-width: 120px;
}

.status-box.lives {
    border-left-color: var(--color-error);
}

.status-box.timer {
    border-left-color: var(--color-warning);
}

.status-box.streak {
    border-left-color: #FF6600;
    background: linear-gradient(45deg, rgba(255, 102, 0, 0.2), rgba(255, 153, 0, 0.2));
}

.status-label {
    color: #AAAAAA;
    font-size: 0.9rem;
    margin-right: 5px;
}

.status-label i {
    margin-right: 5px;
}

.status-value {
    color: #FFFFFF;
    font-weight: bold;
}

/* Timer e Streak Styles */
.timer-box, .streak-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.timer-box .timer-text {
    color: #FFFFFF;
    font-size: 1.1rem;
}

.timer-box .bonus-text {
    color: #00CC44;
    font-size: 0.8rem;
    font-weight: bold;
}

.blink {
    animation: blink 0.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.streak-box {
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
}

.streak-text {
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 102, 0, 0.8);
}

.streak-label {
    font-size: 0.7rem;
    opacity: 0.9;
}

.progress-container {
    flex: 1;
    min-width: 300px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #AAAAAA;
}

.progress-bar {
    height: 10px;
    background: var(--color-card-bg);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--color-red), var(--color-yellow));
    width: 0%;
    transition: width 0.5s ease;
}

.game-body {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 500px;
}

.question-panel {
    flex: 1;
    min-width: 300px;
}

.map-panel {
    flex: 1;
    min-width: 300px;
}

.terminal-window {
    background: var(--color-terminal-bg);
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.window-header {
    background: var(--color-black);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.window-actions {
    display: flex;
    gap: 10px;
}

.power-up-btn {
    background: var(--color-card-bg);
    color: #FFFFFF;
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.power-up-btn:hover:not(:disabled) {
    background: var(--color-info);
    transform: translateY(-2px);
}

.power-up-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-text {
    display: none;
}

@media (min-width: 768px) {
    .btn-text {
        display: inline;
    }
}

.terminal-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.question-header {
    background: var(--color-card-bg);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    border-left: 3px solid var(--color-terminal-text);
}

.question-container {
    flex: 1;
}

#question-text {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #FFFFFF;
    line-height: 1.4;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-black);
    color: var(--color-yellow);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.answers-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.answer-btn {
    background: var(--color-card-bg);
    border: 2px solid var(--color-border);
    color: #FFFFFF;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--color-info);
    transform: translateX(5px);
}

.answer-btn.correct {
    border-color: var(--color-success);
    background: rgba(0, 204, 68, 0.1);
}

.answer-btn.incorrect {
    border-color: var(--color-error);
    background: rgba(255, 51, 51, 0.1);
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.terminal-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cursor {
    color: var(--color-terminal-text);
    animation: blink 1s infinite;
}

.feedback {
    color: var(--color-terminal-text);
    font-weight: bold;
}

/* Painel do Mapa */
.map-container {
    background: var(--color-terminal-bg);
    border-radius: 10px;
    padding: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.map-header h3 {
    color: var(--color-yellow);
    font-size: 1.1rem;
}

.map-legend {
    display: flex;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #AAAAAA;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.connected { background: var(--color-success); }
.legend-dot.current { background: var(--color-yellow); }
.legend-dot.locked { background: var(--color-border); }

.world-map {
    flex: 1;
    background: var(--color-card-bg);
    border-radius: 8px;
    position: relative;
    min-height: 300px;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 400" fill="%23333344"><path d="M..."/></svg>');
    background-size: cover;
    background-position: center;
}

.map-point {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    transition: all 0.3s ease;
}

.point-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-black);
    color: #FFFFFF;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.map-point:hover .point-label {
    opacity: 1;
}

.point-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.point-icon.active {
    background: var(--color-yellow);
    color: var(--color-black);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
}

.point-icon.connected {
    background: var(--color-success);
    color: #FFFFFF;
    box-shadow: 0 0 10px rgba(0, 204, 68, 0.8);
}

.point-icon.locked {
    background: var(--color-border);
    color: #888888;
    cursor: not-allowed;
}

.connection-path {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.stats-panel {
    background: var(--color-card-bg);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.stats-panel h4 {
    color: var(--color-yellow);
    margin-bottom: 15px;
    font-size: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-terminal-text);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #AAAAAA;
}

/* Rodapé do Jogo */
.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.hint-box {
    flex: 1;
    min-width: 300px;
    background: var(--color-card-bg);
    padding: 12px 15px;
    border-radius: 5px;
    border-left: 3px solid var(--color-warning);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hint-box i {
    color: var(--color-warning);
    font-size: 1.2rem;
}

.btn-next {
    background: linear-gradient(to right, var(--color-info), var(--color-terminal-text));
    color: var(--color-black);
    border: none;
    padding: 12px 25px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-next:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 153, 255, 0.4);
}

.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animações de Conexão */
.connection-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
}

.ping-circle, .error-circle, .timeout-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    position: relative;
    animation: pulse 1.5s ease-out;
}

.ping-circle {
    border: 5px solid var(--color-success);
    box-shadow: 0 0 30px rgba(0, 204, 68, 0.8);
}

.error-circle {
    border: 5px solid var(--color-error);
    box-shadow: 0 0 30px rgba(255, 51, 51, 0.8);
}

.timeout-circle {
    border: 5px solid var(--color-warning);
    box-shadow: 0 0 30px rgba(255, 153, 0, 0.8);
}

.ping-circle::before, .error-circle::before, .timeout-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    animation: innerPulse 1.5s ease-out 0.3s;
}

.ping-circle::before {
    background: rgba(0, 204, 68, 0.5);
}

.error-circle::before {
    background: rgba(255, 51, 51, 0.5);
}

.timeout-circle::before {
    background: rgba(255, 153, 0, 0.5);
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

@keyframes innerPulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.ping-text, .error-text, .timeout-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FFFFFF;
    font-weight: bold;
    font-size: 1.2rem;
    white-space: nowrap;
}

.ping-text {
    text-shadow: 0 0 10px rgba(0, 204, 68, 0.8);
}

.error-text {
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.8);
}

.timeout-text {
    text-shadow: 0 0 10px rgba(255, 153, 0, 0.8);
}

/* Telas de Game Over e Vitória */
.gameover-content, .victory-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.error-window {
    background: var(--color-terminal-bg);
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    overflow: hidden;
    border: 2px solid var(--color-error);
}

.error-header {
    background: var(--color-error);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.error-header i {
    font-size: 3rem;
}

.error-header h2 {
    font-size: 1.5rem;
}

.error-body {
    padding: 30px;
}

.error-body p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.gameover-stats {
    background: var(--color-card-bg);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.gameover-stats h3 {
    color: var(--color-yellow);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.route-display {
    background: var(--color-black);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    min-height: 100px;
    border: 1px solid var(--color-border);
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.final-stats p {
    background: var(--color-terminal-bg);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
}

.error-message {
    background: var(--color-black);
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
    border-left: 3px solid var(--color-terminal-text);
}

.error-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

.btn-restart {
    background: linear-gradient(to right, var(--color-red), var(--color-yellow));
    color: var(--color-black);
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(204, 0, 0, 0.4);
}

/* Tela de Vitória */
.certificate {
    background: linear-gradient(135deg, var(--color-black) 0%, var(--color-terminal-bg) 100%);
    border-radius: 15px;
    max-width: 700px;
    width: 100%;
    overflow: hidden;
    border: 5px solid var(--color-yellow);
    box-shadow: 0 0 40px rgba(255, 204, 0, 0.5);
}

.certificate-header {
    background: linear-gradient(to right, var(--color-red), var(--color-yellow));
    padding: 30px;
    text-align: center;
    position: relative;
}

.certificate-flag {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 40px;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.flag-stripe {
    height: 33.33%;
    width: 100%;
}

.flag-symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-yellow);
    font-size: 1.5rem;
}

.certificate-header h1 {
    font-size: 2.5rem;
    color: var(--color-black);
    margin-bottom: 10px;
}

.certificate-header h2 {
    font-size: 1.5rem;
    color: var(--color-black);
    opacity: 0.9;
}

.certificate-body {
    padding: 40px;
}

.award-text {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #AAAAAA;
}

.player-name {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    background: linear-gradient(to right, var(--color-red), var(--color-yellow));
    border-radius: 10px;
    border: 3px solid var(--color-black);
}

.player-name span {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--color-black);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.achievement-text {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #CCCCCC;
}

.quote {
    background: var(--color-card-bg);
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
    border-left: 5px solid var(--color-red);
    font-style: italic;
    line-height: 1.8;
}

.quote p {
    margin-bottom: 10px;
}

.victory-stats {
    background: var(--color-black);
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.stat-row:last-child {
    border-bottom: none;
}

.certificate-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 30px;
}

.signature {
    flex: 1;
    min-width: 200px;
}

.signature-line {
    height: 1px;
    background: #FFFFFF;
    margin-bottom: 5px;
}

.signature p {
    color: #AAAAAA;
    font-size: 0.9rem;
}

.share-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-share {
    background: var(--color-info);
    color: #FFFFFF;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-share:hover {
    background: #0077CC;
    transform: translateY(-2px);
}

.btn-play-again {
    background: var(--color-success);
    color: #FFFFFF;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-play-again:hover {
    background: #00AA44;
    transform: translateY(-2px);
}

/* Responsividade */
@media (max-width: 768px) {
    .game-body {
        flex-direction: column;
    }
    
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-info {
        justify-content: center;
    }
    
    .status-box {
        min-width: 100px;
        flex: 1;
    }
    
    .progress-container {
        min-width: 100%;
    }
    
    .game-footer {
        flex-direction: column;
    }
    
    .hint-box, .btn-next {
        min-width: 100%;
    }
    
    .certificate-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .signature {
        min-width: 100%;
        margin-bottom: 20px;
    }
    
    .start-content h1 {
        font-size: 2.5rem;
    }
    
    .start-content h2 {
        font-size: 1.5rem;
    }
    
    .avatar {
        width: 120px;
        height: 120px;
    }
    
    .avatar i {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    .game-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .status-box {
        min-width: 100%;
    }
    
    .map-legend {
        flex-direction: column;
        gap: 8px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}