/* 1. 基础变量 */
:root { 
  --bg: #1a1a1a; --text: #FFA500; --link: #4DB6AC; 
  --btn-bg: #333; --btn-text: #aaa; --accent: #2e7d32; --panel-bg: #252525; 
}
body.theme-0 { --bg: #e8f4ea; --text: #2e3b2e; --link: #1565C0; --btn-bg: #d0ded0; --btn-text: #555; --panel-bg: #d8e6d8; }
body.theme-1 { --bg: #f4ecd8; --text: #4a3a2a; --link: #795548; --btn-bg: #e6dec9; --btn-text: #666; --panel-bg: #ebe2cc; }

body { 
  font-family: sans-serif; margin: 0; background: var(--bg); color: var(--text); 
  transition: 0.3s; display: flex; flex-direction: column; min-height: 100vh; text-align: center; 
}

/* 顶部紧凑布局 */
header { padding: 5px 20px; }
.top-bar { display: flex; justify-content: space-between; align-items: center; max-width: 800px; margin: 0 auto; }
#page-title { margin: 10px 0; }

/* 2. 记事本样式：pub-note-box 专门去掉多余外边距 */
.note-container { width: 70%; margin: 0 auto 10px auto; max-width: 800px; }
.pub-note-box { margin-top: -5px; } /* 负边距让它更靠近标题 */

textarea {
    width: 100%; height: 80px; background: rgba(255, 255, 255, 0.05);
    color: var(--text); border: 1px solid #444; border-radius: 5px;
    padding: 10px; font-size: 14px; resize: vertical; outline: none; box-sizing: border-box;
}
textarea[readonly] { background: transparent; border: 1px dashed #555; height: 60px; }

/* 3. 搜索区域 */
.search-box { padding: 10px 10px; position: relative; }
.bar { display: flex; justify-content: center; position: relative; z-index: 102; }
input#q { 
  width: 70%; padding: 12px; border: 1px solid #555; border-radius: 5px 0 0 5px; 
  background: #c8e6c9; color: #000; outline: none; font-size: 16px; 
}
#s-btn { padding: 10px 20px; background: var(--accent); color: #fff; border: none; border-radius: 0 5px 5px 0; cursor: pointer; }

/* 4. 链接与按钮 */
.link-area a { color: var(--link); text-decoration: none; font-weight: 500; margin: 0 5px; }
#h-panel { 
  display: none; position: absolute; left: 50%; transform: translateX(-50%); width: 70%; 
  background: var(--panel-bg); border: 1px solid #555; border-radius: 0 0 5px 5px; z-index: 101; 
}
.engines { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 15px; }
.engine { padding: 8px 12px; border: 1px solid #666; background: var(--btn-bg); color: var(--btn-text); border-radius: 5px; cursor: pointer; }
.engine.active { background: #FF8C00; color: #fff; border-color: #FF8C00; }

.mgr-btn { background: #444; color: #ddd; border: 1px solid #666; padding: 5px 10px; border-radius: 4px; cursor: pointer; margin: 5px; }
.logout-btn { background: #8b0000; color: #fff; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }

footer { margin-top: auto; padding: 20px; font-size: 13px; }
#pw-input { background: #222; color: #fff; border: 1px solid #444; padding: 8px; border-radius: 4px; text-align: center; width: 200px; }

@media (max-width: 480px) {
  input#q, #h-panel, .note-container, #pw-input { width: 90%; }
}