/* ============================================
   Threads-inspired Community - CSS
   ============================================ */

:root {
    --bg: #000000;
    --bg-secondary: #101010;
    --bg-card: #181818;
    --bg-hover: #222222;
    --border: #333333;
    --text: #f5f5f5;
    --text-secondary: #999999;
    --text-muted: #666666;
    --accent: #ffffff;
    --link: #0095f6;
    --danger: #ff3040;
    --like-active: #ff4fa3;
    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 72px;
    --nav-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button, input, textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

button { cursor: pointer; }
textarea { resize: vertical; }

/* ============================================
   Sidebar (Desktop)
   ============================================ */
.sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg);
    border-right: 1px solid var(--border);
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    z-index: 100;
}

.sidebar-logo {
    font-size: 0;
    width: 36px;
    height: 36px;
    background: var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    color: var(--bg);
    font-weight: 700;
}

.sidebar-logo::after {
    content: 'C';
    font-size: 16px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 0;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar-link.active {
    color: var(--text);
}

.sidebar-link-dot,
.nav-link-dot {
    position: relative;
}

.sidebar-link-dot.has-unread::after,
.nav-link-dot.has-unread::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b30;
    box-shadow: 0 0 0 2px var(--bg);
}

.sidebar-link-dot.has-unread::after {
    top: 10px;
    right: 10px;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0;
}

.sidebar-footer a {
    color: var(--text-muted);
    font-size: 11px;
    display: none;
}

/* ============================================
   Mobile Navigation
   ============================================ */
.nav-mobile {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-logo { display: none; }

.nav-links {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 12px;
    transition: color 0.2s;
}

.nav-link span {
    font-size: 10px;
}

.nav-link:hover, .nav-link.active {
    color: var(--text);
}

.nav-link-dot.has-unread::after {
    top: 8px;
    right: 18px;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    padding-bottom: calc(var(--nav-height) + 34px);
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
    flex: 1 0 auto;
}

/* ============================================
   Feed
   ============================================ */
.feed-container {
    padding: 0 16px;
}

.feed-header {
    position: sticky;
    top: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 0;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.feed-header h1 {
    font-size: 22px;
    font-weight: 700;
}

.back-btn {
    display: flex;
    align-items: center;
    color: var(--text);
    padding: 4px;
}

.feed-tabs {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.feed-tab {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.feed-tab:hover {
    background: var(--bg-hover);
}

.feed-tab.active {
    background: var(--accent);
    color: var(--bg);
}

/* ============================================
   Write Prompt
   ============================================ */
.write-prompt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.write-prompt-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.write-prompt-text {
    flex: 1;
    color: var(--text-muted);
    font-size: 14px;
}

.btn-write-sm {
    padding: 6px 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-write-sm:hover {
    color: var(--text);
    border-color: var(--text);
}

/* ============================================
   Post Card (Threads Style)
   ============================================ */
.post-list {
    display: flex;
    flex-direction: column;
}

.post-card {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.post-left {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.post-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.post-thread-line {
    flex: 1;
    width: 2px;
    background: var(--border);
    margin-top: 8px;
    border-radius: 1px;
    min-height: 20px;
}

.post-right {
    flex: 1;
    min-width: 0;
}

.post-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.post-author {
    font-weight: 600;
    font-size: 14px;
}

.post-author .user-level-name,
.comment-author .user-level-name,
.write-username .user-level-name,
.profile-name .user-level-name {
    vertical-align: middle;
}

.post-author:hover {
    text-decoration: underline;
}

.post-time {
    color: var(--text-muted);
    font-size: 13px;
}

.user-level-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.user-level-name .level-icon {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.user-level-name .level-nickname {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-level-sm .level-icon {
    width: 15px;
    height: 15px;
}

.user-level-lg .level-icon {
    width: 20px;
    height: 20px;
}

.user-level-xl .level-icon {
    width: 24px;
    height: 24px;
}

.profile-name .user-level-name {
    gap: 8px;
}

.post-edit-inline {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.2s;
}

.post-edit-inline:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.post-menu-btn {
    margin-left: auto;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.post-menu-btn:hover {
    background: var(--bg-hover);
}

.post-content {
    display: block;
    color: var(--text);
    text-decoration: none;
}

.post-content[role="button"] {
    cursor: pointer;
}

.post-content[role="button"]:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
    border-radius: 6px;
}

.post-content p {
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.post-content-full p {
    font-size: 15px;
    line-height: 1.6;
    word-break: break-word;
}

.post-image {
    margin-top: 12px;
    width: min(100%, 520px);
    max-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.post-image img {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
}

.post-stats {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.post-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.action-btn.liked {
    color: var(--like-active);
}

.action-btn.liked svg {
    fill: var(--like-active);
    stroke: var(--like-active);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 15px;
}

/* ============================================
   Notifications
   ============================================ */
.notification-list {
    display: flex;
    flex-direction: column;
}

.notification-clear-form {
    margin-left: auto;
}

.notification-clear-btn {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.notification-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.notification-body {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}

.notification-text strong {
    color: var(--text);
}

.notification-meta {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.notification-type {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
}

.notification-go {
    margin-top: 8px;
    display: inline-block;
    color: var(--link);
    font-size: 13px;
}

.notification-go:hover {
    text-decoration: underline;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: var(--accent);
    color: var(--bg);
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.85; }

.btn-sm { padding: 6px 18px; font-size: 13px; }

.btn-full { width: 100%; }

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-text {
    display: inline-block;
    padding: 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    width: 100%;
    margin-top: 4px;
}

.btn-text:hover { color: var(--text); }

/* ============================================
   Auth (Login/Register)
   ============================================ */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 28px;
    border: 1px solid var(--border);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--bg-hover);
    color: var(--text);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--text-muted);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.auth-form .btn-primary {
    margin-top: 8px;
}

/* ============================================
   Alert
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(255,48,64,0.1);
    color: var(--danger);
    border: 1px solid rgba(255,48,64,0.2);
}

.alert-success {
    background: rgba(0,200,120,0.1);
    color: #1bd38a;
    border: 1px solid rgba(0,200,120,0.25);
}

/* ============================================
   Write Form
   ============================================ */
.write-form {
    padding: 8px 0;
}

.write-body {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    align-items: flex-start;
}

.write-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.write-input-area {
    flex: 1;
    min-width: 0;
}

.write-username {
    font-weight: 600;
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}

.write-input-area textarea {
    width: 100%;
    min-height: 120px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: transparent;
}

.write-quill-editor {
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
}

.write-quill-editor .ql-toolbar.ql-snow {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #1a1a2e;
    border: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
}

.write-quill-editor .ql-toolbar.ql-snow::-webkit-scrollbar {
    display: none;
}

.write-quill-editor .ql-formats {
    flex-shrink: 0;
}

.write-quill-editor .ql-container.ql-snow {
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: var(--bg-dark);
    min-height: 400px;
}

.write-quill-editor .ql-editor {
    min-height: 380px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
}

.write-quill-editor .ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
}

.write-quill-editor .ql-snow .ql-stroke {
    stroke: #aaa;
}

.write-quill-editor .ql-snow .ql-fill {
    fill: #aaa;
}

.write-quill-editor .ql-snow .ql-picker {
    color: #aaa;
}

.write-quill-editor .ql-snow .ql-picker-options {
    background: #1a1a2e;
    border-color: var(--border);
}

.write-quill-editor .ql-editor iframe.ql-video,
.post-content iframe.ql-video,
.post-content-full iframe.ql-video {
    width: 100%;
    max-width: 100%;
    min-height: 220px;
    border: 0;
    border-radius: 8px;
}

.post-content .ql-align-center,
.post-content-full .ql-align-center {
    text-align: center;
}

.post-content .ql-align-right,
.post-content-full .ql-align-right {
    text-align: right;
}

.post-content .ql-align-justify,
.post-content-full .ql-align-justify {
    text-align: justify;
}

.post-content pre.ql-syntax,
.post-content-full pre.ql-syntax {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    font-size: 13px;
}

.editor-shell {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
}

.editor-toolbar-rich {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.editor-toolbar-rich::-webkit-scrollbar {
    display: none;
}

.editor-tool {
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 10px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-tool:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.editor-tool.is-preview {
    margin-left: auto;
}

.editor-shell textarea {
    border: 0;
    min-height: 220px;
    padding: 16px;
    width: 100%;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
}

.editor-preview {
    display: none;
    margin-top: 12px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.editor-preview.active {
    display: block;
}

.editor-preview h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.editor-preview p {
    margin-bottom: 8px;
    line-height: 1.55;
}

.editor-preview ul {
    margin: 0 0 10px 18px;
}

.editor-preview li {
    margin-bottom: 4px;
}

.editor-preview blockquote {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-left: 3px solid var(--text-muted);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.write-input-area textarea::placeholder {
    color: var(--text-muted);
}

.write-toolbar {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.image-preview {
    position: relative;
    margin-top: 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.image-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.post-md-heading {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
}

.post-md-list {
    margin: 0 0 10px 18px;
}

.post-md-list li {
    margin-bottom: 4px;
    line-height: 1.55;
}

.post-md-quote {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-left: 3px solid var(--text-muted);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.post-content code,
.post-content-full code {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 13px;
}

@media (max-width: 767px) {
    .write-quill-editor .ql-toolbar.ql-snow {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 6px;
    }

    .write-quill-editor .ql-toolbar.ql-snow::-webkit-scrollbar {
        display: none;
    }

    .write-quill-editor .ql-container.ql-snow {
        min-height: 260px;
    }

    .write-quill-editor .ql-editor {
        min-height: 240px;
        font-size: 14px;
    }

    .write-quill-editor .ql-editor iframe.ql-video,
    .post-content iframe.ql-video,
    .post-content-full iframe.ql-video {
        min-height: 180px;
    }

    .post-image {
        width: 100%;
        max-height: 320px;
    }

    .post-image img {
        max-height: 320px;
    }

    .profile-level-wrap {
        max-width: 100%;
    }

    .profile-level-head {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .profile-level-xp {
        white-space: normal;
    }

    .comment-replies {
        margin-left: 8px;
        padding-left: 8px;
    }
}

.preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Search
   ============================================ */
.search-form {
    padding: 8px 0 16px;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.search-input-wrap input {
    flex: 1;
    font-size: 15px;
    color: var(--text);
}

.search-input-wrap input::placeholder {
    color: var(--text-muted);
}

.search-result-count {
    color: var(--text-secondary);
    font-size: 14px;
    padding-bottom: 12px;
}

/* ============================================
   Profile
   ============================================ */
.profile-header-card {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.profile-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.profile-text { flex: 1; }

.profile-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.profile-stat {
    color: var(--text-muted);
    font-size: 13px;
}

.profile-level-wrap {
    margin-top: 12px;
    max-width: 420px;
}

.profile-level-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.profile-level-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
}

.profile-level-xp {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

.profile-level-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    overflow: hidden;
}

.profile-level-fill {
    height: 100%;
    background: linear-gradient(90deg, #33d17a 0%, #f5c451 55%, #ff7b54 100%);
    border-radius: inherit;
    transition: width 0.35s ease;
}

.profile-level-note {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.profile-avatar-lg img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.profile-tab {
    flex: 1;
    text-align: center;
    padding: 14px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.profile-tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

/* Profile Edit Modal */
.profile-edit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.edit-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.edit-form h2 {
    font-size: 18px;
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.form-actions .btn-outline,
.form-actions .btn-primary {
    flex: 1;
}

/* ============================================
   Comments
   ============================================ */
.comments-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.comments-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.comment-input-wrap {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-input-wrap textarea {
    flex: 1;
    min-height: 60px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
}

.comment-form .btn-primary {
    align-self: flex-end;
}

.login-prompt {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.login-prompt a {
    color: var(--link);
    font-weight: 500;
}

.comment-card {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.comment-card-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-body { flex: 1; }

.comment-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 600;
    font-size: 13px;
}

.comment-time {
    color: var(--text-muted);
    font-size: 12px;
}

.comment-menu-btn {
    margin-left: auto;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.comment-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.comment-body p {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.comment-actions-row {
    margin-top: 6px;
}

.comment-reply-btn {
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.comment-reply-btn:hover {
    color: var(--text);
}

.comment-replies {
    margin-top: 10px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.reply-card {
    padding: 10px 0 0;
    border-bottom: 0;
}

.reply-card + .reply-card {
    margin-top: 10px;
    border-top: 1px dashed var(--border);
    padding-top: 10px;
}

.comment-reply-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.comment-reply-target span {
    color: var(--text-secondary);
    font-size: 13px;
}

.comment-reply-cancel {
    color: var(--text-muted);
    font-size: 12px;
}

.comment-reply-cancel:hover {
    color: var(--text);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 24px 0;
}

.page-btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.page-btn:hover {
    background: var(--bg-hover);
}

.page-btn.active {
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
}

/* ============================================
   Static Pages (About, Privacy, Terms, Contact)
   ============================================ */
.static-page {
    padding: 24px 0;
}

.static-page h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.static-page h2 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
}

.static-page h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 8px;
}

.static-page p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 14px;
}

.static-page ul, .static-page ol {
    color: var(--text-secondary);
    padding-left: 24px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.8;
}

.contact-form .form-group {
    margin-bottom: 20px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--nav-height);
    padding: 0 16px 0;
    text-align: center;
    z-index: 90;
    pointer-events: none;
}

.footer-collapsible {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    pointer-events: auto;
    position: relative;
}

.footer-mobile {
    display: block;
}

.footer-desktop {
    display: none;
}

.footer-toggle {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 0 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.92);
}

.footer-toggle:hover {
    color: var(--text-secondary);
}

.footer-toggle::-webkit-details-marker {
    display: none;
}

.footer-toggle::marker {
    content: '';
}

.footer-toggle::after {
    content: '\25BE';
    font-size: 11px;
    transition: transform 0.2s;
}

.footer-collapsible[open] .footer-toggle {
    color: var(--text-secondary);
}

.footer-collapsible[open] .footer-toggle::after {
    transform: rotate(180deg);
}

.footer-toggle:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

.footer-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 13px;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--text-secondary); }

.footer-copy {
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid var(--border);
    opacity: 0;
    transition: all 0.3s;
    z-index: 500;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   Post Menu Dropdown
   ============================================ */
.post-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-width: 140px;
    z-index: 60;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.post-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    font-size: 14px;
    transition: background 0.2s;
}

.post-menu a {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
    transition: background 0.2s;
}

.post-menu button:hover,
.post-menu a:hover { background: var(--bg-hover); }
.post-menu .edit-link { color: var(--text); }
.post-menu .delete-btn { color: var(--danger); }
.post-menu .report-btn { color: #ffcc66; }

/* ============================================
   Responsive - Desktop
   ============================================ */
@media (min-width: 768px) {
    body {
        padding-left: var(--sidebar-width);
    }

    .sidebar {
        display: flex;
    }

    .nav-mobile {
        display: none;
    }

    .main-content {
        margin: 0 auto; /* 완벽하게 남은 공간 중앙 정렬 */
        padding-top: 20px;
        padding-bottom: 40px;
        max-width: 600px; /* 스레드처럼 조금 더 슬림하게 */
    }

    .feed-header {
        top: 0;
        margin-bottom: 20px;
        padding: 20px 0;
        background: rgba(0,0,0,0.85); /* 다크모드 배경 고정 */
    }

    .footer {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        pointer-events: auto;
        z-index: auto;
        border-top: 1px solid var(--border);
        padding: 24px 16px 40px;
        margin-top: auto;
    }

    .footer-mobile {
        display: none;
    }

    .footer-desktop {
        display: block;
    }

    .footer-links {
        justify-content: center;
    }

    .footer-copy {
        color: var(--text-muted);
    }

    .post-avatar img {
        width: 44px;
        height: 44px;
    }

    .toast {
        bottom: 40px;
    }
}

@media (min-width: 1024px) {
    :root {
        --sidebar-width: 240px; /* 왼쪽 사이드바 확장 */
    }

    .sidebar {
        align-items: stretch;
        padding: 20px 16px;
    }

    .sidebar-logo {
        width: auto;
        height: auto;
        background: none;
        border-radius: 0;
        font-size: 20px;
        font-weight: 700;
        color: var(--text);
        justify-content: flex-start;
        padding: 8px 12px;
        margin-bottom: 24px;
    }

    .sidebar-logo::after {
        content: none;
    }

    .sidebar-link {
        width: 100%;
        justify-content: flex-start;
        gap: 16px;
        padding: 0 12px;
        font-size: 15px;
    }

    .sidebar-link-dot.has-unread::after {
        top: 12px;
        right: 14px;
    }

    .sidebar-footer {
        align-items: flex-start;
        padding: 0 12px;
    }

    .sidebar-footer a {
        display: block;
    }
}

/* ============================================
   Default Avatar SVG
   ============================================ */
img[src="/img/default-avatar.svg"] {
    background: var(--bg-hover);
    padding: 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Selection */
::selection {
    background: rgba(255,255,255,0.15);
}
