/* 互动面板 */
.social-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 20;
  padding: 0.55rem 1rem;
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.25s;
}

.social-toggle:hover,
.social-toggle.active {
  background: rgba(255, 45, 149, 0.15);
  border-color: rgba(255, 45, 149, 0.45);
  color: var(--neon-pink);
  box-shadow: 0 0 20px rgba(255, 45, 149, 0.25);
}

.social-panel {
  position: fixed;
  top: 4rem;
  right: 1.2rem;
  z-index: 19;
  width: min(92vw, 340px);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

.social-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.social-panel h3 {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--neon-cyan);
  margin-bottom: 0.8rem;
}

.social-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}

#high-five-btn {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.9rem;
  border: 1px solid rgba(255, 230, 0, 0.35);
  border-radius: 8px;
  background: rgba(255, 230, 0, 0.08);
  color: var(--neon-yellow);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#high-five-btn:hover {
  box-shadow: 0 0 16px rgba(255, 230, 0, 0.3);
}

#high-five-btn.bump {
  transform: scale(1.08);
  box-shadow: 0 0 24px rgba(255, 230, 0, 0.5);
}

.mood-row {
  display: grid;
  grid-template-columns: 88px 1fr 28px;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.mood-btn {
  padding: 0.25rem 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: #e0e6f0;
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  transition: background 0.2s;
}

.mood-btn:hover {
  background: rgba(0, 245, 255, 0.12);
}

.mood-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mood-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
  transition: width 0.4s ease;
}

.mood-num {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: right;
}

.message-form {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.message-form label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.message-form input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: #e0e6f0;
  font-family: inherit;
  font-size: 0.75rem;
  outline: none;
}

.message-form input:focus {
  border-color: rgba(0, 245, 255, 0.4);
}

.message-form button {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid rgba(255, 45, 149, 0.35);
  border-radius: 6px;
  background: rgba(255, 45, 149, 0.1);
  color: var(--neon-pink);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.message-form button:hover {
  background: rgba(255, 45, 149, 0.2);
}

/* 弹幕层 */
#danmaku-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  right: -40%;
  white-space: nowrap;
  font-size: 0.85rem;
  text-shadow: 0 0 8px currentColor;
  animation: danmaku-fly linear forwards;
  opacity: 0.85;
}

.dm-nick {
  margin-right: 0.5rem;
  font-weight: 700;
  opacity: 0.9;
}

.dm-text {
  opacity: 0.95;
}

@keyframes danmaku-fly {
  from { transform: translateX(0); }
  to { transform: translateX(-160vw); }
}

body.boot-done .social-toggle {
  opacity: 1;
  pointer-events: auto;
}

body.booting .social-toggle,
body.booting .social-panel,
body.booting #danmaku-layer {
  opacity: 0;
  pointer-events: none;
}

.leaderboard-section,
.achievement-section {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-section h4,
.achievement-section h4 {
  font-size: 0.72rem;
  color: var(--neon-yellow);
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
}

.leaderboard-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.lb-col h4 {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.lb-col ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lb-col li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 0.25rem;
  font-size: 0.65rem;
  padding: 0.2rem 0;
  color: #e0e6f0;
}

.lb-rank {
  color: var(--neon-cyan);
  font-weight: 700;
}

.lb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  color: var(--text-dim);
}

.lb-empty,
.ach-empty {
  font-size: 0.65rem;
  color: var(--text-dim);
  list-style: none;
}

.achievement-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ach-badge {
  display: inline-block;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 230, 0, 0.3);
  background: rgba(255, 230, 0, 0.08);
  color: var(--neon-yellow);
  font-size: 0.62rem;
  cursor: default;
}

.social-toast {
  position: fixed;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 120;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 230, 0, 0.45);
  background: rgba(10, 14, 23, 0.95);
  color: var(--neon-yellow);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
  box-shadow: 0 0 24px rgba(255, 230, 0, 0.2);
}

.social-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .social-toggle {
    top: auto;
    bottom: 1.2rem;
    right: 1rem;
    z-index: 25;
    font-size: 0.72rem;
    padding: 0.5rem 0.85rem;
  }

  .social-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    max-height: 72vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(110%);
    opacity: 1;
    pointer-events: none;
    padding: 1rem 1rem 1.5rem;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  }

  .social-panel.open {
    transform: translateY(0);
    pointer-events: auto;
  }

  .leaderboard-box {
    grid-template-columns: 1fr;
  }

  .message-form input,
  .message-form button,
  #high-five-btn {
    font-size: 16px; /* 防止 iOS 缩放 */
  }
}
