/* It's 50/50 - Polished Cinematic Version - ALL FIXES APPLIED + Tiny Copy Button */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    --accent: #ff0033;
}

body {
    margin: 0;
    font-family: 'Press Start 2P', monospace;
    background: #000000;
    color: #e6e6e6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* ==================== MENU BACKGROUND ==================== */
#menu-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.suit-layer {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    height: 100%;
    background-image: url('../images/Suit.jpg');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    opacity: 0.92;
}

.skull-layer {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 420px;
    height: 520px;
    background-image: url('../images/skull.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left bottom;
    z-index: 1;
    animation: skullMove 5.5s infinite ease-in-out;
}

.rose-layer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 380px;
    height: 520px;
    background-image: url('../images/Flowers.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: right bottom;
    z-index: 1;
    animation: roseMove 6.5s infinite ease-in-out;
}

@keyframes skullMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-5px, 4px) rotate(-1deg); }
    50% { transform: translate(4px, -3px) rotate(0.8deg); }
    75% { transform: translate(-3px, 5px) rotate(-0.7deg); }
}

@keyframes roseMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(6px, -4px) rotate(0.9deg); }
    45% { transform: translate(-4px, 5px) rotate(-0.8deg); }
    70% { transform: translate(3px, -3px) rotate(0.6deg); }
}

/* Scanlines + glitch */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 0, 51, 0.09),
        rgba(255, 0, 51, 0.09) 1px,
        transparent 1px,
        transparent 3.5px
    );
    pointer-events: none;
    z-index: 2;
    animation: scanline 3.2s linear infinite;
}

@keyframes scanline {
    0% { background-position: 0 0; }
    100% { background-position: 0 280px; }
}

#menu::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 0, 51, 0.03);
    pointer-events: none;
    animation: glitchPulse 2.8s infinite;
    z-index: 1;
}

@keyframes glitchPulse {
    0%, 100% { opacity: 0.03; }
    50% { opacity: 0.08; }
}

/* ==================== MENU ==================== */
#menu {
    text-align: center;
    z-index: 10;
    padding: 20px;
    max-width: 420px;
    width: 100%;
    position: relative;
}

h1 {
    font-size: 42px;
    margin-bottom: 40px;
    letter-spacing: 4px;
    position: relative;
    animation: glitch 1.3s infinite;
    color: #e6e6e6;
    text-shadow: 
        3px 3px 0 #000000,
        -2px -2px 0 #000000,
        2px -2px 0 #000000,
        -2px 2px 0 #000000,
        0 0 10px rgba(0, 0, 0, 0.9);
}

h1 .fifty.red { color: #ff0033; }
h1 .fifty.green { color: #00ff99; }

button {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 12px auto;
    padding: 16px 24px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid #555;
    background: #111;
    color: #e6e6e6;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

button:hover {
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 0, 51, 0.4);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: #444;
}

input {
    width: 100%;
    max-width: 280px;
    padding: 16px 14px;
    font-size: 15px;
    font-family: inherit;
    background: #111;
    border: 2px solid #444;
    color: white;
    text-align: center;
    outline: none;
    margin-bottom: 6px;
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(255, 0, 51, 0.3);
}

.input-error {
    border-color: #ff3366 !important;
    animation: shake 0.3s;
}

.error-message {
    color: #ff3366;
    font-size: 12px;
    min-height: 18px;
}

/* ==================== LOBBY / GAME / GAUNTLET ==================== */
#lobby {
    width: 100%;
    max-width: 620px;
    padding: 20px;
    text-align: center;
}

.lobby-container, .game-container, .gauntlet-container {
    background: #111;
    border: 3px solid #333;
    padding: 20px 25px;
    border-radius: 12px;
    animation: sceneEnter 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes sceneEnter {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.room-code { color: var(--accent); letter-spacing: 4px; }

/* TINY COPY BUTTON - exactly as requested */
.copy-btn-small {
    font-size: 14px !important;
    padding: 4px 8px !important;
    margin-left: 8px !important;
    vertical-align: middle !important;
    max-width: 36px !important;
    width: auto !important;
    display: inline-block !important;
    border: 2px solid #555 !important;
    background: #1a1a1a !important;
}

.copy-btn-small:hover {
    border-color: var(--accent) !important;
    background: #222 !important;
}

.host-badge { color: #ffcc66; font-size: 12px; }

.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
}

.player-item {
    background: #1f1f1f;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-item:hover .kick-btn {
    opacity: 1;
}

.kick-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #660000;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    border: 1px solid #ff3366;
}

.submit-btn, .gauntlet-btn, .reveal-btn {
    font-size: 17px;
    padding: 12px 40px;
    margin-top: 15px;
    background: #1a1a1a;
    border: 3px solid var(--accent);
}

.gauntlet-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.status-text, .count-text {
    font-size: 14px;
    color: #aaa;
}

.image-preview {
    max-width: 200px;
    max-height: 220px;
    object-fit: contain;
    border: 3px solid var(--accent);
    margin: 10px auto;
    display: block;
    border-radius: 6px;
}

/* ==================== GAUNTLET CARD ==================== */
.gauntlet-container { padding: 15px 20px; }

#cardContainer {
    perspective: 1200px;
    margin: 12px auto;
}

#gameCard {
    width: 300px;
    height: 420px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.05s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 35px rgba(255, 0, 51, 0.5);
    border-radius: 12px;
    cursor: pointer;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 5px solid var(--accent);
    box-sizing: border-box;
}

.card-face.front { background: #000; padding: 4px; }
.card-face.back { background: #000; transform: rotateY(180deg); padding: 6px; }

.card-logo {
    max-width: 98%;
    max-height: 98%;
    object-fit: contain;
    display: block;
}

.reveal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.text-above {
    font-size: 17px;
    margin: 8px 0 12px;
    min-height: 42px;
    line-height: 1.35;
    text-align: center;
}

.or-text {
    color: var(--accent);
    margin: 0 14px;
    font-weight: bold;
}

#playerText, #goodText {
    transition: all 0.6s ease;
}

.reveal-btn {
    font-size: 16px;
    padding: 10px 32px;
    margin-top: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== END GAME CUTSCENE ==================== */
.endgame-container {
    width: 100%;
    max-width: 1100px;
    padding: 10px 15px;
    overflow: hidden;
}

#endgameStage {
    position: relative;
    width: 100%;
    min-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    perspective: 1400px;
    overflow: hidden;
}

.endgame-deck {
    width: 240px;
    height: 340px;
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-style: preserve-3d;
    transition: transform 900ms cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 50px rgba(255, 0, 51, 0.7);
    border-radius: 14px;
    z-index: 10;
}

.dealt-cards-row {
    position: relative;
    width: 100%;
    min-height: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px 14px;
    justify-content: center;
    align-items: flex-start;
    padding: 15px 10px;
    z-index: 5;
    max-width: 820px;
    margin: 0 auto;
}

.dealt-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 115px;
}

.dealt-card-wrapper.small {
    width: 100px;
}

.card-prompt-outside {
    color: #ffcc66;
    font-size: 9px;
    line-height: 1.15;
    max-width: 108px;
    text-align: center;
    margin-bottom: 8px;
    min-height: 32px;
    max-height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    word-break: break-word;
}

.dealt-card-wrapper.small .card-prompt-outside {
    font-size: 8px;
    max-width: 94px;
    min-height: 26px;
    max-height: 30px;
}

.dealt-card {
    width: 105px;
    height: 148px;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
    flex-shrink: 0;
}

.dealt-card.small {
    width: 92px;
    height: 130px;
}

.dealt-card .card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.85s cubic-bezier(0.23, 1, 0.32, 1);
}

.dealt-card .card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    border: 4px solid var(--accent);
    box-sizing: border-box;
}

.dealt-card .card-face.front {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dealt-card .card-face.back {
    background: #111;
    transform: rotateY(180deg);
    padding: 4px;
}

.card-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 2px;
    box-sizing: border-box;
    background: #000;
    overflow: hidden;
}

.card-reveal-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 3px;
    display: block;
    margin: auto;
    background: #000;
}

.card-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #ffcc66;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    padding: 3px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}

.dealt-card.small .card-name-overlay {
    font-size: 8px;
    padding: 2px 3px;
}

.card-logo-small {
    max-width: 82%;
    max-height: 82%;
    object-fit: contain;
}

.endgame-btn {
    padding: 14px 32px;
    font-size: 15px;
    border: 3px solid var(--accent);
    background: #1a1a1a;
    color: #e6e6e6;
    cursor: pointer;
    transition: all 0.2s;
}

.endgame-btn.leave {
    border-color: #660000;
    background: #2a0000;
}

.endgame-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 0, 51, 0.4);
}

.endgame-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(0.96);
}

#returnStatus {
    font-size: 11px;
    color: #ffcc66;
    min-height: 18px;
    letter-spacing: 0.5px;
    text-align: center;
}

/* ==================== CINEMATIC TRANSITION ==================== */
#scene-transition {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#scene-transition.black { background: #000000; }
#scene-transition.red { background: #1a0000; }

#scene-transition.active {
    opacity: 1;
    pointer-events: all;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.hidden { display: none; }

.modal-content {
    background: #111;
    border: 3px solid var(--accent);
    padding: 25px 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border-radius: 12px;
}

.modal-btn {
    margin-top: 18px;
    padding: 10px 35px;
    font-size: 15px;
    background: #1a1a1a;
    border: 2px solid #555;
}

.error-text { color: #ff3366; }

/* ==================== ANIMATIONS ==================== */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-1.5px, 1px); }
    40% { transform: translate(1.5px, -1px); }
    60% { transform: translate(-1px, -1.5px); }
    80% { transform: translate(1px, 1.5px); }
    100% { transform: translate(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ==================== PRE-MENU ==================== */
#premenu {
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 1.4s ease;
}

.premenu-content {
    text-align: center;
}

#premenu h1 {
    font-size: 42px;
    color: #ffffff;
    letter-spacing: 6px;
    margin: 0 0 20px;
    animation: glitch 1.8s infinite;
    text-shadow: 
        3px 3px 0 #000000,
        -2px -2px 0 #000000;
}

.premenu-hint {
    margin-top: 40px;
    font-size: 14px;
    color: #888;
    letter-spacing: 3px;
}

/* ==================== MOBILE ==================== */
@media (max-width: 600px) {
    h1 { font-size: 32px; }
    .skull-layer, .rose-layer { display: none; }
    .suit-layer { background-position: center 20%; height: 70vh; }

    .game-container h2 { font-size: 18px; margin-bottom: 12px; }
    .game-container { padding: 16px 18px; max-width: 95vw; }

    input, input[type="file"] {
        width: 100%; max-width: 100%; box-sizing: border-box;
        font-size: 14px; padding: 11px 10px;
    }

    .submit-btn, .gauntlet-btn { font-size: 15px; padding: 12px 30px; }

    #gameCard {
        width: 78vw;
        height: 110vw;
        max-width: 300px;
        max-height: 420px;
    }

    .text-above { font-size: 15px; }

    .dealt-card-wrapper {
        width: 28vw;
        max-width: 96px;
    }

    .dealt-card {
        width: 26vw;
        max-width: 88px;
        height: 37vw;
        max-height: 124px;
    }

    .dealt-card.small {
        width: 22vw;
        max-width: 78px;
    }

    .card-prompt-outside {
        max-width: 26vw;
        font-size: 7.5px;
        min-height: 24px;
    }

    .endgame-container {
        max-width: 100vw;
        padding: 8px;
    }

    #endgameStage {
        min-height: 420px;
    }

    .endgame-deck {
        width: 180px;
        height: 260px;
    }

    .copy-btn-small {
        font-size: 12px !important;
        padding: 3px 6px !important;
        max-width: 30px !important;
    }
}