:root {
    --felt-bg: #141617;
    --felt-gradient: radial-gradient(circle at 50% 30%, #25282a 0%, #121415 85%, #0a0b0b 100%);
    --coral: #e5735b;
    --light-blue: #6aaae4;
    --white: #ffffff;
    --text-muted: rgba(229, 115, 91, 0.7);
    --win-glow: rgba(0, 160, 220, 0.85);
    --win-border: #00a0dc;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
}

html {
    background-color: #1e1e1d;
}

body {
    background-color: #1e1e1d;
    background-image: radial-gradient(circle at 50% 30%, #25282a 0%, #1e1e1d 85%, #1e1e1d 100%);
    color: var(--coral);
    font-family: 'Georgia', serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    text-align: center;
    overflow: hidden;
    user-select: none;
}

#menu-screen,
#game-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

#game-screen {
    display: none;
    position: relative;
}

/* --- BACKGROUND FOR GAME SCREEN (new phoenix watermark) --- */
.game-wallpaper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(254, 192, 75, 0.07) 0%, transparent 60%),
        radial-gradient(circle at 50% 30%, #26282a 0%, #1e1e1d 70%, #161616 100%);
}

.game-wallpaper::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url('Images/phoenix_logo.png') no-repeat center 45%;
    background-size: min(85vw, 620px) auto;
    opacity: 0.07;
}

/* Ensure game content stays above the wallpaper */
#game-screen>*:not(.game-wallpaper) {
    position: relative;
    z-index: 1;
}

#menu-screen {
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* --- PHOENIX LOGO ON MENU --- */
.menu-glow {
    position: absolute;
    top: 38%;
    left: 50%;
    width: min(120vw, 900px);
    height: min(120vw, 900px);
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(254, 192, 75, 0.07) 0%, rgba(229, 115, 91, 0.03) 35%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.menu-phoenix-logo {
    display: block;
    width: clamp(240px, 75vw, 460px);
    height: auto;
    margin: 0 auto 22px;
    filter: drop-shadow(0 0 12px rgba(254, 192, 75, 0.22)) drop-shadow(0 0 32px rgba(229, 115, 91, 0.12));
    animation: phoenixRise 1s cubic-bezier(0.2, 0.8, 0.2, 1) both, phoenixGlow 5s ease-in-out 1s infinite;
}

@keyframes phoenixRise {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes phoenixGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 12px rgba(254, 192, 75, 0.22)) drop-shadow(0 0 32px rgba(229, 115, 91, 0.12));
    }

    50% {
        filter: drop-shadow(0 0 18px rgba(254, 192, 75, 0.34)) drop-shadow(0 0 48px rgba(229, 115, 91, 0.18));
    }
}

.menu-header {
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.menu-actions {
    position: relative;
    z-index: 1;
}

.menu-title {
    font-size: 40px;
    letter-spacing: 8px;
    margin-bottom: 5px;
    color: var(--white);
    text-shadow: 0 0 15px rgba(229, 115, 91, 0.4), 0 0 30px rgba(229, 115, 91, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.menu-subtitle {
    color: var(--light-blue);
    font-size: 11px;
    letter-spacing: 5px;
    text-transform: uppercase;
    opacity: 0.8;
}

.menu-slogan {
    font-family: 'Cinzel Decorative', serif;
    color: #c9952a;
    font-size: clamp(10px, 2.8vw, 13px);
    letter-spacing: 3px;
    margin-top: 12px;
    text-transform: uppercase;
    opacity: 0.7;
    text-shadow: 0 0 12px rgba(201, 149, 42, 0.4), 0 0 30px rgba(201, 149, 42, 0.15);
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn {
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: bold;
    font-family: sans-serif;
    border: 1px solid rgba(229, 115, 91, 0.4);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(45, 47, 50, 0.8) 0%, rgba(18, 19, 21, 0.9) 100%);
    color: var(--coral);
    cursor: pointer;
    width: 260px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.menu-btn:hover {
    background: rgba(229, 115, 91, 0.18);
    border-color: var(--coral);
    color: var(--white);
    box-shadow: 0 0 20px rgba(229, 115, 91, 0.4), 0 6px 16px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.dev-icon {
    position: absolute;
    bottom: 30px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    opacity: 0.2;
    transition: opacity 0.3s;
}

.dev-icon:hover {
    opacity: 1;
}

.top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    box-sizing: border-box;
    font-family: sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    background: #111214;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 10;
}

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-btn {
    color: var(--light-blue);
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-btn:hover {
    color: var(--white);
}

.table-text {
    color: var(--text-muted);
    font-family: sans-serif;
    font-size: 11px;
    margin: 6px 0;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.hand-label {
    color: var(--light-blue);
    font-family: sans-serif;
    font-size: 13px;
    letter-spacing: 2.5px;
    margin-bottom: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

.main-logo-container {
    margin-top: 10px;
    margin-bottom: 20px;
}

.main-logo {
    font-size: 38px;
    letter-spacing: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.banner-subtext {
    color: var(--light-blue);
    font-family: sans-serif;
    font-size: 10px;
    letter-spacing: 1.5px;
    margin-top: 5px;
    text-transform: uppercase;
    opacity: 0.85;
}

.area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.cards {
    display: flex;
    gap: 12px;
    min-height: 115px;
    margin: 12px 0;
    align-items: center;
}

@keyframes dealIn {
    0% {
        opacity: 0;
        transform: translateY(-35px) scale(0.75);
    }

    60% {
        transform: translateY(4px) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card {
    width: 72px;
    height: 104px;
    background: linear-gradient(135deg, #ffffff 0%, #f4f5f7 100%);
    color: #1a1a1a;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 32px;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    animation: dealIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card.red {
    color: #d32f2f;
}

.card.facedown {
    background:
        radial-gradient(circle at center, rgba(106, 170, 228, 0.35) 0%, transparent 70%),
        repeating-linear-gradient(45deg, rgba(106, 170, 228, 0.18) 0px, rgba(106, 170, 228, 0.18) 2px, transparent 2px, transparent 8px),
        repeating-linear-gradient(-45deg, rgba(106, 170, 228, 0.18) 0px, rgba(106, 170, 228, 0.18) 2px, transparent 2px, transparent 8px),
        linear-gradient(135deg, #0d223a 0%, #06111f 100%);
    border: 2px solid var(--light-blue);
    color: transparent;
    position: relative;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.card.facedown::after {
    content: "🔥";
    position: absolute;
    font-size: 28px;
    opacity: 0.9;
    filter: drop-shadow(0 0 8px rgba(106, 170, 228, 0.85));
}

.card.discarded {
    opacity: 0.35;
    background: #111213;
    color: #444;
    border: 1px solid #222;
    transform: scale(0.85);
    position: relative;
    box-shadow: none;
}

.card.discarded::before {
    content: "X";
    position: absolute;
    color: rgba(229, 115, 91, 0.5);
    font-size: 55px;
    font-weight: 900;
}

.card.highlight-win {
    box-shadow: 0 0 25px var(--win-glow), 0 10px 20px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--win-border);
    transform: scale(1.08) translateY(-6px);
    z-index: 10;
}

.card.highlight-lose {
    box-shadow: 0 0 25px rgba(231, 76, 60, 0.9), 0 10px 20px rgba(0, 0, 0, 0.5);
    border: 3px solid #e74c3c;
    transform: scale(1.08) translateY(-6px);
    z-index: 10;
}

#controls {
    padding: 18px 20px;
    background: #0e0f10;
    min-height: 135px;
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
    width: 100%;
}

.btn-group {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
    width: 100%;
    box-sizing: border-box;
}

button {
    padding: 13px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: linear-gradient(180deg, #2b2d30 0%, #1d1e20 100%);
    color: var(--white);
    cursor: pointer;
    flex: 1;
    min-width: 0;
    max-width: 125px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

button:hover:not(:disabled) {
    background: linear-gradient(180deg, #35383c 0%, #242629 100%);
    border-color: var(--coral);
    box-shadow: 0 0 12px rgba(229, 115, 91, 0.25), 0 4px 10px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-strike {
    color: var(--coral);
    border-color: rgba(229, 115, 91, 0.3);
}

.btn-burn {
    color: var(--light-blue);
    border-color: rgba(106, 170, 228, 0.3);
}

#message {
    font-size: 15px;
    font-weight: 700;
    min-height: 40px;
    margin: 0 0 12px 0;
    color: var(--white);
    letter-spacing: 1.5px;
    white-space: pre-line;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--felt-bg);
    border: 2px solid var(--coral);
    padding: 25px;
    border-radius: 8px;
    width: 85%;
    max-width: 450px;
    color: var(--white);
    text-align: left;
    font-family: sans-serif;
    font-size: 13px;
    line-height: 1.5;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    color: var(--light-blue);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    margin-top: 15px;
}

.modal-content ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.close-btn {
    width: 100%;
    max-width: none;
    background: var(--coral);
    color: var(--white);
    border: none;
    font-weight: bold;
    padding: 12px;
    margin-top: 15px;
    border-radius: 4px;
    cursor: pointer;
}

.logo-flame {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 1.1em;
    height: 1.1em;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
}

.logo-flame canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* --- BURN IT: CREST LOGO STYLING --- */
.crest-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.diablo-text {
    font-family: 'Cinzel Decorative', serif;
    color: #e6e6e6;
    text-align: center;
    line-height: 1;
    text-shadow:
        0 0 4px rgba(255, 60, 0, 0.6),
        0 0 12px rgba(255, 0, 0, 0.4),
        0 0 30px rgba(139, 0, 0, 0.8);
}

.crest-small {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    letter-spacing: 0.4em;
    margin-bottom: -5px;
    padding-left: 0.4em;
    /* Centers properly with letter-spacing */
    margin-bottom: 8px;
    opacity: 0.85;
}

.crest-large {
    font-size: clamp(2rem, 9.6vw, 2.8rem);
    white-space: nowrap;
    letter-spacing: 0.1em;
    padding-left: 0.1em;
    text-transform: uppercase;
}