﻿/* stylesheet for deck, colors, animation, etc. */

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

body 
{
    font-family: sans-serif;
    background: #143F59; /* default before deck selection */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

    /* deck-specific colors of backside */
    body.wyr 
    {
        background: #EF78CF !important;
    }

    body.qa 
    {
        background: #257CA0 !important;
    }

    body.emote 
    {
        background: #85aa98 !important; 
    }

    body.fav 
    {
        background: #039D84 !important;
    }

/* ASCII Art */
pre.ascii-art 
{
    font-family: monospace;
    white-space: pre;
    text-align: center;
    color: #F2EBDF;
}

.mobile-title 
{
    display: none;
}

@media (max-width: 600px) and (orientation: portrait) 
{
    pre.ascii-art 
    {
        display: none;
    }

    .mobile-title 
    {
        display: block;
        font-size: 1.8em;
        color: #F2EBDF;
        text-align: center;
        margin-bottom: 1rem;
    }
}

/* overlay for deck selection */
#game-select 
{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20,63,89,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

    #game-select h2 
    {
        color: #F2EBDF;
        margin-bottom: 20px;
        font-size: 1.5em;
    }

    #game-select button 
    {
        margin: 10px;
        padding: 10px 20px;
        font-size: 1em;
        border: none;
        border-radius: 4px;
        background: #A62626;
        color: #F2EBDF;
        cursor: pointer;
    }

/* actual gameplay area */
#game-area 
{
    position: relative;
    width: 100%;
    height: 400px;
    perspective: 1000px;
}

.card 
{
    width: 250px;
    height: 350px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

#deck 
{
    z-index: 1;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    overflow: hidden;
}

body.started #deck 
{
    transform: translate(calc(-50% - 200px), -50%);
}

#drawn 
{
    opacity: 0;
    z-index: 2;
    pointer-events: none;
}

body.started #drawn 
{
    opacity: 1;
    pointer-events: auto;
}

.card-inner 
{
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    transform: rotateY(180deg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.card.flipped .card-inner 
{
    transform: rotateY(0deg);
}

.card-front, .card-back 
{
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    font-size: 1.2em;
}

.card-front 
{
    background: #F2EBDF;
    visibility: hidden;
}

.card-back 
{
    background: url('cardback.jpeg') center/cover no-repeat;
    transform: rotateY(180deg);
    visibility: visible;
}

/* I did not expect to need so many css revisions, there was always something broken */
.card.flipped .card-front 
{
    visibility: visible;
}

.card.flipped .card-back 
{
    visibility: hidden;
}

/* Deck-type overrides */
body.qa .card-back 
{
    background: url('cardbackqa.jpeg') center/cover no-repeat !important;
}

body.wyr .card-back 
{
    background: url('cardbackwyr.jpeg') center/cover no-repeat !important;
}

body.emote .card-back 
{
    background: url('cardbackemote.jpeg') center/cover no-repeat !important;
}

/* favorite deck back override */
body.fav .card-back 
{
    background: url('cardbackfav.jpeg') center/cover no-repeat !important;
}

/* mobile css, kinda works */
@media (max-width: 600px) and (orientation: portrait) 
{
    #game-area 
    {
        display: flex;
        flex-direction: column;
        align-items: center;
        height: auto;
        padding: 1rem 0;
    }

    #deck, #drawn, .card 
    {
        position: relative;
        top: auto;
        left: auto;
        transform: none !important;
        margin-bottom: 1rem;
        width: 80vw;
        height: calc(80vw * 1.4);
    }
}

/* custom cursor of course */
html, body 
{
    cursor: url('cursor.png') 16 16, auto !important;
}

    body * 
    {
        cursor: inherit !important;
    }

        body *:hover 
        {
            cursor: url('cursorhover.png') 16 16, auto !important;
        }

/* fav/star botton toggle */
.star-btn 
{
    position: fixed;
    top: 10px;
    left: 10px;
    font-size: 2rem;
    background: transparent;
    border: none;
    color: #F2EBDF;
    cursor: pointer;
    z-index: 20;
    transition: transform .2s ease;
}

    .star-btn.active 
    {
        color: gold;
        transform: scale(1.2);
    }

/* button to swap decks live in-game */
.change-btn 
{
    position: fixed;
    top: 50px;
    left: 10px;
    font-size: 1.8rem;
    background: transparent;
    border: none;
    color: #F2EBDF;
    cursor: pointer;
    z-index: 20;
    transition: transform .2s ease;
}

    .change-btn:active 
    {
        transform: scale(1.1);
    }

/* little popup so user knows clicking deck face-card did something */
.toast 
{
    position: fixed;
    top: 10px;
    left: 60px;
    background: rgba(0,0,0,0.8);
    color: #FFF;
    padding: 8px 12px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

    .toast.show 
    {
        opacity: 1;
    }
