/* Opening halaman: medali logo 3D. Warna mengikuti --primary dari pengaturan admin. */

.splash {
    display: none;
}

html.has-splash {
    overflow: hidden;
}

html.has-splash .splash {
    display: flex;
}

.splash {
    --sp-size: clamp(132px, 38vmin, 240px);
    --sp-gold-1: var(--gold-soft, #f7e58a);
    --sp-gold-2: var(--gold, #d4a72c);
    --sp-gold-3: var(--accent, #8f6a12);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: radial-gradient(120% 90% at 50% 34%, var(--primary, #1e3a8a) 0%, var(--primary-dark, #14275f) 62%, #060d22 100%);
    color: #ffffff;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease, visibility 0.7s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.splash.is-leaving {
    opacity: 0;
    visibility: hidden;
}

.sp-rays {
    position: absolute;
    left: 50%;
    top: 40%;
    width: 170vmax;
    height: 170vmax;
    margin: -85vmax 0 0 -85vmax;
    background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.045) 0deg 6deg, rgba(255, 255, 255, 0) 6deg 18deg);
    -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
    mask-image: radial-gradient(circle, #000 0%, transparent 55%);
    animation: spRays 60s linear infinite;
    pointer-events: none;
}

.sp-grid {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 70%);
    mask-image: radial-gradient(ellipse at 50% 45%, #000 0%, transparent 70%);
    pointer-events: none;
}

.sp-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 640px;
    padding: 0 24px;
    box-sizing: border-box;
    transition: transform 0.7s ease;
}

.splash.is-leaving .sp-stage {
    transform: scale(1.08);
}

.sp-scene {
    position: relative;
    width: var(--sp-size);
    height: var(--sp-size);
    margin-bottom: clamp(28px, 7vmin, 52px);
    perspective: 900px;
    -webkit-perspective: 900px;
}

.sp-tilt {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.25s ease-out;
}

.sp-glow {
    position: absolute;
    top: -30%;
    right: -30%;
    bottom: -30%;
    left: -30%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 224, 130, 0.34) 0%, rgba(255, 224, 130, 0) 62%);
    animation: spGlow 3.2s ease-in-out infinite;
}

.sp-ring {
    position: absolute;
    top: -16%;
    right: -16%;
    bottom: -16%;
    left: -16%;
    border-radius: 50%;
    border: 2px solid rgba(247, 229, 138, 0.85);
    border-left-color: transparent;
    border-bottom-color: transparent;
    opacity: 0;
    animation-fill-mode: both;
}

.sp-ring-a {
    animation: spRingA 5.2s linear 0.3s infinite, spFade 0.8s ease 0.3s both;
}

.sp-ring-b {
    top: -26%;
    right: -26%;
    bottom: -26%;
    left: -26%;
    border-width: 1.5px;
    border-color: rgba(255, 255, 255, 0.55);
    border-left-color: transparent;
    border-top-color: transparent;
    animation: spRingB 7.4s linear 0.5s infinite, spFade 0.8s ease 0.5s both;
}

.sp-ring-c {
    top: -8%;
    right: -8%;
    bottom: -8%;
    left: -8%;
    border-style: dashed;
    border-width: 1.5px;
    border-color: rgba(247, 229, 138, 0.5);
    animation: spRingC 18s linear 0.4s infinite, spFade 0.8s ease 0.4s both;
}

.sp-coin {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    animation: spCoinIn 2.1s cubic-bezier(0.18, 0.85, 0.22, 1) both, spCoinSway 6s ease-in-out 2.1s infinite;
    will-change: transform;
}

.sp-edge {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sp-gold-1), var(--sp-gold-2) 55%, var(--sp-gold-3));
    transform: translateZ(var(--z));
    -webkit-transform: translateZ(var(--z));
}

.sp-face {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 50%;
    background: #ffffff;
    border: calc(var(--sp-size) * 0.045) solid transparent;
    background-clip: padding-box;
    box-shadow: 0 0 0 calc(var(--sp-size) * 0.045) var(--sp-gold-2), inset 0 0 18px rgba(20, 39, 95, 0.18);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-front {
    transform: translateZ(8px);
    -webkit-transform: translateZ(8px);
}

.sp-back {
    transform: rotateY(180deg) translateZ(8px);
    -webkit-transform: rotateY(180deg) translateZ(8px);
}

.sp-face img {
    width: 82%;
    height: 82%;
    object-fit: contain;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
}

.sp-front::after {
    content: '';
    position: absolute;
    top: -20%;
    bottom: -20%;
    left: -60%;
    width: 38%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.75) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-18deg);
    animation: spShine 3s ease-in-out 1.6s infinite;
}

.sp-floor {
    position: absolute;
    left: 14%;
    right: 14%;
    bottom: -22%;
    height: 12%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 70%);
    animation: spFloor 6s ease-in-out 2.1s infinite;
}

.sp-spark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    border-radius: 50%;
    background: var(--sp-gold-1);
    box-shadow: 0 0 10px 2px rgba(247, 229, 138, 0.8);
    opacity: 0;
    animation: spSpark 3.4s ease-out infinite;
    animation-delay: var(--d, 0s);
}

.sp-name {
    font-family: 'Lora', Georgia, 'Times New Roman', serif !important;
    font-weight: 700;
    font-size: clamp(1.05rem, 4.2vw, 1.75rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.3;
    color: #ffffff;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
    opacity: 0;
    animation: spRise 0.9s ease 1s both;
}

.sp-line {
    display: block;
    width: 0;
    height: 2px;
    margin: 14px auto 12px;
    background: linear-gradient(90deg, transparent, var(--sp-gold-1), transparent);
    animation: spLine 0.9s ease 1.25s both;
}

.sp-tag {
    font-size: clamp(0.78rem, 2.6vw, 0.98rem);
    font-weight: 500;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.82);
    opacity: 0;
    animation: spRise 0.9s ease 1.4s both;
}

.sp-bar {
    position: relative;
    width: min(260px, 62vw);
    height: 3px;
    margin: clamp(22px, 5vmin, 34px) auto 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
    opacity: 0;
    animation: spRise 0.6s ease 1.6s both;
}

.sp-bar span {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--sp-gold-2), var(--sp-gold-1));
    transform: scaleX(0);
    transform-origin: left center;
    animation: spBar 3.2s cubic-bezier(0.3, 0.6, 0.3, 1) 1.6s forwards;
}

.splash.is-done .sp-bar span {
    animation: none;
    transform: scaleX(1);
    transition: transform 0.35s ease;
}

.sp-skip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    opacity: 0;
    animation: spRise 0.6s ease 2.2s both;
}

@keyframes spRays { to { transform: rotate(360deg); } }
@keyframes spFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spGlow { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.06); } }

@keyframes spCoinIn {
    0% { transform: translateZ(-420px) rotateY(-900deg) rotateX(24deg) scale(0.35); opacity: 0; }
    25% { opacity: 1; }
    100% { transform: translateZ(0) rotateY(0deg) rotateX(0deg) scale(1); opacity: 1; }
}

@keyframes spCoinSway {
    0%, 100% { transform: translateY(0) rotateY(-16deg) rotateX(4deg); }
    25% { transform: translateY(-6px) rotateY(0deg) rotateX(-2deg); }
    50% { transform: translateY(0) rotateY(16deg) rotateX(4deg); }
    75% { transform: translateY(-6px) rotateY(0deg) rotateX(-2deg); }
}

@keyframes spRingA { from { transform: rotateX(72deg) rotateZ(0deg); } to { transform: rotateX(72deg) rotateZ(360deg); } }
@keyframes spRingB { from { transform: rotateY(74deg) rotateZ(360deg); } to { transform: rotateY(74deg) rotateZ(0deg); } }
@keyframes spRingC { from { transform: rotateZ(0deg); } to { transform: rotateZ(360deg); } }

@keyframes spShine {
    0% { left: -60%; }
    55%, 100% { left: 130%; }
}

@keyframes spFloor { 0%, 100% { transform: scale(1); opacity: 0.8; } 50% { transform: scale(0.82); opacity: 0.5; } }

@keyframes spSpark {
    0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1); }
}

@keyframes spRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spLine { from { width: 0; } to { width: min(220px, 56vw); } }
@keyframes spBar { 0% { transform: scaleX(0); } 100% { transform: scaleX(0.92); } }

@media (max-height: 480px) and (orientation: landscape) {
    .splash {
        --sp-size: clamp(96px, 46vh, 170px);
    }
    .sp-stage {
        flex-direction: row;
        text-align: left;
        align-items: center;
        justify-content: center;
        gap: 32px;
        max-width: 860px;
    }
    .sp-scene {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .sp-text {
        min-width: 0;
    }
    .sp-line {
        margin-left: 0;
    }
    .sp-bar {
        margin-left: 0;
        margin-right: 0;
    }
    .sp-skip {
        display: none;
    }
}

@media (min-width: 1200px) {
    .splash {
        --sp-size: clamp(200px, 34vmin, 280px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sp-rays,
    .sp-ring,
    .sp-spark,
    .sp-glow,
    .sp-floor,
    .sp-front::after {
        display: none;
    }
    .sp-coin {
        animation: spFade 0.8s ease both;
    }
    .sp-name,
    .sp-tag,
    .sp-bar,
    .sp-skip {
        animation-duration: 0.4s;
        animation-delay: 0.2s;
    }
    .sp-line {
        animation-duration: 0.4s;
        animation-delay: 0.2s;
    }
    .sp-bar span {
        animation-duration: 1.2s;
        animation-delay: 0.2s;
    }
}
