@import url('../../../common/fonts/anton.css');

/* General Styles */
:root {
    --display-font: 'Anton', Impact, Haettenschweiler, 'Arial Narrow Bold', 'Arial Black', sans-serif;
}

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

html {
    height: 100%;
}

/* Split body styles into generic and page-type specific */
body {
    background: #111;
    color: #ccc;
    font-family: 'Courier New', monospace, sans-serif;
    min-height: 100vh;
}

body.game-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    touch-action: none;
}

body.about-page {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Content starts from top */
    overflow-y: auto;
    /* Allow vertical scrolling */
}


/* Game Container Styles */
#game-container {
    position: relative;
    width: 100%;
    max-width: 540px;
    height: 100vh;
    height: 100dvh;
    /* Only effective on game-page */
    overflow: hidden;
    /* Only effective on game-page */
    background: #000;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 600px) {
    #game-container {
        height: auto;
        max-height: 95vh;
        aspect-ratio: 9 / 16;
        border-radius: 15px;
        border: 2px solid rgba(0, 255, 255, 0.7);
    }

    body.game-page {
        /* Only for index.html body */
        min-height: 100vh;
        /* Override existing min-height */
    }
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    flex: 1;
    image-rendering: pixelated;
}

/* UI Styles */
#ui {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #0ff;
    font-size: 14px;
    text-shadow: 0 0 10px #0ff;
    z-index: 10;
}

#adrenaline-status {
    color: #f00;
    font-weight: bold;
    text-shadow: 0 0 10px #f00, 0 0 15px #f00;
    margin-top: 2px;
}

/* Buttons */
#drawModeBtn {
    position: absolute;
    bottom: 20px;
    bottom: calc(constant(safe-area-inset-bottom, 0px) + 20px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #0ff;
    color: #0ff;
    font-size: 16px;
    cursor: pointer;
    text-shadow: 0 0 10px #0ff;
    box-shadow: 0 0 20px #0ff;
    /* Specify transition properties explicitly */
    transition: background-color 0.3s, box-shadow 0.3s, opacity 0.3s, transform 0.3s;
    z-index: 100;
}

/* Add :not(:disabled) to prevent hover effects when disabled */
#drawModeBtn:hover:not(:disabled) {
    background: rgba(0, 255, 255, 0.4);
    transform: translateX(-50%) scale(1.1);
}


#aboutBtn {
    position: absolute;
    display: none;
    bottom: 90px;
    bottom: calc(constant(safe-area-inset-bottom, 0px) + 90px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #0ff;
    color: #0ff;
    font-size: 16px;
    cursor: pointer;
    text-shadow: 0 0 10px #0ff;
    text-decoration: none;
    transition: all 0.3s;
    z-index: 201;
}

#aboutBtn:hover:not(:disabled) {
    background: rgba(0, 255, 255, 0.3);
    transform: translateX(-50%) scale(1.05);
}

#shareBtn,
#pauseBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 15px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #0ff;
    color: #0ff;
    font-size: 14px;
    cursor: pointer;
    text-shadow: 0 0 10px #0ff;
    transition: all 0.3s;
    z-index: 10;
    font-family: 'Courier New', monospace;
    /* Match other UI */
}

#pauseBtn {
    top: 10px;
}

#shareBtn:hover:not(:disabled),
#pauseBtn:hover:not(:disabled) {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}

#helpBtn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(255, 165, 0, 0.5);
    border: 3px solid #ffa500;
    border-radius: 5px;
    color: #fff;
    font-family: var(--display-font);
    font-weight: 400;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    font-size: 18px;
    letter-spacing: 1px;
    cursor: pointer;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7), 0 0 10px #ff0;
    box-shadow: 0 0 30px #ffa500;
    z-index: 40;
    animation: help-pulse 1s infinite;
}

/* Instructions and Overlays */
#instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #0ff;
    font-size: 18px;
    text-shadow: 0 0 20px #0ff;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border: 2px solid #0ff;
    width: 90%;
    z-index: 200;
}

#instructions h2 {
    font-family: var(--display-font);
    font-weight: 400;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    font-size: 48px;
    letter-spacing: 3px;
    margin-bottom: 20px;
    animation: title-pulse 2s infinite;
}

.warning,
.danger {
    position: absolute;
    left: 50%;
    font-family: var(--display-font);
    font-weight: 400;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    z-index: 20;
    letter-spacing: 5px;
}

.warning {
    top: 40%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    color: #f00;
    text-shadow: 0 0 30px #f00, 0 0 50px #f00;
    animation: pulse 0.5s infinite;
}

.danger {
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    color: #ff0;
    text-shadow: 0 0 40px #ff0, 0 0 60px #f00;
    animation: danger-pulse 0.3s infinite;
    z-index: 25;
}

.game-effect-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--display-font);
    font-weight: 400;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    text-align: center;
    z-index: 50;
    pointer-events: none;
    animation: text-fade-out 2s forwards;
}

#takeoffText {
    font-size: 100px;
    color: #0ff;
    text-shadow: 0 0 30px #0ff;
}

#burstText {
    font-size: 120px;
    color: #ff0;
    text-shadow: 0 0 40px #ff0;
}

#burstText small {
    font-size: 20px;
    color: #fff;
    display: block;
}

/* LockOn Sight */
.lockOnSight {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid #ff0;
    border-radius: 50%;
    box-shadow: 0 0 20px #ff0, inset 0 0 20px #ff0;
    animation: lockOn 0.8s infinite;
    pointer-events: none;
    z-index: 15;
}

.lockOnSight::before,
.lockOnSight::after {
    content: '';
    position: absolute;
    background: #ff0;
    box-shadow: 0 0 10px #ff0;
}

.lockOnSight::before {
    width: 40px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.lockOnSight::after {
    width: 2px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Misc */
#copyright {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-family: 'Courier New', monospace;
    color: rgba(0, 255, 255, 0.6);
    text-decoration: none;
    font-size: 12px;
    text-shadow: 0 0 5px #0ff;
    z-index: 300;
    display: none;
}

#copyright:hover {
    color: rgba(0, 255, 255, 1);
}

.hide {
    display: none;
}

/* Animations */
@keyframes title-pulse {

    0%,
    100% {
        text-shadow: 0 0 20px #0ff;
        opacity: 1;
    }

    50% {
        text-shadow: 0 0 30px #0ff, 0 0 40px #0ff;
        opacity: 0.8;
    }
}

@keyframes lockOn {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(180deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes danger-pulse {

    0%,
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

@keyframes text-fade-out {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

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

    50% {
        transform: scale(1.1);
    }

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

/* About Page Specific Styles */
#about-container {
    max-width: 600px;
    width: 100%;
    border: 2px solid rgba(0, 255, 255, 0.7);
    background: #000;
    padding: 20px 30px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    /* margin-top: 20px; /* Add some space from top if align-items:flex-start */
}

#about-container h1,
#about-container h2,
#about-container h3 {
    font-family: var(--display-font);
    font-weight: 400;
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

#about-container h1 {
    font-size: 38px;
    text-align: center;
    margin-bottom: 25px;
}

#about-container h2 {
    font-size: 28px;
    border-bottom: 2px solid #0ff;
    padding-bottom: 5px;
    margin-top: 25px;
}

#about-container h3 {
    font-size: 22px;
    color: #ff0;
    text-shadow: 0 0 10px #ff0;
    margin-top: 20px;
}

#about-container p,
#about-container li {
    font-size: 15px;
    line-height: 1.7;
    /* color: #ccc; */
    /* Inherited from body */
}

#about-container ul {
    list-style: none;
    padding-left: 0;
}

#about-container li {
    background: rgba(0, 255, 255, 0.05);
    padding: 10px;
    border-left: 3px solid #0ff;
    margin-bottom: 10px;
}

#about-container strong {
    color: #0ff;
    font-weight: normal;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 40px;
    padding: 12px 20px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #0ff;
    color: #0ff;
    font-size: 16px;
    cursor: pointer;
    text-shadow: 0 0 10px #0ff;
    text-decoration: none;
    transition: all 0.3s;
}

.back-link:hover:not(:disabled) {
    background: rgba(0, 255, 255, 0.4);
    transform: scale(1.05);
}

.mode-desc strong {
    color: #ffa500;
}

.mode-desc-danger strong {
    color: #f00;
}


/* Media Queries for Responsiveness */
@media (max-height: 600px) {
    #ui {
        font-size: 12px;
    }

    #drawModeBtn {
        padding: 8px 16px;
        font-size: 14px;
        bottom: 10px;
        bottom: calc(constant(safe-area-inset-bottom, 0px) + 10px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    }

    #aboutBtn {
        padding: 8px 16px;
        font-size: 14px;
        bottom: 70px;
        bottom: calc(constant(safe-area-inset-bottom, 0px) + 70px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 70px);
    }

    #instructions {
        padding: 15px;
    }

    #instructions h2 {
        font-size: 36px;
    }

    #shareBtn,
    #pauseBtn {
        padding: 4px 10px;
        font-size: 12px;
    }

    #helpBtn {
        padding: 8px 16px;
        font-size: 16px;
        bottom: 10px;
    }
}

/* Mobile only (PC: 600px and above unchanged). Keep the same glow values as
   PC and only constrain the size so the text fits within the screen width */
@media (max-width: 599px) {
    .warning {
        text-shadow: 0 0 30px #f00, 0 0 50px #f00;
        font-size: min(80px, 15vw);
        white-space: nowrap;
    }

    .danger {
        text-shadow: 0 0 40px #ff0, 0 0 60px #f00;
        font-size: min(100px, 17vw);
        white-space: nowrap;
    }

    #takeoffText {
        text-shadow: 0 0 30px #0ff;
        font-size: min(100px, 19vw);
        white-space: nowrap;
    }

    #burstText {
        text-shadow: 0 0 40px #ff0;
        font-size: min(120px, 24vw);
        white-space: nowrap;
    }
}

@media (max-width: 360px) {
    #game-container {
        max-width: 100vw;
    }
}

/* Disabled button styles */
button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    /* transform: none !important; Removed: this was causing slide issues */
    box-shadow: none !important;
}

/* Control transform when #drawModeBtn is disabled */
#drawModeBtn:disabled {
    transform: translateX(-50%);
    /* Maintain center alignment and reset scale */
}
