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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

#userSelectionScreen,
#newUserScreen {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: white;
    padding-top: 30px;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    text-align: center;
}

h1 {
    font-size: 2em;
    margin-bottom: 30px;
    color: #333;
}

h2 {
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.user-list {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.user-item {
    padding: 15px;
    margin: 10px 0;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-item:hover {
    background: #e0e0e0;
}

.user-item-online:hover {
    background: #f0f0f0;
    cursor: not-allowed;
}

.user-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.user-item-name {
    text-align: left;
    flex: 1;
}

.input-field {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.btn-primary,
.btn-secondary,
.btn-center {
    padding: 12px 24px;
    margin: 10px 5px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #45a049;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background: #0b7dda;
}

.btn-center {
    position: absolute;
    bottom: 20px;
    right: 15px;
    width: 48px;
    height: 48px;
    padding: 0;
    background: white;
    border: none;
    border-radius: 2px;
    font-size: 1.3em;
    z-index: 400;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s;
}

.btn-center:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btn-center:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#map {
    width: 100%;
    height: 100%;
}

.user-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: white;
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 400;
    display: none;
}

.location-log {
    position: absolute;
    bottom: 20px;
    left: 10px;
    background: white;
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 400;
    font-size: 0.9em;
    line-height: 1.5;
    color: #333;
}

.location-log div {
    white-space: nowrap;
}

.legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 400;
    min-width: 150px;
    overflow: hidden;
}

.legend-header {
    padding: 10px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95em;
    user-select: none;
}

.legend-header:hover {
    background: #efefef;
}

.legend-toggle {
    transition: transform 0.3s ease;
    display: inline-block;
}

.legend.collapsed .legend-toggle {
    transform: rotate(-90deg);
}

.legend-content {
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.legend.collapsed .legend-content {
    max-height: 0;
}

.legend-item {
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
}

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

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

#selfiePreview {
    max-width: 200px;
    margin: 10px 0;
    border-radius: 8px;
}

.greyscale {
    filter: grayscale(100%);
}
