/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: #ffffff;
    color: #1e293b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* 星光背景（白底下隐藏） */
.stars {
    display: none;
}

/* 导航栏 */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-bottom: 1px solid #e2e8f0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #d97706;
    text-decoration: none;
}

.nav-links a {
    color: #475569;
    text-decoration: none;
    margin-left: 2rem;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #d97706;
}

/* 主体内容 */
main {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

/* 主页专属样式 */
.hero {
    text-align: center;
    margin-top: 4rem;
}

.hero h1 {
    font-size: 3rem;
    color: #0f172a;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 3rem;
    line-height: 1.8;
}

/* 卡片链接 */
.card-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    padding: 2rem;
    width: 250px;
    text-align: center;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.4s ease;
}

.card:hover {
    transform: translateY(-10px);
    border-color: #f59e0b;
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.15);
    background: #fffbeb;
}

.card h3 {
    color: #b45309;
    margin-bottom: 1rem;
}

.card p {
    font-size: 0.9rem;
    color: #64748b;
}

/* 子页面通用标题 */
.page-title {
    text-align: center;
    font-size: 2rem;
    color: #b45309;
    margin-bottom: 2rem;
}

/* 画廊样式 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: 0.3s;
}

.gallery-item:hover {
    border-color: #f59e0b;
}

.gallery-item span {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

/* 留言板表单 */
.message-form {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-form input, .message-form textarea {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #1e293b;
    font-family: inherit;
    outline: none;
}

.message-form input:focus, .message-form textarea:focus {
    border-color: #f59e0b;
}

.message-form button {
    padding: 1rem;
    background: #f59e0b;
    color: #78350f;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.message-form button:hover {
    background: #fbbf24;
}

/* 软件下载页 */
.card .app-meta {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.6rem;
}

.download-btn {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.7rem 2.2rem;
    background: #f59e0b;
    color: #78350f;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    transition: 0.3s;
}

.download-btn:hover {
    background: #fbbf24;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

/* 页脚 */
footer {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* 账号登录页 */
.auth-card {
    max-width: 400px;
    margin: 0 auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-tabs .tab {
    padding: 0.5rem 1.5rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}

.auth-tabs .tab.active {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #78350f;
    font-weight: bold;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-card input {
    padding: 0.9rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #1e293b;
    font-family: inherit;
    outline: none;
}

.auth-card input:focus {
    border-color: #f59e0b;
}

.auth-card .auth-submit {
    padding: 0.9rem;
    background: #f59e0b;
    color: #78350f;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.auth-card .auth-submit:hover {
    background: #fbbf24;
}

.auth-msg {
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2em;
    color: #dc2626;
}

.auth-msg.ok {
    color: #16a34a;
}

.logout-btn {
    margin-top: 1rem;
    padding: 0.8rem 2rem;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

.logout-btn:hover {
    background: #f87171;
}

/* 个人中心 */
.profile-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.role-badge {
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: bold;
}

.role-badge.root { background: #fef3c7; color: #b45309; border: 1px solid #f59e0b; }
.role-badge.admin { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.role-badge.user { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

.center-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
}

@media (max-width: 760px) {
    .center-grid { grid-template-columns: 1fr; }
}

.panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    padding: 1.5rem;
}

.panel h3 { margin-bottom: 1rem; color: #b45309; }

#add-form, #chat-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

#add-form input, #chat-form input {
    flex: 1;
    min-width: 0;
    padding: 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    background: #fff;
    color: #1e293b;
}

#add-form input:focus, #chat-form input:focus { border-color: #f59e0b; }

#add-form button, #chat-form button {
    padding: 0.7rem 1.2rem;
    background: #f59e0b;
    color: #78350f;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

#add-form button:hover, #chat-form button:hover { background: #fbbf24; }
#chat-form button:disabled, #chat-form input:disabled { opacity: 0.5; cursor: not-allowed; }

#friend-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
}

#friend-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

#friend-list li:hover, #friend-list li.active { border-color: #f59e0b; background: #fffbeb; }

#friend-list .del {
    color: #ef4444;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem;
}

#chat-box {
    height: 340px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.msg-item {
    max-width: 75%;
    padding: 0.5rem 0.9rem;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.msg-item.mine { align-self: flex-end; background: #f59e0b; color: #78350f; }
.msg-item.theirs { align-self: flex-start; background: #f1f5f9; color: #1e293b; }
.msg-time { display: block; font-size: 0.7rem; opacity: 0.7; margin-top: 0.25rem; }

.admin-panel { margin-top: 1.5rem; }
.admin-panel table { width: 100%; border-collapse: collapse; }
.admin-panel th, .admin-panel td { padding: 0.6rem; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 0.9rem; }
.admin-panel th { color: #64748b; font-weight: normal; }

.op-btn {
    padding: 0.35rem 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 0.4rem;
    font-size: 0.8rem;
    font-weight: bold;
}

.op-btn.ban { background: #fee2e2; color: #b91c1c; }
.op-btn.unban { background: #dcfce7; color: #15803d; }
.op-btn.promote { background: #dbeafe; color: #1d4ed8; }
.op-btn.demote { background: #f1f5f9; color: #475569; }
