* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.screen {
    display: none;
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.title-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    margin: 0 auto 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

h1 {
    text-align: center;
    color: #d32f2f;
    font-size: 2.5em;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
    text-align: center;
    color: #d32f2f;
    font-size: 2em;
    margin-bottom: 30px;
}

h3 {
    color: #f57c00;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #ddd;
    color: #333;
    margin-top: 20px;
}

.btn-secondary:hover {
    background: #ccc;
}

.lobby-code-display {
    text-align: center;
    margin: 30px 0;
}

.lobby-code-display p {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 10px;
}

.code {
    font-size: 3em;
    font-weight: bold;
    color: #d32f2f;
    letter-spacing: 10px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 10px;
    display: inline-block;
}

.form-group {
    margin: 20px 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #d32f2f;
}

.lobbies-container {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.lobby-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 12px;
    background: #f8f8f8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.lobby-item:hover {
    background: #fff;
    border-color: #d32f2f;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.2);
}

.lobby-item strong {
    color: #d32f2f;
    font-size: 1.2em;
    display: block;
    margin-bottom: 5px;
}

.lobby-item small {
    color: #666;
    font-size: 0.9em;
}

.lobby-arrow {
    font-size: 1.8em;
    color: #d32f2f;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.lobby-item:hover .lobby-arrow {
    transform: translateX(5px);
}

.settings-section, .players-section {
    margin: 25px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.settings-section p, .players-section p {
    margin: 8px 0;
    color: #555;
}

#players-list {
    list-style: none;
    padding: 0;
}

#players-list li {
    padding: 12px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #d32f2f;
    font-weight: 600;
}

.player-circle {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
    border: 3px dashed #d32f2f;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.circle-arrow {
    font-size: 3em;
    color: #d32f2f;
}

.sortable-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.player-item {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 2px solid #ddd;
    cursor: move;
    user-select: none;
    transition: all 0.2s ease;
}

.player-item:hover {
    background: #e8e8e8;
    border-color: #d32f2f;
}

.player-item.dragging {
    opacity: 0.5;
}

.round-info {
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    margin: 20px 0;
}

.round-info p {
    margin: 8px 0;
    font-size: 1.1em;
    color: #555;
}

.round-info span {
    font-weight: bold;
    color: #d32f2f;
}

.guess-section, .results-section {
    margin: 25px 0;
}

#guesses-list, #results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guess-item, .result-item {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guess-item.current-turn, .result-item.current-turn {
    background: #fffbea;
    border: 2px solid #f59e0b;
}

.guess-item.completed {
    background: #e8f5e9;
    border: 2px solid #4caf50;
}

.guess-value, .result-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #d32f2f;
}

#your-guess-section {
    margin: 25px 0;
    padding: 20px;
    background: #fffbea;
    border-radius: 10px;
    border: 2px solid #f59e0b;
}

#your-guess-section input {
    width: 100%;
    padding: 12px;
    font-size: 1.2em;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin: 15px 0;
}

#waiting-for-guesses {
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
}

.error-message {
    padding: 15px;
    background: #fee;
    border: 2px solid #f44;
    border-radius: 8px;
    color: #c00;
    margin: 20px 0;
    text-align: center;
    font-weight: 600;
}

#forbidden-guess-message {
    margin: 10px 0;
    padding: 10px;
    background: #fee;
    border-radius: 5px;
}

.winner-section {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 15px;
    margin: 20px 0;
}

.winner-section h3 {
    color: #333;
    font-size: 2em;
    margin-bottom: 10px;
}

.winner-section p {
    font-size: 1.3em;
    color: #555;
}

.final-scores {
    margin: 25px 0;
}

#final-scores-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#final-scores-table th,
#final-scores-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#final-scores-table th {
    background: #d32f2f;
    color: white;
    font-weight: 600;
}

#final-scores-table tr:hover {
    background: #f5f5f5;
}

#final-scores-table tr:first-child td {
    font-weight: bold;
    color: #d32f2f;
}

.result-input {
    width: 80px;
    padding: 8px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

.result-input:focus {
    outline: none;
    border-color: #d32f2f;
}

.scores-display {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.scores-display h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #d32f2f;
}

.score-item.leader {
    border-left-color: #ffd700;
    background: #fffbea;
}

.score-item .player-name {
    font-weight: 600;
    color: #333;
}

.score-item .score-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #d32f2f;
}

.admin-player-card {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    border: 2px solid #ddd;
}

.admin-player-card h4 {
    margin-bottom: 10px;
    color: #d32f2f;
}

.admin-score-input {
    width: 100px;
    padding: 8px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.admin-score-input:focus {
    outline: none;
    border-color: #d32f2f;
}

/* Admin Table Styles */
.admin-table-container {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    background: white;
    margin-bottom: 20px;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    white-space: nowrap;
}

.admin-table thead {
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.admin-table th.sticky-col {
    position: sticky;
    left: 0;
    z-index: 11;
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    min-width: 120px;
    text-align: left;
    padding-left: 15px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.admin-table th.total-col {
    position: sticky;
    right: 0;
    z-index: 11;
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    min-width: 80px;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    border-right: none;
}

.admin-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.admin-table tbody tr:hover {
    background-color: #f8f8ff;
}

.admin-table tbody tr:last-child {
    border-bottom: none;
}

.admin-table td {
    padding: 10px 8px;
    text-align: center;
    border-right: 1px solid #e0e0e0;
}

.admin-table td.sticky-col {
    position: sticky;
    left: 0;
    background: white;
    font-weight: 600;
    color: #d32f2f;
    text-align: left;
    padding-left: 15px;
    z-index: 9;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.admin-table tbody tr:hover td.sticky-col {
    background-color: #f8f8ff;
}

.admin-table td.total-col {
    position: sticky;
    right: 0;
    background: white;
    font-weight: bold;
    font-size: 1.1em;
    color: #d32f2f;
    z-index: 9;
    box-shadow: -2px 0 5px rgba(0,0,0,0.05);
    border-right: none;
}

.admin-table tbody tr:hover td.total-col {
    background-color: #f8f8ff;
}

.round-group {
    display: inline-block;
}

.round-subcell {
    display: inline-block;
    padding: 4px;
    min-width: 60px;
}

.subcell-label {
    font-size: 10px;
    color: #999;
    display: block;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.admin-cell-input {
    width: 50px;
    padding: 6px 4px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
}

.admin-cell-input:focus {
    outline: none;
    border-color: #d32f2f;
    background-color: #fff5f5;
}

.admin-cell-value {
    font-weight: 600;
    padding: 6px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.points-positive {
    color: #22c55e;
}

.points-negative {
    color: #ef4444;
}

.points-zero {
    color: #999;
}

/* Soundboard Styles */
.soundboard-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}

.soundboard-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.soundboard-float-btn:active {
    transform: scale(0.95);
}

.soundboard-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}

.soundboard-modal.active {
    display: flex;
}

.soundboard-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.soundboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #d32f2f;
}

.soundboard-header h2 {
    margin: 0;
    color: #d32f2f;
}

.soundboard-close {
    background: none;
    border: none;
    font-size: 40px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.soundboard-close:hover {
    color: #d32f2f;
}

.soundboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.sound-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 120px;
}

.sound-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
    border-color: #d32f2f;
}

.sound-btn:active {
    transform: translateY(0);
}

.sound-btn img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

.sound-btn span {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-align: center;
    word-wrap: break-word;
    max-width: 100%;
}

.sound-btn-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin-bottom: 8px;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
        border-radius: 15px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    h3 {
        font-size: 1.1em;
    }

    .title-image {
        max-width: 100%;
        margin-bottom: 15px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1em;
    }

    input {
        padding: 12px;
        font-size: 1em;
    }

    .code {
        font-size: 2em;
        letter-spacing: 5px;
    }

    .player-circle {
        width: 120px;
        height: 120px;
        font-size: 0.9em;
    }
    
    .admin-table {
        font-size: 10px;
        overflow-x: auto;
        display: block;
    }
    
    .admin-cell-input {
        width: 40px;
        font-size: 11px;
        padding: 4px;
    }
    
    .round-subcell {
        min-width: 45px;
        font-size: 10px;
    }
    
    .soundboard-float-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }
    
    .soundboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    .soundboard-btn {
        padding: 12px 8px;
        font-size: 0.85em;
    }

    .players-list {
        font-size: 0.95em;
    }

    .player-item {
        padding: 10px;
    }

    .settings-group label {
        font-size: 0.95em;
    }

    .card-display {
        font-size: 3em;
    }

    .guess-controls {
        gap: 8px;
    }

    .guess-btn {
        padding: 12px;
        font-size: 1.1em;
    }
}
