/* ═══════════════════════════════════════════
   Эшелон-Z — Entry Screen
   Boot splash + Role selection
   ═══════════════════════════════════════════ */

:root {
    --bg-dark: #0a0e14;
    --bg-panel: rgba(10, 14, 20, 0.92);
    --bg-card: rgba(20, 28, 40, 0.8);
    --border: rgba(0, 229, 255, 0.15);
    --border-accent: rgba(0, 229, 255, 0.35);
    --text-primary: #d0e8f0;
    --text-secondary: #6b8a99;
    --text-dim: #3a5060;
    --cyan: #00E5FF;
    --cyan-dim: rgba(0, 229, 255, 0.3);
    --red: #FF1744;
    --orange: #FF9100;
    --purple: #AA00FF;
    --green: #00E676;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --font-display: 'Oswald', sans-serif;
}

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

body {
    font-family: var(--font-mono);
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}


/* ═══════════════════════════════════════════
   BOOT SPLASH
   ═══════════════════════════════════════════ */

.boot-splash {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.6s ease, visibility 0.6s;
}
.boot-splash.boot-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.boot-terminal {
    width: 480px;
    max-width: 90vw;
    padding: 24px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
}

.boot-line {
    font-size: 11px;
    line-height: 1.8;
    color: var(--text-dim);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s, transform 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.boot-line.boot-visible {
    opacity: 1;
    transform: translateY(0);
}

.boot-prefix {
    color: var(--cyan);
    font-weight: 600;
    min-width: 36px;
}
.boot-ok {
    margin-left: auto;
    color: var(--green);
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 0.1em;
}


/* ═══════════════════════════════════════════
   ENTRY SCREEN
   ═══════════════════════════════════════════ */

.entry-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}
.entry-screen.entry-visible {
    opacity: 1;
}

/* Background grid canvas */
.grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* Scanline overlay */
.scanline-overlay {
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
}


/* ═══════════════════════════════════════════
   HEADER — Logo + Title
   ═══════════════════════════════════════════ */

.entry-header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
    z-index: 1;
}

/* Logo SVG */
.logo-mark {
    width: 96px;
    height: 96px;
    margin: 0 auto 20px;
}
.logo-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.25));
}
.logo-shield {
    animation: shield-pulse 4s ease-in-out infinite;
}
.logo-sweep {
    transform-origin: 40px 40px;
    animation: radar-sweep 3s linear infinite;
}
.logo-ring-1 { animation: ring-pulse 4s ease-in-out infinite 0s; }
.logo-ring-2 { animation: ring-pulse 4s ease-in-out infinite 0.5s; }
.logo-ring-3 { animation: ring-pulse 4s ease-in-out infinite 1s; }
.logo-dot {
    animation: dot-glow 2s ease-in-out infinite;
}
.logo-z {
    animation: z-draw 2.5s ease forwards;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
}

@keyframes shield-pulse {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.5; }
}
@keyframes radar-sweep {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes ring-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.45; }
}
@keyframes dot-glow {
    0%, 100% { r: 2; opacity: 1; }
    50% { r: 3; opacity: 0.7; }
}
@keyframes z-draw {
    to { stroke-dashoffset: 0; }
}

/* Title */
.entry-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}
.title-z {
    color: var(--cyan);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

.entry-subtitle {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 12px;
}

.entry-version {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}


/* ═══════════════════════════════════════════
   ROLE GRID
   ═══════════════════════════════════════════ */

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 720px;
    position: relative;
    z-index: 1;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: rgba(10, 14, 20, 0.85);
    border: 1px solid var(--border);
    border-radius: 2px;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

/* Left glow accent per role */
.role-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--card-accent);
    opacity: 0.6;
    transition: opacity 0.25s, width 0.25s;
}
.role-card:hover::before {
    opacity: 1;
    width: 4px;
}

.role-attack  { --card-accent: var(--red); }
.role-defense { --card-accent: #42A5F5; }
.role-viewer  { --card-accent: var(--cyan); }
.role-analyst { --card-accent: var(--orange); }

.role-card:hover {
    border-color: var(--card-accent);
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}
.role-card:active {
    transform: translateY(0);
}

/* Icon */
.role-icon-wrap {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    border-radius: 2px;
}
.role-icon {
    width: 28px;
    height: 28px;
    color: var(--card-accent);
    opacity: 0.8;
    transition: opacity 0.25s;
}
.role-card:hover .role-icon {
    opacity: 1;
}

/* Content */
.role-content {
    flex: 1;
    min-width: 0;
}
.role-name {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: color 0.25s;
}
.role-card:hover .role-name {
    color: var(--card-accent);
}
.role-desc {
    font-size: 9.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.role-access {
    display: flex;
    gap: 6px;
}
.role-badge-mini {
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 2px 6px;
    border-radius: 1px;
}
.role-badge-auth {
    background: rgba(255, 145, 0, 0.1);
    border: 1px solid rgba(255, 145, 0, 0.3);
    color: var(--orange);
}
.role-badge-open {
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.25);
    color: var(--green);
}

/* Arrow */
.role-arrow {
    font-size: 18px;
    color: var(--text-dim);
    flex-shrink: 0;
    transition: color 0.25s, transform 0.25s;
}
.role-card:hover .role-arrow {
    color: var(--card-accent);
    transform: translateX(4px);
}


/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

.entry-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 20px;
    text-align: center;
    z-index: 1;
    background: linear-gradient(0deg, var(--bg-dark) 0%, transparent 100%);
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
}
.footer-line {
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.footer-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.5);
    animation: dot-blink 2s ease infinite;
}
@keyframes dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.footer-sep { opacity: 0.3; }
.footer-ws-off { color: var(--text-dim); }
.footer-ws-on  { color: var(--green); }


/* ═══════════════════════════════════════════
   FOCUS
   ═══════════════════════════════════════════ */

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}
:focus:not(:focus-visible) {
    outline: none;
}


/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 700px) {
    .role-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        max-width: 400px;
    }
    .entry-title {
        font-size: 36px;
        letter-spacing: 0.12em;
    }
    .entry-subtitle {
        font-size: 10px;
        letter-spacing: 0.15em;
    }
    .logo-mark {
        width: 72px;
        height: 72px;
    }
    .entry-header {
        margin-bottom: 32px;
    }
    .role-desc {
        display: none; /* Save space on phone */
    }
    .role-card {
        padding: 14px 16px;
    }
}

@media (max-width: 400px) {
    .entry-title { font-size: 28px; }
    .entry-subtitle { font-size: 9px; letter-spacing: 0.1em; }
    .entry-version { font-size: 8px; }
    .role-icon-wrap { width: 40px; height: 40px; }
    .role-icon { width: 22px; height: 22px; }
    .role-name { font-size: 11px; }
}

@media (max-height: 600px) {
    .entry-screen { padding: 20px 16px; }
    .entry-header { margin-bottom: 20px; }
    .logo-mark { width: 56px; height: 56px; margin-bottom: 12px; }
    .entry-title { font-size: 28px; }
    .entry-subtitle { font-size: 9px; }
    .entry-version { display: none; }
    .role-card { padding: 10px 14px; }
    .role-desc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .logo-shield, .logo-sweep, .logo-ring-1,
    .logo-ring-2, .logo-ring-3, .logo-dot,
    .logo-z, .footer-dot {
        animation: none !important;
    }
    .boot-line {
        transition: none;
    }
    .logo-z {
        stroke-dashoffset: 0;
    }
}
