body {
    background-color: #1a1a2e;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* Base styles for containers */
#lock-screen, main, #letter-section {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

/* Lock Screen Styles */
#lock-screen h1 {
    color: #fca311;
}
.puzzle-text {
    line-height: 1.6;
    margin-bottom: 20px;
    color: #c0c0c0;
}
#lock-error {
    color: #ff4d4d;
    margin-top: 10px;
    font-weight: bold;
}

/* Main Chat Styles */
#chat-container {
    background-color: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
    text-align: left;
}
.chat-message {
    margin-bottom: 15px;
    line-height: 1.5;
}
.chat-message strong {
    color: #fca311;
}
#error-message {
    color: #ff4d4d;
    margin-top: 10px;
    font-weight: bold;
}

/* Letter Section Styles */
.letter-nav {
    text-align: right;
    margin-bottom: 20px;
}
#letter-content {
    background-color: #16213e;
    padding: 25px;
    border-radius: 8px;
    line-height: 1.8;
    text-align: left;
    white-space: pre-wrap;
}
.letter-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* Form Styles */
form {
    display: flex;
    gap: 10px;
}
label {
    position: absolute;
    left: -10000px; /* Hide label visually but keep for screen readers */
}
input[type="text"], textarea {
    flex-grow: 1;
    background-color: #0f3460;
    border: 1px solid #e0e0e0;
    color: #e0e0e0;
    padding: 10px;
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Segoe UI', sans-serif;
}
input[type="text"]:focus, textarea:focus {
    outline: 2px solid #fca311;
}
button {
    background-color: #fca311;
    color: #1a1a2e;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
}
button:focus {
    outline: 2px solid #e0e0e0;
}

/* Hide elements by default */
#main-content, #input-area, #letter-section, #comments-section {
    display: none;
}

/* Comments Section Styles */
#comments-section h3 {
    color: #fca311;
}
.comment {
    background-color: #16213e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    text-align: left;
}
.comment-text {
    line-height: 1.6;
}
.comment-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.comment-actions button {
    background-color: transparent;
    color: #fca311;
    border: 1px solid #fca311;
    padding: 5px 10px;
    font-size: 0.9em;
}
.comment-actions button.delete-btn {
    color: #ff4d4d;
    border-color: #ff4d4d;
}
.edit-textarea {
    width: 100%;
    box-sizing: border-box;
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgba(0,0,0,0.6);
}
.modal-content {
    background-color: #1a1a2e;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #fca311;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
}
.close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}
.close-btn:hover,
.close-btn:focus {
    color: #fca311;
    text-decoration: none;
    cursor: pointer;
}
#archive-list {
    list-style: none;
    padding: 0;
}
#archive-list li {
    background-color: #16213e;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    cursor: pointer;
}
#archive-list li:hover {
    background-color: #0f3460;
}