:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.25);
    /* Increased transparency */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --option-bg: rgba(51, 65, 85, 0.2);
    --option-hover: rgba(51, 65, 85, 0.25);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 1s ease-in-out;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #7c3aed;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #2563eb;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: #db2777;
    animation-delay: -10s;
    transform: translate(-50%, -50%);
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.app-container {
    width: 90%;
    margin: 0 auto;
    padding: 1.5rem 0;
    /* Vertical padding only */
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    background: rgba(15, 23, 42, 0.3);
    padding: 1rem 2rem;
    border-radius: 16px;
    backdrop-filter: blur(5px);
}

.controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--accent-color);
}

/* Preferences Area */
.preferences-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Increased gap for better separation */
    width: 100%;
}

.pref-group {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: flex-start;
    gap: 1.5rem;
}

.pref-label-container,
.pref-group>label:first-child:last-child {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.pref-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.checkbox-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    /* Added to handle many categories */
}

.pref-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.ok-btn {
    background-color: var(--success-color);
    color: #0f172a;
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.ok-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.settings-btn {
    font-size: 1.5rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    margin-right: auto;
    /* Push to left if flex */
}


.pref-label-container label {
    margin: 0;
}

.text-link-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 0;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    transition: all 0.2s;
    text-align: left;
}

.text-link-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.lang-chip {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.lang-checkbox:checked+.lang-chip {
    background: var(--accent-color);
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.lang-dropdown {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
}

.lang-dropdown option {
    background: #1e293b;
    color: var(--text-primary);
}

/* Main Game Area */
#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Vertical Center */
    align-items: center;
    /* Horizontal Center */
    width: 100%;
    max-width: 1000px;
    /* Limit content width */
    margin: 0 auto;
    gap: 2rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.category-tag {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    display: block;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.question-word-text {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    /* Larger font */
    line-height: 1.2;
    margin: 0;
    color: #a7f3d0;
    /* Soft pastel green */
    min-height: 1.2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.instruction {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
}

.option-btn {
    background-color: var(--option-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(2px);
}

.option-btn:hover {
    background-color: var(--option-hover);
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Feedback Overlay */
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    border-radius: 24px;
}

.feedback-content {
    text-align: center;
    background: rgba(30, 41, 59, 0.9);
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
}

/* Session Info */
.session-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 12px;
}

.petname-display {
    font-family: monospace;
    color: var(--accent-color);
}

.primary-btn {
    background: var(--accent-color);
    color: #0f172a;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(56, 189, 248, 0.5);
}

/* Utilities */
.hidden {
    display: none !important;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        width: 100%;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .preferences-area {
        flex-direction: column;
        gap: 1rem;
    }

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


    .question-word-text {
        font-size: 2rem;
    }
}

/* Word Container and Speak Button */
.word-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

.speak-btn {
    font-size: 1.5rem;
    color: var(--accent-color);
    padding: 0.5rem;
}

.auto-speak-label {
    display: flex;
    align-items: center;
}

/* Ensure hidden checkbox doesn't take space but kept for logic */
.vis-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.help-btn {
    font-size: 1.4rem;
    color: #fbbf24;
    padding: 0.5rem;
}

.help-btn:hover {
    color: #f59e0b;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5));
}

.full-translation {
    margin-top: 0.5rem;
    font-size: 1.5rem;
    color: #fbbf24;
    font-weight: 600;
    margin-top: 1rem;
    font-style: italic;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
    animation: fadeIn 0.3s ease-out;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    text-align: center;
    backdrop-filter: blur(2px);
}

.modal h3 {
    margin-top: 0;
    color: var(--accent-color);
    font-size: 1.5rem;
}

.modal input {
    width: 100%;
    padding: 0.8rem 1rem;
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}

.modal input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

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