:root {
    --primary-color: #9d4edd;
    --secondary-color: #7b2cbf;
    --accent-color: #3c096c;
    --accent-color-dark: #2f0457;
    --text-light: #ecf0f1;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --spacing-base: 2rem;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --card-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
    --infotester-primary: #0096E7;
    --infotester-secondary: #FFFFFF;
    --hiab-primary: #EE4326;
    --hiab-secondary: #000000;
    --yhta-primary: #c83e36;
    --yhta-secondary: #e8b455;
    --logo-height-lg: 180px;
    --logo-height-md: 120px;
    --logo-height-sm: 80px;
    --logo-height-xs: 60px;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #f5f5f5, #fff);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 56px;
    font-size: 18px;
    line-height: 1.6
}

.typed-cursor {
    opacity: 1;
    animation: typedjsBlink .7s infinite;
    color: var(--primary-color)
}

@keyframes typedjsBlink {
    50% {
        opacity: 0
    }
}

/* Consolidated animation keyframes */

/* Position animation - already consolidated previously */
@keyframes position-animation {
    0% { background-position: 0 50% }
    50% { background-position: 100% 50% }
    100% { background-position: 0 50% }
}

/* Consolidated shine animations for buttons and downloads */
@keyframes shine-effect {
    0% { transform: rotate(45deg) translateX(-150%) }
    50% { transform: rotate(45deg) translateX(0%) }
    100% { transform: rotate(45deg) translateX(150%) }
}

/* Consolidated glow animations for tabs */
@keyframes glow-effect {
    from { opacity: .6; box-shadow: 0 0 5px var(--glow-color, #fff) }
    to { opacity: 1; box-shadow: 0 0 15px 5px var(--glow-shadow, rgba(0,0,0,.7)) }
}

/* Specific keyframes that need to remain separate */
@keyframes ripple {
    0% { width: 0; height: 0; opacity: .5 }
    100% { width: 300px; height: 300px; opacity: 0 }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) }
    40% { transform: translateY(-8px) }
    60% { transform: translateY(-4px) }
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    background: linear-gradient(45deg, #fff, #f7b7ff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: position-animation 6s ease infinite;
    min-height: 70px;
    display: inline-block;
    position: relative;
    margin-bottom: 1.5rem;
    opacity: 1;
    text-shadow: 0 3px 5px rgba(0, 0, 0, .2);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, .6))
}

[data-translate=desc] {
    max-width: 800px;
    margin: 1rem auto;
    line-height: 1.6;
    opacity: 1
}

.typed-fade-out {
    opacity: 0;
    transition: opacity .25s
}

.wrapper {
    flex: 1
}

.navbar {
    background: var(--primary-color);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px)
}

nav ul {
    list-style: none;
    padding: 0
}

nav ul li {
    display: inline;
    margin: 0 15px
}

nav ul li a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: all .3s ease;
    font-size: 1.15rem
}

nav ul li a:hover {
    color: var(--text-light);
    opacity: .9
}

.navbar-brand {
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, .2)
}

/* Consolidated navbar styles */
.navbar-nav .nav-item .nav-link {
    color: #fff !important;
    background-color: transparent;
    border: none;
    padding: .5rem 1rem;
    font-weight: 500;
    margin: 0 3px;
    border-radius: 4px;
    text-decoration: none;
    box-shadow: none !important
}

.navbar-nav .nav-item .nav-link:hover {
    color: #fff !important;
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, .1) !important
}

.navbar-nav .nav-item .nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, .15) !important;
    font-weight: 600;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) !important
}

.language-switcher {
    display: flex;
    gap: 5px;
    margin-left: 15px
}

.language-switcher .btn {
    position: relative;
    padding: 5px 15px;
    font-weight: 600;
    transition: all .3s ease
}

.language-switcher .btn.active {
    background-color: rgba(255, 255, 255, .2);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .4)
}

.language-switcher .btn:hover {
    transform: translateY(-2px)
}

.language-switcher .btn:active {
    transform: translateY(1px)
}

.nav-link {
    display: inline-block;
    padding: 15px 20px;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: all .3s ease, transform .2s ease;
    cursor: pointer;
    background: linear-gradient(45deg, #6a11cb, #2575fc);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .1);
    position: relative;
    overflow: hidden
}

.nav-link:active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, .3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ripple .6s ease-out;
    z-index: 0
}

@keyframes ripple {
    0% {
        width: 0;
        height: 0;
        opacity: .5
    }

    100% {
        width: 300px;
        height: 300px;
        opacity: 0
    }
}

.nav-link:active {
    animation: rotateColors .9s ease;
    transform: scale(.95)
}

@keyframes rotateColors {
    0% {
        background: linear-gradient(45deg, #6a11cb, #2575fc)
    }

    25% {
        background: linear-gradient(90deg, #2575fc, #6a11cb)
    }

    50% {
        background: linear-gradient(135deg, #6a11cb, #2575fc)
    }

    75% {
        background: linear-gradient(180deg, #2575fc, #6a11cb)
    }

    100% {
        background: linear-gradient(45deg, #6a11cb, #2575fc)
    }
}

.nav-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .2)
}

.nav-pills .nav-link {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color), var(--accent-color-dark));
    border-radius: 12px;
    color: var(--text-light);
    transition: all 1.5s cubic-bezier(.4, 0, .2, 1);
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 15px rgba(157, 78, 221, .3);
    margin: 0 4px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    padding: 15px 20px;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
    transform: translateY(0)
}

.nav-pills .nav-link:hover {
    background-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(157, 78, 221, .5);
    color: var(--text-light);
    border-radius: 12px;
    transition: all 1.5s cubic-bezier(.4, 0, .2, 1)
}

.nav-pills .nav-link:active {
    background: linear-gradient(45deg, var(--accent-color-dark), var(--accent-color), var(--secondary-color), var(--primary-color));
    transform: scale(.98);
    transition: all .3s ease
}

.nav-pills .nav-link.active {
    background: linear-gradient(45deg, var(--accent-color-dark), var(--accent-color), var(--secondary-color), var(--primary-color));
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .2);
    transform: translateY(-2px);
    transition: all 1.5s cubic-bezier(.4, 0, .2, 1)
}

.nav-pills .nav-link::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, .2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 2s ease, height 2s ease, opacity 2s ease;
    z-index: 0
}

.nav-pills .nav-link:active::after {
    background: rgba(0, 0, 0, .2);
    transition: all .5s ease;
    width: 300px;
    height: 300px;
    opacity: 0
}

#hiab-tab {
    position: relative;
    background: linear-gradient(45deg, #ee4326, #000);
    transition: all .4s ease;
    color: #fff;
    box-shadow: 0 0 10px rgba(238, 67, 38, .4);
    border: none;
    overflow: hidden
}

#hiab-tab:hover {
    box-shadow: 0 0 10px 2px rgba(238, 67, 38, .7), 0 0 20px 5px rgba(238, 67, 38, .4);
    transform: translateY(-3px);
    z-index: 5
}

#hiab-tab:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #ee4326;
    border-radius: inherit;
    --glow-color: #ee4326;
    --glow-shadow: #000;
    animation: glow-effect 1.5s infinite alternate;
    pointer-events: none
}

#hiab-tab.active {
    background: linear-gradient(45deg, #000, #ee4326, #000);
    background-size: 200% 200%;
    animation: position-animation 3s ease infinite;
    box-shadow: 0 0 15px #ee4326, inset 0 0 10px #000;
    border: 1px solid rgba(238, 67, 38, .6)
}

#yhta-tab {
    position: relative;
    background: linear-gradient(45deg, #c83e36, #e8b455);
    transition: all .4s ease;
    color: #fff;
    box-shadow: 0 0 10px rgba(200, 62, 54, .4);
    border: none;
    overflow: hidden
}

#yhta-tab:hover {
    box-shadow: 0 0 10px 2px rgba(200, 62, 54, .6), 0 0 20px 5px rgba(232, 180, 85, .4);
    transform: translateY(-3px);
    z-index: 5
}

#yhta-tab:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #e8b455;
    border-radius: inherit;
    --glow-color: #e8b455;
    --glow-shadow: #c83e36;
    animation: glow-effect 1.5s infinite alternate;
    pointer-events: none
}

@keyframes yhtaGlow {
    from {
        opacity: .6;
        box-shadow: 0 0 5px #e8b455
    }

    to {
        opacity: 1;
        box-shadow: 0 0 15px 5px #c83e36
    }
}

#yhta-tab.active {
    background: linear-gradient(45deg, #c83e36, #e8b455, #c83e36);
    background-size: 200% 200%;
    animation: position-animation 3s ease infinite;
    box-shadow: 0 0 15px #c83e36, inset 0 0 10px #e8b455;
    border: 1px solid rgba(232, 180, 85, .6)
}

#infotester-tab {
    position: relative;
    background: linear-gradient(45deg, var(--infotester-primary), var(--infotester-secondary));
    transition: all .4s ease;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .3) !important;
    box-shadow: 0 0 10px rgba(0, 150, 231, .4);
    border: none;
    overflow: hidden
}

#infotester-tab:hover {
    box-shadow: 0 0 10px 2px rgba(0, 150, 231, .7), 0 0 20px 5px rgba(0, 150, 231, .4);
    transform: translateY(-3px);
    z-index: 5;
    color: #fff !important
}

#infotester-tab:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #0096e7;
    border-radius: inherit;
    --glow-color: #0096e7;
    --glow-shadow: rgba(0, 150, 231, .7);
    animation: glow-effect 1.5s infinite alternate;
    pointer-events: none
}

@keyframes infotesterGlow {
    from {
        opacity: .6;
        box-shadow: 0 0 5px #0096e7
    }

    to {
        opacity: 1;
        box-shadow: 0 0 15px 5px rgba(0, 150, 231, .7)
    }
}

#infotester-tab.active {
    background: linear-gradient(45deg, #0096e7, #c6c6c6, #0096e7);
    background-size: 200% 200%;
    animation: position-animation 3s ease infinite;
    box-shadow: 0 0 15px #0096e7, inset 0 0 10px #fff;
    border: 1px solid rgba(0, 150, 231, .6);
    color: #fff !important
}

#infotester-tab .tab-stats,
#infotester-tab small,
#infotester-tab span {
    color: #fff !important
}

#Infotester4Education .row {
    margin: 0 !important;
    padding: 0 !important
}

#Infotester4Education .d-flex.justify-content-center.mb-1,
#Infotester4Education .logo-section {
    height: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 10px !important
}

#infotesterGames {
    margin-top: 0 !important
}

.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    animation: position-animation 15s ease infinite;
    padding: 6rem 0;
    color: var(--text-light);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, .2);
    text-align: center;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column
}

.search-box {
    position: relative;
    max-width: 500px;
    margin: 2rem auto
}

.search-box input {
    padding: 15px 20px 15px 45px;
    width: 100%;
    border: 1px solid rgba(157, 78, 221, .3);
    border-radius: 25px;
    font-size: 1.2rem;
    transition: all .3s ease;
    background-color: rgba(255, 255, 255, .9);
    box-shadow: 0 5px 15px rgba(0, 0, 0, .1);
    color: #333
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #9d4edd
}

.search-box input:focus {
    border-color: #9d4edd;
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .15)
}

.search-box::after {
    content: "Search by team name, game title...";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    color: #999;
    pointer-events: none;
    opacity: .7
}

.search-box input:focus+.search-box::after {
    display: none
}

#games {
    padding: 0;
    margin: 0;
    min-height: auto;
    display: block
}

#games h2[data-translate=nav-games] {
    font-size: 2.8rem;
    display: inline-block;
    position: relative;
    margin-bottom: 2rem;
    background: 0 0;
    padding: 0;
    border: none;
    box-shadow: none
}

h2.text-center.mb-4[data-translate=nav-games] {
    position: static;
    float: none;
    left: auto;
    right: auto;
    transform: none;
    text-align: center;
    margin: 0 auto 2rem auto;
    width: auto;
    max-width: 200px;
    display: block;
    font-size: 2.8rem;
    font-weight: 700;
    padding: 5px 0;
    border-bottom: 2px solid var(--primary-color)
}

h2.text-center.mb-4[data-translate=nav-games]::after,
h2.text-center.mb-4[data-translate=nav-games]::before {
    display: none
}

.games-section .container {
    text-align: center
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    margin-top: 0 !important;
    padding-top: 0 !important;
    position: relative !important;
    height: auto !important;
    min-height: auto !important;
    margin-bottom: 20px !important;
    overflow: visible !important
}

.games-grid .row {
    margin: 0 !important;
    padding: 0 !important
}

.games-grid .row:first-child {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important
}

#infotesterGames .row:first-child {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    display: block !important
}

body .games-grid>.row {
    margin: 0;
    padding: 0
}

body .tab-content .tab-pane .games-grid .row:first-child {
    margin: 0;
    padding: 0;
    height: auto;
    min-height: 0;
    display: block
}

.games-grid>* {
    border: none
}

.row>* {
    border: none
}

.col-12 {
    border: none
}

.col {
    padding: 10px;
    display: flex
}

.d-flex.justify-content-center.mb-1 {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important
}

.d-flex.justify-content-center {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important
}

img.Logos,
img[src*="logos/infotester"],
img[src="logos/infotester.png"] {
    max-height: 80px !important;
    width: auto !important;
    margin: 10px auto !important;
    padding: 0 !important;
    border: none !important;
    display: block !important
}

.d-flex.justify-content-center.mb-1 img[src*=infotester],
img.Logos[src*=infotester],
img[src="logos/infotester.png"] {
    max-height: 120px !important;
    width: auto !important;
    margin: 15px auto !important;
    padding: 0 !important;
    display: block !important
}

body #Infotester4Education img[src*=infotester],
body .carousel-item img[src*=infotester],
body .d-flex.justify-content-center img[src*=infotester] {
    max-height: 180px;
    width: auto;
    margin: 15px auto;
    display: block
}

img.Logos.yhta-logo,
img.yhta-logo,
img[src*="YHTÄ"],
img[src*=YHTA-ilme],
img[src*=yhta],
img[src="logos/YHTA-ilme.png"] {
    max-height: 150px !important;
    height: auto !important;
    width: auto !important;
    margin: 10px auto !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center !important;
    filter: none !important;
    min-height: 0 !important;
    max-width: 100% !important
}

img[src*="YHTÄ"],
img[src*=yhta-logo],
img[src*=yhta] {
    max-height: 150px !important;
    height: auto !important;
    width: auto !important;
    margin: 10px auto !important;
    padding: 0 !important;
    border: none !important;
    display: block !important
}

.games-grid img[src*=YHTA],
.games-grid img[src*=yhta],
.tab-content img[src*=YHTA],
img.Logos.yhta-logo,
img.yhta-logo,
img[src*=YHTA-ilme],
img[src="logos/YHTA-ilme.png"] {
    max-height: 150px !important;
    height: auto !important;
    width: auto !important;
    margin: 10px auto !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
    filter: none !important
}

.tab-content img[src*=YHTA],
.tab-content img[src*=yhta] {
    max-width: none !important
}

#Infotester4Education {
    padding-top: 0 !important
}

#Infotester4Education .d-flex.justify-content-center {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    height: auto !important
}

.card {
    height: 100%;
    display: flex;
    flex-direction: column
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1
}

.card-img-top {
    width: 100% !important;
    height: 0 !important; /* Force height calculation via padding */
    padding-bottom: 100% !important; /* Creates perfect square */
    object-fit: cover !important;
    margin: 0 auto;
    display: block;
    background-color: #f0f0f0;
    transition: transform .3s ease-in-out;
    backface-visibility: hidden;
    transform: translateZ(0);
    position: relative !important;
}

/* Create a wrapper for card images to ensure proper sizing */
.card-img-wrapper {
    position: relative !important;
    width: 100% !important;
    padding-top: 100% !important; /* Creates 1:1 aspect ratio */
    overflow: hidden !important;
}

.card-img-wrapper .card-img-top {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding-bottom: 0 !important; /* Override padding from earlier rule */
}

@media (max-width:992px) {
    .card-img-top {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1/1 !important;
        object-fit: cover !important;
    }
}

@media (max-width:768px) {
    .card-img-top {
        height: 220px
    }

    .card-text {
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
        display: -webkit-box;
    }
}

@media (max-width:480px) {
    .card-img-top {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1/1 !important;
        object-fit: cover !important;
    }
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .15)
}

.card:hover .card-img-top {
    transform: scale(1.03)
}

@media (max-width:992px) {
    .card-img-top {
        width: 100% !important;
        aspect-ratio: 1/1 !important;
    }
}

@media (max-width:768px) {
    .card-img-top {
        height: 220px
    }

    .card-text {
        -webkit-line-clamp: 4;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

@media (max-width:480px) {
    .card-img-top {
        height: 180px
    }
}

.card-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(157, 78, 221, .2), -1px -1px 2px rgba(0, 0, 0, .1), 1px 1px 4px rgba(255, 255, 255, .5);
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: .75rem;
    transition: text-shadow .3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card:hover .card-title {
    text-shadow: 3px 3px 6px rgba(157, 78, 221, .8), -2px -2px 4px rgba(0, 0, 0, .15), 2px 2px 6px rgba(255, 255, 255, .6)
}

.card-text {
    font-size: 1.1rem;
    line-height: 1.5;
    flex-grow: 0;
    margin-bottom: 1rem;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: vertical;
    overflow: visible;
    max-height: none
}

.developers {
    display: block;
    opacity: 1;
    visibility: visible;
    margin: .75rem 0;
    text-align: left;
    padding: 5px 0;
    border-top: 1px solid rgba(0, 0, 0, .05);
    font-weight: 500;
    margin-top: auto
}

.developers .text-muted {
    font-weight: 500;
    color: #555;
    opacity: 1;
    visibility: visible;
    font-style: italic;
    margin-bottom: .75rem;
    padding: .5rem 0
}

.card:hover .developers .text-muted {
    color: var(--primary-color)
}

.team-name {
    font-weight: 600;
    color: var(--primary-color, #6a35dd);
    display: inline-block;
    opacity: 1;
    visibility: visible
}

.d-grid {
    margin-top: auto;
    margin-bottom: .5rem
}

.download-container {
    margin-top: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: .75rem
}

.download-btn {
    width: 100%;
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    transition: transform .3s ease, box-shadow .3s ease;
    position: relative;
    overflow: hidden;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center
}

.download-btn .fas {
    margin-right: 8px
}

.download-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, .1);
    transform: rotate(45deg);
    animation: downloadShine 3s infinite
}

.poster {
    max-width: 60%; /* Reduced from 80% to 60% */
    height: auto;
    margin: 0 auto 20px auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform .3s ease;
    display: block;
}

@media (max-width: 992px) {
    .poster {
        max-width: 70%;
    }
}

@media (max-width: 768px) {
    .poster {
        max-width: 80%;
    }
}

@media (max-width: 576px) {
    .poster {
        max-width: 90%;
    }
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(76, 175, 80, .4)
}

.qr-code-wrapper {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: .5rem
}

.qr-code {
    width: 100px;
    height: 100px;
    background-color: #fff;
    padding: 5px;
    border-radius: 5px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center
}

.qr-code-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.qr-placeholder {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    color: #666;
    font-size: 14px;
    text-align: center;
    border-radius: 4px;
    border: 1px dashed #ccc;
}

@keyframes downloadShine {
    0% {
        transform: rotate(45deg) translateX(-120%)
    }

    100% {
        transform: rotate(45deg) translateX(120%)
    }
}

@keyframes buttonShine {
    0% {
        transform: rotate(45deg) translateX(-150%)
    }

    50% {
        transform: rotate(45deg) translateX(150%)
    }

    100% {
        transform: rotate(45deg) translateX(150%)
    }
}

/* Unified logo styling system that eliminates all duplicate selectors */
.Logos, .logo, .partner-logo,
img[src*="logos/"], [class*="-logo"],
#partnersCarousel .carousel-item img {
    width: auto !important;
    height: auto !important;
    margin: 10px auto !important;
    padding: 0 !important;
    display: block !important;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: grayscale(20%);
    object-fit: contain !important;
    max-width: 100% !important;
    max-height: var(--logo-height-md) !important;
}

/* Logo hover effects */
.Logos:hover, .logo:hover, .partner-logo:hover,
img[src*="logos/"]:hover, [class*="-logo"]:hover {
    transform: scale(1.05);
    filter: grayscale(0%);
}

/* Special cases for specific logos */
#partnersCarousel .carousel-item img.partner-logo,
.logo-section img,
img[src*="YHTA-ilme"], img[src*="YHTÄ"],
img[src*="infotester"], img[src*="HIAB_Logo"],
img.yhta-logo, img.partner-logo {
    max-height: var(--logo-height-lg) !important;
}

/* Navigation tab logo styles */
#hiab-tab img, #infotester-tab img, #yhta-tab img,
.nav-item a.nav-link img {
    max-height: 24px !important;
    margin-right: 8px !important;
    vertical-align: middle !important;
}

/* Consolidated responsive styles for all logos */
@media (max-width: 992px) {
    :root {
        --logo-height-lg: 120px;
        --logo-height-md: 100px;
        --logo-height-sm: 60px;
        --logo-height-xs: 50px;
    }
}

@media (max-width: 768px) {
    :root {
        --logo-height-lg: 80px;
        --logo-height-md: 70px;
        --logo-height-sm: 50px;
        --logo-height-xs: 40px;
    }
    #partnersCarousel .carousel-item img {
        max-height: var(--logo-height-sm) !important;
    }
}

@media (max-width: 576px) {
    :root {
        --logo-height-lg: 60px;
        --logo-height-md: 50px;
        --logo-height-sm: 40px;
        --logo-height-xs: 30px;
    }
    #partnersCarousel .carousel-item img {
        max-height: var(--logo-height-xs) !important;
    }
}

.logo-container {
    margin-bottom: 5px !important;
    padding-bottom: 0 !important
}

.partners-section {
    padding: 2rem 0;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee
}

.partner-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 1rem 0
}

.tab-pane .row:first-child {
    margin-top: 0;
    padding-top: 0
}

.tab-content,
.tab-pane {
    margin-top: 0 !important;
    padding-top: 0 !important
}

.tab-content>.tab-pane {
    padding-top: 0 !important;
    margin-top: 0 !important
}

.row {
    margin-left: 0 !important;
    margin-right: 0 !important
}

.row .row {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    margin-left: -12px !important;
    margin-right: -12px !important
}

.row .d-flex.justify-content-center.mb-1 {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important
}

#hiab-tab img,
#infotester-tab img,
#yhta-tab img,
.nav-item a.nav-link img {
    max-height: 24px !important;
    width: auto !important;
    margin-right: 8px !important;
    vertical-align: middle !important
}

.row>.d-flex.justify-content-center.mb-1 {
    margin-bottom: 0 !important;
    border: none !important;
    background: 0 0 !important;
    display: flex !important;
    height: auto !important;
    max-height: 80px !important
}

#infotesterGames .row:first-child,
.games-section .row:first-child,
.tab-pane>.row:first-child {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: 0 0 !important;
    border: none !important
}

img.Logos[src*=infotester],
img[src="logos/infotester.png"] {
    max-height: 80px !important;
    width: auto !important;
    margin: 10px auto !important;
    padding: 0 !important;
    display: block !important
}

.row>.col>.col {
    padding: 0 !important;
    margin: 0 !important;
    display: contents !important
}

.alert.d-none {
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    border: none !important
}

#infotesterGames.row {
    margin-top: 0 !important;
    padding-top: 0 !important
}

#hiabGames,
#yhtaGames {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important
}

.col .col {
    padding: 0 !important;
    margin: 0 !important
}

.btn-website {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 6px;
    transition: all .3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(52, 152, 219, .3)
}

.btn-website:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, .5);
    color: #fff
}

.btn-website::before {
    content: "🌐";
    margin-right: 8px;
    font-size: 1rem
}

.btn-trailer {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 6px;
    transition: all .3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(231, 76, 60, .3)
}

.btn-trailer:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(231, 76, 60, .5);
    color: #fff
}

.btn-trailer .fas {
    margin-right: 8px
}

.btn-trailer::after,
.btn-website::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, .1);
    transform: rotate(45deg);
    animation: buttonShine 3s infinite
}

.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all .3s ease;
    z-index: 1000
}

.scroll-top-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, .25)
}

.scroll-top-btn:active {
    transform: translateY(0) scale(.95)
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0)
}

.scroll-top-btn i {
    animation: bounce 2s infinite
}

@keyframes bounce {

    0%,
    100%,
    20%,
    50%,
    80% {
        transform: translateY(0)
    }

    40% {
        transform: translateY(-8px)
    }

    60% {
        transform: translateY(-4px)
    }
}

@media (max-width:768px) {
    .scroll-top-btn {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
        font-size: 1rem
    }
}

.carousel-item img {
    max-height: 250px;
    width: auto;
    margin: 0 auto;
    display: block
}

@media (max-width:768px) {
    .carousel-item img {
        max-height: 60px
    }
}

@media (max-width:576px) {
    .carousel-item img {
        max-height: 50px
    }
}

#partnersCarousel .carousel-item img,
.d-flex.justify-content-center img.Logos,
.logo-section img.Logos {
    max-height: 180px !important;
    width: auto !important;
    margin: 15px auto !important;
    display: block !important;
    object-fit: contain !important
}

img.yhta-logo,
img[alt*="YHTÄ Logo"],
img[src*=YHTA-ilme] {
    max-height: 180px !important;
    width: auto !important;
    margin: 15px auto !important
}

img[alt*=Infotester],
img[src*=infotester] {
    max-height: 180px !important;
    width: auto !important;
    margin: 15px auto !important
}

@media (max-width:992px) {
    .games-grid {
        gap: 15px
    }

    .col {
        width: calc(50% - 15px)
    }

    .title {
        font-size: 2.5rem
    }
}

@media (max-width:768px) {
    .games-grid {
        grid-template-columns: 1fr
    }

    .col {
        width: 100%;
        padding: 0 10px
    }

    body {
        font-size: 16px
    }

    .hero {
        padding: 3rem 1rem
    }

    .card {
        margin-bottom: 1.5rem
    }

    .partner-logo {
        height: 60px
    }

    .nav-pills .nav-link {
        padding: 10px 15px;
        font-size: 1.1rem
    }

    .title,
    h1 {
        font-size: 2.8rem
    }

    h2 {
        font-size: 2.2rem
    }

    .card-text {
        font-size: 1rem;
        /* Remove the line clamping for full text visibility */
        -webkit-line-clamp: unset;
        -webkit-line-clamp: unset;
        max-height: none;
        overflow: visible;
    }

    .Tiko1,
    .Tiko2,
    .Tiko3 {
        font-size: 2.2rem
    }

    .Logos,
    .logo,
    .partner-logo {
        max-height: 60px
    }

    .btn-trailer,
    .btn-website {
        padding: 8px 15px;
        font-size: .9rem
    }
}

@media (max-width:576px) {
    .stats .stat-card {
        padding: 1rem
    }

    .card-title {
        font-size: 1.1rem
    }

    .search-box {
        width: 90%
    }

    .games-grid {
        gap: 10px
    }

    .title {
        font-size: 2rem
    }

    .nav-pills .nav-link {
        padding: 8px 12px;
        font-size: .9rem
    }

    .Logos,
    .logo,
    .partner-logo {
        max-height: 50px
    }

    .partner-logo-container {
        gap: 15px
    }
}

@media (max-width:375px) {
    .title {
        font-size: 1.8rem
    }

    .btn {
        padding: 8px 15px;
        font-size: .9rem
    }
}

footer {
    text-align: center;
    padding: 1.5rem 0;
    background: linear-gradient(135deg, #f1f1f1, #e5e5e5);
    color: #333;
    font-size: 1rem;
    border-top: 1px solid #ddd;
    margin-top: 2rem;
    position: relative;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .05)
}

footer p {
    margin: 0;
    font-weight: 500;
    letter-spacing: .5px
}

footer .copyright {
    display: inline-block;
    position: relative;
    padding: .5rem 1.5rem;
    background-color: rgba(255, 255, 255, .6);
    border-radius: 4px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1)
}

footer .copyright::before {
    content: "©";
    font-weight: 700;
    margin-right: 5px;
    color: var(--primary-color)
}

.copyright-text {
    margin-top: 30px;
    text-align: center;
    padding: 15px;
    background-color: rgba(0, 0, 0, .05);
    border-radius: 8px;
    position: relative;
    z-index: 5; /* Lower z-index than carousel controls */
    pointer-events: none; /* Prevent copyright from capturing clicks */
}

.copyright-text p {
    margin: 0;
    font-weight: 500;
    font-size: 1.1rem;
    pointer-events: auto; /* Allow text itself to be selectable */
}

img[src="logos/infotester.png"] {
    max-height: 60px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    display: block !important
}

.tab-pane>.games-grid>.row {
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important
}

.games-grid>.row>.d-flex.justify-content-center.mb-1 {
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
    height: auto !important
}

.Logos {
    max-height: 80px !important;
    width: auto !important;
    display: block !important;
    margin: 0 auto !important
}

.yhta-logo {
    max-height: 150px !important
}

#hiab-tab,
#infotester-tab,
#yhta-tab,
.navbar-nav .nav-item .nav-link {
    color: #fff !important
}

.games-grid>.row>.row {
    margin: 0 !important;
    width: 100% !important
}

.games-grid .row-cols-1.row-cols-md-3.g-4 {
    margin-top: 0 !important;
    padding-top: 0 !important
}

.carousel-item img,
.d-flex.justify-content-center img,
.logo-section img,
img.Logos {
    margin: 15px auto !important;
    padding: 0 !important;
    display: block !important;
    width: auto !important;
    object-fit: contain !important;
    transition: transform .3s ease;
    height: auto !important
}

.carousel-item img:hover,
.logo-section img:hover,
img.Logos:hover {
    transform: scale(1.05)
}

img.Logos {
    max-height: 100px !important
}

#Infotester4Education .logo-section img,
.carousel-item img[src*=infotester],
img.Logos[src*=infotester],
img[src*="infotester.png"] {
    max-height: 160px !important
}

#YHTÄ .logo-section img,
.carousel-item img[src*=YHTA],
img.yhta-logo,
img[src*=YHTA-ilme] {
    max-height: 160px !important
}

#Hiab .logo-section img,
.carousel-item img[src*=HIAB],
img[src*=HIAB_Logo] {
    max-height: 160px !important
}

#hiab-tab img,
#infotester-tab img,
#yhta-tab img,
.nav-item a.nav-link img {
    max-height: 24px !important;
    margin-right: 8px !important;
    vertical-align: middle !important
}

.logo-section,
.row .d-flex.justify-content-center.mb-1 {
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important
}

.games-grid {
    position: relative !important;
    height: auto !important;
    margin-bottom: 20px !important
}

.row>.col>.col {
    padding: 0 !important;
    margin: 0 !important
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.tab-header {
    display: flex;
    flex-direction: column
}

.tab-header .Tiko1,
.tab-header .Tiko2,
.tab-header .Tiko3 {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .5rem
}

/* Mobile and Tablet Responsive Improvements */
@media (max-width: 992px) {
    /* Tablet adjustments */
    .row-cols-md-3 {
        --bs-gutter-x: 1rem;
    }

    .hero {
        padding: 4rem 1rem;
    }

    .nav-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .card-img-top {
        height: 250px;
        object-fit: cover;
    }

    .qr-code-wrapper {
        margin: 0.5rem auto;
    }
}

@media (max-width: 768px) {
    /* Mobile adjustments */
    body {
        padding-top: 56px;
        font-size: 16px;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .hero {
        padding: 3rem 0.5rem;
        min-height: auto;
    }

    h2[data-translate="nav-games"] {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .row-cols-md-3 > .col {
        flex: 0 0 auto;
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .card {
        margin: 0 auto;
        max-width: 100%;
    }

    .card-title {
        font-size: 1.4rem;
    }

    .card-text {
        font-size: 1rem;
        /* Display only 4 lines of text on mobile */
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Improve touch targets for better mobile usability */
    .btn {
        padding: 12px 15px;
        margin-bottom: 8px;
    }

    .download-btn, .btn-website, .btn-trailer {
        min-height: 48px;
    }

    /* Smaller QR codes on mobile */
    .qr-code {
        width: 80px;
        height: 80px;
    }

    /* Better spacing for card content on mobile */
    .card-body {
        padding: 1rem;
    }

    .d-grid {
        gap: 0.5rem !important;
    }

    /* Navigation tabs improvements for mobile */
    .nav-pills .nav-link {
        padding: 8px;
        font-size: 0.9rem;
    }

    .tab-header .Tiko1, .tab-header .Tiko2, .tab-header .Tiko3 {
        font-size: 1.5rem;
    }

    .tab-stats small {
        font-size: 0.7rem;
    }

    #YHTÄ .logo-section img,
    .carousel-item img[src*=YHTA],
    img.yhta-logo,
    img[src*=YHTA-ilme],
    img[src*="YHTÄ"],
    img[src*=yhta] {
        max-height: 120px !important; /* Increased from 80px to 120px */
    }
}

@media (max-width: 576px) {
    /* Small mobile devices */
    .navbar-brand {
        font-size: 1.1rem;
    }

    .hero {
        padding: 2rem 0.5rem;
    }

    .title {
        font-size: 1.8rem;
    }

    h4[data-translate="desc"] {
        font-size: 1rem;
    }

    .card-img-top {
        height: 180px;
    }

    /* Stack buttons on very small screens */
    .d-grid .btn {
        display: block;
        width: 100%;
    }

    /* Improved touch targets for small screens */
    .btn, .navbar-toggler {
        min-height: 44px;
    }

    /* Make the carousel controls more visible on mobile */
    .carousel-control-next, .carousel-control-prev {
        width: 10%;
        opacity: 0.8;
    }

    /* Adjust tab styling for very small screens */
    .nav-pills .nav-link {
        padding: 6px;
        font-size: 0.8rem;
    }

    .scroll-top-btn {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
    }

    #YHTÄ .logo-section img,
    .carousel-item img[src*=YHTA],
    img.yhta-logo,
    img[src*=YHTA-ilme],
    img[src*="YHTÄ"],
    img[src*=yhta] {
        max-height: 100px !important; /* Increased from 60px to 100px */
    }
}

/* Add smooth scrolling for all devices */
html {
    scroll-behavior: smooth;
}

/* Improve tap targets for touch devices */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .navbar-toggler, .language-switcher .btn {
        min-height: 44px;
    }

    /* Increase spacing between interactive elements */
    .d-grid {
        gap: 0.75rem !important;
    }

    /* Make download container more touch-friendly */
    .download-container {
        padding: 0.75rem 0;
    }

    .qr-code-wrapper {
        padding: 12px;
    }
}

/* Logo responsiveness improvements */
.logo-section {
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 15px 0 !important;
    padding: 10px 0 !important;
}

.logo-section img.Logos {
    max-height: 120px !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    transition: transform 0.3s ease;
}

@media (max-width: 992px) {
    /* Tablet */
    .logo-section img.Logos {
        max-height: 100px !important;
    }

    #Infotester4Education .logo-section img,
    .carousel-item img[src*=infotester],
    img.Logos[src*=infotester],
    img[src*="infotester.png"] {
        max-height: 120px !important;
    }

    #YHTÄ .logo-section img,
    .carousel-item img[src*=YHTA],
    img.yhta-logo,
    img[src*=YHTA-ilme] {
        max-height: 120px !important;
    }

    #Hiab .logo-section img,
    .carousel-item img[src*=HIAB],
    img[src*=HIAB_Logo] {
        max-height: 120px !important;
    }
}

@media (max-width: 768px) {
    /* Mobile */
    .logo-section img.Logos {
        max-height: 80px !important;
    }

    .d-flex.justify-content-center.mb-1 img[src*=infotester],
    img.Logos[src*=infotester],
    img[src="logos/infotester.png"] {
        max-height: 80px !important;
    }

    #Infotester4Education .logo-section img,
    .carousel-item img[src*=infotester],
    img.Logos[src*=infotester],
    img[src*="infotester.png"] {
        max-height: 80px !important;
    }

    #YHTÄ .logo-section img,
    .carousel-item img[src*=YHTA],
    img.yhta-logo,
    img[src*=YHTA-ilme] {
        max-height: 80px !important;
    }

    #Hiab .logo-section img,
    .carousel-item img[src*=HIAB],
    img[src*=HIAB_Logo] {
        max-height: 80px !important;
    }

    /* Partner logos in carousel */
    #partnersCarousel .carousel-item img {
        max-height: 60px;
    }
}

@media (max-width: 576px) {
    /* Small mobile */
    .logo-section img.Logos {
        max-height: 60px !important;
    }

    .d-flex.justify-content-center.mb-1 img[src*=infotester],
    img.Logos[src*=infotester],
    img[src="logos/infotester.png"] {
        max-height: 60px !important;
    }

    #Infotester4Education .logo-section img,
    .carousel-item img[src*=infotester],
    img.Logos[src*=infotester],
    img[src*="infotester.png"] {
        max-height: 60px !important;
    }

    #YHTÄ .logo-section img,
    .carousel-item img[src*=YHTA],
    img.yhta-logo,
    img[src*=YHTA-ilme] {
        max-height: 60px !important;
    }

    #Hiab .logo-section img,
    .carousel-item img[src*=HIAB],
    img[src*=HIAB_Logo] {
        max-height: 60px !important;
    }

    /* Partner logos in carousel */
    #partnersCarousel .carousel-item img {
        max-height: 50px;
    }
}

/* Footer and Partner Carousel Responsive Improvements */
#partners {
    padding: 2rem 0;
    overflow: hidden;
}

#partners .container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

#partnersCarousel {
    position: relative;
    margin: 0 auto;
    max-width: 1200px;
    margin-top: 20px; /* Added margin to move logos down */
}

#partnersCarousel .carousel-inner {
    padding: 20px 0;
    height: 280px; /* Increased height */
    margin-bottom: 20px;
}

#partnersCarousel .carousel-item {
    text-align: center;
    height: auto;
    display: flex !important; /* Force display: flex */
    justify-content: center;
    align-items: center;
}

#partnersCarousel .carousel-item img {
    max-height: 100px;
    width: auto;
    max-width: 80%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Ensure single items are centered */
#partnersCarousel.carousel .carousel-item img {
    margin: 0 auto !important;
}

/* For multiple logo display if needed */
#partnersCarousel .logo-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    width: 100%;
    margin: 0 auto;
}

#partnersCarousel .logo-grid img {
    max-height: 80px;
    width: auto;
    margin: 10px !important;
}

/* Fix for carousel item height and vertical alignment during transitions */
#partnersCarousel .carousel-inner {
    height: 220px; /* Fixed height for the carousel container */
}

#partnersCarousel .carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-in-out;
}

.partner-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 220px; /* Increase height to prevent cropping */
    width: 100%;
    padding: 200px 0 10px 0; /* Significantly increased from 100px to 200px top padding */
}

/* Ensure logos maintain consistent vertical position */
#partnersCarousel .carousel-item img.partner-logo {
    max-height: 150px;
    max-width: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

/* Fix for carousel transition issues */
#partnersCarousel .carousel-item {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    display: block;
    transition: opacity 0.5s ease-in-out;
    height: 180px;
    top: 0;
    left: 0;
    right: 0;
}

#partnersCarousel .carousel-item.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#partnersCarousel .carousel-inner {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 180px;
}

/* Force no transitions when carousel is loading */
.carousel-loading .carousel-inner,
.carousel-loading .carousel-item {
    transition: none !important;
}

/* Override Bootstrap transition that might cause overlapping */
.carousel-item-next:not(.carousel-item-left),
.active.carousel-item-right {
    transform: translateX(0);
    opacity: 0;
    visibility: hidden;
}

.carousel-item-prev:not(.carousel-item-right),
.active.carousel-item-left {
    transform: translateX(0);
    opacity: 0;
    visibility: hidden;
}

/* Ensure carousel items are properly contained */
#partnersCarousel .carousel-inner {
    overflow: hidden;
}

#partnersCarousel .carousel-item {
    height: auto;
    transition: transform 0.6s ease-in-out;
}

#partnersCarousel .carousel-item.active {
    display: flex !important;
    justify-content: center;
}

/* Add responsive adjustments for the carousel */
@media (max-width: 992px) {
    .partner-logo-wrapper {
        height: 150px;
    }

    .partner-logo {
        max-height: 120px;
    }
}

@media (max-width: 768px) {
    .partner-logo-wrapper {
        height: 120px;
    }

    .partner-logo {
        max-height: 90px;
    }
}

@media (max-width: 576px) {
    .partner-logo-wrapper {
        height: 100px;
    }

    .partner-logo {
        max-height: 70px;
    }
}

/* Improve carousel controls visibility and clickable area */
.carousel-control-next,
.carousel-control-prev {
    position: absolute !important;
    width: 15% !important;
    height: 100% !important;
    top: 0 !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    background: transparent !important;
    opacity: 1 !important;
    border: none !important;
    outline: none !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    transition: none !important;
}

.carousel-control-prev {
    left: 0 !important;
    right: auto !important;
}

.carousel-control-next {
    left: auto !important;
    right: 0 !important;
}

.carousel-control-next-icon,
.carousel-control-prev-icon {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background-color: var(--primary-color) !important;
    background-size: 50% !important;
    background-position: center !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4) !important;
    border: 4px solid white !important;
    pointer-events: none !important;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
}

/* Button press effects */
.carousel-control-next:active .carousel-control-next-icon,
.carousel-control-prev:active .carousel-control-prev-icon {
    transform: translateY(-50%) scale(0.9) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4) !important;
    background-color: var(--secondary-color) !important;
}

/* Invisible overlay for better click detection */
.carousel-control-next::before,
.carousel-control-prev::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .carousel-control-next,
    .carousel-control-prev {
        width: 25% !important;
    }

    .carousel-control-next-icon,
    .carousel-control-prev-icon {
        width: 60px !important;
        height: 60px !important;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .carousel-control-next-icon,
    .carousel-control-prev-icon {
        width: 48px !important;
        height: 48px !important;
    }

    .carousel-control-prev-icon {
        left: 20px !important;
    }

    .carousel-control-next-icon {
        right: 20px !important;
    }
}

@media (max-width: 576px) {
    .carousel-control-next-icon,
    .carousel-control-prev-icon {
        width: 42px !important;
        height: 42px !important;
    }

    .carousel-control-prev-icon {
        left: 5px !important;
    }

    .carousel-control-next-icon {
        right: 5px !important;
    }
}

/* Make carousel controls more accessible on mobile */
@media (max-width: 768px) {
    .carousel-control-next-icon,
    .carousel-control-prev-icon {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 576px) {
    .carousel-control-next-icon,
    .carousel-control-prev-icon {
        width: 30px;
        height: 30px;
    }
}

/* Make carousel controls more prominent on mobile */
@media (max-width: 768px) {
    .carousel-control-next::before,
    .carousel-control-prev::before {
        width: 36px;
        height: 36px;
    }

    .carousel-control-prev::before {
        left: 10px;
    }

    .carousel-control-next::before {
        right: 10px;
    }

    .carousel-control-next-icon,
    .carousel-control-prev-icon {
        width: 20px;
        height: 20px;
    }
}

/* Ensure the copyright text doesn't interfere with controls */
.copyright-text {
    pointer-events: none;
    margin-top: 20px;
}

.copyright-text p {
    pointer-events: auto;
    background-color: transparent;
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Override any transform that might interfere with carousel animation */
#partnersCarousel .carousel-item-next,
#partnersCarousel .carousel-item-prev,
#partnersCarousel .carousel-item.active {
    transform: translateX(0);
    transition: opacity 0.5s ease-in-out;
}

/* Remove any conflicting animations */
.carousel-item-next:not(.carousel-item-left),
.active.carousel-item-right,
.carousel-item-prev:not(.carousel-item-right),
.active.carousel-item-left {
    transform: translateX(0) !important;
}

#partnersCarousel .carousel-inner {
    height: 250px; /* Increased height to prevent image cropping */
    margin-bottom: 30px; /* Add space for copyright text */
    overflow: visible; /* Allow overflow for full image visibility */
}

#partnersCarousel .carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-in-out;
}

.partner-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 220px; /* Increase height to prevent cropping */
    width: 100%;
    padding: 200px 0 10px 0; /* Increased from 60px to 200px top padding */
}

/* Ensure logos maintain consistent vertical position and aren't cropped */
#partnersCarousel .carousel-item img.partner-logo {
    max-height: 180px; /* Increased to prevent cropping */
    max-width: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
    position: relative;
}

/* Copyright text styling for better readability */
.copyright-text {
    margin-top: 30px;
    text-align: center;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.85); /* More opaque background */
    border-radius: 8px;
    position: relative;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Add shadow for better contrast */
    border: 1px solid rgba(0, 0, 0, 0.1); /* Subtle border */
}

.copyright-text p {
    margin: 0;
    font-weight: 500;
    font-size: 1.1rem;
    color: #333; /* Darker text for better readability */
}

/* Partner Carousel Logo Size Improvements for Mobile */
@media (max-width: 768px) {
    /* Larger partner logos on mobile */
    .carousel-item img {
        max-height: 100px !important; /* Increased from 60px */
    }

    #partnersCarousel .carousel-item img,
    #partnersCarousel .carousel-item img.partner-logo,
    .partner-logo {
        max-height: 120px !important; /* Increased from ~60-80px */
    }

    .partner-logo-wrapper {
        height: 160px; /* Increased to accommodate larger logos */
    }
}

@media (max-width: 576px) {
    /* Larger partner logos on small mobile */
    .carousel-item img {
        max-height: 80px !important; /* Increased from 50px */
    }

    #partnersCarousel .carousel-item img,
    #partnersCarousel .carousel-item img.partner-logo,
    .partner-logo {
        max-height: 100px !important; /* Increased from ~50-70px */
    }

    .partner-logo-wrapper {
        height: 140px; /* Increased to accommodate larger logos */
    }
}

/* Mobile Card Description Fix */
@media (max-width: 768px) {
    /* More specific selector with !important to override any other rules */
    .card .card-body .card-text {
        display: block !important;
        -webkit-line-clamp: unset !important;
        -webkit-line-clamp: unset;
        -webkit-box-orient: vertical !important;
        overflow: visible !important;
        max-height: none !important;
        white-space: normal !important;
        text-overflow: clip !important;
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }

    /* Ensure card body expands as needed */
    .card .card-body {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }

    /* Add padding and space for better readability */
    .card-text {
        padding-bottom: 10px !important;
        margin-bottom: 15px !important;
    }
}

/* Mobile navbar improvements */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-collapse {
        background: var(--primary-color);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
        border-radius: 0 0 10px 10px;
        padding: 1rem;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        z-index: 1030;
        transition: transform 0.3s ease-out, opacity 0.3s ease-out;
        transform-origin: top center;
    }

    .navbar-collapse:not(.show) {
        display: block;
        height: 0;
        padding: 0;
        overflow: hidden;
        transform: scaleY(0);
        opacity: 0;
    }

    .navbar-collapse.show {
        transform: scaleY(1);
        opacity: 1;
        height: auto;
    }

    .navbar-nav {
        margin-bottom: 0.5rem;
    }

    .navbar-nav .nav-item {
        margin: 0.5rem 0;
    }

    .navbar-nav .nav-item .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 8px;
        background-color: rgba(255, 255, 255, 0.1);
        text-align: center;
        font-size: 1.1rem;
    }

    /* Add touch-friendly padding to language switcher */
    .language-switcher {
        display: flex;
        justify-content: center;
        margin: 1rem 0 0.5rem;
        gap: 10px;
    }

    .language-switcher .btn {
        padding: 0.5rem 1.25rem;
        min-height: 44px; /* Improve touch targets */
    }

    /* Animation for toggler button */
    .navbar-toggler {
        border: none;
        padding: 0.5rem;
        transition: transform 0.2s;
    }

    .navbar-toggler:active {
        transform: scale(0.95);
    }

    .navbar-toggler:focus {
        box-shadow: none;
        outline: none;
    }
}

/* Fix for mobile navbar toggle issues - revised to prevent always-visible menu */
.navbar-collapse {
  /* Remove the transition that causes toggle issues */
  transition: height 0.001s linear !important;
}

/* Remove our previous rules that were too aggressive */
.collapsing {
  transition: none !important;
}

/* Ensure proper handling of collapsed state */
.navbar-collapse:not(.show) {
  display: none !important;
}

.navbar-collapse.show {
  display: block !important;
}

@media (max-width: 768px) {
  /* Mobile-specific navbar styling */
  .navbar-collapse {
    background: var(--primary-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 10px 10px;
    padding: 1rem;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 1030;
  }

  /* Improve navbar toggler touch target */
  .navbar-toggler {
    padding: 0.5rem;
    margin-right: 0.5rem;
    border: none;
    touch-action: manipulation;
  }
}

/* Fix for mobile navbar toggle issues */
.navbar-collapse {
  /* Override Bootstrap default transition which may cause issues */
  transition: none !important;
}

.navbar-toggler {
  /* Prevent toggler from double triggering */
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Disable all animations/transitions during collapse/expand to prevent flicker */
.collapsing {
  transition: none !important;
  display: none !important;
}

/* Hard override to ensure proper collapsed state */
.navbar-collapse:not(.show) {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.navbar-collapse.show {
  display: block !important;
  height: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Prevent any automatic transitions */
.navbar-toggler[aria-expanded="false"] + .navbar-collapse {
  display: none !important;
}

.navbar-toggler[aria-expanded="true"] + .navbar-collapse {
  display: block !important;
}

@media (max-width: 768px) {
  /* Additional mobile-specific fixes */
  .navbar-collapse {
    background: var(--primary-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 10px 10px;
    padding: 1rem;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 1030;
  }

  /* These styles bring the navbar menu items slightly further down so they don't get cut off */
  .navbar-nav {
    margin-top: 5px;
  }
}

/* Ensure language switcher is visible on desktop */
@media (min-width: 769px) {
  .language-switcher {
    display: flex;
    gap: 5px;
    margin-left: 15px;
    align-items: center;
  }

  .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
  }

  .navbar > .container-fluid {
    display: flex;
    flex-wrap: inherit;
    align-items: center;
    justify-content: space-between;
  }
}

/* Fix mobile view language switcher positioning */
@media (max-width: 768px) {
  .language-switcher {
    display: flex;
    justify-content: center;
    margin: 1rem auto;
    gap: 10px;
  }

  .language-switcher .btn {
    padding: 8px 20px;
    min-width: 60px;
  }
}

/* New rules to fix navbar visibility on desktop - with !important to override any conflicting styles */
@media (min-width: 768px) {
  #navbarNav {
    display: flex !important;
    flex-basis: auto !important;
    flex-grow: 1 !important;
    align-items: center !important;
    visibility: visible !important;
    height: auto !important;
    opacity: 1 !important;
    position: static !important;
    transform: none !important;
  }

  #navbarNav .navbar-nav {
    display: flex !important;
    flex-direction: row !important;
    margin-right: auto !important;
  }

  #navbarNav .language-switcher {
    display: flex !important;
    margin-left: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .navbar > .container-fluid {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
}
