/* ============================================
   黑白配色 · 卡片式 · 丝滑交互
   ============================================ */
:root {
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --ink:       #0a0a0a;
  --ink-2:     #1a1a1a;
  --muted:     #6b6b6b;
  --line:      #e5e5e7;
  --line-2:    #d4d4d6;
  --accent:    #0a0a0a;
  --danger:    #b00020;
  --success:   #0a6b3a;
  --warning:   #8a6300;
  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --shadow-h:  0 2px 4px rgba(0,0,0,.06), 0 10px 30px rgba(0,0,0,.08);
  --ease:      cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d4d4d6; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b4b4b6; }

/* ============ 导航（黑色） ============ */
.navbar {
  background: #0a0a0a !important;
  border-bottom: 1px solid #2a2a2a;
  padding: .7rem 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
}
.navbar-brand { color: #fff !important; font-weight: 700; letter-spacing: -.02em; }
.navbar .nav-link {
  color: rgba(255,255,255,.7) !important;
  font-weight: 500;
  padding: .5rem .9rem !important;
  border-radius: 8px;
  transition: all .2s var(--ease);
}
.navbar .nav-link:hover { color: #fff !important; background: rgba(255,255,255,.08); }
.navbar .badge { font-weight: 500; }
.navbar .text-warning { color: #ffd966 !important; }
.navbar-toggler { border-color: rgba(255,255,255,.2); }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ============ 头像 ============ */
.avatar-wrap {
  position: relative;
  width: 120px; height: 120px;
}
.avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  border: 4px solid var(--bg);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  display: block;
}
.avatar-edit {
  position: absolute;
  right: 0; bottom: 0;
  width: 36px; height: 36px;
  background: var(--ink); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: 3px solid #fff;
  transition: all .2s var(--ease);
}
.avatar-edit:hover { background: #2a2a2a; transform: scale(1.1); }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; }

/* 黑色导航下的下拉菜单适配 */
.navbar .dropdown-menu {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.navbar .dropdown-item { color: rgba(255,255,255,.8); }
.navbar .dropdown-item:hover { background: #2a2a2a; color: #fff; }
.navbar .dropdown-divider { border-color: #2a2a2a; }

/* ============ 按钮 ============ */
.btn {
  border-radius: 10px;
  font-weight: 500;
  padding: .5rem 1.1rem;
  transition: all .2s var(--ease);
  border: 1px solid transparent;
}
.btn:active { transform: scale(.97); }

.btn-dark, .btn-primary {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: #fff !important;
}
.btn-dark:hover, .btn-primary:hover {
  background: #2a2a2a !important;
  border-color: #2a2a2a !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.btn-outline-dark {
  color: var(--ink) !important;
  border-color: var(--line-2) !important;
  background: #fff !important;
}
.btn-outline-dark:hover {
  background: var(--ink) !important;
  border-color: var(--ink) !important;
  color: #fff !important;
}

.btn-success { background: var(--success) !important; border-color: var(--success) !important; }
.btn-warning { background: var(--warning) !important; border-color: var(--warning) !important; color: #fff !important; }
.btn-danger  { background: var(--danger) !important;  border-color: var(--danger)  !important; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 卡片基础 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all .25s var(--ease);
}
.card:hover { box-shadow: var(--shadow-h); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  padding: 1rem 1.25rem;
}

/* ============ 状态面板（顶部 - 黑色） ============ */
.status-panel {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  border: 1px solid #0a0a0a;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
.status-panel .avatar {
  width: 56px; height: 56px;
  background: #fff;
  color: #0a0a0a;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 0 0 3px rgba(255,255,255,.1);
}
.status-panel .status-label {
  font-size: .75rem;
  color: rgba(255,255,255,.6);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.status-panel .badge.bg-dark { background: #fff !important; color: #0a0a0a !important; }
.status-panel hr { border-color: rgba(255,255,255,.1); margin: 1rem 0; }
.status-panel .btn-outline-dark {
  color: #fff !important;
  border-color: rgba(255,255,255,.3) !important;
  background: transparent !important;
}
.status-panel .btn-outline-dark:hover {
  background: #fff !important;
  color: #0a0a0a !important;
  border-color: #fff !important;
}
.status-panel .btn-dark {
  background: #fff !important;
  color: #0a0a0a !important;
  border-color: #fff !important;
}
.status-panel .btn-dark:hover {
  background: #e5e5e5 !important;
  border-color: #e5e5e5 !important;
}
.status-panel .fs-5, .status-panel .fs-3 { color: #fff; }

/* ============ 精力条 ============ */
.energy-bar {
  position: relative;
  height: 28px;
  background: rgba(255,255,255,.12);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.15);
}
.energy-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #ffffff 0%, #d0d0d0 100%);
  border-radius: 14px;
  transition: width .5s var(--ease);
}
.energy-text {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  z-index: 2;
  mix-blend-mode: difference;
}

/* ============ Mini 统计卡 ============ */
.mini-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  transition: all .2s var(--ease);
}
.mini-stat:hover { border-color: var(--ink-2); transform: translateY(-2px); }
.mini-stat-label { font-size: .8rem; color: var(--muted); }
.mini-stat-value { font-size: 1.5rem; font-weight: 700; margin-top: 2px; }

/* ============ 活动卡 ============ */
.activity-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.activity-card:hover:not(.locked) {
  border-color: var(--ink);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.activity-card.selected {
  border-color: var(--ink);
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  box-shadow: 0 0 0 4px rgba(0,0,0,.05);
}
.activity-card.selected::before {
  content: '✓';
  position: absolute; top: 10px; right: 12px;
  width: 22px; height: 22px;
  background: var(--ink); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: bold;
  animation: popIn .3s var(--ease);
}
.activity-card.locked { opacity: .55; cursor: not-allowed; }
.activity-card .activity-icon {
  font-size: 2.5rem; line-height: 1;
  color: var(--ink);
  transition: transform .3s var(--ease);
}
.activity-card:hover:not(.locked) .activity-icon { transform: scale(1.1) rotate(-5deg); }
.activity-card .reward { color: var(--muted); }

/* 抖动动画（干活时） */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-2deg); }
  75% { transform: translateX(4px) rotate(2deg); }
}
.activity-card.working { animation: shake .4s var(--ease); border-color: var(--ink); }

/* ============ 浮动金币动画 ============ */
.float-coin {
  position: fixed; pointer-events: none;
  font-weight: 700; font-size: 1.4rem;
  color: var(--ink);
  animation: floatUp 1.2s var(--ease) forwards;
  z-index: 9999;
  text-shadow: 0 0 8px rgba(255,255,255,.8);
}
.float-coin .small { display: block; font-size: .8rem; color: var(--danger); }

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(.7); }
  20% { opacity: 1; transform: translateY(-20px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-90px) scale(.9); }
}

@keyframes popIn {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,.15); }
  50%      { box-shadow: 0 0 0 8px rgba(0,0,0,0); }
}
.pulse { animation: pulse 2s infinite; }

/* ============ Toast 提示 ============ */
.toast-fixed {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 24px; border-radius: 10px;
  font-size: .95rem; font-weight: 500;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastIn .3s var(--ease);
  max-width: 90%;
  text-align: center;
  cursor: pointer;
}
.toast-fixed.error { background: var(--danger); border: 2px solid #fff; }
.toast-fixed.success { background: var(--success); }
.toast-fixed.warn { background: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ 进度条 ============ */
.progress { height: 18px; background: #f0f0f2; border-radius: 9px; overflow: hidden; }
.progress-bar {
  background: var(--ink);
  transition: width .4s var(--ease);
  font-size: .75rem;
  font-weight: 600;
}

/* ============ 表单 ============ */
.form-control, .form-select {
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: .55rem .9rem;
  transition: all .2s var(--ease);
}
.form-control:focus, .form-select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}
.input-group-text { background: var(--bg); border-color: var(--line-2); border-radius: 10px; }

/* ============ 任务卡 ============ */
.task-card { border-left: 4px solid var(--ink); }

/* ============ 模态框 ============ */
.modal-content { border-radius: var(--radius); border: 1px solid var(--line); }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { border-top: 1px solid var(--line); }

/* ============ 表格 ============ */
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .85rem 1rem; }
.table thead th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.table-hover > tbody > tr:hover { --bs-table-hover-bg: var(--bg); }

/* ============ Alert ============ */
.alert { border-radius: var(--radius-sm); border: 1px solid var(--line); }
.alert-light { background: var(--bg); }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .status-panel .row > div { margin-bottom: 12px; }
  .activity-card .activity-icon { font-size: 2rem; }
  .mini-stat-value { font-size: 1.2rem; }
}
