/* Base styles for header and elements */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f7;
    color: #333;
    margin: 0;
    padding: 0;
}

main {
    padding: 2rem 1rem;
}

header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--user-color), #5e3e94);
    color: white;
    position: relative;
    z-index: 10;
    height: 60px;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 0 0 20px 20px;
    transition: background 0.3s ease;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    flex: 1;
    min-width: 150px;
    text-align: left;
    display: flex;
    align-items: center;
    height: 100%;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    order: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Inter', sans-serif;
}

#score-name-container {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.4rem 1.4rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 15px var(--user-color);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    pointer-events: auto;
    white-space: nowrap;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    perspective: 1000px;
    margin-left: 1rem;
    flex: 0 1 auto;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    order: 1;
    height: 40px;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
}

#score-name-container:hover {
    box-shadow: 0 0 25px var(--user-color);
}

header a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    margin-left: 1rem;
    flex: 0 0 auto;
    text-align: right;
    display: flex;
    align-items: center;
    height: auto;
    padding: 8px 14px;
    order: 2;
    font-size: 1rem;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

header a:hover, header a:focus {
    background-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    outline: none;
}

.flip-inner {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    height: 100%;
}

.flip-front, .flip-back {
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flip-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transform: rotateY(180deg);
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffd700;
}

.user-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
    margin: 0 0.5rem;
}

.user-score strong {
    font-size: 1.2rem;
}

.vs-dot {
    font-weight: 700;
    font-size: 1.3rem;
    user-select: none;
    margin: 0 0.5rem;
}

.total-euro {
    padding: 0 1rem;
}

.total-saved-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #ffffff;
    font-weight: 700;
}

.total-saved-label {
    font-size: 1rem;
    margin-bottom: 0;
    color: white;
}

.total-euro {
    font-size: 1.3rem;
}

/* Portrait orientation adjustments for mobile */
@media (orientation: portrait), (max-width: 600px) {
    header {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: auto;
        padding: .5rem .5rem;
        gap: 0.5rem;
        position: relative;
    }

    header h1 {
        display: none;
    }

    #score-name-container {
        order: 0;
        margin-left: 0;
        max-width: 100%;
        width: auto;
        white-space: normal;
        font-size: 1rem;
        padding: 0.8rem 1rem;
        height: auto;
        box-sizing: border-box;
        margin-top: 2.5rem; /* added to move down */
    }

    header a {
        order: 1;
        margin-left: 0;
        align-self: flex-end;
        padding: 10px 20px;
        flex: none;
        height: auto;
        display: block;
        text-align: center;
        font-size: 0.6rem;
        border-radius: 6px;
        background: transparent;
        cursor: pointer;
        white-space: nowrap;
        width: auto;
        max-width: 300px;
        user-select: none;
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        margin-top: 0;
        margin-right: -1.5rem; /* Added right margin to push further right */
        transition: background-color 0.3s ease;
    }
    header a:hover, header a:focus {
        background-color: rgba(255, 255, 255, 0.2);
        outline: none;
    }
}