:root {
    --bg-color: #1a1a1a;
    --card-bg: #ffffff;
    --primary: #9d2449; /* Burgundy NEM */
    --primary-light: #b33e61;
    --accent: #b38e5d; /* Gold NEM */
    --text-main: #333333;
    --text-light: #f4f4f4;
    --shadow: 0 10px 30px rgba(0,0,0,0.2);
    --radius: 24px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 50%, #2a2a2a 0%, #1a1a1a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* Phone Frame wrapper */
.phone-frame {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Main Container */
.container {
    background-color: var(--card-bg);
    width: 100%;
    height: 90vh;
    max-height: 850px;
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 8px solid #333; /* Pseudo bezel */
}

/* Header */
.header-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--accent);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.title {
    font-size: 1.6rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin: 0;
    border: none;
    padding: 0;
    text-align: left;
}

.info-btn {
    background: transparent;
    color: #888;
    border: 2px solid #ddd;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.info-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(157, 36, 73, 0.05);
}

.instructions-body {
    text-align: left;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    color: #444;
}

.instructions-body p {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions-body i {
    color: var(--primary);
}

.title span {
    color: var(--accent);
}

/* Card Display Area */
.card {
    flex: 1;
    width: 100%;
    background-color: #f8f9fa;
    border-radius: 20px;
    margin: 1rem 0;
    display: flex; /* Flex but content hidden initially by JS */
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    border: 2px dashed #ddd; /* Placeholder look when empty */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:has(img[src=""]) {
    /* Empty state styling if needed */
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none; /* JS toggles this */
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Showing state - overrides inline styles handled by JS if necessary, 
   but JS usually handles display: block. We add animation here. */
.card.showing {
    background-color: transparent;
    border: none;
    transform: scale(1);
    opacity: 1;
}

.card.showing img {
    display: block;
    animation: dealCard 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card img.hiding {
    animation: discardCard 0.4s ease-in forwards;
}

@keyframes dealCard {
    0% {
        transform: translateY(100%) rotate(-10deg) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translateY(0) rotate(0) scale(1);
        opacity: 1;
    }
}

@keyframes discardCard {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scale(0.8);
        opacity: 0;
    }
}

/* Controls */
.button-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 1rem;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 20px;
}

button {
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.nav-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #e0e0e0;
    color: #555;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 0 #ccc;
}

.nav-button:active {
    transform: translateY(4px);
    box-shadow: none;
}

.nav-button.hidden {
    display: none;
    pointer-events: none;
}

.nav-button.main-action {
    background-color: var(--primary);
    color: white;
    width: 70px;
    height: 70px;
    font-size: 2rem;
    box-shadow: 0 4px 0 #7a1c38;
}

.nav-button.main-action:hover {
    background-color: var(--primary-light);
}

.nav-button.main-action:active {
    box-shadow: none;
    transform: translateY(4px);
}

.mid-button {
    flex: 1;
    height: 60px;
    background-color: white;
    border: 2px solid var(--accent);
    color: var(--accent);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 2px;
}

.mid-button i {
    font-size: 1.4rem;
}

.mid-button:hover {
    background-color: var(--accent);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 20% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 85%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    position: relative;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
}

.modal h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-input {
    width: 80%;
    padding: 10px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin: 1rem 0;
    outline: none;
    font-weight: bold;
    color: var(--text-main);
}

.modal-input:focus {
    border-color: var(--accent);
}

.mi-button {
    background-color: var(--primary);
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(157, 36, 73, 0.3);
}

.mi-button:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-height: 700px) {
    .container {
        height: 100vh;
        border: none;
        border-radius: 0;
    }
    
    .card {
        margin: 0.5rem 0;
    }
}
