* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

a {
    color: #1f3a8a;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #d1d5db;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #111827;
}

.logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.site-title {
    font-size: 20px;
    font-weight: 700;
}

.auth-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.welcome {
    font-weight: 600;
    color: #374151;
}

.top-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #cbd5e1;
}

.status-msg {
    font-size: 12px;
    color: #6b7280;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-badge {
    font-size: 11px;
    border: 1px solid #86efac;
    color: #166534;
    background: #dcfce7;
    padding: 2px 6px;
}

.container {
    max-width: 1280px;
    margin: 12px auto;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
}

.sidebar {
    background: #fff;
    border: 1px solid #d1d5db;
    padding: 14px;
}

.sidebar h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar li {
    border-top: 1px solid #e5e7eb;
}

.sidebar li:first-child {
    border-top: none;
}

.sidebar a {
    display: block;
    padding: 10px 4px;
    color: #111827;
    font-size: 14px;
}

.content {
    min-width: 0;
}

.alerts {
    margin-bottom: 10px;
}

.alert {
    background: #e5edff;
    border: 1px solid #c7d2fe;
    padding: 10px;
    margin-bottom: 6px;
    font-size: 14px;
}

.panel {
    background: #fff;
    border: 1px solid #d1d5db;
    padding: 14px;
    margin-bottom: 12px;
}

.panel.narrow {
    max-width: 520px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.sub {
    color: #4b5563;
    font-size: 14px;
    margin-top: 4px;
}

.rules {
    margin: 12px 0;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 10px;
}

.rules h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.rules ol {
    margin: 0;
    padding-left: 18px;
}

.rules li {
    margin-bottom: 5px;
    font-size: 14px;
}

.form-grid {
    display: grid;
    gap: 8px;
}

.form-grid label {
    font-size: 14px;
    font-weight: 600;
}

input,
textarea,
button {
    font: inherit;
}

input,
textarea {
    border: 1px solid #cbd5e1;
    padding: 8px;
    background: #fff;
}

select {
    border: 1px solid #cbd5e1;
    padding: 8px;
    background: #fff;
}

button,
.btn {
    border: 1px solid #1e3a8a;
    background: #1e40af;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
}

button.secondary {
    background: #6b7280;
    border-color: #4b5563;
}

.inline-form {
    margin-top: 10px;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.list-table th,
.list-table td {
    border: 1px solid #d1d5db;
    padding: 9px;
    font-size: 14px;
}

.list-table th {
    background: #eef2ff;
}

.best-row td {
    background: #fff1f2;
}

.best-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    background: #ffe4e6;
    font-size: 11px;
    font-weight: 700;
}

.empty {
    text-align: center;
    color: #6b7280;
}

.post-body {
    border-top: 1px solid #e5e7eb;
    margin-top: 10px;
    padding-top: 10px;
    line-height: 1.6;
}

.post-text-block {
    margin-bottom: 10px;
}

.post-image-block {
    margin: 10px 0;
}

.post-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #d1d5db;
    background: #fff;
}

.image-upload-box {
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    padding: 10px;
}

.upload-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.image-preview-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.post-inline-preview {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
}

.vote-box {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.vote-form {
    display: flex;
    gap: 6px;
}

.active-vote {
    outline: 2px solid #1d4ed8;
}

.comment-list {
    margin-bottom: 12px;
}

.reply-compose {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    padding: 10px;
    margin-bottom: 10px;
}

.comment-item {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 8px;
    margin-bottom: 8px;
}

.comment-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.comment-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.mini {
    font-size: 12px;
    padding: 5px 8px;
}

.reply-form {
    margin-top: 8px;
    display: grid;
    gap: 6px;
}

.hidden {
    display: none;
}

.reply-list {
    margin-top: 8px;
    border-left: 2px solid #dbeafe;
    padding-left: 10px;
}

.reply-item {
    background: #f8fafc;
}

.profile-preview {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

.check-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.danger-btn {
    border: 1px solid #b91c1c;
    background: #dc2626;
    color: #fff;
}

.admin-popup-body {
    margin: 0;
    background: #f3f4f6;
    color: #111827;
}

.admin-popup-wrap {
    max-width: 1160px;
    margin: 0 auto;
    padding: 12px;
}

.admin-panel-section {
    overflow: auto;
}

body.dark-mode {
    background: #111827;
    color: #e5e7eb;
}

body.dark-mode .topbar,
body.dark-mode .panel,
body.dark-mode .sidebar,
body.dark-mode .comment-item,
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select,
body.dark-mode .rules {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
}

body.dark-mode .site-title,
body.dark-mode .logo-link,
body.dark-mode .sidebar a,
body.dark-mode .welcome {
    color: #e5e7eb;
}

body.dark-mode .sub,
body.dark-mode .comment-meta,
body.dark-mode .status-msg,
body.dark-mode .empty {
    color: #9ca3af;
}

body.dark-mode .list-table th,
body.dark-mode .list-table td {
    border-color: #374151;
}

body.dark-mode .list-table th {
    background: #273449;
}

body.dark-mode .best-row td {
    background: #402126;
}

body.dark-mode .image-upload-box {
    background: #1b2433;
    border-color: #334155;
}

body.dark-mode .post-inline-preview,
body.dark-mode .profile-preview,
body.dark-mode .post-image {
    border-color: #475569;
    background: #0f172a;
}

@media (max-width: 960px) {
    .container {
        grid-template-columns: 1fr;
    }
}
