:root {
    --bg-color: #0d162a;
    --text-color: #ffffff;
    
    --color-correct-top: #6ded5e;
    --color-correct-bottom: #21a31d;
    --color-present-top: #ffe260;
    --color-present-bottom: #e09d13;
    --color-absent-top: #8b96a4;
    --color-absent-bottom: #556271;
    --color-empty-bg: #111a31;
    --color-empty-border: #233659;
    
    --key-bg: #2a3c5a;
    --key-text: #ffffff;
    --key-shadow: #18253c;
}

html { height: 100%; margin: 0; padding: 0; }
body {
    margin: 0; padding: 0; min-height: 100%;
    font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
    display: flex; justify-content: center; align-items: center;
    background: radial-gradient(circle at center, #1a2744 0%, #080d19 100%);
    color: var(--text-color);
}

#game-container {
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 500px;
    background: #0f182b;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 20px 10px;
    position: relative;
    box-sizing: border-box;
}

#header { display: flex; flex-direction: column; align-items: center; width: 100%; margin-bottom: 20px; }
.subtitle { font-size: 0.8rem; letter-spacing: 1px; color: #a0aec0; font-weight: bold; margin-bottom: 5px; }
.subtitle .highlight { color: #f6e05e; }
#header h1 { margin: 0; font-size: 3.5rem; font-weight: 900; line-height: 1; text-align: center; }
.title-word { color: #fff9c4; text-shadow: 0 0 10px #ffeb3b, 0 0 20px #ffc107; }
.title-lock { color: #b9f6ca; text-shadow: 0 0 10px #69f0ae, 0 0 20px #00e676; }

#board-container { display: flex; justify-content: center; align-items: center; margin-bottom: 10px; }
#board { display: grid; grid-template-rows: repeat(6, 1fr); grid-gap: 8px; }
.row { display: grid; grid-template-columns: repeat(5, 1fr); grid-gap: 8px; }

.tile {
    width: 60px; height: 60px;
    background-color: var(--color-empty-bg);
    border: 2px solid var(--color-empty-border);
    border-radius: 8px;
    display: inline-flex; justify-content: center; align-items: center;
    font-size: 2.2rem; font-weight: 900; color: white;
    box-sizing: border-box;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.tile[data-state="correct"] { background: linear-gradient(180deg, var(--color-correct-top), var(--color-correct-bottom)); border: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); }
.tile[data-state="present"] { background: linear-gradient(180deg, var(--color-present-top), var(--color-present-bottom)); border: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); }
.tile[data-state="absent"] { background: linear-gradient(180deg, var(--color-absent-top), var(--color-absent-bottom)); border: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); }

#tries-counter { font-weight: bold; font-size: 1.1rem; color: #ffffff; align-self: flex-start; margin-left: 20px; margin-bottom: 20px; }
.green { color: #4ade80; }

#keyboard-container { width: 100%; padding: 0 10px; box-sizing: border-box; }
.keyboard-row { display: flex; width: 100%; margin: 0 auto 8px; touch-action: manipulation; }
#keyboard-container button {
    font-family: inherit; font-weight: bold; border: 0; padding: 0; margin: 0 4px;
    height: 55px; border-radius: 6px; cursor: pointer;
    background-color: var(--key-bg); color: var(--key-text);
    flex: 1; font-size: 1.2rem; box-shadow: 0 4px 0 var(--key-shadow);
    transition: transform 0.1s, box-shadow 0.1s;
}
#keyboard-container button:active { transform: translateY(4px); box-shadow: 0 0 0 var(--key-shadow); }
.spacer-half { flex: 0.5; }
.wide-button { flex: 1.5; font-size: 0.9rem !important; }

#keyboard-container button[data-state="correct"] { background: linear-gradient(180deg, var(--color-correct-top), var(--color-correct-bottom)); box-shadow: 0 4px 0 #1b8217; border: none; }
#keyboard-container button[data-state="present"] { background: linear-gradient(180deg, var(--color-present-top), var(--color-present-bottom)); box-shadow: 0 4px 0 #b37e11; border: none; }
#keyboard-container button[data-state="absent"] { background: linear-gradient(180deg, var(--color-absent-top), var(--color-absent-bottom)); box-shadow: 0 4px 0 #3c4550; border: none; }

#message-modal { position: absolute; top: 30%; background-color: #1a2744; padding: 30px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); text-align: center; z-index: 10; border: 2px solid #2c4066; }
#message-modal.hidden { display: none; }
#message-text { font-size: 1.5rem; font-weight: bold; margin-bottom: 20px; }
#new-game-btn { background: linear-gradient(180deg, #6ded5e, #21a31d); color: white; border: none; padding: 12px 24px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 0 #1b8217; }
#new-game-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #1b8217; }

/* Mobile adjustments */
@media (max-width: 450px) {
    #header h1 { font-size: 2.2rem; }
    .tile { width: 13vw; height: 13vw; max-width: 55px; max-height: 55px; font-size: 1.8rem; }
    #board { grid-gap: 5px; }
    .row { grid-gap: 5px; }
    #keyboard-container button { margin: 0 2px; height: 50px; font-size: 1rem; }
    .wide-button { font-size: 0.75rem !important; }
}
