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

body {
    font-family: 'Courier New', monospace;
    background: white;
    color: black;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Floating nametags background elements */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Nametag styling - Classic "Hello My Name Is" design */
.nametag {
    position: absolute;
    width: 160px;
    height: 100px;
    background: #808080; /* Classic gray color */
    border-radius: 12px;
    animation: floatAndType 12s infinite ease-in-out;
    user-select: none;
    opacity: 0.12;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    font-size: 0.7rem;
    text-align: center;
    padding: 0;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transform: rotate(-2deg); /* Slight tilt like real stickers */
}

/* Nametag header section */
.nametag-header {
    background: #808080;
    color: white;
    width: 100%;
    padding: 8px 0 6px 0;
    border-radius: 12px 12px 0 0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nametag-hello {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.nametag-my-name-is {
    font-size: 0.6rem;
    font-weight: normal;
    opacity: 0.9;
}

/* Nametag name field - white area */
.nametag-name-field {
    background: white;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 12px 12px;
    margin-top: 2px;
    min-height: 40px;
}

.nametag-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: black;
    text-align: center;
    min-height: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
}

/* Floating and typewriter animation */
@keyframes floatAndType {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-15px);
    }
    50% {
        transform: translateY(-10px);
    }
    75% {
        transform: translateY(-20px);
    }
}

/* Typewriter cursor animation */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.nametag-cursor {
    animation: blink 1s infinite;
}

/* Different nametag variations */
.nametag:nth-child(odd) {
    animation-delay: -2s;
    animation-duration: 15s;
}

.nametag:nth-child(even) {
    animation-delay: -6s;
    animation-duration: 18s;
}

.nametag:nth-child(3n) {
    animation-delay: -10s;
    animation-duration: 14s;
}

.container {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* Sections */
.section {
    display: none;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
}

.section.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: normal;
    letter-spacing: 0.2em;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 40px;
    letter-spacing: 0.05em;
    text-align: center;
}

/* Handle Input Section */
.input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    position: relative;
    width: 100%;
    max-width: 600px;
    z-index: 1;
}

.input-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
}

#handle-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    background: white;
    border: 2px solid black;
    outline: none;
}

#handle-input:focus {
    border-width: 3px;
    padding: 11px 14px;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid black;
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.autocomplete-item:hover {
    background: #f0f0f0;
}

.autocomplete-item.selected {
    background: #f0f0f0;
}

.autocomplete-handle {
    font-weight: bold;
    font-size: 0.95rem;
}

.autocomplete-name {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 2px;
}

/* Turnstile Container */
.turnstile-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    background: black;
    color: white;
    border: 2px solid black;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.btn:hover:not(:disabled) {
    background: white;
    color: black;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn.secondary {
    background: white;
    color: black;
}

.btn.secondary:hover {
    background: black;
    color: white;
}

/* Results Section */
.result-content {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.handle-display {
    font-size: 1rem;
    margin: 10px 0 30px;
    opacity: 0.8;
}

.handle-display span {
    font-weight: bold;
}

/* Change Stats */
.hop-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: #f9f9f9;
    border: 2px solid black;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.7;
    letter-spacing: 0.1em;
}

/* Change History */
.hop-history {
    background: #f9f9f9;
    border: 2px solid #ddd;
    padding: 20px;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

.hop-entry {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.hop-entry:last-child {
    border-bottom: none;
}

.hop-from, .hop-to {
    font-weight: bold;
}

.hop-arrow {
    margin: 0 10px;
    opacity: 0.6;
}

.hop-timestamp {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 2px;
}

/* Leaderboard Section */
.leaderboard-content {
    max-width: 1000px;
    width: 100%;
}

/* Leaderboard List */
.leaderboard-list {
    margin: 20px 0;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border: 2px solid #ddd;
    margin-bottom: 10px;
    background: white;
    transition: all 0.2s ease;
}

.leaderboard-entry:hover {
    border-color: black;
    transform: translateX(5px);
}

.leaderboard-entry.current-user {
    border-color: black;
    background: #f0f0f0;
}

.leaderboard-rank {
    font-size: 1.2rem;
    font-weight: bold;
    margin-right: 20px;
    min-width: 40px;
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid black;
}

.leaderboard-info {
    flex: 1;
    text-align: left;
}

.leaderboard-handle {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 2px;
}

.leaderboard-stats {
    font-size: 0.8rem;
    opacity: 0.7;
}

.leaderboard-badges {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.badge {
    padding: 2px 8px;
    font-size: 0.7rem;
    border: 1px solid black;
    background: white;
}

.share-leaderboard-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    background: black;
    color: white;
    border: 2px solid black;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.share-leaderboard-btn:hover {
    background: white;
    color: black;
}

/* User Links */
.user-links {
    display: none;
    gap: 10px;
    margin-left: auto;
    align-items: center;
}

.user-link {
    padding: 5px 10px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.user-link:hover {
    background: #333;
    color: white;
    border-color: #333;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin: 30px 0;
}

/* Button group for multiple buttons */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Error Message */
.error-message {
    color: black;
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.error-message.show {
    opacity: 1;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #ddd;
    border-top-color: black;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.footer a {
    color: black;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.footer a:hover {
    opacity: 0.6;
}

.footer .separator {
    margin: 0 10px;
    opacity: 0.4;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .nametag {
        width: 140px;
        height: 90px;
        font-size: 0.6rem;
    }
    
    .nametag-hello {
        font-size: 0.7rem;
    }
    
    .nametag-my-name-is {
        font-size: 0.5rem;
    }
    
    .nametag-name {
        font-size: 0.8rem;
    }

    h1 {
        font-size: 1.8rem;
        letter-spacing: 0.1em;
    }

    /* Handle input on mobile */
    .input-container {
        max-width: 90%;
        flex-direction: column;
        gap: 15px;
    }

    .input-wrapper {
        width: 100%;
    }

    #handle-input {
        font-size: 1rem;
        padding: 15px;
    }

    .btn {
        width: 100%;
        padding: 15px;
    }

    /* Change stats on mobile */
    .hop-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-number {
        font-size: 2rem;
    }

    /* Leaderboard on mobile */
    .leaderboard-entry {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .leaderboard-rank {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .leaderboard-avatar {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .leaderboard-info {
        text-align: center;
    }

    .leaderboard-badges {
        margin-left: 0;
        margin-top: 10px;
        justify-content: center;
    }

    /* Button groups on mobile */
    .button-group {
        width: 90%;
        flex-direction: column;
        gap: 10px;
    }

    .button-group .btn {
        width: 100%;
    }

    /* Footer on mobile */
    .footer {
        padding: 15px 10px;
        font-size: 0.75rem;
    }

    .footer .separator {
        display: inline;
        margin: 0 5px;
    }

    .footer-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
    }
}
