:root {
    color-scheme: only dark;
    --transition-duration: 1.8s;
    --transition-timing: cubic-bezier(0.4, 0.2, 0.2, 1);
    --letter-spacing: 10px;
    --letter-spacing-expanded: 13px;
    --title-font-size: clamp(1.15rem, 4vw, 2.8rem);
    --title-letter-margin: clamp(1px, 0.3vw, 3px);
    --title-padding-y: clamp(8px, 1.2vw, 14px);
    --title-padding-x: clamp(10px, 2vw, 24px);
    --ui-accent: #85d8ff;
    --ui-accent-strong: #ffffff;
    --title-color: #ffffff;
    --title-active-color: #ff1d1d;
    --title-shadow-color: rgba(255, 255, 255, 0.55);
}

body,
html {
    height: 100%;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000000 !important;
    color: #ffffff !important;
    font-family: "Montserrat", sans-serif;
    font-weight: 200;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow: hidden;
    padding: 0 10px;
    box-sizing: border-box;
    forced-color-adjust: none;
    -webkit-text-size-adjust: 100%;
}

#spaceCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background: #000000;
}

.fade-in-text {
    display: inline-block;
    cursor: pointer;
    animation: initialLetterSpacing 2s cubic-bezier(0.005, 2.2, 0.8, 1.4) forwards;
    position: relative;
    padding: var(--title-padding-y) var(--title-padding-x);
    font-size: var(--title-font-size);
    z-index: 6;
    color: var(--title-color);
    -webkit-text-fill-color: currentColor;
    isolation: isolate;
    white-space: nowrap;
}

.fade-in-text::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% + 96px);
    height: calc(100% + 88px);
    background:
        radial-gradient(
            ellipse at center,
            rgba(0, 0, 0, 0.99) 0%,
            rgba(0, 0, 0, 0.96) 28%,
            rgba(0, 0, 0, 0.82) 54%,
            rgba(0, 0, 0, 0.42) 76%,
            rgba(0, 0, 0, 0) 100%
        );
    filter: blur(28px);
    z-index: -1;
    border-radius: 999px;
    pointer-events: none;
    transition: width var(--transition-duration) var(--transition-timing),
        height var(--transition-duration) var(--transition-timing),
        filter var(--transition-duration) var(--transition-timing);
}

.fade-in-text.animation-completed {
    animation: none;
    letter-spacing: var(--letter-spacing);
    transition: letter-spacing var(--transition-duration) var(--transition-timing);
}

.fade-in-text.animation-completed.expanded {
    letter-spacing: var(--letter-spacing-expanded);
    transition: letter-spacing var(--transition-duration) var(--transition-timing);
}

.fade-in-text.expanded {
    letter-spacing: var(--letter-spacing-expanded) !important;
}

.fade-in-text.expanded::before {
    width: calc(100% + 132px);
    height: calc(100% + 112px);
    filter: blur(34px);
}

.fade-in-text.tapped,
.fade-in-text.animation-completed.tapped {
    animation: textTapPulse var(--tap-duration, 320ms) cubic-bezier(0.18, 0.9, 0.28, 1.32);
}

.letter {
    display: inline-block;
    margin: 0;
    opacity: 0;
    font-weight: 200;
    z-index: 3;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 1),
        0 0 3px rgba(0, 0, 0, 0.96),
        0 0 8px var(--title-shadow-color),
        0 0 18px rgba(255, 255, 255, 0.18);
}

.m6istus {
    transition: color 0.3s ease-in-out;
}

.letter.red {
    color: var(--title-active-color);
    transition: color var(--transition-duration) var(--transition-timing);
}

.letter.white {
    color: var(--title-color);
    transition: color var(--transition-duration) var(--transition-timing);
}

@keyframes initialLetterSpacing {
    0% {
        letter-spacing: 0px;
    }

    100% {
        letter-spacing: var(--letter-spacing);
    }
}

@keyframes letterFadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes letterScale {
    0% {
        transform: scale(0.8);
        font-weight: 200;
    }

    50% {
        transform: scale(1.6);
    }

    100% {
        transform: scale(1.1);
    }
}

@keyframes textTapPulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    40% {
        transform: scale(var(--tap-scale, 1.06));
        filter: brightness(1.35);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

#letter-6 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-duration) var(--transition-timing);
}

.red {
    color: var(--title-active-color) !important;
}

.white {
    color: var(--title-color) !important;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

.container {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.text-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    font-size: 12vw;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    padding: 20px;
    box-sizing: border-box;
}

@media screen and (max-width: 768px) {
    .text-container {
        font-size: 11vw;
        padding: 10px;
    }
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

.scrambling {
    animation: scrambleGlow 0.5s ease-in-out infinite alternate;
}

@keyframes scrambleGlow {
    from {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #00ff00;
    }

    to {
        text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #00ff00;
    }
}

.letter-container {
    display: inline-block;
    width: 1em;
    text-align: center;
}

.switch-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #a00000;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    color: white;
    font-size: 12px;
    text-align: center;
    margin-top: 5px;
}

@media screen and (max-width: 768px) {
    :root {
        --letter-spacing: 3px;
        --letter-spacing-expanded: 4.5px;
        --title-font-size: clamp(0.95rem, 4.5vw, 1.8rem);
        --title-letter-margin: 1px;
        --title-padding-y: 8px;
        --title-padding-x: 10px;
    }
}

.info-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: monospace;
    z-index: 1000;
}

.info-panel {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid white;
    padding: 15px;
    border-radius: 5px;
    color: white;
    font-family: monospace;
    font-size: 12px;
    max-width: 300px;
    z-index: 999;
}

.info-panel.visible {
    display: block;
}

.controls-button {
    position: fixed;
    bottom: 18px;
    left: 18px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background:
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.26), transparent 34%),
        rgba(7, 10, 16, 0.72);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: monospace;
    font-size: 18px;
    z-index: 1000;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(14px);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.controls-button:hover,
.controls-button:focus-visible,
.controls-button.active {
    border-color: rgba(255, 255, 255, 0.62);
    background:
        radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.36), transparent 34%),
        rgba(17, 23, 35, 0.84);
    box-shadow: 0 12px 42px rgba(0, 0, 0, 0.56);
    transform: translateY(-1px);
    outline: none;
}

.controls-panel {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 18px;
    width: min(420px, calc(100vw - 36px));
    max-height: min(76vh, 760px);
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(17, 20, 31, 0.94), rgba(6, 8, 13, 0.94)),
        rgba(0, 0, 0, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 12px;
    border-radius: 14px;
    color: white;
    font-family: "Montserrat", system-ui, sans-serif;
    font-size: 12px;
    z-index: 999;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
}

.controls-panel.visible {
    display: block;
}

.debug-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 12px;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.debug-subtitle {
    color: rgba(255, 255, 255, 0.52);
    font-size: 10px;
    text-transform: none;
}

.control-group {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.035);
    overflow: hidden;
}

.control-group summary {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.045);
    list-style: none;
    user-select: none;
}

.control-group summary::-webkit-details-marker {
    display: none;
}

.control-group summary::after {
    content: "+";
    color: var(--ui-accent);
    font-size: 16px;
    line-height: 1;
}

.control-group[open] summary::after {
    content: "-";
}

.control-row {
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.control-row label,
.slider-container label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.78);
}

.control-row input[type="range"] {
    width: 100%;
    height: 18px;
    margin: 0;
    accent-color: var(--ui-accent);
}

.control-row select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.32);
    color: #ffffff;
    padding: 8px 10px;
    font: inherit;
}

.value-display {
    color: rgba(255, 255, 255, 0.54);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.78);
    cursor: pointer;
}

.toggle-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--ui-accent);
}

.debug-action {
    width: calc(100% - 24px);
    margin: 10px 12px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    min-height: 34px;
    font: inherit;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.debug-action:hover,
.debug-action:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.34);
    outline: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.stat-card {
    min-width: 0;
    border-radius: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.24);
}

.stat-label {
    color: rgba(255, 255, 255, 0.45);
    font-size: 10px;
}

.stat-value {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-picker {
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.78);
}

.color-value {
    color: rgba(255, 255, 255, 0.54);
    font-variant-numeric: tabular-nums;
}

.color-plane,
.hue-bar {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    cursor: crosshair;
    overflow: hidden;
}

.color-plane {
    height: 118px;
    background:
        linear-gradient(0deg, #000000, transparent),
        linear-gradient(90deg, #ffffff, hsl(var(--picker-hue, 200), 100%, 50%));
}

.hue-bar {
    height: 14px;
    margin-top: 8px;
    background: linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);
}

.color-plane::after,
.hue-bar::after {
    content: "";
    position: absolute;
    left: var(--handle-x, 100%);
    top: var(--handle-y, 0%);
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.72);
    transform: translate(-50%, -50%);
}

.hue-bar::after {
    top: 50%;
}

.info-button,
.controls-button {
    display: none;
}

.info-button.visible,
.controls-button.visible {
    display: flex;
    position: fixed;
}

.copy-feedback {
    display: block;
    text-align: center;
    color: #6f6;
    font-size: 11px;
    margin: 4px 12px 12px;
    min-height: 16px;
    opacity: 0;
    transition: opacity 200ms ease;
}

.copy-feedback.visible {
    opacity: 1;
}
