/* Resets & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    --color-primary-purple: #8b5cf6;
    --color-primary-red: #ea2a33;
    --color-primary-blue: #0ea5e9;
    --color-bg-dark: #0B0A14;
    --color-bg-light: #1a1625;
    --font-display: 'Space Grotesk', sans-serif;
    --font-ui: 'Plus Jakarta Sans', sans-serif;

    /* Dynamic Theme Variables - Default to Purple (Hidden) */
    --theme-color: var(--color-primary-purple);
    --shadow-neon: 0 0 20px rgba(139, 92, 246, 0.5), 0 0 40px rgba(139, 92, 246, 0.3);
}

body {
    font-family: var(--font-display);
    background-color: var(--color-bg-dark);
    color: white;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* Cosmic Background */
.cosmic-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%),
        url("../assets/background-image.jpg") no-repeat center center;
    background-size: cover;
    background-blend-mode: screen;
}

.cosmic-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(11, 10, 20, 0.85);
    backdrop-filter: blur(2px);
}

/* 3D Flip Card Container */
.perspective-container {
    perspective: 1000px;
    width: 100%;
    max-width: 320px;
    height: 520px;
    position: relative;
    z-index: 10;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0s;
    /* Controlled by JS physics loop */
    transform-style: preserve-3d;
    cursor: pointer;

    /* Interaction Safety */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

.flip-card-inner.pressing {
    scale: 0.96;
    transition: scale 0.2s ease-out;
}

/* Card Faces */
.card-face {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 2rem;
    overflow: hidden;
    box-shadow: var(--shadow-neon);
    /* Border Gradient Simulation */
    padding: 2px;
    background: linear-gradient(to bottom, var(--theme-color), rgba(139, 92, 246, 0.5), rgba(11, 10, 20, 0.8));
}

.card-content {
    background: #131122;
    width: 100%;
    height: 100%;
    border-radius: 1.9rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    padding: 1.5rem;
    /* Inherit backface-visibility to prevent content showing through */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.front-layout {
    justify-content: space-between;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

/* Back Face (Revealed) */
.card-back {
    transform: rotateY(180deg);
}

/* Inner Card Styles - Decor */
.stardust-bg {
    position: absolute;
    inset: 0;
    opacity: 0.2;
    background-image: url('../assets/stardust.png');
    mix-blend-mode: overlay;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
}

/* === FRONT FACE STYLES === */

.player-name-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.fingerprint-wrapper-center {
    flex: 1;
    /* Take up available space to center vertically */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.fingerprint-container-large {
    position: relative;
    width: 180px;
    /* Increased size */
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), transparent);
    border: 1px solid rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
    /* Add scale animation to the container itself for "breathing" effect */
    animation: breathe-glow 3s infinite ease-in-out;
}

/* Force override of material icons default size */
.fingerprint-icon-large.material-icons {
    font-size: 150px !important;
    /* Maximize icon within container (approx 85%) */
    color: #d8b4fe;
    text-shadow: 0 0 15px rgba(167, 139, 250, 0.8);
    /* Separate pulse for the icon if needed, or stick to container breathe */
}

.press-hint {
    opacity: 0.8;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* === REVEALED CONTENT STYLES === */

.reveal-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
    overflow: hidden;
    /* Prevent spillover */
}

.spacer {
    flex: 1;
}



.reveal-primary {
    font-family: var(--font-ui);
    /* Dynamic sizing to fit long words */
    font-size: 3.5rem;
    /* Starting max size, JS will scale down */
    font-weight: 900;
    line-height: 1.1;
    font-style: italic;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    margin: 0;
    text-align: center;
    text-shadow: 0 0 20px var(--theme-color);
    white-space: nowrap;
    /* Force single line */
    width: 100%;
    /* Take full width for calculation */
    padding: 0 20px;
    /* Increased padding to prevent clipping */
}

.reveal-secondary {
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-top: 1rem;
    text-align: center;
}

/* Themes */
.theme-infiltrado {
    --theme-color: var(--color-primary-red);
    --shadow-neon: 0 0 25px rgba(234, 42, 51, 0.4), 0 0 50px rgba(234, 42, 51, 0.2);
}

.theme-civilian {
    --theme-color: var(--color-primary-blue);
    --shadow-neon: 0 0 25px rgba(14, 165, 233, 0.4), 0 0 50px rgba(14, 165, 233, 0.2);
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes breathe-glow {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 60px rgba(139, 92, 246, 0.6);
    }
}

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Material Icons helpers */
.material-icons,
.material-symbols-outlined {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
}

/* Error State */
.error-container {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 1rem;
    backdrop-filter: blur(10px);
}