
:root {
    --intro-accent: rgb(34, 211, 238);
    --intro-glass: rgba(255, 255, 255, 0.045);
    --intro-border: rgba(255, 255, 255, 0.10);
    --intro-dim: rgba(255, 255, 255, 0.55);
    --frame: rgb(20, 22, 27);
    --rack-w: 66vw;
    --header-h: 60px;
}

:root[data-theme="light"] {
    --intro-glass: rgba(255, 255, 255, 0.55);
    --intro-border: rgba(0, 0, 0, 0.10);
    --intro-dim: rgba(0, 0, 0, 0.55);
    --frame: rgb(226, 228, 233);
}

html:has(body.intro-page) {
    overflow: hidden;
}

body.intro-page {
    height: 100vh;
    overflow: hidden;
    background: var(--theme);
    color: var(--primary);
}

.scene {
    position: fixed;
    inset: 0;
    transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

body.scene-open .scene {
    transform: translateX(var(--rack-w));
}

.screen {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 20px;
    background: var(--theme);
    overflow: hidden;
    --sp-t: 13vh;
    --sp-x: 5vw;
    --sp-b: 7.5vh;
    padding: var(--sp-t) var(--sp-x) var(--sp-b);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.screen-frame {
    position: absolute;
    inset: 0;
    z-index: 34;
    pointer-events: none;
    background: url("/wp-content/themes/tuagfey/screen/frame.webp") center / 100% 100% no-repeat;
}

.screen-static {
    position: absolute;
    inset: var(--sp-t) var(--sp-x) var(--sp-b);
    z-index: 30;
    border-radius: 12px;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    background: transparent;
    transition: opacity 0.22s linear;
}

.screen-static canvas {
    display: block;
    width: 100%;
    height: 100%;
}

html.frame-fitted .screen-static {
    inset: 0;
    border-radius: 0;
}

html.frame-fitted .screen-static canvas {
    position: absolute;
    left: var(--ff-safe-left, 0px);
    top: var(--ff-safe-top, 0px);
    right: var(--ff-safe-right, 0px);
    bottom: var(--ff-safe-bottom, 0px);
    width: calc(100% - var(--ff-safe-left, 0px) - var(--ff-safe-right, 0px));
    height: calc(100% - var(--ff-safe-top, 0px) - var(--ff-safe-bottom, 0px));
}

html.frame-fitted .screen-static.is-full canvas {
    inset: 0;
    width: 100%;
    height: 100%;
}

.screen-static.is-on {
    opacity: 1;
}

.screen-static.is-black {
    opacity: 1;
    background: #04060a;
}


.statusbar-toggle {
    position: absolute;
    left: 50%;
    top: calc(var(--ff-win-top, 13vh) - 10px);
    transform: translateX(-50%);
    z-index: 41;
    width: 88px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 10px 10px;
    border: 1px solid var(--intro-border);
    border-top: 0;
    background: var(--intro-glass);
    color: var(--intro-dim);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, opacity 0.3s ease,
        transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
}

body.scene-open .statusbar-toggle {
    opacity: 0;
    pointer-events: none;
}

.statusbar-toggle:hover {
    color: var(--primary);
    border-color: var(--intro-accent);
}

.statusbar-toggle svg {
    transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.intro-main {
    position: absolute;
    inset: 0;
}

.intro-panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px 48px 40px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s linear 0.4s;
    overflow-y: auto;
}


.intro-panel.is-active {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.panel-inner {
    width: min(720px, 100%);
}

.panel-kicker {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.76rem;
    letter-spacing: 0.3em;
    color: var(--intro-accent);
}

.panel-title {
    font-size: clamp(2.6rem, 8vw, 4.6rem);
    font-weight: 800;
    margin: 12px 0 16px;
    letter-spacing: 0.04em;
}

.panel-text {
    color: var(--intro-dim);
    font-size: 1.05rem;
    line-height: 1.9;
    max-width: 560px;
    white-space: pre-line;
}

.screen-slot {
    position: absolute;
    left: 3vw;
    top: 50%;
    transform: translateY(-50%);
    z-index: 36;
    display: flex;
    align-items: center;
    gap: 8px;
}

.slot-seam {
    display: block;
    width: 3px;
    height: 150px;
    border-radius: 2px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.85));
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}

.slot-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 52px;
    border-radius: 10px;
    border: 1px solid var(--intro-border);
    background: var(--intro-glass);
    color: var(--primary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.slot-toggle:hover {
    border-color: var(--intro-accent);
    color: var(--intro-accent);
}

.rack {
    position: absolute;
    right: 100%;
    top: 0;
    width: var(--rack-w);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 22px;
    background-color: #0b0b14;
    border: 0;
    border-radius: 18px 0 0 18px;
    color: var(--rack-fg, var(--primary));
    transition: background-color 560ms cubic-bezier(0.4, 0, 0.2, 1), color 560ms cubic-bezier(0.4, 0, 0.2, 1);

    --glow-alpha: 0.2;
    --glow-dx: 0px;
    --glow-dy: 0px;
    --glow-x: var(--cd-x, 30%);
    --glow-y: var(--cd-y, 46%);
    --glow-scale: 3.6;

    --bg-tile: 208px;
    --bg-scroll: 26s;
    --bg-diamond: 0.25;

    --rack-pad: clamp(16px, 2vw, 38px);
    --rack-text-w: min(28vw, 440px);
    --rack-theme-size: clamp(30px, 3.4vw, 56px);
    --rack-caption-size: clamp(12px, 1.05vw, 18px);
    --rack-song-size: clamp(19px, 1.9vw, 32px);
    --rack-artist-size: clamp(12px, 1.05vw, 18px);
    --rack-top: 9%;
    --rack-bottom: 10%;
}

.rack-info {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
}

.rack-info-item {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 420ms ease;
}

.rack-info-item.is-active {
    opacity: 1;
}

.rack-info-top {
    position: absolute;
    left: var(--rack-pad);
    top: var(--rack-top);
    width: max-content;
    max-width: var(--rack-text-w);
    overflow-wrap: break-word;
    padding: 24px 22px 22px 24px;
}

.rack-info-bottom {
    position: absolute;
    left: var(--rack-pad);
    bottom: var(--rack-bottom);
    width: max-content;
    max-width: var(--rack-text-w);
    text-align: left;
    overflow-wrap: break-word;
    padding-left: 36px;
}

.rack-theme {
    color: inherit;
    font-size: var(--rack-theme-size);
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.05;
    position: relative;
    z-index: 1;
}


.rack-insert {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 7;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    color: var(--rack-fg, #22d3ee);
    border: 1px solid color-mix(in srgb, var(--rack-fg, #22d3ee) 45%, transparent);
    background: color-mix(in srgb, var(--rack-fg, #22d3ee) 8%, rgba(6, 8, 14, 0.55));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 0 12px color-mix(in srgb, var(--rack-fg, #22d3ee) 20%, transparent),
        inset 0 0 10px color-mix(in srgb, var(--rack-fg, #22d3ee) 12%, transparent);
    transition: transform 0.18s ease, background 0.3s ease;
}

.rack-insert:hover {
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 0 16px color-mix(in srgb, var(--rack-fg, #22d3ee) 35%, transparent),
        inset 0 0 14px color-mix(in srgb, var(--rack-fg, #22d3ee) 16%, transparent);
}

.rack-insert:active {
    transform: translateY(-50%) scale(0.96);
}

.rack-insert[disabled] {
    opacity: 0.35;
    cursor: default;
}

.rack-slider {
    position: absolute;
    left: 34px;
    z-index: 7;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.rack-slider-top {
    top: 72px;
}

.rack-slider-bottom {
    bottom: 72px;
}

.rack-slider-label {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: color-mix(in srgb, var(--rack-fg, #22d3ee) 65%, transparent);
    writing-mode: vertical-rl;
}

.rack-slider-track {
    width: 18px;
    height: 128px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rack-slider-track input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 128px;
    height: 3px;
    margin: 0;
    transform: rotate(-90deg);
    background: color-mix(in srgb, var(--rack-fg, #22d3ee) 22%, transparent);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.rack-slider-track input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: var(--rack-fg, #22d3ee);
    border: 0;
    box-shadow: 0 0 8px color-mix(in srgb, var(--rack-fg, #22d3ee) 45%, transparent);
    cursor: pointer;
}

.rack-slider-track input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: var(--rack-fg, #22d3ee);
    border: 0;
    cursor: pointer;
}

.rack-caption {
    margin-top: 0.55em;
    font-size: var(--rack-caption-size);
    letter-spacing: 0.02em;
    opacity: 0.72;
}

.rack-song {
    font-size: var(--rack-song-size);
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.rack-artist {
    margin-top: 0.32em;
    font-size: var(--rack-artist-size);
    letter-spacing: 0.04em;
    opacity: 0.72;
}


.wheel {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-right: -22px;
}

.cd {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--secondary);
    cursor: pointer;
    will-change: transform;
    transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
        color 0.2s ease, opacity 0.3s ease, filter 0.3s ease;
}

.cd-disc {
    --cd-color: var(--intro-accent);
    position: relative;
    flex: none;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    transition: transform 0.3s ease, filter 0.3s ease;
    transform: perspective(400px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

.cd-face {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at center,
            transparent 0 8px,
            var(--theme) 8px 10.5px,
            transparent 10.5px 13px,
            rgba(128, 128, 128, 0.6) 13px 66px);
    border: 1px solid rgba(128, 128, 128, 0.6);
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: cd-spin 8s linear infinite;
    transition: animation-duration 0.25s ease;
}

.cd-face::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--cd-color) 26%, transparent);
}

.cd-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    color: color-mix(in srgb, var(--cd-color) 60%, var(--primary));
}

.cd-title {
    font-size: 0.95rem;
}

.cd:hover .cd-face {
    animation-duration: 1.6s;
}

.cd[data-panel="self"] .cd-face { --cd-color: rgb(34, 211, 238); }
.cd[data-panel="growth"] .cd-face { --cd-color: rgb(74, 222, 128); }
.cd[data-panel="lost"] .cd-face { --cd-color: rgb(167, 139, 250); }
.cd[data-panel="tech"] .cd-face { --cd-color: rgb(96, 165, 250); }
.cd[data-panel="future"] .cd-face { --cd-color: rgb(244, 114, 182); }

@keyframes cd-spin {
    to { transform: rotate(-360deg); }
}

.cd.is-selected {
    color: var(--primary);
    border-color: var(--intro-border);
    background: var(--intro-glass);
    box-shadow: inset 3px 0 0 var(--cd-color, var(--intro-accent));
}

.cd.is-selected .cd-face {
    animation-duration: 3.2s;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--cd-color, var(--intro-accent)) 45%, transparent));
}

.cd.is-dimmed {
    opacity: 0.45;
}

.hub {
    position: absolute;
    width: 92px;
    height: 112px;
    border-radius: 14px;
    border: 1px solid var(--intro-border);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.82));
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.85);
    overflow: hidden;
    visibility: hidden;
}

body.scene-open .hub {
    visibility: visible;
}

.hub-glow {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: radial-gradient(60% 50% at 50% 62%, rgba(34, 211, 238, 0.22), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hub.is-playing .hub-glow {
    opacity: 1;
}

.hub-cd {
    position: absolute;
    left: -40px;
    top: 50%;
    width: 62px;
    height: 62px;
    margin-top: -31px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center,
            transparent 0 7px,
            var(--theme) 7px 9.5px,
            transparent 9.5px 12px,
            rgba(128, 128, 128, 0.6) 12px 62px);
    border: 1px solid rgba(128, 128, 128, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    opacity: 0;
}

.hub-cd.is-inserting {
    animation: hub-insert 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.hub-cd.is-ejecting {
    animation: hub-eject 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes hub-insert {
    0% { opacity: 0; transform: translateX(-52px) scale(0.92); }
    35% { opacity: 1; }
    70% { opacity: 0.9; }
    100% { opacity: 0; transform: translateX(30px) scale(0.92); }
}

@keyframes hub-eject {
    0% { opacity: 0; transform: translateX(24px) scale(0.96); }
    40% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-56px) scale(0.98); }
}


.rack-bg,
.rack-grid,
.rack-glow,
.rack-vignette,
.rack-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
}

.rack-bg {
    z-index: 0;
}

.rack-grid {
    z-index: 0;
}

.rack-glow {
    z-index: 0;
    left: calc(var(--glow-x, 30%) + var(--glow-dx, 0px));
    top: calc(var(--glow-y, 46%) + var(--glow-dy, 0px));
    right: auto;
    bottom: auto;
    width: calc(var(--cd-r, 200px) * var(--glow-scale, 3.6));
    height: calc(var(--cd-r, 200px) * var(--glow-scale, 3.6));
    margin-left: calc(var(--cd-r, 200px) * var(--glow-scale, 3.6) / -2);
    margin-top: calc(var(--cd-r, 200px) * var(--glow-scale, 3.6) / -2);
    inset-inline-start: auto;
    background:
        radial-gradient(closest-side,
            color-mix(in srgb, var(--rack-fg, #22d3ee) calc(20% + var(--cd-pulse, 0) * 26%), transparent) 0%,
            color-mix(in srgb, var(--rack-fg, #22d3ee) 8%, transparent) 42%,
            transparent 72%);
    opacity: calc((0.85 + var(--cd-pulse, 0) * 0.5) * var(--glow-alpha, 1));
    transform: scale(calc(1 + var(--cd-pulse, 0) * 0.12));
    transition: background 0.8s ease, opacity 0.25s linear, transform 0.25s linear;
}

.rack-vignette {
    z-index: 4;
    background:
        radial-gradient(125% 105% at 34% 50%, transparent 40%, rgba(0, 0, 0, 0.40) 84%, rgba(0, 0, 0, 0.60) 100%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.32) 0%, transparent 20%);
}

.rack-grain {
    z-index: 5;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
    animation: rack-grain-shift 1.1s steps(3) infinite;
}

@keyframes rack-grain-shift {
    0% { background-position: 0 0; }
    33% { background-position: -60px 30px; }
    66% { background-position: 40px -50px; }
    100% { background-position: 0 0; }
}

.fx-switches {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 7;
}

html:not(.has-cd-fx) .fx-switches {
    display: none;
}

.fx-switch {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--rack-fg, var(--primary)) 24%, transparent);
    background: transparent;
    color: color-mix(in srgb, var(--rack-fg, var(--primary)) 52%, transparent);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, opacity 0.4s ease;
}

.fx-switch svg {
    width: 28px;
    height: 28px;
}

.fx-switch:hover {
    color: var(--rack-fg, var(--primary));
    border-color: color-mix(in srgb, var(--rack-fg, var(--primary)) 60%, transparent);
}

.fx-switch[aria-pressed="true"] {
    color: var(--rack-fg, var(--primary));
    border-color: var(--rack-fg, var(--primary));
    background: color-mix(in srgb, var(--rack-fg, var(--primary)) 15%, transparent);
}


body.cd3d-on .cd,
body.cd3d-on .hub,
body.cd3d-on .hub-cd {
    display: none;
}

.intro-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
}

.intro-loader.is-active {
    opacity: 1;
    pointer-events: auto;
}

.intro-loader.is-done {
    opacity: 0;
    pointer-events: none;
}

.intro-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(16px, 2.6vh, 28px);
    width: min(560px, 78vw);
}

.intro-loader-brand {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: clamp(1.3rem, 2.1vw, 2.1rem);
    letter-spacing: 0.34em;
    text-indent: 0.34em;
    color: #eaf3ff;
    text-shadow: 0 0 12px rgba(234, 243, 255, 0.28);
}

.intro-loader-bar {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(127, 240, 255, 0.14);
    overflow: hidden;
}

.intro-loader-bar i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--intro-accent), #8b5cf6);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
    transition: width 0.25s ease;
}

.intro-loader.is-active .intro-loader-bar i {
    animation: loader-breathe 1.5s ease-in-out infinite;
}

@keyframes loader-breathe {
    0%, 100% { opacity: .78; }
    50%      { opacity: 1; }
}

.intro-loader-pct {
    font-size: clamp(0.92rem, 1.15vw, 1.15rem);
    letter-spacing: 0.16em;
    color: rgba(198, 220, 246, 0.72);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.intro-loader-sub {
    display: block;
    min-height: 1.4em;
    font-size: clamp(0.72rem, 0.86vw, 0.86rem);
    letter-spacing: 0.2em;
    color: rgba(127, 240, 255, 0.42);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    white-space: pre;
}

.intro-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(1000px 700px at 80% -10%, rgba(34, 211, 238, 0.06), transparent 60%),
        radial-gradient(800px 600px at -5% 110%, rgba(139, 92, 246, 0.06), transparent 60%),
        var(--theme);
}

@media (max-width: 720px) {
    :root {
        --rack-w: 84vw;
    }

    .screen {
        border-width: 8px;
        border-radius: 12px;
    }

    .rack {
        padding: 12px 14px;
    }

    .wheel {
        margin-right: -14px;
    }

    .intro-panel {
        padding: 24px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scene,
    .intro-panel,
    .cd,
    .slot-toggle,
    .hub-cd {
        transition: none !important;
        animation: none !important;
    }
}
