body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #28a745; /* Green felt color */
    color: #fff;
    overflow: hidden; /* Prevent scrollbars from card animations */
}

#always-on-display {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 1.2em;
    z-index: 1000; /* Ensure it's on top */
    color: #f1c40f;
}

#login-container, #main-menu-container, #mining-container {
    background-color: #34495e;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

#login-container h1, #main-menu-container h1, #mining-container h1 {
    margin-top: 0;
    color: #f1c40f;
}

#login-container input {
    width: calc(100% - 20px);
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Styles for signup modal inputs */
#signup-modal input {
    width: calc(100% - 40px); /* Adjust width to account for padding */
    padding: 15px; /* Larger padding */
    margin: 15px 0; /* More margin */
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1.1em; /* Slightly larger font */
}

#login-container button, #main-menu-container button, #mining-container button {
    background-color: #f39c12;
    color: #fff;
    border: none;
    padding: 10px 20px;
    margin: 10px auto; /* Center buttons horizontally */
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: block; /* Make buttons block-level for vertical stacking */
    width: 80%; /* Make buttons take 80% of the container width */
    max-width: 250px; /* Limit maximum width for larger screens */
}

#login-container button:hover, #main-menu-container button:hover, #mining-container button:hover {
    background-color: #e67e22;
}

/* Specific styles for the mine button to make it larger */
#mine-button {
    padding: 20px 40px; /* Larger padding */
    font-size: 24px; /* Larger font size */
    width: 90%; /* Wider */
    max-width: 300px; /* Larger max-width */
    margin-bottom: 20px; /* More space below */
}

.game-container {
    background-color: #34495e;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 90%;
    max-width: 800px;
    position: relative; /* For positioning the quit button */
}

#quit-game-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #e74c3c; /* Red color for quit button */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

#quit-game-button:hover {
    background-color: #c0392b;
}

h1 {
    margin-top: 0;
    color: #f1c40f;
}

h2 {
    margin-bottom: 15px;
}

.cards-container {
    display: flex;
    justify-content: center;
    min-height: 120px; /* Space for cards */
    margin-bottom: 20px;
    flex-wrap: wrap;
    perspective: 1000px; /* For 3D transforms */
}

.card {
    width: 80px;
    height: 110px;
    background-color: #fff;
    border: 1px solid #333;
    border-radius: 8px;
    margin: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    position: relative;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);

    /* For animation */
    transition: transform 0.5s ease-out, opacity 0.5s ease-out; /* Adjusted for new animation */
    transform-style: preserve-3d;
    transform-origin: center center; /* Changed to center for better flip */
}

.card.new-card-animation {
    opacity: 0;
    transform: scale(0.5);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-inner {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    box-sizing: border-box;
    transition: transform 0.5s ease-out; /* Added for flip animation */
}

.card.hidden .card-inner {
    transform: rotateY(180deg); /* Show back when hidden */
}

.card.flipped .card-inner {
    transform: rotateY(0deg); /* Show front when flipped */
}

.card-inner {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    box-sizing: border-box;
}

.card-front {
    transform: rotateY(0deg);
    background-color: #fff;
    color: #333;
    backface-visibility: hidden;
}

.card-back {
    transform: rotateY(180deg);
    background-color: #c0392b;
    color: transparent;
    backface-visibility: hidden;
}


.card .rank {
    font-size: 0.8em;
}

.card .suit {
    font-size: 0.8em;
}

.card.red {
    color: #e74c3c; /* Red for Hearts and Diamonds */
}

.player-info {
    margin-top: 15px;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.betting-controls {
    margin-bottom: 15px;
}

.betting-controls label {
    margin-right: 5px;
}

.betting-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.bet-unit-control, .bet-amount-control {
    display: flex;
    align-items: center;
    margin: 5px 15px;
}

.bet-unit-control span {
    margin-right: 10px;
}

.unit-btn {
    background-color: #7f8c8d;
    padding: 5px 10px;
    border: none;
    color: white;
    cursor: pointer;
    margin: 0 2px;
}

.unit-btn.active {
    background-color: #f39c12;
}

.bet-amount-control span {
    margin: 0 10px;
    font-size: 20px;
    min-width: 60px;
    text-align: center;
}

#decrease-bet-btn, #increase-bet-btn {
    font-size: 20px;
    padding: 5px 10px;
}

.game-actions button {
    margin: 5px;
}

.controls button {
    background-color: #f39c12;
    color: #fff;
    border: none;
    padding: 10px 20px;
    margin: 10px;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.controls button:hover {
    background-color: #e67e22;
}

.controls button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.message {
    margin-top: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #f1c40f;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.25s, opacity 0.25s 0s;
    display: flex; /* Use flexbox for centering */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
}

.modal.show {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s linear 0s, opacity 0.25s 0s;
}

.modal-content {
    background-color: #34495e;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-height: 90vh; /* Limit height to viewport height */
    overflow-y: auto; /* Enable vertical scroll for content */
}

.modal-content h2 {
    color: #f1c40f;
}

.modal-content p {
    margin-bottom: 20px;
}

.modal-buttons button {
    background-color: #f39c12;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 10px;
    font-size: 16px;
}

.modal-buttons button:hover {
    background-color: #e67e22;
}

.text-button {
    background: none;
    border: none;
    color: #f1c40f; /* Yellow color for text button */
    text-decoration: underline;
    cursor: pointer;
    font-size: 1em;
    margin-top: 10px;
    padding: 5px;
}

.text-button:hover {
    color: #e67e22;
}

/* Styles for details/summary in help modal */
#help-modal details {
    background-color: #2c3e50; /* Darker background for collapsible sections */
    border-radius: 5px;
    margin-bottom: 10px;
    overflow: hidden; /* Ensures content stays within rounded corners */
}

#help-modal summary {
    background-color: #34495e; /* Same as modal content background */
    padding: 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    border-bottom: 1px solid #2c3e50; /* Separator */
    list-style: none; /* Remove default arrow */
    position: relative;
}

#help-modal summary::-webkit-details-marker {
    display: none; /* Hide default arrow for Chrome */
}

#help-modal summary::before {
    content: '+'; /* Custom plus sign */
    position: absolute;
    right: 15px;
    font-size: 1.2em;
    transition: transform 0.2s ease;
}

#help-modal details[open] summary::before {
    content: '-'; /* Custom minus sign when open */
    transform: rotate(180deg); /* Rotate for visual effect */
}

#help-modal details p, #help-modal details ul {
    padding: 15px;
    margin: 0;
    text-align: left;
    line-height: 1.6;
    color: #ecf0f1; /* Light gray for text */
}

#help-modal details ul {
    list-style-position: inside;
    padding-left: 30px; /* Indent list items */
}
