:root {
    --bg: #111214;
    --text-main: #ffffff;
    --text-dim: #6b7280;
    --text-soft: #4b5563;
    --border: #1f2227;
    --accent: #4a8fe8;
    --accent-dim: rgba(74, 143, 232, 0.18);
    --accent-glow: rgba(74, 143, 232, 0.12);
    --wave-line-1: rgba(74, 143, 232, 0.18);
    --wave-line-2: rgba(74, 143, 232, 0.14);
    --wave-line-3: rgba(74, 143, 232, 0.10);
    --wave-line-4: rgba(74, 143, 232, 0.08);
    --wave-line-5: rgba(74, 143, 232, 0.06);
    --wave-line-6: rgba(74, 143, 232, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.material-symbols-outlined {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    min-width: 1em;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: normal;
    font-style: normal;
    font-weight: normal;
    visibility: hidden;
}

a:focus-visible,
button:focus-visible,
.resource-main:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

html.icons-ready .material-symbols-outlined {
    visibility: visible;
}

body {
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 0.003em;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    isolation: isolate;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle 500px at 50% 38%, rgba(74, 143, 232, 0.13) 0%, rgba(74, 143, 232, 0.07) 50%, rgba(74, 143, 232, 0) 100%);
    filter: blur(60px) saturate(1.2);
    opacity: 1;
    animation: frosted-float-a 24s ease-in-out infinite alternate;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle 320px at 20% 80%, rgba(74, 143, 232, 0.08) 0%, rgba(74, 143, 232, 0) 100%);
    filter: blur(80px);
    opacity: 0.6;
    animation: frosted-float-b 32s ease-in-out infinite alternate;
}

@keyframes frosted-float-a {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(20px, 30px, 0); }
    100% { transform: translate3d(-16px, 50px, 0); }
}

@keyframes frosted-float-b {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-24px, -18px, 0); }
    100% { transform: translate3d(14px, -36px, 0); }
}

.staged {
    opacity: 0;
    transform: translateY(8px);
    animation: stage-in 0.46s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.stage-1 { animation-delay: 0.03s; }
.stage-2 { animation-delay: 0.08s; }
.stage-3 { animation-delay: 0.13s; }
.stage-4 { animation-delay: 0.18s; }

::selection {
    background: rgba(74, 143, 232, 0.26);
    color: #f0f6ff;
}

@keyframes stage-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wave-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: clamp(140px, 34vh, 380px);
    z-index: 1;
    pointer-events: none;
    opacity: 0.7;
    mask-image: linear-gradient(to top, rgba(0,0,0,0.96) 0%, rgba(0,0,0,0.4) 62%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.96) 0%, rgba(0,0,0,0.4) 62%, rgba(0,0,0,0) 100%);
}

.waves {
    position: relative;
    width: 100%;
    height: 100%;
}

.parallax>use {
    stroke-linecap: round;
    stroke-dasharray: 10 16;
    vector-effect: non-scaling-stroke;
    animation: flow-wave 6.8s linear infinite;
}

.parallax>use:nth-child(1) { animation-delay: -0.5s; animation-duration: 5.3s; }
.parallax>use:nth-child(2) { animation-delay: -1.1s; animation-duration: 5.8s; }
.parallax>use:nth-child(3) { animation-delay: -1.7s; animation-duration: 6.3s; }
.parallax>use:nth-child(4) { animation-delay: -2.3s; animation-duration: 6.8s; }
.parallax>use:nth-child(5) { animation-delay: -2.9s; animation-duration: 7.3s; }
.parallax>use:nth-child(6) { animation-delay: -3.5s; animation-duration: 7.8s; }

@keyframes flow-wave {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -52; }
}

#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.98);
    min-width: 220px;
    max-width: min(92vw, 420px);
    padding: 12px 16px;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    background: rgba(18, 18, 20, 0.92);
    color: #e8e8e8;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-align: center;
    opacity: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

#toast.success { border-color: rgba(74, 143, 232, 0.45); }
#toast.error { border-color: rgba(210, 110, 110, 0.55); }

.audio-control {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(18, 18, 20, 0.72);
    color: #cfcfcf;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.audio-control:hover {
    background: rgba(30, 32, 38, 0.92);
    color: #ffffff;
    border-color: #3a3a3a;
}

.audio-control.is-active {
    border-color: rgba(74, 143, 232, 0.6);
    color: #a8c8f0;
    box-shadow: 0 0 0 2px rgba(74, 143, 232, 0.12);
}

.audio-control .material-symbols-outlined {
    font-size: 22px;
}

@media (prefers-reduced-motion: reduce) {
    .parallax>use { animation: none !important; }
    .staged { opacity: 1; transform: none; animation: none; }
    .audio-control, .link-btn { transition: none !important; }
}

@media (max-width: 700px) {
    .wave-container { height: clamp(110px, 26vh, 240px); }
    .audio-control { right: 14px; bottom: 14px; width: 40px; height: 40px; }
}