:root {
    --bg-color: #fdf6e3;
    --text-color: #586e75;
    --primary-color: #268bd2;
    --enigma-bg: #eee8d5;
    --correct-color: #859900;
    --incorrect-color: #dc322f;
    --font-handwriting: 'Kalam', cursive;
}

body {
    font-family: sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

#game-container {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 600px;
    width: 100%;
}

h1 {
    text-align: center;
    color: var(--primary-color);
    margin-top: 0;
}

#letter {
    font-family: var(--font-handwriting);
    font-size: 1.5rem;
    line-height: 2.5;
    white-space: normal;
    transition: opacity 0.5s ease-in-out;
}

#letter.fade-out {
    opacity: 0;
}

#letter p {
    margin: 20px 0;
}

.signature {
    text-align: right;
    font-weight: 700;
}

.enigma {
    background-color: var(--enigma-bg);
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    vertical-align: middle;
    border-bottom: 2px dashed var(--primary-color);
    transition: background-color 0.2s, transform 0.2s;
}

.enigma:hover {
    background-color: #e0dace;
    transform: translateY(-2px);
}

.enigma img {
    max-height: 40px;
    pointer-events: none; /* Evita que a imagem capture o clique */
}

.solved {
    color: var(--correct-color);
    font-weight: 700;
    padding: 5px 8px;
    border-radius: 8px;
    background-color: #f0fff0;
}

.win-container {
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.win-container h2 {
    font-family: sans-serif;
    color: var(--correct-color);
    font-size: 2.5rem;
}

.win-container p {
    font-size: 1.2rem;
    font-family: sans-serif;
}

.win-container button {
    background-color: var(--primary-color);
    color: white;
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 1.2rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 30px 20px 20px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    max-width: 90%;
    width: 400px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

#modal-close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}

#modal-close-btn:hover {
    color: #333;
}

#modal-enigma-content {
    font-family: var(--font-handwriting);
    font-size: 1.8rem;
    line-height: 1.5;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 80px;
    color: var(--text-color);
}

#modal-enigma-content img {
    max-height: 60px;
}

#modal-form {
    display: flex;
    gap: 10px;
}

#modal-input {
    flex-grow: 1;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 1.2rem;
}

#modal-form button {
    padding: 12px 20px;
    font-size: 1.2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.hidden {
    display: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}