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

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

.header {
    background-color: #2c3e50;
    color: white;
    padding: 20px 0;
    text-align: center;
    margin-bottom: 30px;
}

.room-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

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

.room-controls input[type="text"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-width: 200px;
}

.btn {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn-share {
    background-color: #27ae60;
}

.btn-share:hover {
    background-color: #229954;
}

.btn-leave {
    background-color: #e74c3c;
}

.btn-leave:hover {
    background-color: #c0392b;
}

.btn-settings {
    background-color: #95a5a6;
    font-size: 18px;
    padding: 8px 12px;
}

.btn-settings:hover {
    background-color: #7f8c8d;
}

.settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    min-width: 150px;
}

.settings-item {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.3s;
}

.settings-item:hover {
    background-color: #f8f9fa;
}

.settings-item:first-child {
    border-radius: 4px 4px 0 0;
}

.settings-item:last-child {
    border-radius: 0 0 4px 4px;
}

#roomActions {
    position: relative;
}

.room-code-display {
    font-weight: bold;
    font-size: 18px;
    color: #2c3e50;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 4px;
    margin-right: 10px;
}

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

.share-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

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

.share-url {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    background-color: #f8f9fa;
    margin-bottom: 15px;
    font-size: 14px;
}

.share-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.puzzle-selection {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.puzzle-list {
    width: 100%;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.puzzle-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.3s;
}

.puzzle-item:hover {
    background-color: #f8f9fa;
}

.puzzle-item:last-child {
    border-bottom: none;
}

.puzzle-item.archive-option {
    background-color: #e8f4fd;
    font-style: italic;
    color: #17a2b8;
}

.puzzle-item.archive-option:hover {
    background-color: #d1ecf1;
}

.archive-section {
    width: 100%;
    margin-top: 10px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.archive-section h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.archive-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.archive-select, .archive-date {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.archive-select {
    min-width: 200px;
}

.btn-archive {
    background-color: #17a2b8;
}

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

.file-upload {
    margin-top: 10px;
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload label {
    display: inline-block;
    padding: 10px 20px;
    background-color: #27ae60;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.file-upload label:hover {
    background-color: #229954;
}

.status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

.status.connected {
    background-color: #d4edda;
    color: #155724;
}

.status.disconnected {
    background-color: #f8d7da;
    color: #721c24;
}

.status.error {
    background-color: #f8d7da;
    color: #721c24;
}

.puzzle-container {
    margin-top: 20px;
}

.puzzle-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.btn-video {
    background-color: #e67e22;
}

.btn-video:hover {
    background-color: #d35400;
}

.btn-video.active {
    background-color: #27ae60;
}

.btn-video.active:hover {
    background-color: #229954;
}

.btn-view {
    background-color: #9b59b6;
}

.btn-view:hover {
    background-color: #8e44ad;
}

.btn-nav {
    background-color: #34495e;
}

.btn-nav:hover {
    background-color: #2c3e50;
}

.video-container {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
    background-color: #2c3e50;
    padding: 15px;
    border-radius: 8px;
}

.video-container.one-user {
    grid-template-columns: 1fr;
}

.video-container.two-users {
    grid-template-columns: 1fr 1fr;
}

.video-container.three-users {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.video-container.four-users {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.video-tile {
    position: relative;
    background-color: #34495e;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    min-height: 150px;
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-tile.audio-only {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.video-controls {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
}

.video-control-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 5px;
    cursor: pointer;
    font-size: 12px;
}

.video-control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.video-control-btn.muted {
    background: #e74c3c;
}

.video-control-btn.hidden-video {
    background: #e74c3c;
}

.full-view {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.single-clue-view {
    max-width: 800px;
    margin: 0 auto;
}

.single-clue-header {
    text-align: center;
    margin-bottom: 20px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.clue-progress {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.current-clue-text {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.single-clue-grid {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.single-clue-cell {
    width: 40px;
    height: 40px;
    border: 2px solid #2c3e50;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
}

.single-clue-cell.current {
    background-color: #3498db;
    color: white;
}

.single-clue-cell.incorrect {
    position: relative;
}

.single-clue-cell.incorrect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, #e74c3c 40%, #e74c3c 60%, transparent 60%);
    pointer-events: none;
}

.single-clue-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    outline: none;
}

.single-clue-cell-number {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: 10px;
    font-weight: bold;
    color: #2c3e50;
}

.single-clue-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.grid-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.crossword-grid {
    display: inline-block;
    border: 2px solid #2c3e50;
    background-color: #2c3e50;
    gap: 1px;
}

.grid-cell {
    width: 30px;
    height: 30px;
    border: 1px solid #2c3e50;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
}

.grid-cell.black {
    background-color: #2c3e50;
    cursor: default;
}

.grid-cell.current {
    background-color: #3498db;
    color: white;
}

.grid-cell.highlighted {
    background-color: #e3f2fd;
}

.grid-cell.other-user {
    background-color: #ffeb3b;
}

.grid-cell.incorrect {
    position: relative;
}

.grid-cell.incorrect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, #e74c3c 40%, #e74c3c 60%, transparent 60%);
    pointer-events: none;
}

.grid-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    outline: none;
}

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 10px;
    font-weight: bold;
    color: #2c3e50;
}

.clues-container {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 600px;
    overflow-y: auto;
}

.clues-section {
    margin-bottom: 30px;
}

.clues-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.clue-item {
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.clue-item:hover {
    background-color: #f8f9fa;
}

.clue-item.active {
    background-color: #e3f2fd;
}

.clue-number {
    font-weight: bold;
    color: #2c3e50;
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

@media (max-width: 768px) {
    .full-view {
        grid-template-columns: 1fr;
    }
    
    .room-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .room-controls input[type="text"] {
        min-width: auto;
    }
    
    .puzzle-selection {
        flex-direction: column;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .archive-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .archive-select {
        min-width: auto;
    }
    
    .puzzle-header {
        flex-direction: column;
        align-items: center;
    }
    
    .video-container.two-users,
    .video-container.three-users,
    .video-container.four-users {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
    
    .single-clue-cell {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .single-clue-controls {
        flex-direction: column;
    }
}
