@import url("https://s1.hdslb.com/bfs/static/jinkela/long/font/regular.css");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-family: "HarmonyOS_Regular", "Segoe UI", system-ui, -apple-system,
    sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
  color: #1a1a1a;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
}

/* 云母背景效果 */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 15% 50%,
      rgba(255, 255, 255, 0.8) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(255, 255, 255, 0.6) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(255, 255, 255, 0.4) 0%,
      transparent 50%
    );
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  z-index: -1;
}

#selectionBar {
  position: absolute;
  top: 5%;
  display: flex;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  transform: translateY(50px);
  animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

.selectionButton {
  padding: 12px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.selectionButton:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.selectionButton.selected {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12),
    0 0 0 1.5px rgba(255, 182, 193, 0.6);
  color: #ff8fa3;
}

#nameDisplay {
  font-size: 6vw;
  font-weight: 700;
  padding: 40px 60px;
  min-width: 60vw;
  max-width: 80vw;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-align: center;
  margin-bottom: 20px;
  transition: font-size 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease,
    box-shadow 0.3s ease;
  opacity: 0;
  transform: translateY(50px);
  animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
  border: 1px solid rgba(255, 255, 255, 0.3);
  line-height: 1.2;
}

#nameDisplay.running-text {
  font-size: 5vw;
  opacity: 0.85;
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.35);
  transition: font-size 0.4s cubic-bezier(0.33, 1, 0.68, 1),
    transform 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

#nameDisplay.result-animation {
  transform: translateY(0) scale(1.05);
  font-size: 6.5vw;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(40px) saturate(220%);
  -webkit-backdrop-filter: blur(40px) saturate(220%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#controlButton {
  margin-top: 50px;
  padding: 16px 48px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ffb6c1 0%, #ff8fa3 100%);
  border: none;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(255, 182, 193, 0.3),
    0 2px 8px rgba(255, 182, 193, 0.2);
  opacity: 0;
  transform: translateY(50px);
  animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.6s forwards;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#controlButton:hover {
  background: linear-gradient(135deg, #ffc2cc 0%, #ff9eb3 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 25px rgba(255, 182, 193, 0.4),
    0 4px 12px rgba(255, 182, 193, 0.25);
}

#controlButton:active {
  transform: translateY(0) scale(0.98);
}

.footer {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(26, 26, 26, 0.6);
  opacity: 0;
  transform: translateY(50px);
  animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.8s forwards;
}

#beianLink {
  color: rgba(26, 26, 26, 0.6);
  text-decoration: none;
  transition: color 0.3s ease;
}

#beianLink:hover {
  color: #1a1a1a;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out,
    visibility 0.3s ease-out;
  z-index: 1000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.modal-content {
  background: rgba(255, 255, 255, 0.75);
  padding: 30px;
  border-radius: 24px;
  width: 90%;
  max-width: 1200px;
  max-height: 70vh;
  overflow-y: auto;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.3s 0.1s ease-out, opacity 0.3s 0.1s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.4);
  position: relative;
}

.modal.show .modal-content {
  transform: scale(1);
  opacity: 1;
}

.close-button {
  position: absolute;
  top: 15px; /* 更靠近顶部边缘 */
  right: 15px; /* 更靠近右侧边缘 */
  font-size: 1.8rem;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.close-button:hover {
  color: #1a1a1a;
  background: rgba(0, 0, 0, 0.05);
}

.historyNameContainer {
  display: flex;
  gap: 30px;
  width: 100%;
}

.historyList {
  flex: 1;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 12px; /* 为滚动条留出空间 */
  margin-right: 8px; /* 调整间距 */
}

.historyList::-webkit-scrollbar {
  width: 10px;
}

.historyList::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 0 24px 24px 0; /* 只在右侧设置圆角 */
  margin: 8px 0;
}

.historyList::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box; /* 关键属性：让背景只显示在内容区域 */
}

.historyList::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid transparent;
  background-clip: content-box;
}

.historyList h3 {
  color: #444;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.historyItem {
  background: rgba(255, 255, 255, 0.6);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.historyItem:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.historyItem .names {
  font-size: 1.1rem;
  color: #1a1a1a;
  max-width: 80%;
  font-weight: 500;
}

.historyItem .time {
  font-size: 0.9rem;
  color: #666;
}

.nameStats {
  flex: 1;
  max-height: 50vh;
  overflow-y: auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding-right: 12px; /* 为滚动条留出空间 */
}

.nameStats::-webkit-scrollbar {
  width: 10px;
}

.nameStats::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 0 16px 16px 0; /* 只在右侧设置圆角 */
  margin: 8px 0;
}

.nameStats::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box; /* 关键属性：让背景只显示在内容区域 */
}

.nameStats::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid transparent;
  background-clip: content-box;
}

.nameStats h3 {
  color: #444;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.nameStats ul {
  list-style-type: none;
  padding: 0;
}

.statsItem {
  padding: 12px 16px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: background 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.statsItem:hover {
  background: rgba(255, 255, 255, 0.9);
}

.progressBar {
  width: 120px;
  height: 8px;
  background: rgba(200, 200, 200, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  background: linear-gradient(90deg, #ffb6c1, #ff8fa3);
  transition: width 0.5s ease;
  border-radius: 4px;
}

.probability-switch-container {
  margin: 20px 0;
  padding: 20px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.switch-label {
  font-size: 1rem;
  color: #1a1a1a;
  flex: 1;
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: #ffb6c1;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.switch-desc {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
  padding: 0 5px;
}

/* 全局滚动条样式优化 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  #nameDisplay {
    font-size: 9vw;
    padding: 30px 40px;
    min-width: 80vw;
  }

  #nameDisplay.running-text {
    font-size: 7.5vw;
  }

  #nameDisplay.result-animation {
    font-size: 9.5vw;
  }

  .historyNameContainer {
    flex-direction: column;
    gap: 20px;
  }

  .historyList,
  .nameStats {
    max-height: 40vh;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .close-button {
    top: 10px;
    right: 10px;
  }
}
