:root {
    --bg-color: #1a202c;
    --card-bg: #2d3748;
    --primary-color: #4299e1;
    --primary-hover: #3182ce;
    --text-color: #f7fafc;
    --text-muted: #a0aec0;
    --border-color: #4a5568;
    --input-bg: #fff;
    --input-text: #1a202c;
    --success-bg: #48bb78;
    --success: #48bb78;
    --error-bg: #f56565;
    --radius: 0.5rem;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
}

/* Typography */
h1,
h2,
h3 {
    margin: 0;
}

.title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.start-card {
    padding: 2rem;
    text-align: center;
}

/* Forms */
.tense-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

/* Filter Group */
.filter-group {
    margin-bottom: 2rem;
    /* Increased padding below */
    text-align: left;
}

.person-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 0.5rem;
    text-align: left;
}

.section-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
    opacity: 0.5;
}

.filter-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-color);
    /* Darker background for input */
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
}

.filter-select:hover {
    border-color: var(--text-muted);
}

.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-color);
}

.checkbox-label input {
    margin-right: 0.5rem;
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

/* Game Card Specifics */
.card-header {
    background-color: var(--primary-color);
    padding: 1.5rem;
    text-align: center;
}

.card-header h2 {
    color: white;
    font-size: 2.25rem;
}

.info-bar {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    flex: 1;
    padding: 1rem;
    text-align: center;
}

.border-right {
    border-right: 1px solid var(--border-color);
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 500;
    font-size: 1rem;
}

.input-area {
    padding: 2rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.pronoun {
    font-size: 1.875rem;
    font-weight: 700;
    margin-right: 1rem;
    width: 30%;
    text-align: right;
}

input[type="text"] {
    flex: 1;
    background-color: var(--input-bg);
    color: var(--input-text);
    font-size: 1.25rem;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    border: 1px solid #e2e8f0;
    outline: none;
    width: 100%;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

.input-correct {
    color: #48bb78 !important;
    /* Green */
}

.input-incorrect {
    color: #f56565 !important;
    /* Red */
}

/* Buttons */
.btn {
    font-weight: 700;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-link:hover {
    color: var(--text-color);
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

.feedback-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.feedback {
    text-align: center;
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0 !important;
    /* Reset margin for container */
}

.controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.controls .btn {
    min-width: 120px;
}

/* Special Characters */
.special-chars {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.btn-char {
    background-color: var(--border-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-char:hover {
    background-color: #718096;
}

/* Feedback */
.feedback {
    text-align: center;
    font-weight: bold;
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
}

.feedback.correct {
    background-color: var(--success-bg);
    color: white;
}

.feedback.incorrect {
    background-color: var(--error-bg);
    color: white;
}

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

.invisible {
    visibility: hidden !important;
}

/* Stable Layout Containers */
.combo-container {
    min-height: 2rem;
    /* Reserve space for combo text */
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    /* keep animation but handle visibility separately */
}

.feedback-container {
    min-height: 4.5rem;
    /* Reserve space for ~3 lines of feedback text */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.footer-controls {
    text-align: center;
    margin-top: 1.5rem;
}

/* Toggle Switch */
.language-control {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-right: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.label-text {
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    color: #cbd5e0;
    font-size: 0.75rem;
    padding-bottom: 1rem;
    font-weight: 500;
}

/* Controls Container */
.controls-container {
    display: flex;
    justify-content: flex-end;
    /* Align to right */
    align-items: center;
    margin-bottom: 1rem;
}

/* Progress Bar */
#progress-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    height: 24px;
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#progress-fill {
    background-color: var(--success-bg);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease-out;
}

#progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    z-index: 1;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Dark mode adjustments for progress bar text shadow */
@media (prefers-color-scheme: dark) {
    #progress-text {
        text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
    }
}

/* Combo Animations */
.combo-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    animation: comboPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: #ffd700;
    /* Gold default */
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#combo-multiplier {
    color: var(--primary-color);
}

@keyframes comboPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Success Shake */
.shake-success {
    animation: shakeSuccess 0.4s ease-in-out;
}

@keyframes shakeSuccess {

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

    15% {
        transform: translateX(-5px) rotate(-1deg);
    }

    30% {
        transform: translateX(5px) rotate(1deg);
    }

    45% {
        transform: translateX(-4px);
    }

    60% {
        transform: translateX(4px);
    }
}

/* Success Card Pulse */
.success-pulse {
    box-shadow: 0 0 20px var(--success-bg) !important;
    transition: box-shadow 0.3s ease;
}

/* Consent Banner */
.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    animation: slideUp 0.5s ease-out;
}

.consent-text {
    font-size: 0.9rem;
    color: var(--text-color);
    max-width: 600px;
    text-align: center;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    animation: scaleIn 0.2s ease-out;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--error-bg);
    color: white;
}

.btn-danger:hover {
    background-color: #c53030;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

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