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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1a1a2e;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Game container - fills screen on mobile, constrained on desktop */
#gameContainer {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Desktop: constrain to vertical aspect ratio, full height, centered */
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    body {
        background: #000;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #gameContainer {
        /* Full height, constrained width to maintain vertical aspect */
        width: auto;
        height: 100%;
        aspect-ratio: 9 / 16;
        max-width: 100vw;
    }
}

/* Operator page styles */
#operatorRoot {
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.operator-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    color: #e0e0e0;
    min-height: 100%;
}

.operator-container h1 {
    color: #f0f0f0;
    margin-bottom: 20px;
    text-align: center;
}

.operator-section {
    background: #252540;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.operator-section h2 {
    color: #f0f0f0;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #b0b0b0;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 16px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6c63ff;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: #6c63ff;
    color: white;
}

.btn-primary:hover {
    background: #5a52d5;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #4a4a6a;
    color: white;
}

.btn-secondary:hover {
    background: #5a5a7a;
}

/* Leaderboard table */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #3a3a5a;
}

.leaderboard-table th {
    background: #1a1a2e;
    color: #b0b0b0;
}

.leaderboard-table tr:hover {
    background: #2a2a4a;
}

/* Login form styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
}

.login-form {
    background: #252540;
    padding: 40px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    color: #f0f0f0;
    margin-bottom: 30px;
}

.error-message {
    background: #dc3545;
    color: white;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
}

/* Position editor */
.position-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    display: block;
}

.video-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.position-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.position-list {
    max-height: 300px;
    overflow-y: auto;
    background: #1a1a2e;
    border-radius: 4px;
    padding: 10px;
}

.position-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #3a3a5a;
}

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

.position-item.active {
    background: #3a3a5a;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .position-editor {
        flex-direction: row;
    }

    .video-container {
        flex: 2;
    }

    .position-sidebar {
        flex: 1;
    }
}
