/* ═══════════════════════════════════════════════════════
   Project TRACE — Splash / Loading Screen
   PULSE-style cinematic design with TRACE blue identity
   ═══════════════════════════════════════════════════════ */

/* ── Overlay ── */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #040e1f 0%, #0a1e3d 35%, #0f2d5c 65%, #061530 100%);
    overflow: hidden;
    transition: opacity .6s cubic-bezier(.4,0,.2,1), visibility .6s;
}
.splash-screen.splash-hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Background effects ── */
.splash-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(59,130,246,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,.04) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: splashGridDrift 20s linear infinite;
}
@keyframes splashGridDrift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.splash-glow {
    position: absolute;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,.15) 0%, transparent 70%);
    animation: splashGlowPulse 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes splashGlowPulse {
    0%, 100% { transform: scale(1); opacity: .6; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* ── Floating particles ── */
.splash-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.splash-particle {
    position: absolute;
    color: rgba(147, 197, 253, .12);
    animation: splashFloat linear infinite;
}
.splash-particle svg {
    width: 100%; height: 100%;
}
@keyframes splashFloat {
    0% { transform: translateY(100vh) rotate(0deg) scale(0); opacity: 0; }
    10% { opacity: 1; }
    50% { transform: translateY(45vh) rotate(180deg) scale(1); }
    90% { opacity: .6; }
    100% { transform: translateY(-10vh) rotate(360deg) scale(.6); opacity: 0; }
}

/* ── Icon container ── */
.splash-icon-wrap {
    position: relative;
    width: 120px; height: 120px;
    margin-bottom: 32px;
    z-index: 2;
}

/* Ring behind icon */
.splash-icon-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid rgba(59,130,246,.15);
    animation: splashRingSpin 8s linear infinite;
}
.splash-icon-ring::before {
    content: '';
    position: absolute;
    top: -3px; left: 50%;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 12px rgba(59,130,246,.6);
    transform: translateX(-50%);
}
@keyframes splashRingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Second ring (counter-rotate) */
.splash-icon-ring-2 {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 1px dashed rgba(59,130,246,.08);
    animation: splashRingSpin 12s linear infinite reverse;
}

/* The icon — now uses an <img> */
.splash-icon {
    width: 100%; height: 100%;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b3d8a, #1565c0);
    box-shadow:
        0 0 40px rgba(59,130,246,.3),
        0 8px 32px rgba(0,0,0,.3),
        inset 0 1px 0 rgba(255,255,255,.1);
    animation: splashIconFloat 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}
.splash-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255,255,255,.08), transparent 60%);
}
@keyframes splashIconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.splash-icon img {
    width: 72px; height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.2));
    position: relative;
    z-index: 1;
}

/* Legacy SVG fallback */
.splash-icon svg {
    width: 62px; height: 62px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.2));
    position: relative;
    z-index: 1;
}

/* ── Text area ── */
.splash-text {
    text-align: center;
    z-index: 2;
    opacity: 0;
    transform: translateY(16px);
    animation: splashTextIn .8s cubic-bezier(.4,0,.2,1) .5s forwards;
}
@keyframes splashTextIn {
    to { opacity: 1; transform: translateY(0); }
}

.splash-label {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .85rem;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(147, 197, 253, .7);
    margin-bottom: 4px;
}

.splash-title {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: .35em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 40px rgba(59, 130, 246, .35);
    position: relative;
}

/* Letter-by-letter reveal */
.splash-title .splash-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(.8);
    animation: splashLetterIn .5s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes splashLetterIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Underline accent */
.splash-accent {
    width: 0;
    height: 3px;
    margin: 10px auto 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, #60a5fa, #3b82f6, transparent);
    animation: splashAccent .8s cubic-bezier(.4,0,.2,1) 1.2s forwards;
}
@keyframes splashAccent {
    to { width: 120px; }
}

/* Version subscript */
.splash-version {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .62rem;
    font-weight: 500;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(147, 197, 253, .45);
    margin-top: 6px;
    opacity: 0;
    animation: splashVersionIn .6s ease 1.4s forwards;
}
@keyframes splashVersionIn {
    to { opacity: 1; }
}

/* ── Tagline ── */
.splash-tagline {
    z-index: 2;
    margin-top: 18px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(148, 163, 184, .5);
    opacity: 0;
    animation: splashFadeIn .6s ease 1.6s forwards;
}
@keyframes splashFadeIn {
    to { opacity: 1; }
}

/* ── Acronym breakdown ── */
.splash-acronym {
    z-index: 2;
    display: flex;
    gap: 24px;
    margin-top: 28px;
    opacity: 0;
    animation: splashFadeIn .6s ease 2.4s forwards;
}
.splash-acr-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateY(12px);
    animation: splashAcrIn .5s cubic-bezier(.34,1.56,.64,1) forwards;
}
.splash-acr-item:nth-child(1) { animation-delay: 2.6s; }
.splash-acr-item:nth-child(2) { animation-delay: 2.85s; }
.splash-acr-item:nth-child(3) { animation-delay: 3.1s; }
.splash-acr-item:nth-child(4) { animation-delay: 3.35s; }
.splash-acr-item:nth-child(5) { animation-delay: 3.6s; }
@keyframes splashAcrIn {
    to { opacity: 1; transform: translateY(0); }
}
.splash-acr-letter {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: #60a5fa;
    text-shadow: 0 0 16px rgba(96, 165, 250, .4);
    line-height: 1;
}
.splash-acr-word {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .58rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(148, 163, 184, .55);
    line-height: 1;
    white-space: nowrap;
}

/* ── Splash Stats (HORIZONTAL like PULSE) ── */
.splash-stats {
    z-index: 2;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
    opacity: 0;
    animation: splashFadeIn .6s ease 3.8s forwards;
    max-width: 720px;
    padding: 0 16px;
    width: 100%;
}
.splash-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(59,130,246,.15);
    border-radius: 14px;
    padding: 14px 16px;
    flex: 1;
    max-width: 200px;
    backdrop-filter: blur(8px);
    transition: transform .2s, border-color .2s;
}
.splash-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59,130,246,.35);
}
.splash-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59,130,246,.25), rgba(96,165,250,.12));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #60a5fa;
    flex-shrink: 0;
}
.splash-stat-body {
    min-width: 0;
}
.splash-stat-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .55rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(148,163,184,.6);
    line-height: 1;
    margin-bottom: 3px;
}
.splash-stat-value {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .72rem;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.splash-stat-sub {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .52rem;
    color: rgba(148,163,184,.5);
    line-height: 1.2;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Latest Students ── */
.splash-latest {
    z-index: 2;
    margin-top: 14px;
    opacity: 0;
    animation: splashFadeIn .6s ease 4.2s forwards;
    max-width: 720px;
    width: 100%;
    padding: 0 16px;
}
.splash-latest-label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .58rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(148,163,184,.5);
    text-align: center;
    margin-bottom: 8px;
}
.splash-latest-list {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.splash-latest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(59,130,246,.1);
    border-radius: 10px;
    padding: 7px 12px;
    min-width: 0;
    max-width: 220px;
}
.splash-latest-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}
.splash-latest-info {
    min-width: 0;
    flex: 1;
}
.splash-latest-name {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .65rem;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.splash-latest-school {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .48rem;
    color: rgba(148,163,184,.5);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.splash-latest-time {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: .44rem;
    color: rgba(96,165,250,.5);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Loading bar ── */
.splash-loader {
    position: absolute;
    bottom: 60px;
    width: 180px;
    z-index: 2;
}
.splash-loader-track {
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,.06);
    border-radius: 1px;
    overflow: hidden;
}
.splash-loader-bar {
    height: 100%;
    width: 0%;
    border-radius: 1px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width .3s;
}
.splash-loader-text {
    text-align: center;
    margin-top: 8px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: .65rem;
    color: rgba(148, 163, 184, .4);
    letter-spacing: 1px;
}

/* Mobile sequential acronym reveal */
.splash-seq-letter {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 3.5rem; font-weight: 900;
    color: #60a5fa;
    text-shadow: 0 0 30px rgba(96,165,250,.5), 0 0 60px rgba(96,165,250,.2);
    line-height: 1; opacity: 0;
    transform: scale(0.5) translateY(20px);
    animation: splashSeqLetterIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes splashSeqLetterIn { to { opacity: 1; transform: scale(1) translateY(0); } }
.splash-seq-word {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .85rem; font-weight: 500;
    letter-spacing: 3px; text-transform: uppercase;
    color: rgba(148, 163, 184, .7);
    margin-top: 6px; opacity: 0;
    animation: splashSeqWordIn .3s ease .1s forwards;
}
@keyframes splashSeqWordIn { to { opacity: 1; } }
.splash-seq-complete {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: .6rem; font-weight: 500;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: rgba(148, 163, 184, .5);
    line-height: 1.8; max-width: 280px;
    margin: 0 auto; word-spacing: 4px;
    opacity: 0;
    animation: splashSeqFadeIn .5s ease forwards;
}
@keyframes splashSeqFadeIn { to { opacity: 1; } }

/* ── Responsive ── */

/* Tablets */
@media (max-width: 768px) {
    .splash-icon-wrap { width: 96px; height: 96px; margin-bottom: 28px; }
    .splash-icon img { width: 60px; height: 60px; }
    .splash-title { font-size: 2.8rem; letter-spacing: .3em; }
    .splash-tagline { font-size: .65rem; padding: 0 20px; text-align: center; }
    .splash-version { font-size: .58rem; letter-spacing: 2px; }
    .splash-acronym { gap: 18px; margin-top: 24px; }
    .splash-glow { width: 320px; height: 320px; }
    .splash-stats { gap: 10px; margin-top: 18px; }
    .splash-stat-card { max-width: 160px; padding: 10px 12px; }
    .splash-latest { margin-top: 10px; }
}

/* Phones */
@media (max-width: 576px) {
    .splash-screen { padding: 20px 16px; }
    .splash-icon-wrap { width: 72px; height: 72px; margin-bottom: 20px; }
    .splash-icon { border-radius: 16px; }
    .splash-icon img { width: 46px; height: 46px; }
    .splash-icon-ring { inset: -8px; }
    .splash-icon-ring-2 { inset: -14px; }
    .splash-title { font-size: 2rem; letter-spacing: .25em; }
    .splash-label { font-size: .7rem; letter-spacing: 3px; }
    .splash-version { font-size: .52rem; letter-spacing: 1.5px; margin-top: 4px; }
    .splash-tagline { font-size: .6rem; letter-spacing: 1.5px; padding: 0 12px; word-break: break-word; }
    .splash-glow { width: 220px; height: 220px; }
    .splash-acronym { gap: 12px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
    .splash-acr-letter { font-size: .95rem; }
    .splash-acr-word { font-size: .48rem; letter-spacing: .5px; }
    .splash-loader { bottom: 36px; width: 140px; }
    .splash-loader-text { font-size: .58rem; }
    .splash-accent { animation-name: splashAccentSm; }
    @keyframes splashAccentSm { to { width: 80px; } }
    .splash-stats { flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; }
    .splash-stat-card { max-width: 260px; width: 100%; flex-direction: row; text-align: left; }
    .splash-latest-list { flex-direction: column; align-items: center; }
    .splash-latest-item { max-width: 260px; width: 100%; }
    .splash-seq-letter { font-size: 3rem; }
    .splash-seq-word { font-size: .75rem; letter-spacing: 2px; }
    .splash-seq-complete { font-size: .52rem; max-width: 240px; }
}

/* Very small phones */
@media (max-width: 360px) {
    .splash-screen { padding: 16px 12px; }
    .splash-icon-wrap { width: 60px; height: 60px; margin-bottom: 16px; }
    .splash-icon { border-radius: 14px; }
    .splash-icon img { width: 38px; height: 38px; }
    .splash-icon-ring { inset: -6px; border-width: 1.5px; }
    .splash-icon-ring-2 { inset: -12px; }
    .splash-title { font-size: 1.7rem; letter-spacing: .22em; }
    .splash-label { font-size: .62rem; letter-spacing: 2px; }
    .splash-version { font-size: .48rem; letter-spacing: 1px; margin-top: 3px; }
    .splash-tagline { font-size: .55rem; letter-spacing: 1px; }
    .splash-acronym { gap: 8px; margin-top: 14px; }
    .splash-acr-letter { font-size: .82rem; }
    .splash-acr-word { font-size: .42rem; letter-spacing: 0; }
    .splash-loader { bottom: 28px; width: 120px; }
    .splash-seq-letter { font-size: 2.5rem; }
    .splash-seq-word { font-size: .65rem; letter-spacing: 1.5px; }
    .splash-seq-complete { font-size: .48rem; max-width: 200px; }
}

/* Landscape phones — reduce vertical space */
@media (max-height: 500px) {
    .splash-screen { padding: 10px 16px; }
    .splash-icon-wrap { width: 52px; height: 52px; margin-bottom: 12px; }
    .splash-icon { border-radius: 12px; }
    .splash-icon img { width: 34px; height: 34px; }
    .splash-icon-ring { inset: -6px; }
    .splash-icon-ring-2 { inset: -10px; }
    .splash-title { font-size: 1.6rem; letter-spacing: 6px; }
    .splash-label { font-size: .6rem; margin-bottom: 2px; }
    .splash-text { margin-bottom: 0; }
    .splash-version { font-size: .46rem; margin-top: 2px; }
    .splash-tagline { margin-top: 10px; font-size: .55rem; }
    .splash-acronym { margin-top: 10px; gap: 10px; }
    .splash-acr-letter { font-size: .8rem; }
    .splash-acr-word { font-size: .42rem; }
    .splash-accent { margin-top: 6px; }
    .splash-glow { width: 180px; height: 180px; }
    .splash-loader { bottom: 14px; width: 120px; }
    .splash-loader-text { font-size: .55rem; margin-top: 4px; }
    .splash-stats { margin-top: 8px; gap: 4px; }
    .splash-stat-card { padding: 6px 10px; max-width: 240px; }
    .splash-stat-value { font-size: .62rem; }
    .splash-latest { margin-top: 6px; }
    .splash-latest-label { font-size: .5rem; margin-bottom: 4px; }
}
