/* 快捷玩法进入道观后通过法器等触发，页面隐藏 */
#quick-actions { display: none !important; }

/* 八字之家 — 主样式表 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'STKaiti', 'KaiTi', 'Noto Serif SC', serif;
  background: #1a1410;
  color: #d4c5a8;
  overflow-x: hidden;
  height: 100vh;
}

/* ===== 页面框架 ===== */
.page { display: none; height: 100vh; width: 100%; }
.page.active { display: flex; flex-direction: column; }

/* ===== 登录页面 ===== */
.splash-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-position: center; background-size: cover; background-repeat: no-repeat;
  filter: brightness(0.3) saturate(0.5) blur(2px);
  z-index: -1;
  transition: opacity 1s;
}
.splash-content {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
}
.temple-title { text-align: center; margin-bottom: 40px; }
.main-title {
  font-size: 48px; font-weight: bold;
  color: #d4a84b; text-shadow: 0 0 20px rgba(212,168,75,0.3);
  letter-spacing: 12px; margin-bottom: 8px;
}
.sub-title { font-size: 18px; color: #c4a55a; letter-spacing: 8px; margin-bottom: 16px; }
.temple-desc { font-size: 14px; color: #8a7a5a; letter-spacing: 3px; }

.auth-form {
  width: 100%; max-width: 360px;
  background: rgba(30, 24, 18, 0.9);
  border: 1px solid #3a2a18;
  border-radius: 12px;
  padding: 30px;
  backdrop-filter: blur(10px);
}
.form-title { font-size: 24px; text-align: center; margin-bottom: 24px; color: #d4a84b; }
.form-input {
  width: 100%; padding: 12px 16px; margin-bottom: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #3a2a18;
  border-radius: 8px;
  color: #d4c5a8; font-size: 16px; outline: none;
}
.form-input:focus { border-color: #d4a84b; }
.form-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #d4a84b, #b8892a);
  border: none; border-radius: 8px;
  color: #1a1410; font-size: 18px; font-weight: bold;
  cursor: pointer; transition: opacity 0.3s;
  font-family: inherit;
}
.form-btn:hover { opacity: 0.9; }
.form-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.form-switch { text-align: center; margin-top: 16px; font-size: 14px; color: #8a7a5a; }
.form-switch a { color: #d4a84b; text-decoration: none; cursor: pointer; }
.gender-select { margin-bottom: 16px; color: #8a7a5a; font-size: 14px; }
.gender-option { margin-right: 16px; cursor: pointer; }
.reg-gender-row {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.reg-gender-opt {
  flex: 1; padding: 10px; text-align: center;
  border: 1px solid #3a2a18; border-radius: 8px;
  cursor: pointer; font-size: 15px; color: #8a7a5a; transition: all 0.2s;
  background: rgba(255,255,255,0.02);
}
.reg-gender-opt.active { border-color: #d4a84b; color: #d4a84b; background: rgba(212,168,75,0.1); }
.reg-gender-opt:hover { border-color: #5a4a32; }

/* ===== 主游戏页面顶部栏 ===== */
#top-bar {
  display: flex; align-items: center; padding: 8px 16px;
  background: rgba(20, 16, 12, 0.95);
  border-bottom: 1px solid #3a2a18;
  gap: 12px; flex-shrink: 0;
}
#user-info { flex: 1; font-size: 14px; color: #d4c5a8; }
#xianyuan-display { font-size: 14px; color: #d4a84b; min-width: 60px; }
#top-bar button {
  padding: 6px 14px; font-size: 13px;
  background: rgba(212, 168, 75, 0.15);
  border: 1px solid #3a2a18; border-radius: 6px;
  color: #d4c5a8; cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
#top-bar button:hover { background: rgba(212, 168, 75, 0.3); border-color: #d4a84b; }

/* ===== 通知系统 ===== */
.notif-badge {
  position: absolute; top: -4px; right: -6px;
  background: #c0392b; color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 8px; text-align: center; font-weight: bold;
  pointer-events: none;
}
#notif-btn { position: relative; }
.notif-panel {
  position: absolute; top: 44px; right: 12px; z-index: 50;
  width: 320px; max-height: 400px; overflow-y: auto;
  background: rgba(20, 16, 12, 0.97);
  border: 1px solid #3a2a18; border-radius: 10px;
  backdrop-filter: blur(8px);
}
.notif-header {
  padding: 12px 16px; font-size: 15px; color: #d4a84b;
  border-bottom: 1px solid #2a1e12; font-weight: bold;
}
.notif-list { padding: 4px 0; }
.notif-item {
  padding: 10px 16px; cursor: pointer; transition: background 0.2s;
  border-bottom: 1px solid rgba(42, 30, 18, 0.5);
}
.notif-item:hover { background: rgba(212, 168, 75, 0.08); }
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-text { font-size: 13px; color: #d4c5a8; }
.notif-item .notif-time { font-size: 11px; color: #5a4a32; margin-top: 2px; }
.notif-empty { padding: 24px; text-align: center; color: #6a5a42; font-size: 13px; }
.notif-toast {
  position: fixed; top: 60px; right: 16px; z-index: 200;
  background: rgba(26, 20, 16, 0.95); border: 1px solid #3a2a18;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  color: #d4c5a8; opacity: 0; transition: opacity 0.3s;
  pointer-events: none; backdrop-filter: blur(4px);
}
.notif-toast.show { opacity: 1; }

/* ===== 个人面板增强 ===== */
.panel-tabs { display: flex; border-bottom: 1px solid #2a1e12; margin-bottom: 12px; }
.panel-tab {
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  color: #6a5a42; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.panel-tab.active { color: #d4a84b; border-bottom-color: #d4a84b; }
.panel-tab:hover { color: #b8892a; }
.panel-body { max-height: 400px; overflow-y: auto; font-size: 13px; line-height: 2; }
.history-item, .log-item {
  padding: 8px 0; border-bottom: 1px solid rgba(42, 30, 18, 0.3);
}
.history-item:last-child, .log-item:last-child { border-bottom: none; }
.history-type { color: #d4a84b; font-size: 12px; }
.history-detail { color: #8a7a5a; font-size: 12px; }
.history-time { color: #5a4a32; font-size: 11px; text-align: right; }
.log-amount { font-weight: bold; }
.log-amount.pos { color: #27ae60; }
.log-amount.neg { color: #c0392b; }
.panel-page-btn {
  display: inline-block; padding: 4px 10px; margin: 4px;
  background: rgba(255,255,255,0.05); border: 1px solid #3a2a18;
  border-radius: 4px; color: #d4c5a8; cursor: pointer; font-size: 12px;
  font-family: inherit;
}
.panel-page-btn:hover { border-color: #d4a84b; }
.panel-page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== p5.js场景区 ===== */
#scene-area {
  flex: 3.7; position: relative; overflow: hidden;
  background: #1a1410;
  min-height: 300px;
  filter: brightness(1.2) contrast(1.1);
}
#p5-canvas-container { width: 100%; height: 100%; }
#p5-canvas-container canvas { display: block; }

/* 快捷操作按钮 */
.action-bar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; z-index: 10;
}
.action-btn {
  padding: 10px 20px; font-size: 15px; font-family: inherit;
  background: rgba(20, 16, 12, 0.85);
  border: 1px solid #3a2a18; border-radius: 25px;
  color: #d4c5a8; cursor: pointer;
  backdrop-filter: blur(4px); transition: all 0.2s;
}
.action-btn:hover {
  background: rgba(212, 168, 75, 0.2);
  border-color: #d4a84b; transform: translateY(-2px);
}

/* ===== 留言墙 ===== */
#wall-area {
  flex: 1.3; display: flex; flex-direction: column;
  background: rgba(16, 12, 10, 0.95);
  border-top: 1px solid #3a2a18;
  min-height: 140px; overflow: hidden;
}
.wall-tabs {
  display: flex; padding: 0 16px;
  border-bottom: 1px solid #2a1e12; flex-shrink: 0;
  align-items: center;
}
.tab {
  padding: 10px 20px; font-size: 14px; cursor: pointer;
  color: #6a5a42; border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab.active { color: #d4a84b; border-bottom-color: #d4a84b; }
.tab:hover { color: #b8892a; }
#wall-area.expanded { flex: 3.7; }

/* 展开/收起按钮行（tabs下方，居中） */
.wall-toggle-row {
  flex-shrink: 0; text-align: center; padding: 2px 0;
  border-bottom: 1px solid #1a1410;
}
.wall-toggle {
  display: inline-block; padding: 2px 16px;
  font-size: 16px; font-weight: 900; cursor: pointer;
  color: #2ecc71; user-select: none;
  transition: color 0.3s, transform 0.2s;
  line-height: 1;
}
.wall-toggle:hover { color: #58d68d; transform: scale(1.15); }

.wall-content {
  flex: 1; overflow-y: auto; padding: 12px 16px;
}

/* 底部备案号 + 管理入口 */
.site-footer {
  flex-shrink: 0; padding: 10px 16px;
  border-top: 1px solid #2a1e12;
  text-align: center;
}
.footer-icp {
  font-size: 11px; color: #4a3a28; cursor: pointer;
  transition: color 0.3s;
}
.footer-icp:hover { color: #6a5a42; }
.footer-admin {
  font-size: 11px; color: #3a2a18; cursor: pointer; margin-left: 12px;
  transition: color 0.3s;
}
.footer-admin:hover { color: #6a5a42; }

/* 管理员登录弹窗 */
.admin-login-form { text-align: center; padding: 8px 0; }
.admin-login-form input {
  width: 100%; max-width: 280px; padding: 10px 14px; margin: 6px 0;
  background: #1a1410; border: 1px solid #3a2a1e; border-radius: 6px;
  color: #d4c5a8; font-size: 14px; outline: none; font-family: inherit;
  box-sizing: border-box;
}
.admin-login-form input:focus { border-color: #5a4a32; }
.admin-login-form .admin-btn {
  display: block; width: 100%; max-width: 280px; margin: 10px auto 0;
  padding: 10px; background: #3a2a18; border: 1px solid #5a4a32;
  border-radius: 6px; color: #d4a84b; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: background 0.2s;
}
.admin-login-form .admin-btn:hover { background: #4a3a28; }
.admin-login-form .admin-msg { font-size: 13px; margin-top: 8px; }

/* 道缘榜条目 */
.fate-item {
  padding: 12px; margin-bottom: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid #2a1e12; border-radius: 8px;
}
.fate-item .fate-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fate-item .fate-user { font-size: 13px; color: #d4a84b; }
.fate-item .fate-time { font-size: 11px; color: #5a4a32; }
.fate-item .fate-delete {
  margin-left: auto; font-size: 14px; cursor: pointer; color: #6a4a3a;
  padding: 2px 6px; border-radius: 4px; transition: all 0.2s;
}
.fate-item .fate-delete:hover { color: #c0392b; background: rgba(192,57,43,0.1); }
.fate-item .fate-gua { font-size: 20px; }
.fate-item .fate-name { font-size: 14px; color: #d4c5a8; }
.fate-item .fate-mood { font-size: 13px; color: #8a7a5a; margin-top: 4px; font-style: italic; }
.fate-item .fate-actions { display: flex; gap: 12px; margin-top: 8px; font-size: 12px; }
.fate-item .fate-actions span { cursor: pointer; color: #6a5a42; }
.fate-item .fate-actions span:hover { color: #d4a84b; }
.fate-item .fate-time { font-size: 11px; color: #5a4a32; text-align: right; }

/* 论道堂帖子 */
.forum-post {
  padding: 12px; margin-bottom: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid #2a1e12; border-radius: 8px;
  cursor: pointer;
}
.forum-post:hover { background: rgba(255,255,255,0.04); }
.forum-post .post-title { font-size: 15px; color: #d4c5a8; margin-bottom: 4px; }
.forum-post .post-author { font-size: 12px; color: #8a7a5a; }
.forum-post .post-preview { font-size: 13px; color: #6a5a42; margin-top: 4px; }
.forum-post .post-meta { font-size: 11px; color: #5a4a32; margin-top: 6px; text-align: right; }

/* ===== 模态对话框 ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: rgba(26, 20, 16, 0.97); max-width: 500px; width: 90%;
  border: 1px solid #3a2a18; border-radius: 12px; padding: 24px;
  max-height: 80vh; overflow-y: auto;
  backdrop-filter: blur(8px);
}
.modal-content h2 { color: #d4a84b; text-align: center; margin-bottom: 16px; font-size: 22px; }
.modal-content .modal-body { color: #d4c5a8; font-size: 15px; line-height: 1.8; }
.modal-content .modal-body .gua-result {
  text-align: center; font-size: 64px; margin: 16px 0;
}
.modal-content .modal-body .judgment-label { color: #d4a84b; font-weight: bold; }
.modal-close {
  display: block; margin: 16px auto 0; padding: 10px 30px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #3a2a18; border-radius: 6px;
  color: #d4c5a8; cursor: pointer; font-family: inherit; font-size: 14px;
}
.modal-close:hover { border-color: #d4a84b; }

/* 输入弹窗 */
.modal-input {
  width: 100%; padding: 12px; margin: 12px 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid #3a2a18; border-radius: 8px;
  color: #d4c5a8; font-size: 15px; font-family: inherit; outline: none;
}

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: rgba(26, 20, 16, 0.95);
  border: 1px solid #3a2a18; padding: 10px 24px; border-radius: 20px;
  font-size: 14px; color: #d4c5a8; z-index: 200;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
  backdrop-filter: blur(4px);
}
.toast.show { opacity: 1; }

/* ===== 占卜结果特定样式 ===== */
.coin-scene { text-align: center; padding: 20px 0; }
.coin-result { font-size: 20px; margin: 16px 0; line-height: 2; }

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .main-title { font-size: 32px; letter-spacing: 6px; }
  .action-bar { flex-wrap: wrap; justify-content: center; }
  .action-btn { font-size: 13px; padding: 8px 14px; }
  .modal-content { width: 95%; padding: 16px; }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #1a1410; }
::-webkit-scrollbar-thumb { background: #3a2a18; border-radius: 2px; }

/* ===== 造型选择网格 ===== */
.skin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 8px 0;
}
.skin-card {
  padding: 8px; border: 1px solid #2a1e12; border-radius: 8px;
  transition: all 0.2s; background: rgba(255,255,255,0.02);
}
.skin-card:hover { border-color: #5a4a32; background: rgba(255,255,255,0.05); }
.skin-card.skin-active { border-color: #d4a84b; background: rgba(212,168,75,0.1); }
.skin-card.skin-locked { opacity: 0.5; }
.skin-img { width: 100%; border-radius: 6px; display: block; }

/* ===== 角色创建面板 ===== */
.char-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.75); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.char-panel {
  background: rgba(26, 20, 16, 0.97);
  border: 1px solid #3a2a18; border-radius: 14px;
  padding: 32px; max-width: 400px; width: 90%;
  backdrop-filter: blur(8px); text-align: center;
}
.char-panel h2 { color: #d4a84b; font-size: 24px; margin-bottom: 4px; }
.char-subtitle { color: #8a7a5a; font-size: 13px; margin-bottom: 24px; }
.char-body { text-align: left; }
.char-name-section, .char-gender-section { margin-bottom: 20px; }
.char-name-section label, .char-gender-section label {
  display: block; font-size: 14px; color: #c4a55a; margin-bottom: 8px;
}
.name-input-row {
  display: flex; align-items: center; gap: 8px;
}
.char-input {
  flex: 1; padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #3a2a18; border-radius: 8px;
  color: #d4c5a8; font-size: 16px; font-family: inherit; outline: none;
  transition: all 0.2s;
}
.char-input:focus { border-color: #d4a84b; }
.char-input.locked {
  border-color: #27ae60; background: rgba(39,174,96,0.08);
  color: #27ae60; cursor: default;
}
.char-input.duplicate {
  border-color: #c0392b; background: rgba(192,57,43,0.08);
  color: #c0392b;
}
.char-random-btn {
  padding: 8px 12px; font-size: 18px; white-space: nowrap;
  background: rgba(212,168,75,0.15);
  border: 1px solid #3a2a18; border-radius: 6px;
  color: #d4a84b; cursor: pointer; font-family: inherit;
  transition: all 0.2s; line-height: 1;
}
.char-random-btn:hover { background: rgba(212,168,75,0.3); border-color: #d4a84b; }
.char-name-status {
  font-size: 12px; margin-top: 6px; min-height: 18px;
  color: #8a7a5a;
}
.char-name-status.checking { color: #d4a84b; }
.char-name-status.available { color: #27ae60; }
.char-name-status.unavailable { color: #c0392b; }
.char-confirm-name-btn {
  display: block; width: 100%; margin-top: 8px; padding: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #3a2a18; border-radius: 6px;
  color: #d4c5a8; font-size: 14px; cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.char-confirm-name-btn:hover { border-color: #d4a84b; background: rgba(212,168,75,0.1); }
.char-confirm-name-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.char-confirm-name-btn.done {
  border-color: #27ae60; color: #27ae60;
  background: rgba(39,174,96,0.1); cursor: default;
}
.gender-row { display: flex; gap: 12px; }
.gender-option {
  flex: 1; padding: 10px; text-align: center;
  border: 1px solid #3a2a18; border-radius: 8px;
  cursor: pointer; font-size: 15px; color: #8a7a5a; transition: all 0.2s;
}
.gender-option.active { border-color: #d4a84b; color: #d4a84b; background: rgba(212,168,75,0.1); }
.gender-option:hover { border-color: #5a4a32; }
.char-error {
  color: #c0392b; font-size: 13px; padding: 8px 12px;
  background: rgba(192,57,43,0.08); border-radius: 6px;
  margin-bottom: 12px;
}
.char-confirm-btn {
  width: 100%; padding: 14px; margin-top: 8px;
  background: linear-gradient(135deg, #d4a84b, #b8892a);
  border: none; border-radius: 8px;
  color: #1a1410; font-size: 17px; font-weight: bold;
  cursor: pointer; font-family: inherit; transition: opacity 0.3s;
}
.char-confirm-btn:hover { opacity: 0.9; }
.char-confirm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
