:root {
    --primary-bg: rgba(0, 0, 0, 0.7);
    --accent-color: #FF5F5F;
    --accent-hover: #FF3F3F;
    --error-color: #ff4444;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    font-weight: 600;
    min-height: 100vh;
    background: linear-gradient(-45deg, #435294, #a83535, #353535, #f5576c);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(1rem, 3vw, 2rem);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

header h4 {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.social-icons {
    display: flex;
    gap: clamp(0.3rem, 1vw, 0.5rem);
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(32px, 5vw, 36px);
    height: clamp(32px, 5vw, 36px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    text-decoration: none;
    font-size: clamp(1rem, 2vw, 1.1rem);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    transform: translateY(-2px) scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2rem);
    gap: 1rem;
}

/* Screens */
.screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Universe Selection */
.universe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    margin-top: 2rem;
}

.universe-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.universe-card:hover {
    transform: translateY(-10px) scale(1.02);
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
    box-shadow: 0 15px 40px rgba(255, 95, 95, 0.3);
}

.universe-card h3 {
    font-size: 1.8rem;
    font-weight: 800;
    z-index: 2;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Game Screen */
.game-header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: var(--glass-bg);
}

.score-container {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    gap: 2rem;
}

.score-container span span {
    color: var(--accent-color);
}

#round-indicator {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    margin-bottom: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.image-viewport {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
}

#character-image-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Zoom Levels */
.zoom-1 {
    transform: scale(5);
}

.zoom-2 {
    transform: scale(2.5);
}

.zoom-3 {
    transform: scale(1);
}

#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: opacity 0.3s ease;
}

#loading-overlay span {
    margin-top: 1rem;
    font-weight: 700;
    color: var(--text-color);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.controls-container {
    width: 100%;
    max-width: 600px;
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

.input-wrapper {
    position: relative;
    width: 100%;
}

#guess-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: all 0.3s;
    font-family: var(--font-main);
}

#guess-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#guess-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(255, 95, 95, 0.3);
}

.suggestions-list {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 20;
    margin-bottom: 0.5rem;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.suggestion-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}

.button-group {
    display: flex;
    gap: 1rem;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #ff7979);
    color: var(--text-color);
    box-shadow: 0 4px 16px rgba(255, 95, 95, 0.4);
    animation: buttonPulse 2s ease-in-out infinite;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #ff5555);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 24px rgba(255, 95, 95, 0.6);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

@keyframes buttonPulse {

    0%,
    100% {
        box-shadow: 0 4px 16px rgba(255, 95, 95, 0.4);
    }

    50% {
        box-shadow: 0 4px 24px rgba(255, 95, 95, 0.6);
    }
}

#feedback-message {
    margin-top: 1rem;
    font-weight: 800;
    font-size: 1.5rem;
    text-align: center;
    min-height: 2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.feedback-error {
    color: var(--error-color);
    animation: shake 0.5s;
}

@keyframes shake {

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

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(15px);
}

.modal-content {
    background: rgba(30, 30, 30, 0.9);
    padding: 3rem;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

#result-image {
    width: 100%;
    border-radius: 16px;
    margin: 1.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--glass-border);
}

#result-title {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 800;
}

#result-description {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .image-viewport {
        aspect-ratio: 1/1;
    }

    .zoom-1 {
        transform: scale(3);
    }

    .universe-grid {
        grid-template-columns: 1fr;
    }

    .score-container {
        font-size: 1rem;
        gap: 1rem;
    }
}