@import "resets.css";
@import url('https://fonts.cdnfonts.com/css/aux-dotbitc');

/* || THEME VARIABLES */
:root {
    --bg-body: #cacaca;
    --text-main: #111;
    --container-bg: #f1f1f1;
    --view-bg: #a7a7a7;
    --view-border: #3b3d47;
    --textbox-bg: #404f64;
    --textbox-text: #e6e6e6;
    --textbox-border: rgb(175, 154, 96);
    --button-bg: rgb(230, 230, 230);
    --button-hover: rgb(196, 196, 196);
    --action-bg: rgb(48, 48, 48);
    --controller-bg: #1e1e22;
    --control-btn-bg: rgb(138, 138, 138);
    --control-btn-hover: rgb(199, 199, 199);
    --shadow: rgba(49, 49, 49, 0.64);
}

body.theme-light {
    --bg-body: #d7d7d7;
    --text-main: #111;
    --container-bg: #f1f1f1;
    --view-bg: #b0b0b0;
    --view-border: #3b3d47;
    --textbox-bg: #404f64;
    --textbox-text: #f3f3f3;
    --textbox-border: rgb(175, 154, 96);
    --button-bg: #ededed;
    --button-hover: #d1d1d1;
    --action-bg: rgb(48, 48, 48);
    --controller-bg: #1e1e22;
    --control-btn-bg: #8a8a8a;
    --control-btn-hover: #c7c7c7;
    --shadow: rgba(49, 49, 49, 0.64);
}

body.theme-dark {
    --bg-body: #000000;
    --text-main: #ffffff;
    --container-bg: #1a1a1a;
    --view-bg: #222222;
    --view-border: #333333;
    --textbox-bg: #1a1a1a;
    --textbox-text: #ffffff;
    --textbox-border: #333333;
    --button-bg: #2a2a2a;
    --button-hover: #3a3a3a;
    --action-bg: #1a1a1a;
    --controller-bg: #0a0a0a;
    --control-btn-bg: #2a2a2a;
    --control-btn-hover: #3a3a3a;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    display: flex; 
    align-items: center; 
    justify-content: center;
    flex-direction: column;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: transparent;
    z-index: 0;
}

body.theme-dark::before {
    opacity: 0;
}

* {
    font-family: 'AuX DotBitC', sans-serif;
    font-size: min(2vw, 15px);
}

#title {
    text-align: center;
    font-size: min(3vw, 30px);
    margin-bottom: 2em;
    padding: 0;
    color: var(--text-main);
    transition: color 0.4s ease;
    position: relative;
    z-index: 1;
}

/* || CONTAINER */ 
#container {
    position: relative;
    width: 85%;
    max-width: 600px;
    border-radius: 2em;
    display: grid; 
    grid-template-columns: 1fr; 
    grid-template-rows: 1fr 0.3fr;
    grid-template-areas: "view"
            "controller";
    background: var(--container-bg);
    box-shadow: 12px 14px 15px 5px var(--shadow);
    transition: background 0.4s ease, box-shadow 0.4s ease;
    z-index: 1;
}


/* || VIEW */ 
#view {
    border: 1.5em solid var(--view-border);
    border-bottom: 0;
    border-radius: 2em 2em 0 0;
    position: relative; 
    overflow: hidden;
    display: grid; 
    grid-template-columns: 1fr; 
    grid-template-rows: 1fr 0.3fr;
    background: var(--view-bg);
    transition: border-color 0.4s ease, background 0.4s ease;
}

#view::before {
    content: "Press the POWER button to play/restart";
    display: flex; 
    align-items: center;
    justify-content: center;
    width: 100%; 
    height: 100%; 
    position: absolute;
    top: 0;
    z-index: 2;
    background: rgb(155, 155, 155);
    color: var(--text-main);
    transition: color 0.4s ease;
}

#view.no-screen::before {
    display: none;
}

#view.intro-playing::before {
    content: "";
    background: black;
}

/* || OPEN ANIMATION */ 
#view.init::before {
    content: ""; 
    animation-name: open-animation;
    animation-iteration-count: 2;
    animation-duration: 1s;
    animation-fill-mode:forwards;
}

#view.init .player {
    animation-name: player-move-in;
    animation-duration: 1s;
    animation-delay: 0.5s; 
    animation-timing-function: ease-out;
    animation-fill-mode:forwards;
}

#view.init .computer {
    animation-name: computer-move-in;
    animation-delay: 1s;
    animation-duration: 1s;
    animation-timing-function: ease-out;
    animation-fill-mode:forwards;
}

@keyframes open-animation {
    50% {
        background: black; 
        opacity: 0.8; 
    }
    75% {
        opacity: 0.9;
    }
    100% {
       opacity: 0;
    }
}

@keyframes player-move-in {
    100% {
        left: -3%;
    }
}

@keyframes computer-move-in {
    100% {
        right: 7%;
    }
}

/* || IMAGES & GAME SCENE */ 
#images {
    position: relative;
    overflow: hidden;
}

.scene {
    display: block ;
    width: 100%;
}


/* || PLAYER & COMPUTER TAG */ 
.player-tag {
    width: 100%;
}
.player-tag-group {
    position: absolute; 
    right: 5%;
    bottom: 3%;
    width: 30%;
    color: #111;
}
.player-tag-level {
    position: absolute; 
    top: 28%;
    right: 12%;
    z-index: 1;
}
.player-tag-score-outer {
    width: 46%; 
    height: 12%; 
    border: 1px solid #1e1e22;
    background: gray;
    position: absolute; 
    top: 45%; 
    right: 10%;
    border-radius: 1em;
    z-index: 1;
}
.player-tag-score {
    width: 100%; 
    height: 100%;
    border-radius: 1em;
    background: rgb(133, 218, 175);
    position: relative; 
    transition: 0.2s; 
}
.player-tag-name {
    position: absolute; 
    top: 28%;
    right: 32%;
    z-index: 1;
}

.computer-tag {
    width: 100%;
}

/* Enhance tag visibility in dark mode */
body.theme-dark .player-tag,
body.theme-dark .computer-tag {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.6)) brightness(1.15);
}
.computer-tag-group {
    position: absolute; 
    width: 32%;
    top: 5%; 
    left: 10%;
    color: #111;
}
.computer-tag-level {
    position: absolute; 
    top: 22%; 
    right: 20%;
    z-index: 1;
}
.computer-tag-name {
    position: absolute; 
    top: 22%; 
    right: 35%;
    z-index: 1;
}
.computer-tag-score-outer {
    width: 46%; 
    height: 14%; 
    border: 1px solid #1e1e22;
    position: absolute; 
    top: 43%; 
    background: gray;
    right: 18%;
    border-radius: 1em;
    z-index: 1;
}
.computer-tag-score {
    width: 100%; 
    height: 100%;
    transition: 0.2s; 
    border-radius: 1em;
    background: rgb(133, 218, 175);
    position: relative; 
}

/* || PLAYER & COMPUTER & CHOICES SPRITES */ 
.player {
    position: absolute; 
    bottom: -40%;
    left: -35%;
    width: 54%;
}

.computer {
    position: absolute; 
    top:15%;
    right: -35%;
    width: 33%;
}

.choice {
    position: absolute;
    width: 15%;
}

.player-choice {
    bottom: -10%; 
    left: 25%;
    opacity: 0;
}

.computer-choice {
    top: 30%; 
    right: 15%; 
    opacity: 0;
}


/* || PLAYER & COMPUTER ANIMATION */ 
.player.tie {
    animation-name: tie; 
    animation-duration: 1s; 
}

.computer.tie {
    animation-name: tie; 
    animation-duration: 1s; 
}

.player.hurt {
    animation-name: hurt; 
    animation-duration: 1s; 
}

.computer.hurt {
    animation-name: hurt; 
    animation-duration: 1s; 
}

.player-choice.shoot {
    animation-name: player-shoot; 
    animation-duration: 1s; 
    animation-fill-mode: forwards; 
}

.computer-choice.shoot {
    z-index: 2;
    animation-name: computer-shoot; 
    animation-duration: 1s; 
    animation-fill-mode: forwards; 
}

@keyframes computer-shoot {
    50% {
        right: 40%; 
        opacity: 1; 
    }
    100% {
        right: 40%;
        opacity: 0; 
    }
}

@keyframes player-shoot {
    50% {
        bottom: 25%; 
        opacity: 1; 
    }
    100% {
        bottom: 15%;
        opacity: 0; 
    }
}

@keyframes tie {
    50% {
        transform: translateY(-0.5em);
    }
    70% {
        transform: translateY(0.5em);
    }
    80% {
        transform: scale(1.2);
    }
}

@keyframes hurt {
    50% {
        transform: translateY(1em);
    }
    70% {
        transform: rotate(20deg);
    }
    80% {
        transform: scale(1.2);
        filter: sepia(100%);
    }
}


/* || TEXTBOX & CHOICES BUTTONS */ 
#action {
    padding-top: 0.5%;
    background: var(--action-bg);
    display: grid; 
    grid-template-columns: 1fr 0.7fr;
    grid-column-gap: 0.5%;
    grid-template-rows: 1fr;
    transition: background 0.4s ease;
}   

.textbox {
    text-overflow:ellipsis;
    padding: 3%;
    background: var(--textbox-bg);
    border: 0.3em solid var(--textbox-border);
    color: var(--textbox-text);
    border-radius: 0.5em 0 0 0.5em;
    border-right: none;    
    line-height: 1em;
    transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.choices {
    border: 0.3em solid rgb(123, 123, 206);
    border-radius: 0.5em;
    display: grid; 
    background: var(--button-bg);
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr; 
    align-content: center;
    justify-content: center;
    transition: background 0.4s ease;
}

.choices button {
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    border: none;
    background: var(--button-bg);
    color: var(--text-main);
}

.choices button:hover {
    background: var(--button-hover);
}


/* || CONTROLLER */ 
.controller {
    grid-area: controller;
    background: var(--controller-bg);
    width: 100%;
    border-radius: 0 0 2em 2em;
    position: relative;
    overflow: hidden;
    transition: background 0.4s ease;
}

.control-btns {
    height: 100%;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-around;
}

.control-btn {
    padding: 3%;
    border-radius: 50%; 
    background: var(--control-btn-bg);
    border: none;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.control-btn:hover {
    background: var(--control-btn-hover);
}

.difficulty-select {
    background: var(--control-btn-bg);
    color: var(--text-main);
    border: none;
    padding: 0.5em 1em;
    border-radius: 1em;
    cursor: pointer;
    outline: none;
    transition: background 0.3s ease, color 0.3s ease;
    text-transform: uppercase;
}

.difficulty-select:hover {
    background: var(--control-btn-hover);
}

/* || FOOTER */ 
footer {
    margin-top: 2em;
    color: var(--text-main);
    transition: color 0.4s ease;
    position: relative;
    z-index: 1;
}

/* || INTRO SCREEN */
#intro-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #111;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#intro-screen.active {
    opacity: 1;
    visibility: visible;
}

.intro-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.intro-title {
    color: #fff;
    font-size: min(3vw, 24px);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(-20px);
}

#intro-screen.active .intro-title {
    animation: fadeSlideDown 0.8s ease 0.2s forwards;
}

.intro-subtitle {
    color: #ffcb05;
    text-shadow: 2px 2px 0px #3c5aa6;
    font-size: min(2vw, 16px);
    margin: 10px 0 30px 0;
    opacity: 0;
    transform: translateY(20px);
}

#intro-screen.active .intro-subtitle {
    animation: fadeSlideUp 0.8s ease 0.6s forwards;
}

.intro-sprites {
    display: flex;
    column-gap: 15px;
    margin-bottom: 30px;
}

.intro-sprite {
    width: 40px;
    height: 40px;
    opacity: 0;
    transform: scale(0.5);
}

#intro-screen.active .intro-sprite:nth-child(1) { animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.2s forwards; }
#intro-screen.active .intro-sprite:nth-child(2) { animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.5s forwards; }
#intro-screen.active .intro-sprite:nth-child(3) { animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.8s forwards; }

.intro-blinking {
    color: #fff;
    font-size: min(1.5vw, 12px);
    opacity: 0;
}

#intro-screen.active .intro-blinking {
    animation: introBlink 1s step-end infinite, fadeIn 0.5s ease 2.5s forwards;
}

@keyframes fadeSlideDown {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideUp {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
    to { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn {
    to { opacity: 1; }
}
@keyframes introBlink {
    50% { opacity: 0; }
}