:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --accent: #2ea043;
    /* Github Green-ish / Neon */
    --accent-hover: #3fb950;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --border: #30363d;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease-out, visibility 1s;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
    animation: fadeInScale 1.2s ease-out forwards;
}

.splash-logo {
    height: 180px;
    width: auto;
    border-radius: 16px;
    box-shadow: 0 0 50px rgba(46, 160, 67, 0.4);
    margin-bottom: 25px;
    animation: pulseGlow 3s infinite ease-in-out;
}

.splash-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 10px 0;
    letter-spacing: -1px;
    background: linear-gradient(90deg, #fff, var(--accent), #fff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

.splash-description {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-style: italic;
    margin-bottom: 30px;
}

.splash-loader {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.splash-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent);
    animation: loadingProgress 2s ease-in-out infinite;
}

/* Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

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

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(46, 160, 67, 0.3);
    }

    50% {
        box-shadow: 0 0 70px rgba(46, 160, 67, 0.6);
    }
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

@keyframes loadingProgress {
    0% {
        left: -100%;
    }

    50% {
        left: 0%;
    }

    100% {
        left: 100%;
    }
}

/* Overlay Exit State */
.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.hidden-init {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.fade-in-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.logo-text span {
    font-size: 0.8rem;
    background: var(--accent);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
    width: 100%;
}

.brand-logo {
    height: 180px;
    /* Increased for maximum impact */
    width: auto;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    filter: contrast(1.1) brightness(1.1);
    animation: float 5s ease-in-out infinite, glow 4s ease-in-out infinite;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    image-rendering: -webkit-optimize-contrast;
    max-width: 100%;
    /* Prevent overflow */
}

.brand-logo:hover {
    transform: scale(1.04) translateY(-5px);
    filter: contrast(1.15) brightness(1.15);
    box-shadow: 0 15px 50px rgba(46, 160, 67, 0.4);
}

@keyframes float {

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

    50% {
        transform: translateY(-15px);
    }
}

@keyframes glow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(46, 160, 67, 0.23));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(46, 160, 67, 0.65));
    }
}

.stats {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

.translation-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    box-sizing: border-box;
}

.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    /* Allow wrapping */
}

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 140px;
    /* Prevent too narrow inputs */
}

label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

select {
    background: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    font-size: 0.95rem;
    width: 100%;
}

textarea {
    width: 100%;
    height: 150px;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.1rem;
    resize: none;
    /* Cleaner look */
    box-sizing: border-box;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: var(--accent);
    outline: none;
}

.action-area {
    display: flex;
    justify-content: center;
    /* Center button on mobile */
    align-items: center;
    margin: 25px 0;
}

button#translate-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 48px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    /* Full width on small screens */
    max-width: 300px;
}

button#translate-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 160, 67, 0.4);
}

.output-area {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 24px;
    min-height: 100px;
    position: relative;
    border: 1px solid var(--border);
    font-size: 1.1rem;
    line-height: 1.6;
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

.icon-btn {
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    position: absolute;
    bottom: 15px;
    right: 15px;
    transition: all 0.3s;
}

.icon-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.icon-btn:disabled {
    opacity: 0.1;
    cursor: not-allowed;
}

.icon-btn.loading {
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
    pointer-events: none;
    opacity: 1;
    background: transparent;
}

.icon-btn.loading #tts-icon {
    display: none;
}

.hidden {
    display: none;
}

.loader {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .app-container {
        padding: 15px;
    }

    header {
        margin-bottom: 25px;
    }

    .brand-logo {
        height: 140px;
        /* Slightly smaller for mobile screens to fit */
    }

    .translation-card {
        padding: 20px;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
    }

    .toggle-group {
        width: 100%;
    }

    button#translate-btn {
        max-width: 100%;
    }

    .output-area {
        padding: 20px;
        font-size: 1rem;
    }
}

footer {
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 30px 0;
}