:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #a8a8ff;
    --font-main: 'Outfit', sans-serif;
}

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

/* Visually hidden text (accessible to screen readers).
   Used for SEO/a11y headings without changing the minimalist UI. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-main);
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(5px);
    transition: opacity 1s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.logo {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    margin-bottom: 2rem;
    color: var(--text-color);
    text-transform: uppercase;
    animation: breathe 4s ease-in-out infinite;
    text-align: center;
    max-width: 800px;
    line-height: 1.4;
    padding: 0 1rem;
}

.subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    max-width: 600px;
    margin-bottom: 3rem;
    line-height: 1.6;
    font-weight: 300;
    padding: 0 1rem;
    animation: breathe 4s ease-in-out infinite 2s;
    /* Delayed breathe for subtitle */
}

@keyframes breathe {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

.start-btn {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-family: var(--font-main);
    color: var(--text-color);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.start-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-color);
    box-shadow: 0 0 20px rgba(168, 168, 255, 0.2);
    transform: scale(1.05);
}

.hint {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

/* Control Panel - Immersive Mode */
.control-panel {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: auto;
    min-width: 300px;
    z-index: 30;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
    pointer-events: none;
}

.control-panel.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.panel-content {
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 1.5rem 2.5rem;
    display: flex;
    gap: 3rem;
    /* Increased gap */
    justify-content: center;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
}

.control-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.theme-selector {
    display: flex;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 30px;
}

.theme-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.theme-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.theme-btn:hover:not(.active) {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* Slider Styling */
input[type=range] {
    -webkit-appearance: none;
    width: 180px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    transition: background 0.3s;
}

input[type=range]:hover {
    background: rgba(255, 255, 255, 0.15);
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    background: var(--accent-color);
}

@keyframes fadePulse {
    0% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

/* Rotate Hint Overlay */
.rotate-hint {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.rotate-hint.show {
    display: flex;
}

.rotate-content {
    text-align: center;
    color: white;
}

.rotate-icon {
    animation: rotatePhone 2s ease-in-out infinite;
    margin-bottom: 2rem;
}

@keyframes rotatePhone {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(90deg);
    }
}

.rotate-text {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: white;
}

.rotate-subtext {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
}

@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }

    .start-btn {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }

    .panel-content {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .control-group {
        width: 100%;
        align-items: center;
    }

    input[type=range] {
        width: 100%;
    }
}

/* Visual Tutorial */
.visual-tutorial {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 35;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.visual-tutorial.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease;
}

.visual-tutorial.step2-breath .tutorial-highlight {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
}

.visual-tutorial.step2-breath .tutorial-pointer {
    opacity: 0;
}

.tutorial-toast {
    position: fixed;
    bottom: clamp(2rem, 6vh, 4rem);
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(8, 8, 10, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 0.9rem 1.2rem 0.85rem;
    color: var(--text-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.tutorial-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-title {
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.toast-sub {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.tutorial-card {
    position: absolute;
    top: clamp(1.2rem, 4vh, 3rem);
    left: clamp(1.2rem, 3vw, 3rem);
    width: min(340px, calc(100% - 2.4rem));
    padding: 1.2rem 1.4rem 1rem;
    border-radius: 20px;
    background: rgba(8, 8, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-color);
    pointer-events: auto;
    display: grid;
    gap: 0.6rem;
    overflow: hidden;
    z-index: 0;
}

.tutorial-card::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 18px;
    background: linear-gradient(120deg, rgba(168, 168, 255, 0.12), rgba(120, 255, 220, 0.1), rgba(255, 255, 255, 0.06));
    opacity: 0.8;
    z-index: 0;
}

.tutorial-card>* {
    position: relative;
    z-index: 1;
}

.tutorial-step-indicator {
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.tutorial-title {
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tutorial-sub {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
}

.tutorial-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
}

.tutorial-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.5);
}

.tutorial-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
    transition: transform 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.tutorial-card.is-heard .tutorial-status::before {
    background: rgba(147, 245, 208, 0.9);
    box-shadow: 0 0 16px rgba(147, 245, 208, 0.9);
    animation: soundPulse 1.2s ease infinite;
}

.tutorial-dismiss {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tutorial-dismiss:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

.tutorial-step-container {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.tutorial-step-container.active {
    opacity: 1;
}

.tutorial-highlight {
    position: absolute;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5), 0 0 32px 10px rgba(120, 255, 220, 0.35);
    transform: translate(-50%, -50%) scale(0.9);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    opacity: 0;
    animation: highlightPulse 2.4s ease-in-out infinite;
}

.tutorial-step-container.active .tutorial-highlight {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.tutorial-pointer {
    position: absolute;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    transition: opacity 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}

.tutorial-step-container.active .tutorial-pointer {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.tutorial-pointer.active .pointer-arrow {
    animation: arrowFloat 1.1s ease-in-out infinite;
    filter: drop-shadow(0 0 14px rgba(120, 255, 220, 0.55));
}

.tutorial-pointer.active .pointer-label {
    animation: labelPulse 1.6s ease-in-out infinite;
    border-color: rgba(255, 255, 255, 0.5);
}

.pointer-arrow {
    width: 28px;
    height: 28px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.pointer-label {
    padding: 0.25rem 0.65rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: labelPulse 2.4s ease-in-out infinite;
}

.theme-btn.tutorial-emphasis {
    transform: scale(1.28);
    box-shadow: 0 8px 28px rgba(120, 255, 220, 0.4);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition: transform 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
    position: relative;
    z-index: 2;
}

@keyframes highlightPulse {
    from {
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 0 18px 6px rgba(120, 255, 220, 0.2);
    }

    to {
        box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.85), 0 0 36px 14px rgba(120, 255, 220, 0.45);
    }
}

@keyframes soundPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

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

@keyframes arrowFloat {

    0%,
    100% {
        transform: translate(0, 0) rotate(45deg);
    }

    50% {
        transform: translate(6px, 6px) rotate(45deg);
    }
}

@keyframes labelPulse {
    0% {
        transform: translateY(0);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-2px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 0.8;
    }
}

@media (max-width: 768px) {
    .tutorial-card {
        width: min(320px, calc(100% - 2rem));
        padding: 1rem 1.1rem 0.9rem;
    }

    .tutorial-title {
        font-size: 0.98rem;
    }

    .tutorial-sub {
        font-size: 0.8rem;
    }
}