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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #526d82 0%, #b7d1da 100%);
    color: #284b63;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.card-small {
    max-width: 500px;
    margin: 50px auto;
}

h1 {
    text-align: center;
    color: #526d82;
    margin-bottom: 30px;
}

h2 {
    color: #526d82;
    margin-top: 20px;
    margin-bottom: 15px;
    border-bottom: 2px solid #dde6ed;
    padding-bottom: 5px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

button {
    background: #526d82;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
    margin-top: 10px;
}

button:hover {
    background: #284b63;
}

button:disabled {
    background: #999;
    cursor: not-allowed;
}

button.secondary {
    background: #6c757d;
}

button.secondary:hover {
    background: #5a6268;
}

button.danger {
    background: #dc3545;
}

button.danger:hover {
    background: #c82333;
}

button.success {
    background: #28a745;
}

button.success:hover {
    background: #218838;
}

.btn-link {
    background: none;
    color: #526d82;
    text-decoration: underline;
    padding: 0;
    cursor: pointer;
}

.alert {
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f2f5f8;
    border-top: 3px solid #b7d1da;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.header {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    margin-bottom: 30px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.header h2 {
    color: white;
    border: none;
    margin: 0;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #526d82;
    color: white;
}

tr:hover {
    background: #f5f5f5;
}

.positive {
    color: #28a745;
    font-weight: bold;
}

.negative {
    color: #dc3545;
    font-weight: bold;
}

.zero {
    color: #666;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 0 0 30px 0;
    width: 100%;
    max-width: 100%;
}

#gameSection .summary-cards,
#hostStats,
#playerStats {
    width: 100%;
    max-width: none;
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    background: linear-gradient(135deg, #b7d1da 0%, #dde6ed 100%);
    color: #284b63;
    padding: 30px 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.summary-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    opacity: 0.9;
    font-weight: normal;
}

.summary-card .amount {
    font-size: 36px;
    font-weight: bold;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.badge-host {
    background: #ffc107;
    color: #000;
}

.badge-player {
    background: #17a2b8;
    color: #fff;
}

.hidden {
    display: none;
}

/* ===== Mobile Responsive Styles ===== */

/* Tablets and below */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
        margin-bottom: 15px;
    }
    
    .card-small {
        margin: 20px auto;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        text-align: center;
    }
    
    .header .user-info {
        flex-direction: column;
        gap: 10px;
    }
    
    button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    /* Make tables scrollable */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 8px;
        font-size: 14px;
    }
    
    .summary-card .amount {
        font-size: 28px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 5px;
    }
    
    .card {
        padding: 15px;
        border-radius: 8px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    input, select, textarea {
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    th, td {
        padding: 6px;
        font-size: 12px;
    }
    
    .summary-card {
        padding: 20px 15px;
        min-height: 100px;
    }
    
    .summary-card h3 {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .summary-card .amount {
        font-size: 24px;
    }
    
    .header {
        padding: 10px;
    }
    
    .header h2 {
        font-size: 18px;
    }
}

/* Landscape mobile phones */
@media (max-width: 768px) and (orientation: landscape) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
