:root {
    --bg-color: #faf1e2;          /* 主背景：温暖的米色 */
    --text-main: #3e322c;         /* 主文字：深褐色 */
    --text-muted: #8c7b71;        /* 辅助文字：浅褐色 */
    --primary: #d97757;           /* 强调色：赤陶色/橘色 */
    --card-bg: #fffbf5;           /* 卡片背景 */
    --border-radius: 12px;
    --shadow-sm: 0 2px 4px rgba(100, 80, 60, 0.05);
    --shadow-md: 0 6px 16px rgba(100, 80, 60, 0.08);
}

/* 浅色主题 (JS 切换时触发) */
html[data-theme="light"] {
    --bg-color: #f5f5f5;
    --text-main: #333333;
    --text-muted: #888888;
    --card-bg: #ffffff;
    --primary: #3b82f6; /* 清爽蓝 */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 6px 12px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}
.container { max-width: 800px; margin: 0 auto; padding: 0 20px; }

/* 头部与导航 */
.site-header {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 20px 0;
    margin-bottom: 30px;
    transition: background-color 0.3s;
}
.site-header .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.site-header h1 a { font-size: 22px; color: var(--text-main); text-decoration: none; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 15px; }
.nav-links a { color: var(--text-muted); text-decoration: none; transition: color 0.3s; }
.nav-links a:hover { color: var(--primary); }
.theme-btn { background: none; border: none; font-size: 18px; cursor: pointer; padding: 5px; color: var(--text-muted); transition: transform 0.3s; }
.theme-btn:hover { transform: rotate(180deg); color: var(--primary); }

/* 卡片通用 */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* 表单区域 */
.form-card { display: flex; flex-direction: column; align-items: flex-start; }
#form-wrapper { width: 100%; margin-top: 20px; transition: all 0.3s ease; }
#form-wrapper.hidden { display: none; }
#form-wrapper.show { display: block; }
textarea {
    width: 100%; min-height: 150px; padding: 15px; border: 1px solid #ddd; border-radius: 8px;
    font-family: inherit; font-size: 15px; resize: vertical; outline: none; background: var(--bg-color); color: var(--text-main);
}
textarea:focus { border-color: var(--primary); }
.form-controls { display: flex; justify-content: space-between; margin-top: 15px; gap: 15px; }
input[type="password"] { flex: 1; padding: 10px 15px; border: 1px solid #ddd; border-radius: 8px; outline: none; background: var(--bg-color); color: var(--text-main); }
input[type="password"]:focus { border-color: var(--primary); }

/* 按钮 */
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 15px; transition: all 0.3s; }
.btn-primary { background: var(--primary); color: white; }
.btn-submit { background: var(--primary); color: white; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.alert { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 6px; margin-bottom: 15px; width: 100%; }

/* 笔记列表 */
.log-meta { display: flex; align-items: baseline; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dashed #ddd; }
.log-year { font-size: 26px; font-weight: bold; color: var(--primary); margin-right: 10px; }
.log-date { font-size: 14px; color: var(--text-muted); }
.log-content { font-size: 16px; word-wrap: break-word; }

/* 友链网格 */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 20px; }
.link-card { display: flex; align-items: center; gap: 10px; padding: 12px 15px; background: var(--bg-color); border-radius: 8px; text-decoration: none; color: var(--text-main); box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.2s; }
.link-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.link-icon { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: bold; font-size: 14px; }
.link-name { font-size: 14px; font-weight: 500; }

/* 页脚 */
.site-footer { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: 14px; }

@media (max-width: 600px) {
    .form-controls { flex-direction: column; }
    .btn-submit { width: 100%; }
    .site-header .container { flex-direction: column; gap: 15px; }
}