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

body {
    font-family: 'Arial', sans-serif;
    background-image: url('profile.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: #000000;
    transition: color 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(117, 117, 117, 0.2);
    z-index: -1;
    transition: background 0.3s ease;
}

body.dark-mode {
    color: #e0e0e0;
}

body.dark-mode::before {
    background: rgba(0, 0, 0, 0.35);
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    border: 1px solid rgb(110, 110, 110);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
    overflow: hidden;
}

.dark-mode .container {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.3);
}

.page {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.page.active {
    opacity: 1;
    transform: translateY(0);
}

.page.hidden {
    display: none;
}

h1, h2, h3, label, button {
    font-weight: bold;
}

h2 {
    min-height: 30px;
}

input, select {
    color: #292929;
}

.dark-mode input, .dark-mode select {
    color: #ffffff;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    flex-grow: 1;
}

h2#game-title {
    margin-top: 20px;
    text-align: center;
    position: relative;
    z-index: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    background: rgba(105, 106, 151, 0.438);
    color: rgb(255, 255, 255);
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin: 15px auto;
    backdrop-filter: blur(5px);
    transition: transform 0.2s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.253);
    font-size: 1em;
    display: block;
}

.btn:hover {
    background: rgba(0, 86, 179, 0.95);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn.large {
    padding: 16px 32px;
    font-size: 1.2em;
    animation: pulse 2s infinite ease-in-out;
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.9em;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.home-btn, #game-settings-btn {
    position: fixed;
    top: 10px;
    z-index: 1000;
}

.home-btn {
    left: 10px;
}

#game-settings-btn {
    left: 120px;
}

#game-page {
    padding-top: 40px;
}

#setup-page, #settings-page {
    padding-top: 40px;
}

#setup-page h2, #settings-page h2 {
    margin-top: 10px;
}

#game-page form, #setup-page form, #settings-page form {
    margin-top: 10px;
}

.options-menu {
    position: relative;
}

.dropdown {
    position: absolute;
    top: 100%;
    right: 50px; /* Align left of theme toggle */
    background: rgba(119, 119, 119, 0.342);
    border: 1px solid rgba(255, 255, 255, 0.192);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.856);
    backdrop-filter: blur(5px);
    padding: 10px;
    min-width: 150px;
    max-width: calc(100% - 60px);
    z-index: 999;
    overflow-y: auto;
}

.dark-mode .dropdown {
    background: rgba(58, 57, 57, 0.089);
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.288);
}

.dropdown.hidden {
    display: none;
}

.dropdown-item {
    width: 100%;
    margin: 5px 0;
    text-align: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider .mode-icon {
    font-size: 12px;
}

input:checked + .slider {
    background-color: #007bff;
}

input:checked + .slider .mode-icon::before {
    content: '🌙';
}

.slider .mode-icon::before {
    content: '☀️';
}

.game-list {
    list-style: none;
}

.game-list li {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s ease, background 0.3s ease;
    cursor: pointer;
}

.game-list li span {
    flex: 1;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dark-mode .game-list li {
    background: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-list li:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.3);
}

.dark-mode .game-list li:hover {
    background: rgba(0, 0, 0, 0.55);
}

.game-list li input[type="checkbox"] {
    margin-right: 10px;
}

.game-list li .actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-icon {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
}

.delete-icon:hover {
    color: #cc0000;
}

form {
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.dark-mode form {
    background: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.3);
}

label {
    display: block;
    margin: 10px 0 5px;
}

input, select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.3);
    font-size: 1em;
}

.dark-mode input, .dark-mode select {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

input[readonly] {
    background: rgba(200, 200, 200, 0.3);
    cursor: not-allowed;
}

.dark-mode input[readonly] {
    background: rgba(50, 50, 50, 0.5);
}

.table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.dark-mode table {
    background: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.3);
}

th, td {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 12px;
    text-align: center;
    min-width: 80px;
}

th {
    background: rgba(0, 123, 255, 0.8);
    color: white;
    cursor: col-resize;
    resize: horizontal;
    overflow: auto;
}

.dark-mode th {
    background: rgba(0, 86, 179, 0.95);
}

td .details {
    display: block;
    font-size: 0.85em;
    margin-top: 8px;
    line-height: 1.4;
}

.payable {
    color: #ff4444;
    font-weight: bold;
}

.receivable {
    color: #014101; /* Dark green for light theme */
    font-weight: bold;
}

.dark-mode .receivable {
    color: #00cc00; /* Keep light green for dark theme */
}
.status-icon, .winner-icon {
    font-size: 0.9em;
    margin-left: 5px;
}

.winner-icon {
    color: gold;
    font-weight: bold;
}

.edit-btn, .delete-btn, .set-winner-btn {
    background: none;
    border: 1px solid #ffc107;
    color: #ffc107;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 4px;
    font-size: 0.9em;
}

.edit-btn:hover, .set-winner-btn:hover {
    background: #ffc107;
    color: black;
}

.delete-btn {
    border-color: #ff4444;
    color: #ff4444;
}

.delete-btn:hover {
    background: #ff4444;
    color: white;
}

.foul-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.info-btn {
    background: none;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 5px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8em;
}

.info-btn:hover {
    background: #007bff;
    color: white;
}

.footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    font-size: 0.9em;
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
        margin: 10px;
    }

    .btn {
        padding: 10px 20px;
    }

    .btn.large {
        padding: 14px 28px;
        font-size: 1.1em;
    }

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

    .header-controls {
        margin-top: 10px;
        width: 100%;
        justify-content: flex-end;
    }

    .dropdown {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
        overflow-y: auto;
    }

    .game-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-list li span {
        max-width: 100%;
        margin-bottom: 10px;
    }

    .game-list li .actions {
        width: 100%;
        justify-content: flex-end;
    }

    th, td {
        padding: 8px;
        font-size: 0.9em;
    }

    .home-btn, #game-settings-btn {
        top: 10px;
    }

    .home-btn {
        left: 10px;
    }

    #game-settings-btn {
        left: 120px;
    }

    #game-page {
        padding-top: 50px;
    }

    #setup-page, #settings-page {
        padding-top: 50px;
    }
}
/* PWA Standalone Mode */
@media (display-mode: standalone) {
    body {
        padding-top: 20px;
    }
    .home-btn, #game-settings-btn {
        top: 20px;
    }
    #game-page, #setup-page, #settings-page {
        padding-top: 60px;
    }
}

/* Optimize images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Enhance table responsiveness */
#round-table {
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 600px) {
    #round-table th, #round-table td {
        font-size: 14px;
        padding: 8px;
    }
}