* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    background: #fff;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 1rem;
}
header h1 { 
    margin: 0; 
    font-size: 1.8rem; 
    flex: 1;
    min-width: 200px;
}
.header-search {
    display: flex;
    gap: 0.5rem;
}
.header-search input {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 150px;
    font-size: 0.9rem;
}
.header-search button {
    padding: 0.4rem 0.8rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
}
.header-search button:hover { background: #5a6268; }

main { margin-bottom: 2rem; }

/* 首页发布表单 */
#publish-form textarea,
#publish-form input[type="text"],
#publish-form input[type="email"],
#publish-form input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}
.captcha {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.captcha input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}
#publish-form button {
    background: #4a6cf7;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}
#publish-form button:hover { background: #3a5bf5; }

/* 话题元信息 */
.topic-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.95rem;
}
.topic-sid::before { content: "#"; }
.topic-time::before { content: "🕒 "; }

/* 话题内容容器 */
.topic-wrapper {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.topic-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px; /* content 和 attachment 之间的间距 */
}
.topic-content {
    background: #f9f9ff;
    padding: 1.5rem;
    border-radius: 8px;
    white-space: pre-wrap;
}
.share-tools {
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0; /* 防止被压缩 */
}
#copy-link {
    width: 100%;
    background: #28a745;
    color: white;
    border: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center;
}
#copy-link:hover { background: #218838; }
#qrcode {
    width: 80px;
    height: 80px;
}
#show-password {
    font-size: 0.8rem;
    color: #6c757d;
    text-decoration: none;
    text-align: center;
    width: 100%;
    display: block;
}
#show-password:hover { text-decoration: underline; }

/* 密码输入框 */
.password-prompt {
    text-align: center;
    padding: 2rem;
}
.password-prompt input {
    padding: 0.75rem;
    width: 200px;
    margin-right: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.password-prompt button {
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 回复区域 */
#replies-container {
    margin: 1.5rem 0;
}

.reply-item {
    margin-bottom: 1.2rem;
    padding: 0.8rem;
    border-radius: 6px;
}
.reply-item.level-1 {
    background: #f8f9fa;
    border-left: 3px solid #4a6cf7;
}
.reply-item.level-2 {
    background: #fcfcfc;
    margin-left: 2rem;
    border-left: 2px solid #adb5bd;
    font-size: 0.95rem;
}

.reply-content-line1 {
    margin-bottom: 0.4rem;
    line-height: 1.5;
}
.floor-number {
    font-weight: bold;
    color: #4a6cf7;
    margin-right: 0.5rem;
}

.reply-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
}
.emoji { font-size: 1.1em; }
.user-id { font-weight: bold; color: #495057; }
.reply-time::before { content: "🕒 "; }
.reply-link {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.85rem;
}
.reply-link:hover { text-decoration: underline; }

/* 回复框 */
.reply-box {
    margin-top: 1rem;
    padding: 0.8rem;
    background: #f1f3f5;
    border-radius: 6px;
}
.reply-box.level-2-box {
    margin-top: 0.8rem;
    background: #e9ecef;
}
.reply-box textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95rem;
    min-height: 60px;
    resize: vertical;
}
.send-reply-btn {
    margin-top: 0.5rem;
    background: #198754;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    display: none;
}
.send-reply-btn:hover { background: #157347; }

/* 回复提示信息 */
.reply-message {
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* 主回复框（固定在话题内容下方） */
#main-reply-box {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* 附件显示 */
.attachment {
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #f8f9fa;
    text-align: center;
}
.attachment-img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.attachment-link {
    display: inline-block;
    padding: 8px 16px;
    background: #e9ecef;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
}
.attachment-link:hover {
    background: #dee2e6;
    text-decoration: underline;
}

/* Footer 语言切换 */
footer {
    text-align: center;
    padding-top: 2rem;
    color: #777;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}
#lang-select {
    padding: 0.2rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}
/* 表单消息提示 */
.form-message {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
}

/* 发布区提醒 */
.publish-notice {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 0 4px 4px 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1565c0;
}