@font-face {
    font-family: "Geist Pixel Circle";
    src: url("/assets/fonts/GeistPixel-Circle.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

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

/* Base layout */
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: "Geist Pixel Circle", "Times New Roman", serif;
    font-size: 16px;
    text-rendering: geometricPrecision;
}

body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

button,
.progress-dot {
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

button:focus,
button:active,
.progress-dot:focus,
.progress-dot:active {
    outline: none;
}

/* UI overlay */
#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

#ui-container>* {
    pointer-events: auto;
}

/* Settings button */
#settings-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 1.5rem;
    height: 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    z-index: 2000;
    overflow: visible;
    transition: transform 0.2s ease;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#settings-btn:hover .star-shape {
    animation: spin 2.5s linear infinite;
}

#settings-btn .star-shape {
    transform-origin: 50% 50%;
    will-change: transform;
}

/* Star glyph */
.star-shape {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.75);
    clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
    transition: all 0.5s ease;
}

/* Settings menu */
#settings-menu {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    padding: 0.625rem 0.625rem;
    border: 0.0625rem solid rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    background: rgba(0, 0, 0, 0.75);
    transform-origin: top right;
    transform: scale(1);
    opacity: 1;
    transition: transform 0.7s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.7s ease;
    z-index: 1999;
}

#settings-menu.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

#settings-menu button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 1);
    padding: 0.3125rem 0.4375rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: lighter;
    text-align: left;
    display: grid;
    grid-template-columns: 1rem auto;
    align-items: center;
    justify-items: start;
    gap: 0.5rem;
    width: 100%;
    letter-spacing: 0.02em;
}

#settings-menu button:hover {
    color: #fff;
    text-shadow: 0 0 0.3125rem rgba(255, 255, 255, 1), 0 0 0.625rem rgba(255, 255, 255, 0.75);
    background: none;
}

#settings-menu button svg {
    opacity: 0.8;
    width: 1rem;
    height: 1rem;
}

#settings-menu button:hover svg {
    opacity: 1;
    filter: drop-shadow(0 0 0.125rem rgba(255, 255, 255, 0.8));
}

/* Mobile */
@media (max-width: 48rem) {
    #settings-btn {
        width: 1.5rem;
        height: 1.5rem;
    }

    #settings-menu button {
        font-size: 1rem;
    }
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.loading-title {
    margin-bottom: 3rem;
    padding: 0 1.5rem;
    color: transparent;
    font-size: 2.5rem;
    line-height: 1.3;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 0 0.65rem rgba(255, 255, 255, 0.2);
    max-width: 90vw;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 1), rgba(200, 230, 255, 0.9));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: 0% 50%;
        opacity: 0.85;
    }

    50% {
        background-position: 100% 50%;
        opacity: 1;
    }

    100% {
        background-position: 0% 50%;
        opacity: 0.85;
    }
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#loading-overlay .loading-star-wrapper {
    width: 3.125rem;
    height: 3.125rem;
    overflow: visible;
}

#loading-overlay .star-shape {
    width: 100%;
    height: 100%;
}

.breathing {
    animation: breathe 2s ease-in-out infinite;
}

/* Debug HUD */
#debug-hud {
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    max-width: 90vw;
    padding: 0.625rem 0.625rem;
    background: rgba(0, 0, 0, 0.75);
    border: 0.0625rem solid rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    color: rgba(255, 255, 255, 1);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: lighter;
    letter-spacing: 0.02em;
    line-height: 1.35;
    z-index: 3000;
    transform-origin: top left;
    transform: scale(1);
    opacity: 1;
    transition: transform 0.7s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.7s ease;
    display: grid;
    gap: 0.4rem;
    min-width: 14rem;
}

#debug-hud.hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

#debug-hud .hud-row {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    column-gap: 0.75rem;
    align-items: baseline;
}

#debug-hud .hud-label {
    opacity: 0.65;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#debug-hud .hud-value {
    opacity: 0.95;
    word-break: break-word;
}

#debug-hud .hud-row.alert .hud-label,
#debug-hud .hud-row.alert .hud-value {
    color: rgba(255, 140, 140, 0.95);
}

/* Loading breathing animation */
@keyframes breathe {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
        filter: drop-shadow(0 0 0.3125rem rgba(255, 255, 255, 0.5));
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
        filter: drop-shadow(0 0 0.625rem rgba(255, 255, 255, 1)) drop-shadow(0 0 1.25rem rgba(255, 255, 255, 0.8)) drop-shadow(0 0 2.5rem rgba(255, 255, 255, 0.6));
    }
}

/* Progress dots */
#progress-container {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.625rem;
    z-index: 1000;
}

.progress-dot {
    width: 0.65rem;
    height: 0.65rem;
    cursor: pointer;
    opacity: 0.4;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: relative;
    background: none;
}

.progress-dot .star-shape {
    background: rgba(255, 255, 255, 0.6);
    transition: background 0.3s ease;
}

.progress-dot.active {
    opacity: 1;
    transform: scale(1.25);
}

.progress-dot.active .star-shape {
    background: #fff;
}
