:root {
    --primary-color: #003399; /* EU Blue */
    --accent-color: #FFCC00;  /* EU Yellow */
    --background: #f0f4f8;
    --text-color: #1e293b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
}

.container {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    max-width: 750px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 25px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

header h1 span {
    color: var(--accent-color);
}

header p {
    color: #64748b;
    margin-top: 5px;
    font-size: 1rem;
}

/* Inline Search Box Layout */
.search-box {
    display: flex;
    gap: 10px;
    background: #f8fafc;
    padding: 8px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    margin-bottom: 20px;
}

.search-box input {
    flex: 2;
    padding: 12px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    outline: none;
}

.search-box select {
    flex: 0.8;
    padding: 12px;
    border: none;
    background: #ffffff;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    outline: none;
}

/* Button Configuration */
.button-group {
    display: flex;
    gap: 8px;
    flex: 1.2;
}

.button-group button {
    flex: 1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

#unscrambleBtn {
    background-color: var(--primary-color);
}

#unscrambleBtn:hover {
    background-color: #002266;
}

.btn-secondary {
    background-color: #64748b !important;
}

.btn-secondary:hover {
    background-color: #475569 !important;
}

/* Advanced Options Panel styling */
.toggle-container {
    text-align: left;
    margin: -10px 0 15px 5px;
}

#toggleOptionsBtn {
    font-size: 0.85rem;
    color: #003399;
    text-decoration: none;
    font-weight: 600;
}

#toggleOptionsBtn:hover {
    text-decoration: underline;
}

.advanced-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    animation: fadeIn 0.2s ease-in-out;
}

.filter-row {
    display: flex;
    gap: 15px;
}

.filter-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.filter-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.filter-field input {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #ffffff;
    width: 100%;
}

.filter-field input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* AdSense Display Ad Box */
.ad-container {
    margin: 25px 0;
    min-height: 90px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Result Elements */
#resultsContainer h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 5px;
}

#resultsList {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.word-badge {
    background: #eff6ff;
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid #bfdbfe;
}

/* Loader Screen Spinner */
#loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #64748b;
    margin: 20px 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #cbd5e1;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer Section */
footer {
    margin-top: 35px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    text-align: center;
}

footer p {
    font-size: 0.85rem;
    color: #94a3b8;
}

footer a {
    color: #64748b;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Cookie Policy Alert Overlay */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    z-index: 10000;
    border: 1px solid #e2e8f0;
}

.cookie-content h3 { margin-bottom: 5px; color: var(--primary-color); }
.cookie-content p { font-size: 0.9rem; margin-bottom: 15px; color: #64748b; }
.cookie-buttons { display: flex; gap: 10px; }
.cookie-buttons button { padding: 10px; border-radius: 6px; border: none; font-weight: bold; cursor: pointer; flex: 1; }
.btn-accept { background: #22c55e; color: white; }
.btn-decline { background: #ef4444; color: white; }

.hidden { display: none !important; }

/* Responsive Media Controls */
@media (max-width: 600px) {
    .search-box {
        flex-direction: column;
        background: transparent;
        border: none;
        padding: 0;
    }
    .search-box input, .search-box select, .button-group {
        width: 100%;
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        background: white;
        padding: 14px;
    }
    .button-group {
        border: none;
        padding: 0;
        display: flex;
        flex-direction: row;
    }
    .button-group button {
        padding: 14px;
    }
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
}
