body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    padding: 20px;
    text-align: center;
    color: #333;
}

h1 { margin-bottom: 20px; color: #2c3e50; }
h2 { color: #2c3e50; }
h3 { margin: 10px 0; }

/* Admin Setup */
.admin-container {
    max-width: 900px;
    margin: 0 auto;
}

.controls {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

#links-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: left;
}

.link-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.link-box a {
    flex: 1;
    word-break: break-all;
    color: #007bff;
    text-decoration: none;
}

.link-box a:hover {
    text-decoration: underline;
}

input[type="text"], input[type="number"] {
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 60%;
    margin-bottom: 10px;
    background: white;
    color: #333;
}

button, .primary-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover, .primary-btn:hover { 
    background-color: #0056b3; 
}

button.small-btn { 
    font-size: 0.8em; 
    padding: 5px 10px; 
    background-color: #6c757d; 
}

button.copied {
    background-color: #28a745 !important;
    transform: scale(1.05);
}

.copy-all-btn {
    background-color: #17a2b8;
    font-weight: bold;
}

.copy-all-btn:hover {
    background-color: #138496;
}

/* Header Bar */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.size-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.size-btn {
    background-color: #6c757d;
    padding: 5px 12px;
    font-size: 0.85em;
}

.size-btn.active {
    background-color: #007bff;
}

/* Player Card Grid */
.card-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.card {
    width: 320px;
    border: 1px solid #000;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, opacity 0.3s, width 0.3s, height 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); 
}

.card img { 
    width: 320px;
    height: 455px;
    object-fit: contain;
    border-radius: 8px 8px 0 0;
}

/* Card size variants */
.card.size-small { width: 240px; }
.card.size-small img { width: 240px; height: 340px; }

.card.size-medium { width: 320px; }
.card.size-medium img { width: 320px; height: 455px; }

.card.size-large { width: 400px; }
.card.size-large img { width: 400px; height: 570px; }

.card.size-xlarge { width: 500px; }
.card.size-xlarge img { width: 500px; height: 710px; }

.card-text {
    font-size: 0.85em;
    font-weight: bold;
    padding: 8px 5px;
    text-align: center;
    width: 100%;
    word-wrap: break-word;
}

.played {
    opacity: 0.3;
    filter: grayscale(100%);
    transform: scale(0.95);
}

/* Host Compact View */
.card-list-compact {
    max-width: 1200px;
    margin: 0 auto;
}

.suit-group {
    margin-bottom: 30px;
    text-align: left;
}

.suit-header {
    padding: 10px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    margin-bottom: 10px;
}

.cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.card-compact {
    width: 80px;
    height: 110px;
    border: 1px solid #000;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, opacity 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-compact:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.card-compact img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-value {
    position: absolute;
    bottom: 5px;
    font-weight: bold;
    font-size: 0.9em;
}

/* Suit Colors for Headers only */
.suit-header.suit-S { background: #800000; color: white; }
.suit-header.suit-T { background: #70ad47; color: white; }
.suit-header.suit-R { background: #ffc000; color: #333; }
.suit-header.suit-I { background: #49b7ad; color: #333; }
.suit-header.suit-D { background: #404040; color: white; }
.suit-header.suit-E { background: #5b9bd5; color: white; }
.suit-header.suit-P { background: #7030a0; color: white; }

/* Host Overlay */
#host-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.9); 
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
}

#host-overlay img {
    max-width: 90%; 
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

#overlay-text {
    color: white; 
    font-size: 1.5em; 
    margin-top: 20px; 
    font-weight: bold;
}

#close-overlay {
    position: absolute; 
    top: 20px; 
    right: 30px;
    color: white; 
    font-size: 50px; 
    cursor: pointer;
}

.instruction-text {
    margin-top: 30px;
    color: #777;
    font-size: 0.9em;
}

/* Card Counter */
.card-counter {
    padding: 8px 16px;
    background: #17a2b8;
    color: white;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    margin: 0 10px;
}

/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.help-btn, .theme-btn {
    font-size: 1.2em;
    padding: 5px 10px !important;
}

/* Keyboard Hint */
kbd {
    background: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    color: #333;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 35px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.modal-content h4 {
    margin-top: 15px;
    margin-bottom: 8px;
    color: #34495e;
    font-size: 1em;
}

.modal-content ul {
    text-align: left;
    line-height: 1.8;
}

.modal-content ol {
    text-align: left;
    line-height: 1.8;
    padding-left: 20px;
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.shortcuts-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.shortcuts-table td:first-child {
    font-weight: bold;
    width: 40%;
}

/* Card Focus State */
.card-player:focus {
    outline: 3px solid #007bff;
    outline-offset: 4px;
}

/* Smooth transitions */
.card, .card img {
    transition: transform 0.2s, opacity 0.3s, filter 0.3s !important;
}

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
    .header-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .size-controls {
        justify-content: center;
    }
    
    .header-buttons {
        justify-content: center;
    }
    
    .card.size-medium { width: 280px; }
    .card.size-medium img { width: 280px; height: 395px; }
    
    .card.size-large { width: 320px; }
    .card.size-large img { width: 320px; height: 455px; }
    
    .modal-content {
        padding: 20px;
        max-height: 90vh;
    }
    
    .shortcuts-table td {
        padding: 8px;
        font-size: 0.9em;
    }
}
