:root {
    /* Default theme (dark) */
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --accent-primary: #60a5fa;
    --accent-secondary: #a855f7;
    --input-bg: #374151;
    --input-border: #4b5563;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
}

/* Sepia theme */
[data-theme="sepia"] {
    --bg-primary: #fef3c7;
    --bg-secondary: #fffbeb;
    --text-primary: #78350f;
    --text-secondary: #92400e;
    --accent-primary: #b45309;
    --accent-secondary: #92400e;
    --input-bg: #fef3c7;
    --input-border: #d97706;
}

/* Night blue theme */
[data-theme="night-blue"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-primary: #38bdf8;
    --accent-secondary: #818cf8;
    --input-bg: #1e293b;
    --input-border: #334155;
}

/* Forest theme */
[data-theme="forest"] {
    --bg-primary: #064e3b;
    --bg-secondary: #065f46;
    --text-primary: #ecfdf5;
    --text-secondary: #a7f3d0;
    --accent-primary: #34d399;
    --accent-secondary: #6ee7b7;
    --input-bg: #065f46;
    --input-border: #047857;
}

/* Twilight theme */
[data-theme="twilight"] {
    --bg-primary: #3730a3;
    --bg-secondary: #4338ca;
    --text-primary: #e0e7ff;
    --text-secondary: #c7d2fe;
    --accent-primary: #818cf8;
    --accent-secondary: #a5b4fc;
    --input-bg: #4338ca;
    --input-border: #4f46e5;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-secondary));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
}

.container {
    max-width: 800px;  /* Increased from 500px */
    width: 90vw;       /* Add responsive width */
    padding: 2rem;
    text-align: center;
}

#game {
    width: 100%;
    padding: 0 1rem;
}

.title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.word {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 1rem 0;
    transition: all 0.3s;
    white-space: normal;     /* Allow word wrapping */
    overflow-wrap: break-word; /* Break long words */
    padding-bottom: 0.5rem;  /* Space for potential scrollbar */
    -ms-overflow-style: none;  /* Hide scrollbar in IE/Edge */
    scrollbar-width: none;     /* Hide scrollbar in Firefox */
}

/* Hide webkit scrollbar but keep functionality */
.word::-webkit-scrollbar {
    display: none;
}

.word span {
    display: inline-block;
    position: relative;
}

.word span.correct {
    color: #10b981;
}

.word span.incorrect {
    color: #ef4444;
}

.word span.current {
    border-bottom: 2px solid var(--accent-primary);
    animation: blink 1s infinite;
}

.word span.space {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.5;
    width: 1em;
    height: 1em;
    font-size: 0.7em;
    margin: 0 0.1em;
    padding: 0.2em;
    border-radius: 0.2em;
    background: rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

.word span.space.correct {
    color: #10b981;
    opacity: 0.7;
    background: rgba(16, 185, 129, 0.1);
}

.word span.space.incorrect {
    color: #ef4444;
    opacity: 0.7;
    background: rgba(239, 68, 68, 0.1);
}

.word span.space.current {
    border-bottom: 2px solid var(--accent-primary);
    animation: blink 1s infinite;
    opacity: 0.8;
}

@keyframes blink {
    50% { border-color: transparent; }
}

.translation {
    font-size: 1.5rem;
    color: #fcd34d;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.input {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    width: 90%;             /* Increased from 80% */
    max-width: 600px;       /* Increased from 300px */
    text-align: center;
    margin-bottom: 1rem;
}

.input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.button {
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.button:hover {
    background: #059669;
    transform: scale(1.05);
}

.button i {
    margin-right: 0.5rem;
}

.stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
    font-size: 1.25rem;
}

.combo {
    color: #fcd34d;
}

.settings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

select {
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--input-border);
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.mode-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.mode-button {
    background: #4b5563;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.3s;
}

.mode-button.active {
    background: var(--accent-primary);
}

.mode-button i {
    margin-right: 0.5rem;
}

.wrong {
    animation: shake 0.5s;
    color: #ef4444;
}

.correct {
    color: #10b981;
    transform: scale(1.1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.mistakes {
    max-height: 200px;
    overflow-y: auto;
    margin: 1rem 0;
}

.mistake-item {
    background: var(--input-bg);
    padding: 0.5rem;
    margin: 0.5rem 0;
    border-radius: 0.5rem;
}

.difficulty-indicator {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.difficulty-easy {
    background: #10b981;
    color: white;
}

.difficulty-medium {
    background: #f59e0b;
    color: white;
}

.difficulty-hard {
    background: #ef4444;
    color: white;
}

.keyboard {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.keyboard.hidden {
    transform: translateX(-50%) translateY(100%);
}

.keyboard img {
    max-width: 100%;
    height: auto;
}

.icon-button {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
}

.icon-button:hover {
    color: var(--accent-primary);
}

.shortcuts {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

.shortcuts i {
    margin-right: 0.25rem;
    color: var(--accent-primary);
}

.achievement {
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    animation: pulse 2s infinite;
}

.high-scores {
    background: var(--input-bg);
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.high-score {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--input-border);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.shortcut {
    font-size: 0.75rem;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

.sound-button {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.sound-button:hover {
    color: var(--accent-primary);
}

.theme-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--input-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.theme-select-wrapper i {
    position: absolute;
    right: 0.5rem;
    color: var(--text-secondary);
    pointer-events: none;
}

#theme-select {
    appearance: none;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border-radius: 0.25rem;
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 130px;
}

#theme-select option {
    padding: 0.5rem;
    background: var(--input-bg);
}

#theme-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Theme preview colors in dropdown */
#theme-select option[value="dark"] { background-color: #1f2937; color: #ffffff; }
#theme-select option[value="light"] { background-color: #f3f4f6; color: #1f2937; }
#theme-select option[value="sepia"] { background-color: #fef3c7; color: #78350f; }
#theme-select option[value="night-blue"] { background-color: #0f172a; color: #e2e8f0; }
#theme-select option[value="forest"] { background-color: #064e3b; color: #ecfdf5; }
#theme-select option[value="twilight"] { background-color: #3730a3; color: #e0e7ff; }

/* Remove old theme button styles */
.theme-button, 
.theme-button::after,
.theme-button[data-theme] {
    display: none;
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.font-size-button {
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.font-size-button:hover {
    transform: scale(1.1);
}
