*{box-sizing:border-box;margin:0;padding:0}
body{font-family:system-ui,sans-serif;color:#111;background:#fff;max-width:680px;margin:0 auto;padding:0 1rem}
button{font-family:inherit;cursor:pointer}
.header-auth{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:1rem 0 .5rem}
nav{display:flex;gap:1.2rem;justify-content:center;padding:1rem 0;border-bottom:0.5px solid #e5e7eb;margin-bottom:2rem;flex-wrap:wrap}
nav a,nav button.nav-btn{font-size:13px;color:#888;text-decoration:none;padding-bottom:3px;border:none;border-bottom:1.5px solid transparent;background:none;cursor:pointer;font-family:inherit}
nav a:hover,nav a.active,nav button.nav-btn:hover{color:#111;border-bottom-color:#111}
.back-link{display:inline-flex;align-items:center;gap:4px;font-size:13px;color:#888;text-decoration:none;margin-bottom:1rem;background:none;border:none;cursor:pointer}
.back-link:hover{color:#111}
.page-title{display:flex;align-items:center;gap:10px;margin-bottom:1.5rem;padding-bottom:1rem;border-bottom:0.5px solid #e5e7eb}
.page-title .icon{font-size:24px}
.page-title h2{font-size:18px;font-weight:500}
.page-title p{font-size:13px;color:#888;margin-top:2px}

/* 글쓰기/수정 폼 */
.write-form{background:#f9fafb;border:0.5px solid #e5e7eb;border-radius:12px;padding:1.25rem;margin-bottom:1.5rem;display:none}
.write-form.open{display:block}
.form-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;font-size:14px;font-weight:500}
.write-form input[type=text]{width:100%;padding:8px 12px;font-size:14px;border-radius:8px;border:0.5px solid #d1d5db;outline:none;background:#fff;font-family:inherit;margin-bottom:8px}
.toolbar-row{display:flex;justify-content:flex-end;margin-bottom:1rem}

/* 에디터 */
.editor-toolbar{display:flex;flex-wrap:wrap;gap:2px;padding:6px 8px;background:#fff;border:0.5px solid #d1d5db;border-radius:8px 8px 0 0;border-bottom:none}
.editor-toolbar button{padding:4px 7px;font-size:13px;border:none;border-radius:5px;background:none;color:#555;cursor:pointer;line-height:1.2}
.editor-toolbar button:hover{background:#f3f4f6}
.editor-toolbar .sep{width:0.5px;background:#e5e7eb;margin:2px 4px;align-self:stretch}
select.toolbar-select{padding:3px 6px;font-size:12px;border:0.5px solid #d1d5db;border-radius:5px;background:#fff;font-family:inherit;color:#555;cursor:pointer}
.editor-body{min-height:200px;padding:12px;background:#fff;border:0.5px solid #d1d5db;border-radius:0 0 8px 8px;outline:none;font-size:14px;line-height:1.8;overflow-y:auto;max-height:500px;margin-bottom:8px}
.editor-body:focus{border-color:#6366f1}
.editor-body img{max-width:100%;border-radius:6px;margin:4px 0}
.editor-body h1{font-size:22px;font-weight:700;margin:8px 0}
.editor-body h2{font-size:18px;font-weight:600;margin:6px 0}
.editor-body h3{font-size:15px;font-weight:600;margin:4px 0}
.editor-body ul,.editor-body ol{padding-left:1.5em;margin:4px 0}
.editor-body blockquote{border-left:3px solid #d1d5db;padding-left:12px;color:#666;margin:6px 0}
.editor-body a{color:#6366f1;text-decoration:underline}
.editor-body table{border-collapse:collapse;width:100%;margin:6px 0}
.editor-body table td,.editor-body table th{border:0.5px solid #d1d5db;padding:6px 10px;font-size:13px}
.editor-body table th{background:#f9fafb;font-weight:500}
.editor-body pre{background:#1e1e1e;color:#d4d4d4;padding:12px;border-radius:6px;font-size:13px;overflow-x:auto;margin:6px 0}
.editor-body code{background:#f3f4f6;padding:1px 5px;border-radius:4px;font-size:13px}

/* 파일 첨부 */
.file-upload-area{border:1.5px dashed #d1d5db;border-radius:8px;padding:.75rem;text-align:center;cursor:pointer;margin:8px 0;transition:border-color .15s,background .15s}
.file-upload-area:hover,.file-upload-area.drag-over{border-color:#6366f1;background:#f5f3ff}
.file-upload-area p{font-size:13px;color:#888}
.preview-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:6px;margin-bottom:8px}
.preview-item{position:relative;border-radius:8px;overflow:hidden;border:0.5px solid #e5e7eb}
.preview-item img{width:100%;height:80px;object-fit:cover;display:block}
.preview-item .fi{height:60px;display:flex;align-items:center;justify-content:center;font-size:24px;background:#f9fafb}
.preview-item .fn{padding:4px 6px;font-size:11px;color:#555;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.preview-item .fs{padding:0 6px 4px;font-size:10px;color:#aaa}
.preview-remove{position:absolute;top:3px;right:3px;width:18px;height:18px;border-radius:50%;background:rgba(0,0,0,.5);color:#fff;border:none;font-size:10px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.form-row{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}

/* 글 목록 */
.post-item{border:0.5px solid #e5e7eb;border-radius:12px;padding:1rem 1.25rem;margin-bottom:10px;cursor:pointer;transition:border-color .15s}
.post-item:hover{border-color:#aaa}
.post-item-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.post-item-title{font-size:14px;font-weight:500;flex:1}
.post-meta{display:flex;align-items:center;gap:6px;flex-shrink:0;flex-wrap:wrap}
.post-author,.post-date{font-size:12px;color:#aaa}
.attach-badge{font-size:11px;color:#6366f1;background:#eef2ff;border-radius:4px;padding:1px 5px}
.updated-badge{font-size:11px;color:#f59e0b;background:#fffbeb;border-radius:4px;padding:1px 5px}
.del-btn{padding:3px 8px;font-size:11px;border-radius:6px;border:0.5px solid #fca5a5;background:#fff5f5;color:#ef4444;cursor:pointer}
.del-btn:hover{background:#fee2e2}
.edit-btn{padding:3px 8px;font-size:11px;border-radius:6px;border:0.5px solid #d1d5db;background:#fff;color:#555;cursor:pointer}
.edit-btn:hover{background:#f3f4f6}
.post-empty{font-size:13px;color:#aaa;text-align:center;padding:3rem 0}

/* 글 상세 */
.post-detail{background:#fff;border:0.5px solid #e5e7eb;border-radius:12px;padding:1.5rem;margin-bottom:1.5rem}
.post-detail-title{font-size:18px;font-weight:500;margin-bottom:6px}
.post-detail-meta{font-size:12px;color:#aaa;margin-bottom:1.25rem;padding-bottom:1rem;border-bottom:0.5px solid #f3f4f6;display:flex;justify-content:space-between;flex-wrap:wrap;gap:4px;align-items:center}
.post-detail-meta em{font-style:normal;color:#f59e0b}
.post-content{font-size:14px;color:#444;line-height:1.9;margin-bottom:1.25rem}
.post-content img{max-width:100%;border-radius:6px;margin:4px 0}
.post-content h1{font-size:22px;font-weight:700;margin:12px 0 6px}
.post-content h2{font-size:18px;font-weight:600;margin:10px 0 4px}
.post-content h3{font-size:15px;font-weight:600;margin:8px 0 4px}
.post-content ul,.post-content ol{padding-left:1.5em;margin:4px 0}
.post-content blockquote{border-left:3px solid #d1d5db;padding-left:12px;color:#666;margin:8px 0}
.post-content a{color:#6366f1;text-decoration:underline}
.post-content table{border-collapse:collapse;width:100%;margin:8px 0}
.post-content table td,.post-content table th{border:0.5px solid #d1d5db;padding:6px 10px;font-size:13px}
.post-content table th{background:#f9fafb;font-weight:500}
.post-content pre{background:#1e1e1e;color:#d4d4d4;padding:12px;border-radius:6px;font-size:13px;overflow-x:auto;margin:8px 0}
.post-content code{background:#f3f4f6;padding:1px 5px;border-radius:4px;font-size:13px}

/* 첨부파일 */
.attachments{border-top:0.5px solid #f3f4f6;padding-top:1.25rem}
.attachments-title{font-size:13px;font-weight:500;margin-bottom:10px;color:#555}
.img-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px;margin-bottom:10px}
.img-gallery a{display:block;border-radius:8px;overflow:hidden;border:0.5px solid #e5e7eb}
.img-gallery img{width:100%;height:130px;object-fit:cover;display:block;transition:opacity .15s}
.img-gallery a:hover img{opacity:.85}
.attach-files{display:flex;flex-direction:column;gap:6px}
.attach-item{display:flex;align-items:center;gap:8px;padding:8px 12px;border:0.5px solid #e5e7eb;border-radius:8px;text-decoration:none;color:#111;transition:background .1s}
.attach-item:hover{background:#f9fafb}
.attach-icon{font-size:18px;flex-shrink:0}
.attach-name{font-size:13px;font-weight:500;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.attach-size{font-size:11px;color:#aaa}
.attach-dl{font-size:11px;color:#6366f1}

/* 버튼 */
.btn{padding:8px 18px;font-size:13px;border-radius:8px;border:none;background:#111;color:#fff;cursor:pointer}
.btn:hover{background:#333}
.btn-sm{padding:5px 12px;font-size:12px;border-radius:7px;border:none;background:#111;color:#fff;cursor:pointer}
.btn-ghost-sm{padding:5px 12px;font-size:12px;border-radius:7px;border:0.5px solid #d1d5db;background:#fff;color:#555;cursor:pointer}
.login-badge{display:inline-flex;align-items:center;gap:6px;background:#f3f4f6;border-radius:20px;padding:4px 12px;font-size:12px;color:#555}
.err{font-size:12px;color:#ef4444;margin-bottom:8px;min-height:16px}

/* 모달 */
.modal-bg{display:none;position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:100;align-items:center;justify-content:center}
.modal-bg.open{display:flex}
.modal{background:#fff;border-radius:14px;padding:1.75rem;width:340px;max-height:90vh;overflow-y:auto;box-shadow:0 8px 32px rgba(0,0,0,.12)}
.modal h3{font-size:16px;font-weight:600;margin-bottom:4px}
.modal .modal-sub{font-size:13px;color:#888;margin-bottom:1.25rem}
.modal input{width:100%;padding:9px 12px;font-size:14px;border-radius:8px;border:0.5px solid #d1d5db;outline:none;font-family:inherit;margin-bottom:8px}
.modal .modal-row{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}
.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.25rem}
.tab-row{display:flex;margin-bottom:1.25rem;border:0.5px solid #e5e7eb;border-radius:8px;overflow:hidden}
.tab-btn{flex:1;padding:8px;font-size:13px;border:none;background:#fff;color:#888;cursor:pointer;font-family:inherit}
.tab-btn.active{background:#111;color:#fff}
.side-modal{width:420px;max-width:95vw}

/* 방문록 */
.gb-form input,.gb-form textarea{width:100%;padding:8px 12px;font-size:14px;border-radius:8px;border:0.5px solid #d1d5db;outline:none;font-family:inherit;margin-bottom:8px}
.gb-form textarea{min-height:72px;resize:vertical}
.gb-list{display:flex;flex-direction:column;gap:8px;margin-top:1rem;max-height:260px;overflow-y:auto}
.gb-item{border:0.5px solid #e5e7eb;border-radius:10px;padding:.85rem 1rem}
.gb-meta{display:flex;justify-content:space-between;margin-bottom:4px}
.gb-name{font-size:13px;font-weight:500}
.gb-date{font-size:11px;color:#aaa}
.gb-msg{font-size:13px;color:#444;line-height:1.6}

/* 채팅 */
.chat-messages{height:220px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;background:#fafafa;border-radius:8px;padding:.75rem;margin-bottom:.75rem}
.chat-msg{display:flex;gap:8px}
.chat-avatar{width:26px;height:26px;border-radius:50%;background:#e5e7eb;display:flex;align-items:center;justify-content:center;font-size:10px;color:#888;flex-shrink:0}
.chat-user{font-size:12px;font-weight:500}
.chat-time{font-size:11px;color:#bbb;margin-left:5px}
.chat-bubble{font-size:13px;color:#333;background:#fff;border:0.5px solid #e5e7eb;border-radius:8px;padding:5px 9px;display:inline-block;margin-top:2px}
.chat-input-row{display:flex;gap:6px}
.chat-input-row input{padding:7px 10px;font-size:13px;border-radius:8px;border:0.5px solid #d1d5db;outline:none;font-family:inherit}
#chatName{width:80px}#chatText{flex:1}
