:root {
    --bg-gradient-1: #2a1a5e;
    --bg-gradient-2: #8b4789;
    --bg-gradient-3: #f4a261;
    --container-bg: rgba(42, 26, 94, 0.7);
    --container-border: rgba(244, 162, 97, 0.8);
    --text-color: #ffe8d6;
    --link-color: #f4a261;
    --link-bg: rgba(139, 71, 137, 0.3);
    --link-hover-bg: rgba(244, 162, 97, 0.3);
    --link-hover-border: rgba(244, 162, 97, 0.8);
    --subtitle-color: #dda15e;
    --glow-color: rgba(244, 162, 97, 0.7);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(
            var(--bg-gradient-1),
            var(--bg-gradient-2),
            var(--bg-gradient-3)
        )
        no-repeat fixed;
    color: var(--text-color);
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
    margin: 0;
    padding: 16px;
    min-height: 100vh;
    transition: all 0.5s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    transition: 0.5s ease;
    background: radial-gradient(
        circle at 20% 50%,
        rgba(255, 255, 255, 0.08) 0%,
        transparent 50%
    );
}

.container {
    background: var(--container-bg);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--container-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 100%;
    max-width: 800px;
    margin: auto;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

h1 {
    margin: 0 0 16px 0;
    font-size: clamp(1.5rem, 5vw, 2rem);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

h2 {
    margin-top: 32px;
    margin-bottom: 16px;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    color: var(--subtitle-color);
    border-bottom: 1px solid rgba(244, 162, 97, 0.3);
    padding-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

p {
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 16px 0;
    font-size: 1rem;
}

ul {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
}

li {
    margin-bottom: 12px;
}

li:last-child {
    margin-bottom: 0;
}

li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-radius: 12px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
    background-color: var(--link-bg);
    border: 1px solid transparent;
    min-height: 56px;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
}

li a::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(244, 162, 97, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

li a:active {
    transform: scale(0.98);
    background-color: var(--link-hover-bg);
}

li a strong {
    font-weight: 600;
    color: var(--link-color);
    transition: color 0.3s ease;
    font-size: 1.05rem;
}

li a span {
    font-weight: 300;
    color: var(--subtitle-color);
    transition: color 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

br {
    display: block;
    margin: 16px 0;
    content: "";
}

/* LibreCounter */
.librecounter {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(244, 162, 97, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 73px;
}

.librecounter-text {
    color: var(--text-color);
    font-size: 0.9rem;
    opacity: 0.9;
}

.librecounter-text a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.librecounter-text a:hover {
    color: var(--subtitle-color);
    text-decoration: underline;
}

.librecounter a {
    display: inline-block;
    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
    flex-shrink: 0;
    line-height: 0;
}

.librecounter a:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.librecounter img {
    display: block;
    height: 64px;
    width: auto;
    max-width: 100%;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--link-bg);
    border: 1px solid var(--container-border);
    color: var(--link-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--link-hover-bg);
    border-color: var(--link-hover-border);
    transform: translateY(-2px);
}

.back-to-top:active {
    transform: translateY(0);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.slide-down {
    animation: slideDown 0.6s ease-out forwards;
}

.slide-up {
    animation: slideUp 0.6s ease-out forwards;
    opacity: 0;
}

@media (hover: hover) {
    li a:hover {
        background-color: var(--link-hover-bg);
        border-color: var(--link-hover-border);
        transform: scale(1.02);
    }

    li a:hover::before {
        left: 100%;
    }
}

@media (min-width: 768px) {
    body {
        padding: 24px;
    }

    .container {
        padding: 32px;
        border-radius: 20px;
    }

    h1 {
        margin-bottom: 24px;
    }

    li {
        margin-bottom: 14px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 20px;
        border-radius: 16px;
    }

    li a {
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    li a span {
        font-size: 0.85rem;
    }

    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        animation: none !important;
        transition: none !important;
    }

    .fade-in,
    .slide-down,
    .slide-up {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* App Gallery Styles */
.app-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.app-card {
    background: var(--link-bg);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    position: relative;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

@media (hover: hover) {
    .app-card:hover {
        transform: translateY(-4px) scale(1.03);
        background-color: var(--link-hover-bg);
        border-color: var(--link-hover-border);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }
}

.app-card:active {
    transform: scale(0.98);
    background-color: var(--link-hover-bg);
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 16px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.app-card h4 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--link-color);
}

.app-card p {
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
    flex-grow: 1;
    color: var(--text-color);
    opacity: 0.9;
}

.app-platforms {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.app-platforms a {
    background: rgba(244, 162, 97, 0.25);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(244, 162, 97, 0.4);
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 12px;
    transition:
        transform 0.2s ease,
        background-color 0.2s ease;
    display: inline-block;
}

.app-platforms a:hover {
    transform: scale(1.05);
    background: rgba(244, 162, 97, 0.4);
}

.app-card.highlighted {
    border-color: var(--glow-color);
    box-shadow:
        0 0 12px 2px var(--glow-color),
        inset 0 0 15px -5px var(--glow-color);
}
