/* 索引云 · 成就中心样式
   ① 解锁提示 .ach-toast（从屏幕中上方滑下来）
   ② 成就面板 .ach-panel（放进浮窗里） */

/* ============================ 解锁提示 ============================ */
.ach-toast {
  position: fixed;
  /* ⚠️ 页面有滚动条时 left:50% 是按「含滚动条」的宽度算的，会向右偏几像素。
     所以横向位置由 JS 用 --ach-cx 这个变量给（按不含滚动条的宽度算），
     这里只兜底一个 50%。 */
  left: var(--ach-cx, 50%);
  /* ⚠️ 要落在顶栏下面：提示压在顶栏上会把它的按钮挡住（点不动）。
     顶栏是「浮动 + 自动收起」的，平时缩在屏幕外、碰它才滑下来，
     所以纵向位置由 JS 按顶栏的**完整高度**算（见 achievements.js 的注释），
     这里只兜底一个值。 */
  top: var(--ach-ty, 74px);
  z-index: var(--z-toast, 2000);            /* 要压在浮窗和抽屉之上 */
  width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, var(--ach-hide, -140%));
  opacity: 0;
  pointer-events: none;     /* 默认不挡鼠标 */
  transition: transform .42s cubic-bezier(.22, 1.1, .3, 1), opacity .3s;
}
.ach-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}
.ach-toast.out {
  transform: translate(-50%, var(--ach-hide, -140%));
  opacity: 0;
  transition: transform .34s cubic-bezier(.5, 0, .7, .2), opacity .28s;
}

.ach-toast-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px 17px;
  background: linear-gradient(135deg, #fffdf6 0%, #fff9ec 100%);
  border: 1px solid #f0dcae;
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(120, 84, 12, .18),
              0 3px 10px rgba(120, 84, 12, .10),
              0 0 0 1px rgba(255, 255, 255, .7) inset;
  overflow: hidden;
}
/* 左侧那条金色细边，让提示有"奖"的感觉 */
.ach-toast-inner::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #e8b23a, #d99a1c);
}

.ach-toast-icon {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  line-height: 1;
  background: linear-gradient(150deg, #fde9b8, #f7d27a);
  box-shadow: 0 3px 9px rgba(180, 128, 20, .22), 0 0 0 1px rgba(210, 160, 50, .3) inset;
  animation: achPop .5s cubic-bezier(.34, 1.56, .64, 1) .12s backwards;
}
@keyframes achPop {
  from { transform: scale(.4) rotate(-14deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.ach-toast-main { min-width: 0; flex: 1; }
.ach-toast-kicker {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #b07d12;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.ach-toast-star { font-size: 12px; }
.ach-toast-name {
  font-size: 16px;
  font-weight: 700;
  color: #6b4a06;
  line-height: 1.3;
  margin-bottom: 3px;
}
.ach-toast-desc {
  font-size: 12.5px;
  color: #9a7b3c;
  line-height: 1.5;
}

/* 底部那根进度条：展示"还能看多久"，到点自动收 */
.ach-toast-bar {
  position: absolute;
  left: 0; bottom: 0;
  height: 2.5px;
  width: 100%;
  background: linear-gradient(90deg, #e8b23a, #f3cd6d);
  transform-origin: left center;
  transform: scaleX(0);
}
@keyframes achToastBar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* 不同分类给一点点色调差异（主要还是金色，只微调） */
.ach-toast[data-cat="study"] .ach-toast-icon { background: linear-gradient(150deg, #dceafa, #b7d4f5); box-shadow: 0 3px 9px rgba(24, 95, 165, .2); }
.ach-toast[data-cat="habit"] .ach-toast-icon { background: linear-gradient(150deg, #d8f2e6, #a9e2c9); box-shadow: 0 3px 9px rgba(29, 158, 117, .2); }
.ach-toast[data-cat="explore"] .ach-toast-icon { background: linear-gradient(150deg, #e6e2fb, #c9c0f2); box-shadow: 0 3px 9px rgba(97, 79, 190, .2); }
.ach-toast[data-cat="challenge"] .ach-toast-icon { background: linear-gradient(150deg, #fde4da, #f7bfa6); box-shadow: 0 3px 9px rgba(196, 92, 54, .2); }
.ach-toast[data-cat="special"] .ach-toast-icon { background: linear-gradient(150deg, #fdf0cf, #f5d98d); box-shadow: 0 3px 9px rgba(190, 145, 40, .2); }

/* ============================ 成就面板 ============================ */
.ach-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

/* ---------- 顶部总览 ---------- */
.ach-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fffdf7 0%, #fff8ea 100%);
  border-bottom: 1px solid #f0e2c4;
}
.ach-headline { display: flex; align-items: center; gap: 13px; min-width: 0; }
.ach-headicon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px;
  background: linear-gradient(150deg, #fde9b8, #f5cd6d);
  box-shadow: 0 3px 10px rgba(180, 128, 20, .22);
}
.ach-headtitle { display: block; font-size: 17px; font-weight: 700; color: #4a3708; line-height: 1.35; }
.ach-headsub { display: block; font-size: 12.5px; color: #9a7b3c; margin-top: 2px; }

.ach-overall { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.ach-overall-num { font-size: 13px; color: #9a7b3c; white-space: nowrap; }
.ach-overall-num b { font-size: 22px; color: #6b4a06; font-weight: 700; }
.ach-overall-ring {
  width: 62px; height: 8px;
  border-radius: 4px;
  background: #f0e2c4;
  overflow: hidden;
}
.ach-overall-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #e8b23a, #f3cd6d);
  transition: width .5s var(--ease, cubic-bezier(.32,.72,.28,1));
}

/* ---------- 筛选 ---------- */
.ach-filters {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.ach-chips { display: flex; gap: 7px; flex-wrap: wrap; }

/* 搜索框：100 个成就，光靠分类筛不够用 */
.ach-search {
  flex: 1 1 180px;
  min-width: 150px;
  max-width: 260px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.ach-search::placeholder { color: var(--text-3); }
.ach-search:focus { border-color: var(--brand); background: var(--surface); }
.ach-chip {
  height: 31px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  transition: border-color .12s, background .12s, color .12s;
}
.ach-chip:hover { border-color: var(--line-strong); color: var(--text); }
.ach-chip i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.ach-chip.on {
  background: #fdf4e0;
  border-color: #e8c476;
  color: #8a6410;
  font-weight: 600;
}
.ach-chip.on i { color: #b07d12; }

/* ---------- 成就网格 ---------- */
.ach-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 26px; }
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 12px;
}

.ach-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.ach-item:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
/* 拿到的成就：金色描边 + 微微的金光 */
.ach-item.got {
  border-color: #e8c476;
  background: linear-gradient(150deg, #fffdf7 0%, #fffaf0 100%);
  box-shadow: 0 1px 2px rgba(180, 128, 20, .07);
}
.ach-item.got:hover { box-shadow: 0 6px 16px rgba(180, 128, 20, .14); }

.ach-item-icon {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  line-height: 1;
  background: var(--surface-2);
  /* 没拿到的：图标灰掉、去饱和 */
  filter: grayscale(1) opacity(.42);
  transition: filter .2s, background .2s;
}
.ach-item.got .ach-item-icon {
  filter: none;
  background: linear-gradient(150deg, #fde9b8, #f5cd6d);
  box-shadow: 0 2px 7px rgba(180, 128, 20, .2);
}

.ach-item-main { min-width: 0; flex: 1; }
.ach-item-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-2);
}
.ach-item.got .ach-item-name { color: #6b4a06; }
.ach-item-badge {
  font-size: 11px;
  color: #fff;
  background: #1d9e75;
  width: 15px; height: 15px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ach-item-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin-top: 3px;
}
.ach-item.got .ach-item-desc { color: #a08551; }

/* 计数型成就的进度条 */
.ach-item-prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ach-item-progbar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.ach-item-progfill {
  height: 100%;
  border-radius: 3px;
  background: var(--brand);
  transition: width .4s var(--ease, cubic-bezier(.32,.72,.28,1));
}
.ach-item-prog span {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.ach-item-time {
  font-size: 11.5px;
  color: #b07d12;
  margin-top: 7px;
  opacity: .9;
}

/* 右上角那个小小的分类角标 */
.ach-item-cat {
  position: absolute;
  right: 11px; top: 10px;
  font-size: 13px;
  opacity: .35;
}
.ach-item.got .ach-item-cat { opacity: .55; }

.ach-empty {
  grid-column: 1 / -1;
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}

/* 面板被塞进浮窗时的容器样式 */
.wb-panel-el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.wb-panel-el.hidden { display: none !important; }

/* ============================ 顶栏的奖杯按钮 ============================ */
/* 复用 .wb-launch-btn 的骨架（.wb-achv-btn），只是里面换成图标 */
.wb-achv-btn {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  transition: background .12s, border-color .12s, transform .12s;
}
.wb-achv-btn:hover { background: var(--surface-2); border-color: var(--line); }
.wb-achv-btn:active { transform: scale(.94); }
.wb-achv-btn.on { background: #fdf4e0; border-color: #e8c476; }
/* 有新成就没看过时点一个小红点 */
.wb-achv-btn.has-new { position: relative; }
.wb-achv-btn.has-new::after {
  content: '';
  position: absolute;
  right: 4px; top: 4px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--surface);
}

@media (max-width: 720px) {
  .ach-toast { top: 12px; }
  .ach-toast-icon { width: 44px; height: 44px; font-size: 23px; }
  .ach-toast-name { font-size: 15px; }
  .ach-head { padding: 14px 16px; }
  .ach-filters { padding: 10px 16px; }
  .ach-body { padding: 14px 16px 22px; }
  .ach-grid { grid-template-columns: 1fr; }
  .ach-overall-ring { display: none; }
}
