* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #121213;
    color: #ffffff;
    min-height: 100vh;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: #ffffff;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.game-mode-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-mode-section label {
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
}

.control-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.ai-settings {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.ai-setting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.ai-setting label {
    font-size: 12px;
    font-weight: bold;
    color: #c9b458;
    text-transform: uppercase;
}

.ai-setting select {
    padding: 6px 10px;
    border: 1px solid #c9b458;
    border-radius: 4px;
    background-color: #121213;
    color: #ffffff;
    font-size: 13px;
    min-width: 120px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.wordset-only {
    display: block;
}

#gameMode[value="ai"] + * .wordset-only {
    display: none;
}

#wordSetSelector {
    padding: 8px 12px;
    border: 1px solid #3a3a3c;
    border-radius: 4px;
    background-color: #121213;
    color: #ffffff;
    font-size: 14px;
    min-width: 200px;
}

button {
    padding: 8px 16px;
    border: 1px solid #3a3a3c;
    border-radius: 4px;
    background-color: #818384;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

button:hover {
    background-color: #565758;
}

button:disabled {
    background-color: #3a3a3c;
    cursor: not-allowed;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #ffffff;
    cursor: pointer;
}

.toggle-control input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6aaa64;
    cursor: pointer;
}

.toggle-label {
    cursor: pointer;
    user-select: none;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#gameInfo {
    text-align: center;
    margin-bottom: 20px;
}

#gameStatus {
    font-size: 16px;
    margin-bottom: 10px;
}

#gameControls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

#gameControls button {
    font-size: 12px;
    padding: 6px 12px;
}

#definitionBtn {
    background-color: #6aaa64;
}

#definitionBtn:hover {
    background-color: #5a9a54;
}

.hidden {
    display: none !important;
}

/* Game Board */
#gameBoard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 30px;
    padding: 10px;
    align-items: center;
}

.game-row {
    display: grid;
    gap: 5px;
}

.tile {
    width: 62px;
    height: 62px;
    border: 2px solid #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
    background-color: #121213;
    color: #ffffff;
    transition: all 0.2s ease;
}

.tile.filled {
    border-color: #565758;
    animation: pop 0.1s ease;
}

.tile.correct {
    background-color: #6aaa64;
    border-color: #6aaa64;
    color: #ffffff;
}

.tile.present {
    background-color: #c9b458;
    border-color: #c9b458;
    color: #ffffff;
}

.tile.absent {
    background-color: #787c7e;
    border-color: #787c7e;
    color: #ffffff;
}

.tile.hint {
    background-color: #f5d800;
    border-color: #f5d800;
    color: #000000;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Keyboard */
#keyboard {
    width: 100%;
    max-width: 484px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.key {
    height: 58px;
    min-width: 43px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    background-color: #818384;
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key.wide {
    min-width: 65px;
}

.key:hover {
    background-color: #565758;
}

.key.correct {
    background-color: #6aaa64;
}

.key.present {
    background-color: #c9b458;
}

.key.absent {
    background-color: #3a3a3c;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #121213;
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #3a3a3c;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #ffffff;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: #3a3a3c;
    border-radius: 4px;
}

.modal-body {
    padding: 20px;
}

/* Definition Modal */
#definitionContent {
    line-height: 1.6;
}

.definition-section {
    margin-bottom: 20px;
}

.part-of-speech {
    font-style: italic;
    color: #c9b458;
    margin-bottom: 10px;
}

.definition-text {
    margin-bottom: 8px;
}

.definition-example {
    font-style: italic;
    color: #818384;
    margin-left: 20px;
    margin-bottom: 8px;
}

.phonetic {
    color: #6aaa64;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.loading {
    text-align: center;
    color: #818384;
}

.error {
    color: #f87171;
    text-align: center;
}

/* Bilingual Definition Styles */
.definition-lang-header {
    font-weight: bold;
    color: #c9b458;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.definition-lang-header:first-of-type {
    margin-top: 5px;
}

.definition-text.native-lang {
    border-left: 3px solid #6aaa64;
    padding-left: 10px;
    margin-bottom: 8px;
    background-color: rgba(106, 170, 100, 0.05);
    padding-top: 5px;
    padding-bottom: 5px;
    border-radius: 0 4px 4px 0;
}

.definition-text.english-lang {
    border-left: 3px solid #c9b458;
    padding-left: 10px;
    margin-bottom: 8px;
    background-color: rgba(201, 180, 88, 0.05);
    padding-top: 5px;
    padding-bottom: 5px;
    border-radius: 0 4px 4px 0;
}

/* Create Word Set Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #3a3a3c;
    border-radius: 4px;
    background-color: #121213;
    color: #ffffff;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-actions button {
    min-width: 100px;
}

.form-actions button[type="submit"] {
    background-color: #6aaa64;
}

.form-actions button[type="submit"]:hover {
    background-color: #5a9a54;
}

/* Language indicator */
.language-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    margin-left: 8px;
}

.language-indicator.en {
    background-color: #6aaa64;
    color: #ffffff;
}

.language-indicator.de {
    background-color: #c9b458;
    color: #000000;
}

.ai-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 10px;
    text-align: center;
}

.source {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .tile {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .key {
        height: 48px;
        min-width: 35px;
        font-size: 10px;
    }
    
    .key.wide {
        min-width: 55px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    #wordSetSelector {
        min-width: 250px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
}