/* 终局：满屏充值 + 歌姬淹没 */

.toast-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.toast-actions .hub-ghost,
.toast-actions .hub-primary {
  flex: 1;
}

.hub-ghost {
  border: 1px solid #ddd;
  background: #fff;
  color: #444;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  cursor: pointer;
}

.hub-ghost:hover {
  border-color: #ff4d8f;
  color: #ff4d8f;
}

/* —— 满屏充值 spam —— */
.spam-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  pointer-events: auto;
}

.spam-root.is-on {
  display: block;
}

.spam-card {
  position: absolute;
  width: min(280px, 78vw);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  padding: 12px 14px 14px;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.25s ease, transform 0.25s ease;
  border: 1px solid #ffe0ec;
}

.spam-card.is-in {
  opacity: 1;
  transform: scale(1);
}

.spam-card.is-shake {
  animation: spam-shake 0.35s ease;
}

@keyframes spam-shake {
  0%,
  100% {
    translate: 0 0;
  }
  25% {
    translate: -6px 2px;
  }
  50% {
    translate: 6px -2px;
  }
  75% {
    translate: -4px -3px;
  }
}

.spam-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #ff4d8f;
  font-weight: 700;
  margin-bottom: 6px;
}

.spam-x {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.spam-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: #222;
}

.spam-card p {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.45;
}

.spam-pay {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 9px 12px;
  background: linear-gradient(90deg, #ff4d8f, #ff7aa8);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.spam-escape {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100000;
}

.spam-escape button {
  border: none;
  background: #111;
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.spam-escape button:hover {
  background: #ff2d55;
}

/* —— 歌姬淹没终局 —— */
.ending-stage {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

.ending-stage.on-explore {
  /* 轻罩一层，周榜仍可见 */
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: none;
}

.ending-stage[hidden] {
  display: none !important;
}

.ending-stage.is-on {
  display: flex;
  pointer-events: auto;
}

.ending-hero {
  max-width: min(720px, 88vw);
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.82) translateY(24px);
  transition: opacity 1.1s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.35));
  z-index: 1;
  pointer-events: none;
}

.ending-hero.is-in {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.ending-text-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.geji-text {
  position: absolute;
  white-space: nowrap;
  line-height: 1.1;
  user-select: none;
  will-change: opacity, transform;
}

.ending-exit-veil {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
}

.ending-stage.is-flooded .ending-hero {
  filter: brightness(0.35) saturate(0.6);
  transition: filter 1.2s ease;
}

.ending-stage.is-exit .ending-exit-veil {
  opacity: 1;
}

.site-user {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.ending-hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #ff4d8f;
}

/* 假卡死 */
.freeze-veil {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99980;
  background: rgba(245, 245, 245, 0.72);
  backdrop-filter: blur(1px);
  align-items: center;
  justify-content: center;
  cursor: wait;
  user-select: none;
}

.freeze-veil.is-on {
  display: flex;
}

.freeze-box {
  text-align: center;
  padding: 28px 32px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  max-width: 360px;
}

.freeze-spin {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid #eee;
  border-top-color: #ff4d8f;
  border-radius: 50%;
  animation: freeze-spin 0.9s linear infinite;
}

@keyframes freeze-spin {
  to {
    transform: rotate(360deg);
  }
}

.freeze-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #222;
}

.freeze-sub {
  margin: 0;
  font-size: 0.88rem;
  color: #666;
  line-height: 1.55;
}

.freeze-tiny {
  margin: 14px 0 0;
  font-size: 0.72rem;
  color: #bbb;
  font-family: "IBM Plex Mono", monospace;
}

/* 刷新后轻推头像 */
.avatar-soft-pulse {
  animation: soft-pulse 1.2s ease-in-out 2;
}

@keyframes soft-pulse {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 0 3px rgba(255, 77, 143, 0.35);
  }
}

#btn-site-avatar.avatar-soft-pulse .user-face,
.avatar-btn .user-face.avatar-soft-pulse,
.avatar-soft-pulse .user-face {
  animation: soft-pulse 1.2s ease-in-out 2;
}

.avatar-soft-tip {
  position: fixed;
  z-index: 90;
  background: #333;
  color: #eee;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  white-space: nowrap;
}

.avatar-soft-tip.is-on {
  opacity: 0.92;
}

.avatar-soft-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 14px;
  border: 5px solid transparent;
  border-bottom-color: #333;
}

/* —— 终局分支引擎 UI —— */
.ending-route-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99985;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

.ending-route-root.is-on {
  display: flex;
}

.er-panel {
  background: #fff;
  border-radius: 16px;
  padding: 22px 22px 18px;
  width: min(440px, 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: er-pop 0.28s ease;
}

@keyframes er-pop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.er-panel h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.er-body {
  margin: 0 0 16px;
  color: #555;
  line-height: 1.55;
  font-size: 0.92rem;
}

.er-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.er-actions-float {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 99999;
  background: rgba(255, 255, 255, 0.95);
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

.er-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  flex: 1;
  min-width: 110px;
}

.er-primary {
  background: #ff4d8f;
  color: #fff;
  font-weight: 700;
}

.er-danger {
  background: #222;
  color: #fff;
}

.er-muted {
  background: #f0f0f0;
  color: #444;
}

.er-huge {
  background: #ff4d8f;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  padding: 14px;
  flex: 1 1 100%;
}

.er-entry {
  width: min(560px, 100%);
}

.er-entry-grid {
  display: grid;
  gap: 10px;
}

.er-entry-card {
  text-align: left;
  border: 1px solid #eee;
  background: #fafafa;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.er-entry-card strong {
  font-size: 1rem;
  color: #222;
}

.er-entry-card span {
  font-size: 0.78rem;
  color: #999;
}

.er-entry-card.er-primary:hover {
  border-color: #ff4d8f;
  background: #fff0f6;
}

.er-entry-card.er-danger:hover {
  border-color: #333;
  background: #f5f5f5;
}

.er-entry-card.er-muted:hover {
  border-color: #aaa;
}

.er-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 22px 20px 28px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.er-drawer.is-in {
  transform: translateY(0);
}

.er-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.er-steps i {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: #eee;
}

.er-steps i.on {
  background: #ff4d8f;
}

.er-clauses {
  max-height: 180px;
  overflow: auto;
  background: #f7f7f7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: #555;
  line-height: 1.5;
}

.er-clauses p {
  margin: 0 0 8px;
}

.er-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  cursor: pointer;
}

.er-check.is-shake {
  animation: spam-shake 0.35s ease;
}

.er-terminal {
  background: #0d1117;
  color: #c9d1d9;
  border-radius: 12px;
  width: min(520px, 100%);
  overflow: hidden;
  font-family: "IBM Plex Mono", monospace;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.er-term-bar {
  background: #161b22;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #8b949e;
}

.er-term-body {
  padding: 12px 14px;
  min-height: 160px;
  font-size: 0.82rem;
  line-height: 1.6;
}

.er-term-body .err {
  color: #ff7b72;
}

.er-term-body .warn {
  color: #d29922;
}

.er-term-body .ok {
  color: #3fb950;
}

.er-terminal .er-actions {
  padding: 10px 12px 14px;
  background: #161b22;
}

.er-prog {
  height: 10px;
  background: #eee;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}

.er-prog i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff4d8f, #ff8fb8);
  width: 92%;
  transition: width 0.12s linear;
}

.er-prog-label {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 12px;
  font-family: "IBM Plex Mono", monospace;
}

.er-shatter-wrap {
  width: min(480px, 100%);
  text-align: center;
  color: #fff;
}

.er-shatter-wrap h2 {
  margin: 0 0 8px;
}

.er-shatter-wrap .er-body {
  color: #ddd;
}

.er-shards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.er-shard {
  border: none;
  background: #fff;
  color: #ff2d55;
  font-weight: 800;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  cursor: pointer;
  transform: rotate(var(--rot)) translate(var(--dx), var(--dy));
  animation: er-shard-in 0.35s ease both;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

@keyframes er-shard-in {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(0);
  }
}

.er-shard.is-gone {
  opacity: 0;
  transform: scale(0.2);
  transition: 0.25s ease;
  pointer-events: none;
}

.er-notify-stack {
  position: fixed;
  right: 16px;
  bottom: 90px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, calc(100vw - 32px));
  z-index: 99986;
}

.er-notify {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateX(40px);
  transition: 0.3s ease;
}

.er-notify.is-in {
  opacity: 1;
  transform: none;
}

.er-n-app {
  font-size: 0.72rem;
  color: #ff4d8f;
  font-weight: 700;
  margin-bottom: 4px;
}

.er-notify h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.er-notify p {
  margin: 0;
  font-size: 0.82rem;
  color: #666;
}

.er-cs {
  background: #fff;
  border-radius: 16px;
  width: min(400px, 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 520px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.er-cs-head {
  background: #ff4d8f;
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
}

.er-cs-body {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  background: #f5f5f5;
  min-height: 220px;
}

.er-typing {
  font-size: 0.8rem;
  color: #999;
  margin: 6px 0;
}

.er-cs-msg {
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 8px 0;
  max-width: 85%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.er-cs-msg strong {
  display: block;
  font-size: 0.72rem;
  color: #ff4d8f;
  margin-bottom: 2px;
}

.er-cs .er-actions {
  padding: 10px 12px 14px;
  background: #fff;
  border-top: 1px solid #eee;
}

.er-chase {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.er-hijack-input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.er-hijack-out {
  background: #fff0f6;
  color: #ff4d8f;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.er-voice-bar {
  width: 100%;
  border: 1px solid #eee;
  background: #f8f8f8;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 12px;
}

.er-wave {
  width: 48px;
  height: 24px;
  background: repeating-linear-gradient(
    90deg,
    #ff4d8f 0 3px,
    transparent 3px 6px
  );
  border-radius: 4px;
  opacity: 0.7;
}

.er-voice-flash {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 3rem;
  font-weight: 900;
  color: #ff0022;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 24px #ff0022;
  transition: 0.35s ease;
}

.er-voice-flash.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

.er-voice {
  position: relative;
}

.er-converge {
  width: min(560px, 100%);
}

.er-conv-grid {
  display: grid;
  gap: 10px;
}

.er-conv-card {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fafafa;
}

.er-conv-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.er-conv-card p {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: #777;
}

/* 歌姬来路染色 */
.geji-boot {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  color: #39ff14;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.ending-stage.is-shake {
  animation: spam-shake 0.45s ease;
}

.ending-stage.flavor-rage .ending-hero.is-in {
  filter: contrast(1.15) saturate(1.2);
}

.ending-stage.path-pay .ending-hero.is-in {
  filter: drop-shadow(0 0 40px rgba(255, 214, 10, 0.35));
}

.ending-stage.path-uninstall .ending-hero.is-in {
  filter: drop-shadow(0 0 40px rgba(57, 255, 20, 0.3));
}

.ending-stage.path-cs .ending-hero.is-in {
  filter: drop-shadow(0 0 40px rgba(255, 0, 34, 0.4));
}

@media (max-width: 640px) {
  .geji-text {
    font-size: clamp(0.9rem, 5vw, 1.6rem) !important;
  }

  .spam-card {
    width: min(240px, 86vw);
  }

  .er-entry-grid {
    grid-template-columns: 1fr;
  }
}
