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

.hidden {
    display: none;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background: rgb(158, 211, 175);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    margin-bottom: 2vh;
}

header h1 {
    font-size: 3.5vw;
    margin-bottom: 0.5vh;
    margin-top: 2vh;
}

header p {
    font-size: 1.5vw;
    opacity: 0.9;
}

.container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100vw;
    height: calc(100vh - 8vh);
    box-sizing: border-box;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
}

/* share */
#share-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    display: none;
}

#share-modal:not(.hidden) {
    display: flex;
}

#share-panel {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    width: 380px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    font-family: 'Courier New', monospace;
}

#share-panel h2 {
    text-align: center;
    color: #333;
}

#close-share-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
}

#share-link {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-align: center;
}

#qr-code {
    display: block;
    width: 220px;
    height: 220px;
    margin: 0 auto;
}

#copy-share-link {
    width: 100%;
    background: rgb(158,211,175);
    color: white;
    font-family: 'Courier New', monospace;
    border-radius: 0.5rem;
}

#share-description {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
}

.share-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.share-field label {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#expiry-dropdown {
    position: relative;
}

#expiry-selected {
    padding: 0.7rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    background: white;
    cursor: pointer;
    color: black;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

#expiry-selected:hover {
    border-color: rgb(158,211,175);
}

#expiry-arrow {
    font-size: 0.8rem;
    transition: transform .2s;
}

#expiry-options {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    overflow: hidden;
    z-index: 100;
}

.expiry-option {
    color: black;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: .2s;
}

.expiry-option:hover {
    background: rgb(158,211,175);
    color: white;
}

/* map */
#map {
    width: 80vw;
    height: 70vh;
    border-radius: 1vw;
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
}

.map-header-container {
    position: relative;
    width: 80vw;
    margin-bottom: 0;
}

#map-loading {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: rgba(158, 211, 175, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1vw;
    font-family: 'Courier New', monospace;
    font-size: 1.2vw;
    color: white;
    letter-spacing: 0.1em;
}

.circular-menu {
    position: absolute;
    top: calc(-2.5vw - 1.5em);
    right: 0.5vw;
    width: 2.5vw;
    height: 2.5vw;
    min-width: 3.4vw;
    min-height: 3.4vw;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 100;
}

#menu-btn:not([style*="display: none"]) {
    display: flex !important;
}

.circular-menu:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.circular-menu span {
    width: 60%;
    height: 0.2vw;
    background-color: white;
    border-radius: 1px;
}

.menu-dropdown {
    position: absolute;
    top: calc(-2.5vw - 1.5em + 3vw);
    right: 0.5vw;
    width: 20vw;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid white;
    border-radius: 0.5vw;
    padding: 1vw;
    z-index: 1000;
}

.menu-dropdown.hidden {
    display: none;
}

#custom-location-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 3px solid white;
    background-color: black;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 500;
    display: none;
}

.slider-btn {
    color: white;
    padding: 0.3vh 0.5vw;
    display: grid;
    grid-template-columns: auto 2.8vw 2vw;
    align-items: center;
    gap: 0.8vw;
    font-size: 0.9vw;
    white-space: nowrap;
    width: 100%;
}

.slider-btn .slider-switch {
    margin-left: 0.4vw;
}

#heatmap-status, #show-friends-status, #timestamps-status {
    margin-left: 0.9vw;
    width: 2vw;
    text-align: left;
}

.slider-switch {
    position: relative;
    display: inline-block;
    width: 2.8vw;
    height: 1.4vw;
}

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

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 1.4vw;
    transition: background 0.3s;
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 1vw;
    width: 1vw;
    left: 0.2vw;
    bottom: 0.2vw;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.slider-switch input:checked + .slider-round {
    background-color: #4caf50;
}

.slider-switch input:checked + .slider-round:before {
    transform: translateX(1.4vw);
}

.container {
    position: relative;
}

.info {
    background: white;
    padding: 0.5vw 2vw;
    border-radius: 1vw;
    margin-top: 2vh;
    width: 60vw;
    min-width: 200px;
    max-width: 90vw;
}

.info p {
    margin: 2vh 0;
    font-size: 1.5vw;
    color: #333;
    display: flex;
    justify-content: center;
    gap: 1vw;
}

#app-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* profile */
#profile-btn {
    position: absolute;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(32px, 4vw, 56px);
    height: clamp(32px, 4vw, 56px);
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    transition: transform 0.2s;
}

#profile-btn:hover { transform: translateY(-50%) scale(1.1); }

#left-buttons {
    position: absolute;
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 1vw;
    z-index: 500;
}

#add-friend-btn, #share-map-btn {
    position: static;
    transform: none;
    background: rgb(158, 211, 175);
    color: white;
    padding: 1vw 2vw;
    border: 3px solid white;
    border-radius: 5px;
    font-weight: bold;
}

#add-friend-btn:hover, #share-map-btn:hover {
    transform: scale(1.05);
}

#profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

@media (max-width: 600px) {
    #profile-btn {
        width: 32px;
        height: 32px;
    }
}

#profile-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#profile-panel {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    width: 340px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
    font-family: 'Courier New', monospace;
}

#close-profile {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
}

#avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

#avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    overflow: hidden;
    border: 3px solid #eee;
}

#modal-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#avatar-upload-label {
    cursor: pointer;
    font-size: 0.85rem;
    color: rgb(100, 170, 130);
    text-decoration: underline;
    font-family: 'Courier New', monospace;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.profile-field label {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field-row {
    display: flex;
    gap: 0.5rem;
}

.field-row input[type="text"] {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}

.field-row input[type="color"] {
    width: 44px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    padding: 2px;
    cursor: pointer;
}

.field-row button {
    padding: 0.5rem 1rem;
    background: rgb(158, 211, 175);
    color: white;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

#username-note {
    font-size: 0.78rem;
    color: #e07040;
    min-height: 1rem;
}

#logout-btn {
    background: #eee;
    color: #555;
    font-family: 'Courier New', monospace;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
}

#profile-status {
    font-size: 0.85rem;
    color: rgb(100, 170, 130);
    text-align: center;
    min-height: 1rem;
}

/* friend */
#add-friend-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-friend-panel {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    width: 380px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: relative;
    font-family: 'Courier New', monospace;
    overflow-y: auto;
}

#close-add-friend {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
}

#add-friend-panel h2 {
    text-align: center;
    font-size: 1.3rem;
    color: #333;
}

.friend-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.friend-field label {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.friend-field input {
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}

#send-friend-request {
    padding: 0.6rem 1rem;
    background: rgb(158, 211, 175);
    color: white;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

#friend-status {
    font-size: 0.85rem;
    color: rgb(100, 170, 130);
    text-align: center;
    min-height: 1rem;
}

#friends-list-section h3 {
    font-size: 1rem;
}

#send-request-section h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.5rem;
}

#requests-section h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.75rem;
}

#requests-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#no-requests-message {
    text-align: center;
    color: #999;
    font-style: italic;
}

.friend-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.friend-request-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.friend-request-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.friend-request-username {
    font-weight: bold;
}

.friend-request-buttons {
    display: flex;
    gap: 0.5rem;
}

.friend-request-accept {
    padding: 5px 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}

.friend-request-accept:hover {
    background: #45a049;
}

.friend-request-reject {
    padding: 5px 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}

.friend-request-reject:hover {
    background: #da190b;
}

#friend-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #ddd;
    padding-bottom: 0.5rem;
}

.friend-tab {
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.3s ease;
}

.friend-tab:hover {
    color: #333;
}

.friend-tab.active {
    color: rgb(158, 211, 175);
    border-bottom-color: rgb(158, 211, 175);
}

.friend-tab-content {
    display: none;
}

.friend-tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 40vh;
    max-height: 50vh;
    overflow-y: auto;
}

.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.friend-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.friend-username {
    font-weight: bold;
}

#no-friends-message {
    text-align: center;
    color: #999;
    font-style: italic;
}

#pending-sent-section {
    margin-top: 1.5rem;
    border-top: 1px solid #ddd;
    padding-top: 1rem;
}

#pending-sent-section h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.75rem;
}

#no-pending-sent-message {
    text-align: center;
    color: #999;
    font-style: italic;
}

.pending-sent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.pending-sent-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pending-sent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.pending-sent-username {
    font-weight: bold;
}

.pending-sent-cancel {
    padding: 4px 8px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

.pending-sent-cancel:hover {
    background: #da190b;
}

.friend-remove {
    padding: 4px 8px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

.friend-remove:hover {
    background: #da190b;
}

/* auth */
#auth-screen {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

#auth-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 320px;
}

#auth-box h2 {
    text-align: center;
    font-family: 'Courier New', monospace;
}

#auth-box input {
    padding: 0.6rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
}

#auth-box button {
    background: rgb(158, 211, 175);
    color: white;
    font-family: 'Courier New', monospace;
}

#auth-toggle {
    background: transparent !important;
    color: #555 !important;
    font-size: 0.85rem;
}

#auth-error {
    color: red;
    font-size: 0.85rem;
    text-align: center;
    min-height: 1rem;
}

#logout-btn {
    padding: 4px 12px;
    font-size: 0.85rem;
    background: #eee;
    color: #333;
}

#friend-tooltip {
    display: none;
    position: fixed;
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 2000;
    white-space: nowrap;
}
