body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

#welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 2rem;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    animation: fadeIn 1s ease-in-out;
}

#welcome-screen img {
    width: 200px;
    height: auto;
    margin-bottom: 2rem;
}

#welcome-screen h1 {
    font-size: 2.5rem;
    color: #4CAF50;
    margin-bottom: 0.5rem;
}

#welcome-screen p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
    max-width: 600px;
}

#start-button {
    font-size: 1.5rem;
    padding: 1rem 2.5rem;
    border: none;
    background-color: #4CAF50;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

#start-button:hover {
    background-color: #45a049;
    transform: translateY(-3px);
}

#main-container {
    display: none;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    margin-bottom: 2rem;
}

header button {
    background-color: #e7e7e7;
    color: #333;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

header button:hover {
    background-color: #d4d4d4;
}

#main-menu {
    text-align: left;
}

#main-menu h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #4CAF50;
}

#main-menu ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

#main-menu li {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
}

#main-menu li:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

#main-menu button {
    width: 100%;
    padding: 1.5rem;
    background-color: #f9f9f9;
    color: #333;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

#main-menu button:hover {
    background-color: #e9ecef;
}

.tool-container {
    display: none;
    padding: 2rem;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 2rem auto;
    text-align: center;
}

.tool-container h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #4CAF50;
}

.tool-container textarea,
.tool-container input[type="file"] {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.tool-container button {
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
    border: none;
    background-color: #007BFF;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 1rem;
}

.tool-container button:hover {
    background-color: #0056b3;
}

.tool-container #clear-button,
.tool-container #next-word-btn,
.tool-container #start-button-wav,
.tool-container #convert-button,
.tool-container #prev-button,
.tool-container #next-button,
.tool-container #neuro-reset-btn {
    background-color: #5cb85c;
}
.tool-container #clear-button:hover,
.tool-container #next-word-btn:hover,
.tool-container #start-button-wav:hover,
.tool-container #convert-button:hover,
.tool-container #prev-button:hover,
.tool-container #next-button:hover,
.tool-container #neuro-reset-btn:hover {
    background-color: #4cae4c;
}

.back-button {
    background-color: #dc3545 !important;
}

.back-button:hover {
    background-color: #c82333 !important;
}

#dyslexia_tool .options button {
    background-color: #f0ad4e;
    color: white;
    margin: 0.5rem;
}
#dyslexia_tool .options button:hover {
    background-color: #ec971f;
}

#output-area {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.dyslexia-mode {
    font-family: 'OpenDyslexic', sans-serif;
    line-height: 2.2;
    letter-spacing: 1.2px;
}

#sand-canvas {
    border: 1px solid #ccc;
    background-color: #f0e68c;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" style="fill:%23663300;stroke:%23663300;stroke-width:1px;"><circle cx="10" cy="10" r="5"/></svg>'), auto;
    touch-action: none;
    width: 100%;
    max-width: 700px;
    height: 400px;
}

.word-puzzle-container, .letters-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.dropzone {
    width: 60px;
    height: 60px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f8f8;
}

.draggable {
    width: 60px;
    height: 60px;
    background-color: #007BFF;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: grab;
    user-select: none;
}
.draggable:active {
    cursor: grabbing;
}

#feedback-character {
    display: none;
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #4CAF50;
    text-align: center;
}

#flashcard-container {
    perspective: 1000px;
    margin-bottom: 1rem;
    width: 350px;
    height: 200px;
    margin: 2rem auto;
}

#flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
}

#flashcard.flipped {
    transform: rotateY(180deg);
}

.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 1rem;
    box-sizing: border-box;
}
.front {
    background-color: #fff;
    color: #333;
}
.back {
    background-color: #007BFF;
    color: white;
    transform: rotateY(180deg);
}
.lang-label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-decoration: underline;
}

.neuro-options {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

#neuro-output {
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    min-height: 100px;
    font-size: 1.2rem;
}

#formas-output span {
    display: inline-block;
    padding: 5px 10px;
    margin: 2px;
    background-color: #4CAF50;
    color: white;
    border-radius: 5px;
}