:root {
  --bg: #111318;
  --bg-surface: #191c24;
  --bg-elevated: #1f2330;
  --bg-hover: #262a38;
  --bg-card: #1f2330;
  --border: #2a2f40;
  --border-light: #353b50;
  --text: #e8eaf0;
  --text-secondary: #a0a5b8;
  --text-muted: #636880;
  --accent: #5b8def;
  --accent-hover: #4a7de0;
  --accent-dim: rgba(91,141,239,0.12);
  --green: #34d399;
  --green-dim: rgba(52,211,153,0.12);
  --orange: #f59e0b;
  --orange-dim: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --chat-self: #2a3a5c;
  --chat-other: #252833;
  --radius: 10px;
  --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* ===== 页面切换 ===== */
.page {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  width: 100%;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
  pointer-events: none;
}
.page.active {
  opacity: 1;
  visibility: visible;
  position: relative;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================
   首页
   ============================ */
.home-page {
  padding: 0 24px;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
/* ===== 全局顶部账号栏 ===== */
.global-header {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  padding: 12px 16px;
}
.global-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-left: auto;
  /* UX-013: 增大点击区域 */
  padding: 8px;
  margin-left: auto;
  box-sizing: content-box;
}
.global-avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.account-dropdown {
  display: none;
  position: absolute;
  top: 48px;
  right: 16px;
  width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  overflow: hidden;
  z-index: 200;
  animation: dropdownIn 0.15s ease;
}
.account-dropdown.show { display: block; }
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.account-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.account-dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.account-dropdown-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.account-dropdown-item {
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s;
}
.account-dropdown-item:hover {
  background: var(--bg-hover);
}
.account-dropdown-item.logout {
  color: var(--red);
}
.account-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ===== 后台管理 ===== */
.admin-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-stat-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}
.admin-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}
.admin-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.admin-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.admin-list-item:last-child { border-bottom: none; }
.admin-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
}
.admin-badge.pending { background: #fef3c7; color: #d97706; }
.admin-badge.failed { background: #fee2e2; color: #dc2626; }

.home-brand {
  text-align: center;
}
.home-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(91,141,239,0.2);
}
.home-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.home-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 6px;
}
.home-search {
  width: 100%;
  position: relative;
}
.home-search input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.home-search input:focus { border-color: var(--accent); }
.home-search input::placeholder { color: var(--text-muted); }
.home-search .icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.home-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.home-tag {
  padding: 7px 15px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.home-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.home-profile-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}
.home-profile-link:hover { color: var(--text-secondary); }
.home-profile-icon { font-size: 16px; }
.home-user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.home-user-info { flex: 1; }
.home-user-actions {
  display: flex;
  gap: 6px;
}
.home-user-action {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.home-user-action:hover { background: var(--bg-hover); color: var(--text-secondary); }
.auth-page {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}
.auth-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-primary);
}
.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim, rgba(99,102,241,0.2)); }
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-switch span {
  color: var(--accent);
  cursor: pointer;
}
.auth-switch span:hover { text-decoration: underline; }
.auth-error {
  color: var(--red);
  font-size: 13px;
  text-align: left;
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  display: none;
  animation: shake 0.3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.home-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.home-user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================
   加载页
   ============================ */
.loading-page {
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--text-muted); }

/* ============================
   游戏页 - 办公软件风格
   ============================ */
.game-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}

/* -- 顶栏 -- */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.game-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.game-topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  position: relative;
}
.game-topbar-info {}
.game-topbar-name { font-size: 14px; font-weight: 600; }
.game-topbar-role { font-size: 11px; color: var(--text-muted); }
.game-topbar-actions {
  display: flex;
  gap: 4px;
}
.topbar-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--accent); }

/* -- 主体区域 -- */
.game-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* -- 侧边栏（TODO + 人物） -- */
.game-sidebar {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: var(--bg-surface);
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0s 0.3s;
  pointer-events: none;
}
.game-sidebar.open {
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0s 0s;
  pointer-events: auto;
}
.member-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 280px;
  z-index: 20;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  flex-direction: column;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0s 0.3s;
  pointer-events: none;
}
.member-panel.open {
  display: flex;
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0s 0s;
  pointer-events: auto;
}
.member-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.member-panel-title { font-size: 14px; font-weight: 500; }
.member-list { flex: 1; overflow-y: auto; padding: 8px 0; }
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title { font-size: 15px; font-weight: 600; }
.sidebar-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* TODO 列表 */
.todo-list { padding: 12px 16px; flex: 1; overflow-y: auto; }

/* 用户身份卡 */
.my-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.my-profile-card .sidebar-close {
  position: static;
  margin-left: auto;
}
.my-profile-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.my-profile-info {}
.my-profile-name { font-size: 14px; font-weight: 600; }
.my-profile-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.my-profile-desc {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
}
.todo-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 2px;
}
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.todo-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.todo-check.done {
  background: var(--accent);
  border-color: var(--accent);
}
.todo-check.done::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.todo-content { flex: 1; }
.todo-text { font-size: 13px; line-height: 1.5; }
.todo-text.done { color: var(--text-muted); text-decoration: line-through; }
.todo-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.todo-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 6px;
}
.todo-tag.urgent { background: var(--red-dim); color: var(--red); }
.todo-tag.normal { background: var(--orange-dim); color: var(--orange); }
.todo-tag.low { background: var(--accent-dim); color: var(--accent); }

/* 人物列表 */
.people-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.people-section-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.people-list { display: flex; flex-direction: column; gap: 4px; }
.person-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.person-item:hover { background: var(--bg-hover); }
.person-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.person-info { flex: 1; }
.person-name { font-size: 13px; font-weight: 500; }
.person-role { font-size: 11px; color: var(--text-muted); }

/* -- 群聊区域 -- */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-title {
  font-size: 14px;
  font-weight: 600;
}
.chat-header-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.chat-header-right {
  display: flex;
  gap: 4px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* 消息气泡 */
.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.chat-msg.visible {
  opacity: 1;
  transform: translateY(0);
}
.chat-msg.self { margin-left: auto; flex-direction: row-reverse; }
.chat-msg-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s;
}
.chat-msg-avatar:hover { transform: scale(1.1); }
.chat-msg-body {}
.chat-msg-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.chat-msg.self .chat-msg-name { text-align: right; }
.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.chat-msg:not(.self) .chat-msg-bubble {
  background: var(--chat-other);
  border-top-left-radius: 4px;
}
.chat-msg.self .chat-msg-bubble {
  background: var(--chat-self);
  border-top-right-radius: 4px;
}
.chat-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}
.chat-msg.self .chat-msg-time { text-align: right; }

/* 系统消息 */
.chat-system {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

/* -- 选项区域（在聊天流内） -- */
.chat-options {
  padding: 4px 0 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.chat-options.visible {
  opacity: 1;
  transform: translateY(0);
}
.chat-options-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}
.chat-option-item {
  display: block;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px);
}
.chat-option-item.visible {
  opacity: 1;
  transform: translateY(0);
}
.chat-option-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.chat-option-item:active { transform: scale(0.98); }
.chat-option-item.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  opacity: 0.7;
}

/* -- 悬浮人物卡 -- */
.person-tooltip {
  display: none;
  position: fixed;
  z-index: 50;
  width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: tooltipIn 0.15s ease;
}
.person-tooltip.show { display: block; }
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.tooltip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.tooltip-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.tooltip-name { font-size: 14px; font-weight: 600; }
.tooltip-role { font-size: 11px; color: var(--text-muted); }
.tooltip-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.tooltip-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.tooltip-trait {
  padding: 2px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================
   暂停菜单
   ============================ */
.pause-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.pause-overlay.active { display: flex; }
.pause-menu {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 280px;
}
.pause-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.pause-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.pause-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.pause-btn.danger { color: var(--red); }
.pause-btn.danger:hover { border-color: var(--red); background: var(--red-dim); }

/* ============================
   结果页
   ============================ */
.result-page {
  padding: 20px;
  gap: 16px;
}
.result-header {
  font-size: 18px;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.result-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.result-block-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.result-eval-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}
.result-method-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(91,141,239,0.25);
  border-radius: 16px;
  font-size: 12px;
  color: var(--accent);
  margin-top: 8px;
}
.radar-wrap { display: flex; justify-content: center; padding: 12px 0; }
.reflection-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
}
.reflection-textarea:focus { border-color: var(--accent); }
.reflection-textarea::placeholder { color: var(--text-muted); }

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--text-muted); }

/* ============================
   档案页
   ============================ */
.profile-page {
  padding: 20px;
  gap: 16px;
}
.profile-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.back-btn {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}
.profile-title { font-size: 16px; font-weight: 600; }
.compare-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.compare-item { text-align: center; flex: 1; }
.compare-val { font-size: 22px; font-weight: 700; }
.compare-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.compare-arrow { font-size: 18px; color: var(--green); }
.recommend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.recommend-name { font-size: 13px; font-weight: 500; }
.recommend-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-high { background: var(--green-dim); color: var(--green); }
.badge-mid { background: var(--orange-dim); color: var(--orange); }
.badge-low { background: var(--red-dim); color: var(--red); }
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.history-left { display: flex; align-items: center; gap: 10px; }
.history-icon {
  width: 32px; height: 32px;
  background: var(--accent-dim);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.history-job { font-size: 13px; font-weight: 500; }
.history-date { font-size: 11px; color: var(--text-muted); }
.history-score { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ============================
   分享页
   ============================ */
.share-page {
  padding: 20px;
  gap: 16px;
}
.share-card {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.share-card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.share-rank-text { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.share-rank-text span { color: var(--accent); font-weight: 700; font-size: 18px; }
.share-qr {
  width: 72px; height: 72px;
  background: #fff;
  border-radius: 8px;
  margin: 12px auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 10px;
}
.share-actions { display: flex; gap: 8px; margin-top: 16px; }
.share-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.share-btn:hover { border-color: var(--accent); }
.share-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== 底部导航 ===== */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: color 0.15s;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-icon { font-size: 18px; }
.bottom-nav-label { font-size: 10px; }

/* 收件箱已读标记 */
.inbox-mark-read {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  flex-shrink: 0;
}
.inbox-mark-read:hover {
  background: var(--accent-dim);
}
.inbox-read-badge {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 4px 8px;
  flex-shrink: 0;
}

/* ===== 评分弹窗 ===== */
#rating-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.rating-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  max-width: 320px;
  width: 90%;
}
.rating-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.rating-star {
  font-size: 32px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
}
.rating-star:hover {
  transform: scale(1.2);
}
.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-danger:hover {
  opacity: 0.85;
}

/* ===== 收件箱 ===== */
.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item.unread { background: var(--accent-dim); }
.inbox-icon {
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.inbox-content { flex: 1; }
.inbox-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.inbox-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.inbox-time { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.inbox-dot {
  position: absolute;
  top: 14px; right: 12px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

/* ===== UX-012: Toast 提示 ===== */
.toast-msg {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-card);
  color: var(--text);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  opacity: 0;
  transition: all 0.3s;
  z-index: 500;
  pointer-events: none;
}
.toast-msg.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== UX-007: 侧边栏遮罩 ===== */
.sidebar-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  pointer-events: none;
}
.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s 0s;
  pointer-events: auto;
}
/* UX-003: 遮罩关闭提示 */
.sidebar-backdrop.active::after {
  content: '点击空白处关闭';
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  padding: 6px 14px;
  background: rgba(0,0,0,0.5);
  border-radius: 14px;
  pointer-events: none;
}

/* ===== UX-017: 输入框焦点增强 ===== */
input:focus, textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-dim, rgba(99,102,241,0.2));
}

/* ===== UX-020: 音效按钮 ===== */
.sound-toggle {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.sound-toggle:hover { opacity: 1; }

/* FIX-07: 新手引导弹窗 */
.onboarding-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.onboarding-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* UX-007: 选项数字键前缀 */
.option-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 10px;
  flex-shrink: 0;
}
.chat-option-item:hover .option-key {
  background: var(--accent);
  color: #fff;
}

