/* css/achievements.css — 隐藏成就：Toast + 抽屉 + 终局卡 + 状态栏按钮
   依赖 css/tokens.css
*/

/* ────────────────────────────────────────────────
   1. 类别色板
   ──────────────────────────────────────────────── */
.cat-milestone { --cat: #4fc3f7; --cat-soft: rgba(79,195,247,0.10); }
.cat-style     { --cat: #ffd54f; --cat-soft: rgba(255,213,79,0.10); }
.cat-drama     { --cat: #ef5350; --cat-soft: rgba(239,83,80,0.10); }
.cat-event     { --cat: #4caf50; --cat-soft: rgba(76,175,80,0.10); }
.cat-easter    { --cat: #ba68c8; --cat-soft: rgba(186,104,200,0.12); }

/* ────────────────────────────────────────────────
   2. Toast 容器 + 单条
   ──────────────────────────────────────────────── */
.ach-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.ach-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3, 12px);
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: var(--sp-3, 12px) var(--sp-4, 16px);
  background: linear-gradient(180deg, var(--bg-2, #10162a) 0%, var(--bg-1, #0a0e1a) 100%);
  border: 1px solid var(--cat, var(--info, #4fc3f7));
  border-radius: var(--r-lg, 10px);
  box-shadow:
    0 16px 40px -12px rgba(0,0,0,0.6),
    0 0 0 1px var(--cat-soft, rgba(79,195,247,0.08)),
    inset 0 1px 0 rgba(255,255,255,0.04);
  color: var(--text-1, #e6ebf5);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ach-toast.show {
  opacity: 1;
  transform: translateX(0);
}
.ach-toast-icon {
  font-size: 20px;
  line-height: 1;
  color: var(--cat, var(--info, #4fc3f7));
  margin-top: 4px;
  filter: drop-shadow(0 0 8px var(--cat-soft, rgba(79,195,247,0.4)));
}
.ach-toast-body { flex: 1; min-width: 0; }
.ach-toast-meta {
  font-size: var(--fs-xs, 11px);
  color: var(--text-3, #5b667f);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.ach-toast-name {
  font-size: var(--fs-h3, 17px);
  color: var(--text-1, #e6ebf5);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}
.ach-toast-desc {
  font-size: var(--fs-sm, 13px);
  color: var(--text-2, #98a3bd);
  line-height: 1.5;
}

/* ────────────────────────────────────────────────
   3. 状态栏「成就」按钮
   ──────────────────────────────────────────────── */
.statusbar .sb-achievements {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(120, 140, 200, 0.06);
  border: 1px solid var(--line, rgba(120,140,200,0.12));
  color: var(--text-2, #98a3bd);
  padding: 4px 10px;
  border-radius: var(--r-sm, 4px);
  font-size: var(--fs-xs, 11px);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
}
.statusbar .sb-achievements:hover {
  border-color: var(--gold, #ffd54f);
  color: var(--gold, #ffd54f);
  background: rgba(255, 213, 79, 0.08);
}
.statusbar .sb-achievements .ach-count {
  color: var(--text-3, #5b667f);
  font-size: 10px;
}

/* ────────────────────────────────────────────────
   4. 终局页「本局解锁」卡片
   ──────────────────────────────────────────────── */
.ach-end-card {
  background: linear-gradient(180deg, var(--bg-2, #10162a) 0%, var(--bg-1, #0a0e1a) 100%);
  border: 1px solid var(--line-strong, rgba(120,140,200,0.22));
  border-radius: var(--r-lg, 10px);
  padding: var(--sp-4, 16px) var(--sp-5, 24px);
  margin-bottom: var(--sp-5, 24px);
  position: relative;
  overflow: hidden;
}
.ach-end-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--gold, #ffd54f) 30%,
    var(--gold, #ffd54f) 70%,
    transparent 100%
  );
  opacity: 0.6;
}
.ach-end-card.empty::before {
  background: linear-gradient(90deg, transparent 0%, var(--text-4, #38415a) 50%, transparent 100%);
}

.ach-end-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3, 12px);
  margin-bottom: var(--sp-3, 12px);
  padding-bottom: var(--sp-3, 12px);
  border-bottom: 1px solid var(--line, rgba(120,140,200,0.12));
}
.ach-end-card.empty .ach-end-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.ach-end-title {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2, 8px);
  font-size: var(--fs-h3, 17px);
  color: var(--text-1, #e6ebf5);
  font-weight: 600;
}
.ach-end-ax { color: var(--gold, #ffd54f); }
.ach-end-card.empty .ach-end-ax { color: var(--text-3, #5b667f); }
.ach-end-sub {
  font-size: var(--fs-xs, 11px);
  color: var(--text-3, #5b667f);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-left: var(--sp-2, 8px);
}
.ach-end-all {
  background: transparent;
  border: 1px solid var(--line, rgba(120,140,200,0.12));
  color: var(--text-2, #98a3bd);
  padding: 4px 10px;
  border-radius: var(--r-sm, 4px);
  font-size: var(--fs-xs, 11px);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.ach-end-all:hover {
  border-color: var(--gold, #ffd54f);
  color: var(--gold, #ffd54f);
}

.ach-end-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3, 12px);
}
.ach-end-item {
  display: flex;
  gap: var(--sp-3, 12px);
  padding: var(--sp-3, 12px);
  background: var(--cat-soft, rgba(79,195,247,0.08));
  border: 1px solid var(--cat, var(--info, #4fc3f7));
  border-radius: var(--r-md, 6px);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ach-end-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -8px var(--cat, var(--info, #4fc3f7));
}
.ach-end-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--cat, var(--info, #4fc3f7));
  margin-top: 2px;
  filter: drop-shadow(0 0 8px var(--cat-soft, rgba(79,195,247,0.5)));
  flex-shrink: 0;
}
.ach-end-body { flex: 1; min-width: 0; }
.ach-end-name {
  font-size: var(--fs-body, 15px);
  font-weight: 600;
  color: var(--text-1, #e6ebf5);
  margin-bottom: 2px;
}
.ach-end-desc {
  font-size: var(--fs-sm, 13px);
  color: var(--text-2, #98a3bd);
  line-height: 1.5;
}

/* ────────────────────────────────────────────────
   5. 抽屉
   ──────────────────────────────────────────────── */
.ach-drawer {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.32s;
}
.ach-drawer.show {
  visibility: visible;
  transition: visibility 0s;
  pointer-events: auto;
}

.ach-drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 15, 0.65);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.32s ease;
}
.ach-drawer.show .ach-drawer-mask { opacity: 1; }

.ach-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--bg-1, #0a0e1a);
  border-left: 1px solid var(--line-strong, rgba(120,140,200,0.22));
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: -16px 0 48px -16px rgba(0, 0, 0, 0.6);
}
.ach-drawer.show .ach-drawer-panel { transform: translateX(0); }

.ach-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4, 16px) var(--sp-5, 24px);
  border-bottom: 1px solid var(--line, rgba(120,140,200,0.12));
  background: var(--bg-2, #10162a);
  flex-shrink: 0;
}
.ach-drawer-title {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3, 12px);
}
.ach-drawer-title h3 {
  margin: 0;
  font-size: var(--fs-h2, 22px);
  color: var(--text-1, #e6ebf5);
  letter-spacing: 0.02em;
}
.ach-drawer-count {
  font-size: var(--fs-xs, 11px);
  color: var(--gold, #ffd54f);
  letter-spacing: 0.05em;
}
.ach-drawer-close {
  background: none;
  border: 1px solid var(--line, rgba(120,140,200,0.12));
  color: var(--text-2, #98a3bd);
  width: 32px;
  height: 32px;
  border-radius: var(--r-md, 6px);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ach-drawer-close:hover {
  border-color: var(--danger, #ef5350);
  color: var(--danger, #ef5350);
  background: rgba(239, 83, 80, 0.08);
}

.ach-drawer-stats {
  padding: var(--sp-2, 8px) var(--sp-5, 24px);
  font-size: var(--fs-xs, 11px);
  color: var(--text-3, #5b667f);
  background: var(--bg-2, #10162a);
  border-bottom: 1px solid var(--line, rgba(120,140,200,0.12));
  letter-spacing: 0.04em;
}

.ach-drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--sp-5, 24px);
}
.ach-drawer-body::-webkit-scrollbar { width: 8px; }
.ach-drawer-body::-webkit-scrollbar-thumb {
  background: rgba(120, 140, 200, 0.18);
  border-radius: 4px;
}

.ach-group {
  margin-top: var(--sp-2, 8px);
}
.ach-cat {
  padding: var(--sp-2, 8px) var(--sp-5, 24px);
  font-size: var(--fs-xs, 11px);
  color: var(--text-3, #5b667f);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--bg-2, #10162a);
  border-top: 1px solid var(--line, rgba(120,140,200,0.12));
  border-bottom: 1px solid var(--line, rgba(120,140,200,0.12));
  position: sticky;
  top: 0;
  z-index: 1;
}

.ach-item {
  display: flex;
  gap: var(--sp-3, 12px);
  padding: var(--sp-3, 12px) var(--sp-5, 24px);
  border-bottom: 1px solid var(--line, rgba(120,140,200,0.12));
  transition: background 0.6s ease;
}
.ach-item.flash {
  background: var(--cat-soft, rgba(79,195,247,0.14));
}
.ach-item-icon {
  font-size: 22px;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}
.ach-item.unlocked .ach-item-icon {
  color: var(--cat, var(--info, #4fc3f7));
  filter: drop-shadow(0 0 6px var(--cat-soft, rgba(79,195,247,0.5)));
}
.ach-item.locked .ach-item-icon {
  color: var(--text-4, #38415a);
}
.ach-item-body { flex: 1; min-width: 0; }
.ach-item-name {
  font-size: var(--fs-body, 15px);
  color: var(--text-1, #e6ebf5);
  font-weight: 600;
  margin-bottom: 4px;
}
.ach-item.locked .ach-item-name {
  color: var(--text-3, #5b667f);
  font-weight: 400;
}
.ach-item-desc {
  font-size: var(--fs-sm, 13px);
  color: var(--text-2, #98a3bd);
  line-height: 1.55;
}
.ach-item.locked .ach-item-desc {
  color: var(--text-3, #5b667f);
  font-style: italic;
}
.ach-item-when {
  font-size: 10px;
  color: var(--text-3, #5b667f);
  margin-top: 6px;
  letter-spacing: 0.05em;
}

.ach-drawer-foot {
  padding: var(--sp-3, 12px) var(--sp-5, 24px);
  border-top: 1px solid var(--line, rgba(120,140,200,0.12));
  background: var(--bg-2, #10162a);
  flex-shrink: 0;
}
.ach-reset {
  background: transparent;
  border: 1px solid var(--line, rgba(120,140,200,0.12));
  color: var(--text-3, #5b667f);
  padding: 6px 14px;
  border-radius: var(--r-sm, 4px);
  font-size: var(--fs-xs, 11px);
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.ach-reset:hover {
  border-color: var(--danger, #ef5350);
  color: var(--danger, #ef5350);
  background: rgba(239, 83, 80, 0.06);
}

/* ────────────────────────────────────────────────
   6. 移动适配
   ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .ach-toast-container { top: 12px; right: 12px; left: 12px; }
  .ach-toast { width: 100%; }
  .ach-drawer-panel { width: 100vw; max-width: 100vw; }
  .ach-drawer-head { padding: var(--sp-3, 12px) var(--sp-4, 16px); }
  .ach-drawer-stats { padding: var(--sp-2, 8px) var(--sp-4, 16px); }
  .ach-cat { padding: var(--sp-2, 8px) var(--sp-4, 16px); }
  .ach-item { padding: var(--sp-3, 12px) var(--sp-4, 16px); }
  .ach-end-list { grid-template-columns: 1fr; }
  .ach-end-card { padding: var(--sp-3, 12px) var(--sp-4, 16px); }
}
