.word-flip-container {
    font-family: var(--font-display);
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 600;
    margin: 0.2rem 0 1rem 0;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

/* Desktop layout - single line */
@media (min-width: 1200px) {
    .word-flip-container {
        display: flex;
        gap: 8px;
        white-space: nowrap;
        overflow: hidden;
        align-items: center;
        perspective: 1000px;
    }
    
    .first-line,
    .second-line,
    .third-line {
        display: contents;
    }
    
    /* On desktop, move Resume text to appear after the brackets */
    .third-line .resume-text {
        order: 10;
    }
}

/* Mobile/Tablet/iPad layout - three lines */
@media (max-width: 1199px) {
    .word-flip-container {
        display: block;
        text-align: center;
        font-size: clamp(20px, 5vw, 28px); /* Larger font size for mobile */
    }
    
    .first-line {
        display: block;
        margin-bottom: 0.3rem;
        font-size: 1.1em; /* Slightly larger for "Welcome to the" */
        font-weight: 600;
        opacity: 0.95;
    }
    
    .second-line {
        display: flex;
        gap: 8px;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
        perspective: 1000px;
        min-height: 2.2em; /* Optimized height for animation */
        margin-bottom: 0.3rem;
    }
    
    .third-line {
        display: block;
        font-size: 1.1em; /* Larger for "Resume" */
        font-weight: 600;
        opacity: 0.95;
    }
    
    .resume-text {
        white-space: nowrap;
    }
}

.word-display {
    display: inline-block;
    text-align: center;
    transition: transform 0.5s ease-in-out;
    color: var(--accent-gold);
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    letter-spacing: 0.02em;
    transform-style: preserve-3d;
}

/* Desktop - fixed width for smooth animation */
@media (min-width: 1200px) {
    .word-display {
        min-width: 200px;
    }
}

/* Mobile/Tablet/iPad - fixed width for smooth animation */
@media (max-width: 1199px) {
    .word-display {
        min-width: 220px; /* Increased width for more breathing room */
        white-space: nowrap;
    }
    
    .word-display.rotating {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.4);
    }
    
    /* Enhanced bracket styling for mobile */
    .second-line .bracket {
        font-size: 1.4em;
        margin: 0 6px;
        font-weight: 900;
    }
}

.bracket {
    color: var(--accent-gold);
    font-weight: 800;
    font-size: 1.2em;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}