:root {
    --primary: #6366f1;
    --secondary: #a855f7;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    color: var(--text-main);
    padding: 20px;
}

.glass-container {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease-out;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-weight: 300;
}

.phrase-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

.phrase-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

#phrase-text {
    font-size: 1.4rem;
    line-height: 1.6;
    margin-bottom: 20px;
    transition: opacity 0.3s ease;
}

.badge {
    background: var(--primary);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 4px;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

select {
    background: #1e1b4b; /* Solid dark background for better compatibility */
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none; /* Remove default arrow for custom one if needed, but let's keep it simple first */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

option {
    background: #1e1b4b;
    color: white;
}

select:focus {
    border-color: var(--primary);
}

.primary-btn {
    grid-column: span 2;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.primary-btn:active {
    transform: translateY(0);
}

footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}

.history-toggle {
    text-align: center;
}

#toggle-history {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

#history-panel {
    margin-top: 20px;
    max-height: 200px;
    overflow-y: auto;
}

#history-list {
    list-style: none;
    margin-bottom: 12px;
}

#history-list li {
    font-size: 0.85rem;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

#clear-history {
    background: none;
    border: 1px solid rgba(255, 0, 0, 0.2);
    color: #ef4444;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
}

.hidden {
    display: none;
}

@media (max-width: 480px) {
    .controls {
        grid-template-columns: 1fr;
    }
    .primary-btn {
        grid-column: span 1;
    }
}
