/* 技能库页：扭蛋机（左）+ 软木板收集墙（右）+ 卡片 3D 翻面三行档案 */
/* 页专用变量：软木板底色、四类能力的柔和色（非全站 token） */
:root {
  --pink-soft: #ffe5f1;
  --blue-soft: #e5fdff;
  --yellow-soft: #ffffe5;
  --green-soft: #d4f4dd;
  --cork: #e9d6ac;
}

/* 容器：内容净宽对齐全站 1052px（calc 抵消 .container 的 1.5rem 内边距） */
.myskills-page {
  max-width: calc(var(--content-width) + 3rem);
  padding-bottom: 110px;
}

/* ===== 页头：左标题区 + 右图例 ===== */
.sk-header {
  padding: 0 0 0.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2.5rem;
}

.sk-header-left {
  min-width: 0;
}

.sk-header-right {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex-shrink: 0;
  align-items: flex-end;
}

.sk-kicker {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sk-title {
  display: inline-flex;
  align-items: center;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0.4rem 0 0.5rem;
}

.sk-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
}

/* 图例（页头右侧）：小色点 + 文字，一行，与副标题同一水平线 */
.sk-legend {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: nowrap;
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sk-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.sk-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1.5px solid #000;
  flex-shrink: 0;
}

.sk-legend-dot--ai { background: var(--accent-pink); }
.sk-legend-dot--product { background: var(--accent-blue); }
.sk-legend-dot--data { background: var(--accent-green); }
.sk-legend-dot--lang { background: var(--accent-yellow); }

/* ===== 主体：扭蛋机左 + 软木板右（垂直居中） ===== */
.sk-stage {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 3rem;
  align-items: center;
  margin-top: 2.5rem;
}

/* 左栏：扭蛋机 + 按钮 + 提示 */
.gacha-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.gacha {
  position: relative;
  width: 320px;
  cursor: pointer;
}

.gacha.shake .gacha-ball {
  animation: ball-shake 0.5s;
}

@keyframes ball-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
  75% { transform: rotate(-4deg); }
}

/* 扭蛋机顶部透明球 */
.gacha-ball {
  position: relative;
  width: 250px;
  height: 250px;
  margin: 0 auto;
  border-radius: 50%;
  border: 4px solid #000;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.9), rgba(200, 230, 245, 0.5));
  box-shadow: inset -8px -8px 0 rgba(0, 0, 0, 0.08), 4px 4px 0 0 #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 球内漂浮的技能珠 */
.gacha-dots {
  position: absolute;
  inset: 0;
}

.gacha-dot {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  box-shadow: 1px 1px 0 0 #000;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.gacha-dot:nth-child(1) { left: 16%; top: 28%; background: var(--accent-pink); animation-delay: 0s; }
.gacha-dot:nth-child(2) { left: 42%; top: 12%; background: var(--accent-blue); animation-delay: 0.5s; }
.gacha-dot:nth-child(3) { left: 64%; top: 30%; background: var(--accent-green); animation-delay: 1s; }
.gacha-dot:nth-child(4) { left: 30%; top: 56%; background: var(--accent-yellow); animation-delay: 0.3s; }
.gacha-dot:nth-child(5) { left: 58%; top: 60%; background: var(--pink-soft); animation-delay: 0.8s; }

.gacha-ball-q {
  position: relative;
  z-index: 2;
  font-size: 2.6rem;
  font-weight: 800;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid #000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 0 #000;
}

/* 扭蛋机机身 */
.gacha-body {
  width: 230px;
  height: 150px;
  margin: -8px auto 0;
  background: linear-gradient(180deg, #ff4d4d, #e03e3e);
  border: var(--border-black);
  border-radius: 14px;
  box-shadow: 4px 4px 0 0 #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gacha-brand {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1rem;
}

/* 扭蛋旋钮 */
.gacha-knob {
  position: absolute;
  right: -38px;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid #000;
  background: var(--accent-yellow);
  box-shadow: 3px 3px 0 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  transition: transform 0.3s;
}

.gacha:hover .gacha-knob {
  transform: translateY(-50%) rotate(60deg);
}

/* 扭蛋出口 */
.gacha-exit {
  width: 110px;
  height: 52px;
  margin: -2px auto 0;
  background: #333;
  border: var(--border-black);
  border-radius: 0 0 14px 14px;
  position: relative;
  box-shadow: 2px 2px 0 0 #000;
}

.gacha-exit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0, #000 20%, transparent 60%);
}

/* 蛋掉落动画 */
.gacha-egg {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd6e8);
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 10;
  animation: egg-drop 1s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
}

@keyframes egg-drop {
  0% { transform: translate(-50%, 0); opacity: 1; }
  70% { transform: translate(-50%, 76px); opacity: 1; }
  85% { transform: translate(-50%, 68px) scale(0.94); opacity: 1; }
  100% { transform: translate(-50%, 76px) scale(0.9); opacity: 0; }
}

/* 操作按钮 */
.sk-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.sk-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: var(--border-black);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-card);
  box-shadow: 3px 3px 0 0 #000;
  transition: all 0.15s;
  font-family: inherit;
}

.sk-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 0 #000;
}

.sk-btn--solid {
  background: #000;
  color: #fff;
}

.gacha-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.gacha-hint b {
  color: var(--text-secondary);
}

/* ===== 右栏：软木板收集墙 ===== */
.board-col {
  min-width: 0;
}

.board {
  position: relative;
  background: var(--cork);
  border: var(--border-black);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-offset);
  height: 600px;
  overflow: hidden;
}

/* 软木板颗粒纹理 */
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.06) 1.5px, transparent 1.5px),
    radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 34px 34px, 17px 17px;
  background-position: 0 0, 8px 8px;
}

/* 收集进度贴纸：浅蓝、倾斜，贴在右上角 */
.board-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: var(--accent-blue);
  border: 2px solid #000;
  border-radius: 12px;
  box-shadow: 3px 3px 0 0 #000;
  padding: 0.55rem 0.9rem;
  transform: rotate(3deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.board-badge-num {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.board-badge-label {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.55);
}

.board-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  z-index: 1;
}

/* ===== 软木板上的技能卡（3D 翻面） ===== */
.pin-card {
  position: absolute;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-card:hover {
  z-index: 30;
  transform: translateY(-8px) scale(1.06);
}

.pin-card-inner {
  position: relative;
  width: 150px;
  height: 200px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.pin-card.flipped .pin-card-inner {
  transform: rotateY(180deg);
}

.pin-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 2px solid #000;
  border-radius: 12px;
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  padding: 0.6rem;
  animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-in {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.pin-front {
  gap: 0.6rem;
}

.pin-back {
  transform: rotateY(180deg);
  background: #fffdf5;
  gap: 0.55rem;
  text-align: left;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0.7rem;
}

.pin-tape {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  width: 46px;
  height: 16px;
  background: rgba(255, 214, 90, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.15);
  z-index: 3;
}

/* 卡片正面：徽章 + 名称（已去星级，徽章微放大补足重心） */
.medal {
  position: relative;
  width: 66px;
  height: 66px;
}

.medal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 2px 2px 0 0 #000;
  background: radial-gradient(circle at 35% 30%, #fff, #f0f0f0);
}

.medal-ribbon {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 13px;
  background: #ff4d4d;
  border: 2px solid #000;
  clip-path: polygon(0 0, 100% 0, 85% 100%, 50% 70%, 15% 100%);
}

.card-name {
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
}

.card-en {
  font-size: 0.55rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.35;
  word-break: break-word;
  padding: 0 2px;
}

/* 卡片背面：档案区（工具 / 作品 / 成果，字段为空自动隐藏，内容超长可滚动） */
.card-back-title {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  flex-shrink: 0;
}

.card-profile {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.card-profile::-webkit-scrollbar {
  width: 3px;
}

.card-profile::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.card-profile-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-align: left;
}

.card-profile-k {
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #9a9a9a;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.45;
}

.card-profile-v {
  font-size: 0.66rem;
  color: #3a3a3a;
  line-height: 1.45;
  word-break: break-word;
}

.card-back-close {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
  flex-shrink: 0;
}

/* 卡片徽章按类目配色 */
.pin-card--ai .medal-ring { background: radial-gradient(circle at 35% 30%, #ffe5f1, #ffb8d9); }
.pin-card--product .medal-ring { background: radial-gradient(circle at 35% 30%, #e5fdff, #bde7f5); }
.pin-card--data .medal-ring { background: radial-gradient(circle at 35% 30%, #eafff0, #b9f5cb); }
.pin-card--lang .medal-ring { background: radial-gradient(circle at 35% 30%, #ffffe5, #ffe88a); }

/* 移动端：单列堆叠，标题缩号 */
@media (max-width: 880px) {
  .sk-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sk-header-right {
    align-items: flex-start;
  }

  .sk-stage {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .board {
    height: 480px;
  }

  .sk-title {
    font-size: 2.2rem;
  }
}
