body {
    font-family: -apple-system, BlinkMacMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.container {
    max-width: 960px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}
h1 {
    color: #007bff;
    margin: 0;
    font-size: 2.2em;
}
.auth-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
    gap: 10px;
}
#theme-toggle {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}
#theme-toggle:hover {
    background-color: #5a6268;
}
.auth-controls.logged-out {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
}
.auth-controls.logged-in {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
}
.auth-controls #login-status {
    margin-right: 5px;
    font-weight: bold;
    white-space: nowrap;
}
.auth-controls input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    width: 80px;
    min-width: 60px;
    max-width: 100px;
    background-color: #fff;
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.auth-controls button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}
.auth-controls button:hover {
    background-color: #0056b3;
}
#admin-panel {
    margin-top: 20px;
    padding: 15px;
    border: 1px dashed #007bff;
    border-radius: 5px;
    background-color: #e6f2ff;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#admin-panel h2 {
    margin-top: 0;
    color: #007bff;
}
#article-list ul {
    list-style: none;
    padding: 0;
}
#article-list li {
    background-color: #f9f9f9;
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#article-list li .article-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
    margin-bottom: 5px;
    width: 100%;
}
#article-list li .article-title-link {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    word-break: break-word;
    font-size: 1.1em;
    transition: color 0.3s ease;
}
#article-list li .article-title-link:hover {
    color: #007bff;
}
#article-list li .article-timestamp {
    font-size: 0.85em;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    transition: color 0.3s ease;
}
.article-actions {
    display: flex;
    flex-wrap: wrap;
    margin-top: 5px;
}
.article-actions button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    margin-right: 5px;
    margin-bottom: 5px;
    transition: background-color 0.3s ease;
}
.article-actions button.delete {
    background-color: #dc3545;
}
.article-actions button.edit {
    background-color: #ffc107;
    color: #333;
}
.article-actions button:hover {
    opacity: 0.9;
}
#article-display {
    border-top: 1px solid #eee;
    margin-top: 20px;
    padding-top: 20px;
    background-color: #fcfcfc;
    padding: 20px;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
#article-display h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.8em;
    transition: color 0.3s ease;
}
#article-display .article-display-timestamp {
    font-size: 0.9em;
    color: #777;
    margin-top: -10px;
    margin-bottom: 15px;
    display: block;
    transition: color 0.3s ease;
}
#article-content {
    line-height: 1.8;
    font-size: 1.1em;
}
#article-content h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #222;
    transition: color 0.3s ease;
}
#article-content p {
    margin-bottom: 1em;
}
#article-content pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9em;
}
#article-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background-color: #eee;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    word-break: break-word;
    transition: background-color 0.3s ease;
}
#article-content pre code {
    background-color: transparent;
    padding: 0;
}
#article-content blockquote {
    border-left: 4px solid #ccc;
    padding-left: 1em;
    color: #666;
    margin: 1em 0;
    transition: border-color 0.3s ease, color 0.3s ease;
}
#article-content ul, #article-content ol {
    margin-left: 20px;
    padding-left: 0;
}
#article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    display: block;
    overflow-x: auto;
}
#article-content th, #article-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    white-space: nowrap;
    transition: border-color 0.3s ease;
}
#article-content th {
    background-color: #f2f2f2;
    transition: background-color 0.3s ease;
}
#article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em auto;
}
#article-form {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#article-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}
#article-form input[type="text"],
#article-form textarea {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    background-color: #fff;
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
#article-form textarea {
    min-height: 300px;
    resize: vertical;
}
#article-form button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: background-color 0.3s ease;
}
#article-form button:hover {
    background-color: #0056b3;
}
#article-form button.cancel {
    background-color: #6c757d;
    margin-left: 0;
}
#article-form button.cancel:hover {
    background-color: #5a6268;
}
.hidden {
    display: none !important;
}
.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
}
.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}
body.dark-mode .container {
    background-color: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
body.dark-mode header {
    border-bottom-color: #444;
}
body.dark-mode .auth-controls input[type="text"] {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border-color: #555;
}
body.dark-mode #admin-panel {
    background-color: #1e3a5f;
    border-color: #007bff;
}
body.dark-mode #article-list li {
    background-color: #3a3a3a;
    border-color: #555;
}
body.dark-mode #article-list li .article-title-link {
    color: #e0e0e0;
}
body.dark-mode #article-list li .article-title-link:hover {
    color: #66b3ff;
}
body.dark-mode #article-list li .article-timestamp {
    color: #aaa;
}
body.dark-mode #article-display {
    background-color: #2a2a2a;
    border-color: #444;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}
body.dark-mode #article-display h2 {
    color: #e0e0e0;
}
body.dark-mode #article-display .article-display-timestamp {
    color: #aaa;
}
body.dark-mode #article-content h1,
body.dark-mode #article-content h2,
body.dark-mode #article-content h3,
body.dark-mode #article-content h4,
body.dark-mode #article-content h5,
body.dark-mode #article-content h6 {
    color: #e0e0e0;
}
body.dark-mode #article-content code {
    background-color: #3a3a3a;
    color: #e0e0e0;
}
body.dark-mode #article-content blockquote {
    border-left-color: #555;
    color: #bbb;
}
body.dark-mode #article-content th,
body.dark-mode #article-content td {
    border-color: #555;
}
body.dark-mode #article-content th {
    background-color: #3a3a3a;
}
body.dark-mode #article-form {
    background-color: #2a2a2a;
    border-color: #555;
}
body.dark-mode #article-form input[type="text"],
body.dark-mode #article-form textarea {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border-color: #555;
}
body.dark-mode .message.success {
    background-color: #1e4d3a;
    color: #a6d4aa;
    border-color: #2d5a3d;
}
body.dark-mode .message.error {
    background-color: #4d1e1e;
    color: #f5c2c7;
    border-color: #5d2d2d;
}
@media (min-width: 769px) {
    #article-list li {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    #article-list li .article-info {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        margin-bottom: 0;
        flex-grow: 1;
    }
    #article-list li .article-title-link {
        margin-bottom: 0;
    }
    #article-list li .article-timestamp {
        flex-grow: 1;
        text-align: right;
        margin-left: 15px;
    }
    .article-actions {
        margin-top: 0;
        margin-left: 15px;
        flex-shrink: 0;
    }
    .auth-controls.logged-out,
    .auth-controls.logged-in {
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}
@media (max-width: 768px) {
    body {
        font-size: 0.95em;
    }
    .container {
        max-width: 100%;
        margin: 0;
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 15px;
    }
    h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    .auth-controls.logged-out {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0;
        flex-wrap: wrap;
    }
    .auth-controls.logged-out #login-status {
        width: auto;
        margin-right: 5px;
        margin-bottom: 0;
    }
    .auth-controls.logged-out input[type="text"] {
        width: 70px;
        flex-grow: 0;
        margin-right: 5px;
        margin-bottom: 0;
        padding: 8px 10px;
        font-size: 0.85em;
    }
    .auth-controls.logged-out button {
        width: auto;
        margin-left: 0;
        margin-right: 0;
        font-size: 0.85em;
        padding: 8px 12px;
    }
    .auth-controls.logged-in {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0;
        flex-wrap: nowrap;
    }
    .auth-controls.logged-in #login-status {
        width: auto;
        margin-right: 5px;
        margin-bottom: 0;
    }
    .auth-controls.logged-in button {
        width: auto;
        margin-left: 0;
        margin-right: 0;
        font-size: 0.85em;
        padding: 8px 12px;
    }

    #article-list li {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    #article-list li .article-info {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 8px;
    }
    #article-list li .article-title-link {
        margin-bottom: 5px;
        font-size: 1em;
    }
    #article-list li .article-timestamp {
        font-size: 0.8em;
        margin-left: 0;
        text-align: left;
    }

    .article-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 0;
    }
    .article-actions button {
        padding: 8px 12px;
        font-size: 0.8em;
        margin-right: 8px;
    }
    #article-display {
        padding: 15px;
    }
    #article-display h2 {
        font-size: 1.6em;
    }
    #article-display .article-display-timestamp {
        font-size: 0.8em;
        margin-top: -5px;
        margin-bottom: 10px;
    }
    #article-content {
        font-size: 1em;
    }
    #article-form input[type="text"],
    #article-form textarea {
        width: 100%;
        padding: 8px;
        margin-bottom: 10px;
        font-size: 0.95em;
    }
    #article-form textarea {
        min-height: 200px;
    }
    #article-form button {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
}
@media (max-width: 480px) {
    body {
        font-size: 0.9em;
    }
    h1 {
        font-size: 1.6em;
    }
    .auth-controls button {
        font-size: 0.8em;
        padding: 8px 10px;
    }
    #article-display h2 {
        font-size: 1.4em;
    }
    #article-content {
        font-size: 0.95em;
    }
    #article-form button {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
}