@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    border: 2px solid #444;
    background: #000;
    box-shadow: 0 0 10px rgba(0, 153, 255, 0.5);
    position: relative;
    z-index: 2;
}

#start-screen, #game-over-screen, #mission-complete-screen, #upgrade-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
    text-align: center;
}

#game-over-screen, #mission-complete-screen, #upgrade-screen {
    display: none;
}

h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ff4500;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.7);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #00bfff;
}

.mission-info {
    font-size: 1.2rem;
    max-width: 600px;
    margin-bottom: 2rem;
    line-height: 1.6;
}

button {
    background: linear-gradient(to bottom, #005288, #003366);
    color: white;
    border: none;
    padding: 12px 24px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s;
}

button:hover {
    background: linear-gradient(to bottom, #ff4500, #d03000);
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.7);
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    z-index: 5;
}

#score, #lives, #mission-status, #research-points {
    font-size: 1.2rem;
    text-shadow: 0 0 5px rgba(0, 191, 255, 0.7);
}

#mission-status {
    color: #00ff00;
}

#research-points {
    color: #ffcc00;
}

#distance-bar-container {
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    padding: 0 10px;
    display: flex;
    align-items: center;
    z-index: 5;
}

#distance-bar {
    flex-grow: 1;
    height: 10px;
    background: #222;
    border-radius: 5px;
    overflow: hidden;
    margin: 0 10px;
}

#distance-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #00bfff, #ff4500);
    transition: width 0.5s;
}

#earth, #mars {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

#earth {
    background: radial-gradient(circle at 30% 30%, #1E90FF, #0000FF);
    box-shadow: 0 0 5px #1E90FF;
}

#mars {
    background: radial-gradient(circle at 30% 30%, #FF6347, #8B0000);
    box-shadow: 0 0 5px #FF6347;
}

.star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    z-index: 1;
}

#tardigrade-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 0.9rem;
    color: #00bfff;
    z-index: 5;
}

#shield-info {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.9rem;
    color: #7e42ff;
    z-index: 5;
}

#level-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #ff4500;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.7);
    z-index: 20;
    opacity: 0;
    transition: opacity 1s;
}

.explosion {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #ff4500, #ff0000, transparent);
    z-index: 3;
    pointer-events: none;
}

#warning-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
    z-index: 20;
    opacity: 0;
    transition: opacity 0.5s;
}

#abilities-container {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 5;
}

.ability {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #003366;
    border: 2px solid #00bfff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    position: relative;
    cursor: pointer;
}

.ability:hover {
    box-shadow: 0 0 10px #00bfff;
}

.ability.cooldown:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 0 0 25px 25px;
}

.ability-icon {
    width: 30px;
    height: 30px;
}

#upgrade-screen {
    padding: 20px;
}

.upgrade-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    max-width: 800px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.upgrade-item {
    width: 200px;
    background: linear-gradient(to bottom, #002244, #001122);
    border: 2px solid #005288;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
}

.upgrade-item:hover {
    border-color: #00bfff;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
}

.upgrade-item h3 {
    color: #00bfff;
    margin-bottom: 10px;
}

.upgrade-item p {
    font-size: 0.8rem;
    margin-bottom: 10px;
    color: #ddd;
}

.upgrade-item button {
    font-size: 0.9rem;
    padding: 5px 10px;
}

.upgrade-item button.disabled {
    background: linear-gradient(to bottom, #444, #333);
    cursor: not-allowed;
}

#available-points {
    font-size: 1.5rem;
    color: #ffcc00;
    margin-bottom: 20px;
}

/* Communication box */
#comms-container {
    position: absolute;
    bottom: 100px;
    left: 10px;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 1px solid #005288;
    border-radius: 5px;
    padding: 10px;
    font-size: 0.9rem;
    z-index: 5;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

#comms-container.active {
    transform: translateY(0);
    opacity: 1;
}

#comms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #005288;
}

#comms-source {
    color: #00bfff;
    font-weight: bold;
}

#comms-message {
    color: #fff;
    line-height: 1.4;
}

/* Mission Dialog Screen Styles */
#mission-dialog-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none; /* Initially hidden */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10;
}

.dialog-container {
    width: 90%;
    max-width: 900px;
    height: 80%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dialog-top, .dialog-bottom {
    display: flex;
    margin: 10px 0;
}

.dialog-bottom {
    opacity: 0.7; /* Slightly dimmed when not active */
    transition: opacity 0.3s;
}

.dialog-bottom.active {
    opacity: 1;
}

.character-portrait {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #005288;
    box-shadow: 0 0 15px rgba(0, 82, 136, 0.5);
    background-color: #001122;
}

.character-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dialog-box {
    flex-grow: 1;
    margin-left: 20px;
    background: rgba(0, 20, 40, 0.7);
    border: 2px solid #005288;
    border-radius: 10px;
    padding: 15px;
    position: relative;
}

.character-name {
    position: absolute;
    top: -15px;
    left: 20px;
    background: #005288;
    padding: 2px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.dialog-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-top: 10px;
    min-height: 80px;
}

.dialog-controls {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

#dialog-next-button {
    background: linear-gradient(to bottom, #005288, #003366);
    padding: 10px 20px;
}

#dialog-skip-button {
    background: linear-gradient(to bottom, #444, #333);
    padding: 10px 20px;
}

/* For the cursor effect */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 20px;
    background-color: #fff;
    margin-left: 3px;
    animation: blink 0.7s infinite;
    vertical-align: middle;
}

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