body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f0f0f5;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"%3E%3Cpath d="M20 30c-2 0-3-1-3-3s2-5 3-5 3 3 3 5-1 3-3 3zm0-10c-2 0-3-1-3-3s2-5 3-5 3 3 3 5-1 3-3 3z" fill="%23d0d0e0" fill-opacity="0.2"/%3E%3C/svg%3E');
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    border: 2px solid #6a0dad;
    margin: 20px auto;
}

h1 {
    text-align: center;
    color: #4b0082;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: bold;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 1.2em;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f9f9f9;
    color: #333;
    box-sizing: border-box;
    font-size: 1.1em;
}

input:focus {
    outline: none;
    border-color: #ffcc00;
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}

button {
    padding: 12px;
    background-color: #4b0082;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

button:hover {
    background-color: #6a0dad;
    transform: scale(1.05);
}

#clearButton, #soundToggle {
    background-color: #666;
}

#clearButton:hover, #soundToggle:hover {
    background-color: #888;
}

#output {
    margin-top: 25px;
    font-size: 1.1em;
    line-height: 1.5;
}

#output p {
    margin: 10px 0;
    animation: fadeIn 0.5s ease-in;
}

.error {
    color: #d32f2f;
    font-weight: bold;
}

.success {
    color: #2e7d32;
    font-weight: bold;
    animation: ghostPop 0.5s ease-in-out;
}

.folklore {
    font-style: italic;
    color: #555;
    font-size: 1em;
    margin-bottom: 20px;
    line-height: 1.4;
}

.learn-more {
    color: #4b0082;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
}

.learn-more:hover {
    color: #6a0dad;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid #6a0dad;
}

.modal-content h2 {
    color: #4b0082;
    margin-top: 0;
}

.modal-content p {
    margin: 10px 0;
}

.modal-content ul {
    padding-left: 20px;
}

.close {
    color: #d32f2f;
    float: right;
    font-size: 1.5em;
    cursor: pointer;
}

.close:hover {
    color: #ff6666;
}

#ghost {
    display: none;
    position: fixed;
    width: 50px;
    height: 50px;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"%3E%3Cpath d="M50 10C30 10 20 30 20 50c0 20 10 30 20 40s10 20 30 20 20-10 20-30c0-20-10-40-40-40z" fill="%23fff" opacity="0.8"/%3Ccircle cx="35" cy="40" r="5" fill="%23000"/%3Ccircle cx="65" cy="40" r="5" fill="%23000"/%3Cpath d="M50 60c-5 0-5 5-10 5s-5-5-10-5-5 5-10 5 5 5 0 10 10 5 20 0 10-5 20 0 5-5 0-10-5-5-10-5z" fill="%23000"/%3C/svg%3E');
    background-size: contain;
    animation: floatGhost 3s ease-in-out forwards;
}

#fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    border-top: 2px solid #6a0dad;
    margin-top: auto;
}

footer a {
    color: #4b0082;
    text-decoration: none;
    margin: 0 5px;
}

footer a:hover {
    color: #6a0dad;
    text-decoration: underline;
}

footer p {
    margin: 5px 0;
    color: #555;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes floatGhost {
    0% { opacity: 0; transform: translate(0, 100vh); }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translate(80vw, -20vh); }
}