:root {
    --accent-color: rgb(222, 137, 0);
    --accent-light-color: rgb(255, 227, 152);
    --light-purple: #e3d5e1;
    --dark-purple: rgb(58, 23, 58);
    --middle-purple: rgb(111, 77, 111);
}

* {
    font-family: Verdana, sans-serif;
}

html {
    overscroll-behavior: none;
}

body {
    margin: 0px;
    background: rgb(230, 232, 234);
}

.content-container {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

#join-screen {
    width: 100%;
    height: 100%;
    background-image: url("sprites/title.png");
    background-size: cover;
    background-position: center;

    h1 {
        margin-top: 0px;
        text-align: center;
    }

    .join-content {
        width: 100%;
        max-width: 400px;
        height: 100%;
        margin: auto;
    }

    img {
        margin: auto;
        display: block;
        width: 600px;
        max-width: 100vw;
        padding-top: 5vh;
    }

    section {
        width: 100%;
        padding: 40px; 
        box-sizing: border-box;
    }

    section input {
        width: 100%;
        height: 40px;
        margin-bottom: 10px;
        box-sizing: border-box;
        text-align: center;
        border-radius: 4px;
        background-color: #f4e3f2;
        color: rgb(72, 6, 72);
    }
    
    section button {
        width: 100%;  
        height: 40px;
        box-sizing: border-box;
        border-radius: 4px;
        background: var(--accent-color);
        color: var(--accent-light-color);
        font-weight: bold;
        font-size: 15px;
    }

    .create-game-container {
        width: 360px;
        max-width: calc(100vw - 40px);
        position: absolute;
        bottom: 20px;
        padding: 0px;
        padding-left: 40px;
        
        button {
            height: 30px;
            background: rgb(138, 106, 138);
            color: rgb(58, 23, 58);
            font-size: 11px;
        }
    }
}

#player-lobby-screen {
    text-align: center;
    width: 100%;
    height: 100%;
    background-image: url("sprites/title.png");
    background-size: cover;
    background-position: center;
    color: var(--accent-light-color);

    section {
        height: 100%;
        display: flex;
        justify-content: center;
        flex-direction: column;
    }

    #player-lobby-message{
        font-size: large;
    }

    b {
        color: var(--accent-color)
    }

    aside {
        margin-top: 10px;
    }
}

#character-select {
    margin: 10px 0;
}

#character-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.character-option {
    padding: 15px 25px;
    font-size: 16px;
    border: 0px;
    border-radius: 8px;
    background: var(--accent-light-color);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    color: var(--accent-color);
}

.character-option:hover {
    background: var(--accent-light-color);
}

.character-option.selected {
    background: var(--accent-color);
    color: var(--accent-light-color);
    box-shadow: 0px 0px 8px var(--accent-light-color);
}

#character-preview {
    margin-top: 14px;
    border: 1px solid var(--dark-purple);
    border-radius: 8px;
    /* background: #fafafa; */
    overflow: hidden;
    width: calc(100vw - 40px);
    max-width: 50vh;
    margin-left: auto;
    margin-right: auto;
}

.player-preview-portrait {
    height: 200px;
    overflow: hidden;
    background: url("sprites/character_preview_background.png");
    background-size: cover;
    background-position: center;
    
    img {
        width: 300px;
    }
}

.player-preview-stats {
    padding: 7px 10px;
    font-size: 14px;
    font-weight: bold;
    color: var(--accent-color);
    /* border-top: 1px solid var(--dark-purple); */
    border-bottom: 1px solid var(--dark-purple);
    background: #332f2b;
}

.preview-deck-card-item {
    text-align: left;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--dark-purple);
    background: var(--light-purple);
}

.preview-card-mana-cost {
    position: absolute;
    right: 8px;
    background: #3a6bd4;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.preview-deck-card-item:last-child {
    border-bottom: none;
}

.preview-deck-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preview-deck-card-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--dark-purple);
}

.preview-deck-card-desc {
    font-size: 12px;
    color: var(--middle-purple);
    margin-right: 20px;
}

#player-game-screen {
    /* padding: 20px;
    background: white;
    margin-top: 20px;
    border-radius: 10px; */
    text-align: center;
    width: 100%;
    height: 100%;
    background-image: url("sprites/title.png");
    background-size: cover;
    background-position: center;
}

#timer-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: rgb(57, 67, 61);
    z-index: 1000;
}

#timer-bar {
    height: 100%;
    width: 100%;
    background: #2da842;
    transform-origin: left;
    transition: transform linear;
}

#timer {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 50px;
    height: 50px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 30px;
    background-color: #2da842;
    font-size: 26px;
    font-weight: bold;
    color: white;
}

#status-input {
    padding-top: 30px;
    padding-bottom: 10px;
    font-size: 22px;
    color: var(--accent-color);
    height: 30px;

    b {
        font-size: 28px;
    }
}

#mana-bar-container {
    position: relative;
    width: calc(100% - 20px);
    margin: 10px;
    height: 28px;
    background: rgb(30, 30, 50);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
}

#mana-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: calc(var(--mana-pct, 1) * 100%);
    background: #3a6bd4;
    transition: width 0.25s ease;
    border-radius: 6px;
}

#mana-text {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

@keyframes cardFlyUp {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(-220px) scale(0.6);
        opacity: 0;
    }
}

.card-fly-up {
    animation: cardFlyUp 0.4s ease-in forwards;
    pointer-events: none;
}

#enemy-turn-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    z-index: 500;
    pointer-events: all;
    justify-content: center;
    align-items: center;

    span {
        font-size: 48px;
        font-weight: bold;
        color: #ff506a;
        text-shadow: 0 0 20px rgba(255, 80, 106, 0.8);
    }
}

#enemy-turn-overlay.active {
    display: flex;
}

#end-turn-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    z-index: 150;
    pointer-events: all;
}

#end-turn-overlay.active {
    display: block;
}

/* Player hand */
.player-card {
    width: 220px;
    min-width: 220px;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    /* background:  #f5f0e6; */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#card-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-height: calc(100vh - 260px);
    margin-top: 10px;
    margin-bottom: 10px;
    overflow-y: auto;
}

/* Cards */
.card-option {
    position: relative;
    width: 140px;
    min-width: 140px;
    height: 220px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
}

.card-option:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 4px 8px 16px rgba(0, 0, 0, 0.4);
}

.card-option.selected {
    border-color: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
}

.card-border-image {
    width: 100%;
    height: 100%;
    position: absolute;
}

.card-header {
    z-index: 2;
    position: absolute;
    width: 100%;
    top: 87px;
    color: black;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-mana-cost {
    position: absolute;
    top: 14px;
    right: 7px;
    background: #3a6bd4;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-option.unplayable {
    filter: grayscale(0.8) brightness(0.6);
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.card-image {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    height: 100px;
    min-height: 100px;
    max-height: 100px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d4cfc4;
    border-bottom: 2px solid #444;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-text {
    z-index: 2;
    position: absolute;
    top: 110px;
    padding-left: 12px;
    padding-right: 12px;
    font-size: 10px;
    color: #333;
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

#movement-options {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 8px 0;
}

.movement-btn {
    padding: 10px 28px;
    font-size: 16px;
    font-family: Verdana, sans-serif;
    border: 2px solid var(--middle-purple);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    background: var(--light-purple);
    color: var(--middle-purple);
}

.movement-btn:hover:not(:disabled) {
    background: var(--middle-purple);
    color: var(--dark-purple);
}

.movement-btn.selected {
    background: var(--middle-purple);
    border-color: var(--dark-purple);
    color: var(--light-purple);
}

.movement-btn:disabled {
    opacity: 0.4;
    background: var(--middle-purple);
    color: var(--dark-purple);
    cursor: not-allowed;
}

#confirm-btn {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 0px);
    bottom: 10px;
    margin: 8px 0;
    padding: 10px 36px;
    font-size: 16px;
    font-family: Verdana, sans-serif;
    background: #3a6bd4;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

#confirm-btn:hover:not(:disabled) {
    background: #2d58b8;
}

#confirm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#end-turn-btn {
    display: none;
    position: absolute;
    left: 50%;
    transform: translate(-50%, 0px);
    bottom: 10px;
    margin: 8px 0;
    padding: 10px 36px;
    font-size: 16px;
    font-family: Verdana, sans-serif;
    background: #d43a4a;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    z-index: 200;
}

#end-turn-btn:hover {
    background: #b82d3a;
}

#selected-card-display {
    margin-top: 10px;
    font-weight: bold;
    color: #4CAF50;
}

#card-target-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

#card-target-overlay.modal-enabled {
    display: flex;
}

.target-option {
    padding: 30px 50px;
    font-size: 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
}

.target-option:hover {
    background: #e0e0e0;
    /* transform: scale(1.05); */
}

.no-cards {
    color: #999;
    font-style: italic;
}

#host-game-screen {
    padding: 20px;
    /* background: white; */
    border-radius: 10px;
    text-align: center;
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    display: flex;
}

#host-announcement {
    font-size: 20px;
    font-weight: bold;
    color: white;
    display: flex;
    width: 100vw;
    height: 130px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    position: absolute;
    top: 50px;
    left: 0px;
}

.announcement-line {
    transition: opacity 0.3s ease;
}

#host-background-image {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: -1;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #101B21;

    img {
        width: 960;
        height: 590px;
    }
}

#host-board {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 50px);
    gap: 5px;
}

.board-space {
    width: 100px;
    max-width: 100px;
    min-width: 100px;
    height: 180px;
    /* border: 2px solid #333; */
    /* border-radius: 4px; */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    position: relative;

    .board-entity-name {
        color: white;
        font-weight: bold;
        margin-bottom: 5px;
    }

    .board-entity-hp-bar {
        width: 80px;
        height: 15px;
        background: #39393f;
        overflow: hidden;
        border-radius: 20px;
        position: relative;
        margin-bottom: 10px;

        .board-entity-hp-fill {
            height: 100%;
        }
    }
    
    .board-entity-hp-text {
        position: absolute;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        top: 0;
    }
}

.has-player .board-entity-hp-fill {
    background: #65bfff;
}

.has-enemy  .board-entity-hp-fill{
    background: #ff506a;
}

.board-space::before {
    /* space Shadow */
    content: "";
    background:#101012;
    width: 94%;
    height: 42px;
    border-radius: 20px;
    border: 5px solid rgb(88, 88, 98);
    position: absolute;
    opacity: 80%;
    z-index: 0;
    bottom: 0px;
}

#host-status {
    margin-top: 20px;
    font-size: 16px;
    color: #666;
}

/* Board sprites */
.board-sprite {
    width: 110px;
    height: 110px;
    object-fit: contain;
    z-index: 2;
}

/* Card display (show_card animation) */
#card-display-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 200;
}

.floating-card {
    position: absolute;
    width: 180px;
    height: 290px;
    animation: cardFloatIn 0.1s ease-out forwards, cardFadeOut 0.5s ease-in 1.0s forwards;

    .card-image {
        width: 180px;
        min-width: 180px;
        max-width: 180px;
        height: 180px;
        min-height: 180px;
        max-height: 180px;
    }
}

.floating-card .player-card {
    width: 100%;
    min-width: unset;
    height: 100%;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2), 4px 8px 20px rgba(0, 0, 0, 0.5);
}

@keyframes slideInRight {
    from {
        transform: translateX(60px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#character-preview.slide-in {
    animation: slideInRight 0.3s ease-out forwards;
}

@keyframes cardFloatIn {
    from {
        transform: scale(0.3) translateY(40px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes cardFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Board space highlight */
.board-space.highlighted {
    z-index: 3;
}

.board-space.highlighted::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    animation: highlightPulse 0.6s ease-in-out 2;
    pointer-events: none;
}

@keyframes highlightPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}