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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3f 50%, #1a472a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

h1 {
    color: #c41e3a;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #1a472a;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

h3 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: left;
}

.hidden {
    display: none !important;
}

/* Back Button - Old style (kept for compatibility) */
.back-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px 10px;
    margin-bottom: 15px;
    display: inline-block;
    transition: color 0.3s;
}

.back-btn:hover {
    color: #333;
}

/* Game Section with Back Button Bubble */
.game-section {
    position: relative;
}

.back-btn-bubble {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    background: #c41e3a;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.3s, transform 0.2s;
    z-index: 10;
}

.back-btn-bubble:hover {
    background: #a01830;
    transform: scale(1.1);
}

/* Home Page Buttons */
.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.home-btn {
    display: block;
    padding: 20px 30px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.create-btn {
    background: #c41e3a;
    color: white;
}

.create-btn:hover {
    background: #a01830;
    transform: scale(1.02);
}

.join-btn {
    background: #1a472a;
    color: white;
}

.join-btn:hover {
    background: #2d5a3f;
    transform: scale(1.02);
}

/* Mode Selection Cards (legacy - kept for compatibility) */
.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mode-card {
    display: block;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    text-decoration: none;
    color: inherit;
}

.mode-card:hover {
    border-color: #1a472a;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.mode-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.mode-card h3 {
    color: #1a472a;
    margin-bottom: 8px;
    text-align: left;
}

.mode-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Entry Method Cards */
.entry-method-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.entry-method-card {
    flex: 1;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.entry-method-card:hover {
    border-color: #1a472a;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.entry-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.entry-method-card h3 {
    color: #1a472a;
    margin-bottom: 5px;
    font-size: 1rem;
    text-align: center;
}

.entry-method-card p {
    color: #666;
    font-size: 0.8rem;
    line-height: 1.3;
    margin: 0;
}

/* Back Link */
.back-link {
    display: block;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 10px;
    margin-top: 15px;
    transition: color 0.3s;
    text-decoration: none;
    text-align: center;
}

.back-link:hover {
    color: #333;
}

/* Manual Names List */
#manual-names-list {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 100px;
}

#manual-player-list {
    list-style: none;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

#manual-player-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#manual-add-btn {
    padding: 15px 25px;
    font-size: 1rem;
    background: #1a472a;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#manual-add-btn:hover {
    background: #2d5a3f;
    transform: scale(1.05);
}

#manual-start-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    background: #c41e3a;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    font-weight: bold;
}

#manual-start-btn:hover:not(:disabled) {
    background: #a01830;
    transform: scale(1.02);
}

#manual-start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#manual-name-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

#manual-name-input:focus {
    border-color: #1a472a;
}

/* Join Game Link Button */
.join-link-btn {
    display: block;
    margin-top: 20px;
    padding: 15px 25px;
    background: #1a472a;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    transition: background 0.3s, transform 0.2s;
}

.join-link-btn:hover {
    background: #2d5a3f;
    transform: scale(1.02);
}

/* Input Groups */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    text-align: left;
}

.input-group-vertical label {
    font-weight: 600;
    color: #333;
}

#name-input,
#room-code-input,
#player-name-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

#room-code-input {
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: bold;
    text-align: center;
}

#name-input:focus,
#room-code-input:focus,
#player-name-input:focus {
    border-color: #1a472a;
}

#add-btn {
    padding: 15px 25px;
    font-size: 1rem;
    background: #1a472a;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

#add-btn:hover {
    background: #2d5a3f;
    transform: scale(1.05);
}

/* Names List */
#names-list,
#waiting-players {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 100px;
}

#player-list,
#joined-list {
    list-style: none;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

#player-list li,
#joined-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#player-list li .remove-btn {
    background: #c41e3a;
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s;
}

#player-list li .remove-btn:hover {
    background: #a01830;
}

/* Buttons */
#start-btn,
#create-room-btn,
#start-revealed-btn,
#join-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    background: #c41e3a;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    font-weight: bold;
}

#start-btn:hover:not(:disabled),
#create-room-btn:hover,
#start-revealed-btn:hover:not(:disabled),
#join-btn:hover {
    background: #a01830;
    transform: scale(1.02);
}

#start-btn:disabled,
#start-revealed-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* QR Code Section */
.qr-container {
    background: white;
    border: 3px solid #1a472a;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: inline-block;
}

.qr-container img {
    display: block;
    max-width: 250px;
}

.room-code-display {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.room-code-display strong {
    display: block;
    font-size: 2rem;
    letter-spacing: 5px;
    color: #1a472a;
    margin-top: 5px;
}

/* Reveal Phase Styles */
.reveal-card {
    background: linear-gradient(135deg, #c41e3a 0%, #a01830 100%);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(196, 30, 58, 0.3);
    animation: fadeIn 0.5s ease-out;
}

.number-badge {
    background: white;
    color: #c41e3a;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.number-badge.secret {
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3f 100%);
    color: white;
    font-size: 1.5rem;
}

.name-reveal {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.progress {
    color: #666;
    margin-bottom: 20px;
    font-size: 1rem;
}

#next-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.2rem;
    background: #1a472a;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    font-weight: bold;
}

#next-btn:hover {
    background: #2d5a3f;
    transform: scale(1.02);
}

#restart-btn {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    background: #666;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 15px;
}

#restart-btn:hover {
    background: #555;
}

/* Game Started Card */
.game-started-card {
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3f 100%);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 20px;
    color: white;
}

.checkmark {
    width: 80px;
    height: 80px;
    background: white;
    color: #1a472a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 20px;
}

.game-started-card h2 {
    color: white;
    margin-bottom: 10px;
}

.game-started-card p {
    opacity: 0.9;
}

/* Join Page Styles */
.join-form {
    text-align: left;
}

.error-message {
    color: #c41e3a;
    background: #ffe6e6;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
}

/* Waiting Card */
.waiting-card {
    background: #f9f9f9;
    border-radius: 20px;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ddd;
    border-top-color: #1a472a;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.waiting-card h2 {
    margin-bottom: 10px;
}

.waiting-card p {
    color: #666;
}

/* Your Number Card */
.your-number-card {
    background: linear-gradient(135deg, #c41e3a 0%, #a01830 100%);
    border-radius: 20px;
    padding: 40px;
    color: white;
    margin-bottom: 20px;
}

.your-number-card h2 {
    color: white;
    margin-bottom: 20px;
    opacity: 0.9;
}

.big-number {
    background: white;
    color: #c41e3a;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.number-subtitle {
    opacity: 0.9;
}

.secret-message {
    color: #666;
    font-style: italic;
    font-size: 1.1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styling */
#player-list::-webkit-scrollbar,
#joined-list::-webkit-scrollbar {
    width: 8px;
}

#player-list::-webkit-scrollbar-track,
#joined-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#player-list::-webkit-scrollbar-thumb,
#joined-list::-webkit-scrollbar-thumb {
    background: #1a472a;
    border-radius: 4px;
}

#player-list::-webkit-scrollbar-thumb:hover,
#joined-list::-webkit-scrollbar-thumb:hover {
    background: #2d5a3f;
}

/* Toggle Switch */
.toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.toggle-label {
    font-weight: 600;
    color: #333;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

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

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    transition: background 0.3s;
}

.toggle-switch label::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + label {
    background: #1a472a;
}

.toggle-switch input:checked + label::before {
    transform: translateX(24px);
}

/* Ladder Container */
.ladder-container {
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3f 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
}

#ladder-list {
    list-style: none;
    counter-reset: ladder;
}

#ladder-list li {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

#ladder-list li:last-child {
    margin-bottom: 0;
}

#ladder-list li .ladder-number {
    background: #c41e3a;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 15px;
    flex-shrink: 0;
}

#ladder-list li .ladder-name {
    flex: 1;
}

#ladder-list li .ladder-remove-btn {
    background: #c41e3a;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.2s;
    flex-shrink: 0;
    margin-left: 10px;
}

#ladder-list li .ladder-remove-btn:hover {
    background: #a01830;
    transform: scale(1.1);
}

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

/* Add Participant Button */
#add-participant-btn {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    background: #1a472a;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    font-weight: bold;
    margin-bottom: 10px;
}

#add-participant-btn:hover {
    background: #2d5a3f;
    transform: scale(1.02);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    color: #1a472a;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.modal-content p {
    color: #666;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-content p strong {
    color: #333;
}

/* Radio Options */
.position-options {
    margin-bottom: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.radio-option:hover {
    background: #f0f0f0;
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #1a472a;
}

.radio-option span {
    color: #333;
    font-weight: 500;
}

.radio-option input[type="number"] {
    width: 60px;
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-left: auto;
}

.radio-option input[type="number"]:focus {
    border-color: #1a472a;
    outline: none;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s, transform 0.2s;
}

.cancel-btn {
    background: #ddd;
    color: #333;
}

.cancel-btn:hover {
    background: #ccc;
}

.confirm-btn {
    background: #1a472a;
    color: white;
}

.confirm-btn:hover {
    background: #2d5a3f;
}

.confirm-btn.danger {
    background: #c41e3a;
}

.confirm-btn.danger:hover {
    background: #a01830;
}

/* Option Toggle with Help Icon */
.option-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
}

.toggle-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
}

.toggle-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a472a;
    cursor: pointer;
}

.toggle-checkbox span {
    user-select: none;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #ddd;
    color: #666;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.help-icon:hover {
    background: #1a472a;
    color: white;
}

/* Help Modal */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.help-modal-content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    max-width: 350px;
    width: 90%;
    text-align: center;
}

.help-modal-content h3 {
    color: #1a472a;
    margin-bottom: 15px;
}

.help-modal-content p {
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

.help-modal-content button {
    padding: 10px 25px;
    background: #1a472a;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.help-modal-content button:hover {
    background: #2d5a3f;
}

/* Follow Link */
.follow-link {
    display: block;
    margin-top: 20px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.follow-link:hover {
    color: #1a472a;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 1.3rem;
    }

    .mode-card {
        padding: 20px;
    }

    .big-number {
        width: 100px;
        height: 100px;
        font-size: 3rem;
    }

    /* Entry method cards stack on mobile */
    .entry-method-cards {
        flex-direction: column;
        gap: 10px;
    }

    .entry-method-card {
        padding: 15px;
    }

    .entry-icon {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    .entry-method-card h3 {
        font-size: 0.95rem;
    }

    .entry-method-card p {
        font-size: 0.75rem;
    }

    /* Input group adjustments */
    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    #manual-add-btn,
    #add-btn {
        width: 100%;
        padding: 12px;
    }

    #manual-name-input,
    #name-input {
        width: 100%;
    }

    /* Smaller buttons */
    #manual-start-btn,
    #start-btn,
    #start-revealed-btn,
    #create-room-btn {
        padding: 15px;
        font-size: 1.1rem;
    }

    /* Ladder adjustments */
    .ladder-container {
        padding: 20px 15px;
    }

    #ladder-list li {
        padding: 12px 15px;
        font-size: 1rem;
    }

    #ladder-list li .ladder-number {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        margin-right: 10px;
    }

    #add-participant-btn {
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Modal adjustments */
    .modal-content {
        padding: 20px;
        width: 95%;
    }
}
