/* ================================================================
   TechTools — 随机抽签器 (Random Picker) Styles
   Indigo accent: --cat-study (#6366F1)
   ================================================================ */

/* ------------------------------------------------------------
   1. Mode Tabs
   ------------------------------------------------------------ */
.pick-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.pick-mode-tab {
  padding: 10px 22px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(99, 102, 241, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  white-space: nowrap;
}
.pick-mode-tab:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}
.pick-mode-tab.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
  color: var(--cat-study);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.25), 0 0 48px rgba(99, 102, 241, 0.1);
  transform: scale(1.04);
}

/* ------------------------------------------------------------
   2. Name Source Panel
   ------------------------------------------------------------ */
.pick-source-panel {
  margin-bottom: 24px;
}
.pick-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.pick-textarea {
  min-height: 130px;
  margin-bottom: 0;
}

.pick-source-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.pick-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ------------------------------------------------------------
   3. Pick Panels (mode panels toggle)
   ------------------------------------------------------------ */
.pick-panel {
  display: none;
  margin-bottom: 24px;
}
.pick-panel.active {
  display: block;
}

/* ------------------------------------------------------------
   4. Single Pick — Slot Machine Style
   ------------------------------------------------------------ */
.pick-result-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 24px 48px;
  min-height: 320px;
}

.pick-slot-display {
  perspective: 800px;
}
.pick-slot-window {
  position: relative;
  width: 280px;
  max-width: 90vw;
  height: 120px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(99, 102, 241, 0.15),
    0 0 80px rgba(99, 102, 241, 0.05),
    inset 0 2px 4px rgba(255, 255, 255, 0.03);
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
}
.pick-slot-window.rolling {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow:
    0 0 60px rgba(99, 102, 241, 0.35),
    0 0 120px rgba(99, 102, 241, 0.12),
    inset 0 0 30px rgba(99, 102, 241, 0.08);
}
.pick-slot-window.landed {
  border-color: rgba(19, 221, 196, 0.5);
  box-shadow:
    0 0 40px rgba(19, 221, 196, 0.3),
    0 0 80px rgba(19, 221, 196, 0.1);
}

.pick-slot-name {
  font-family: var(--font-hero);
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 700;
  color: var(--cat-study);
  text-shadow:
    0 0 20px rgba(99, 102, 241, 0.6),
    0 0 40px rgba(99, 102, 241, 0.3);
  transition: color 0.3s ease, text-shadow 0.3s ease;
  user-select: none;
}

/* Rolling animation: rapid name swaps */
.pick-slot-name.rolling-anim {
  animation: slotRoll 0.08s steps(1) infinite;
}

@keyframes slotRoll {
  0%   { transform: translateY(0);    opacity: 1; }
  33%  { transform: translateY(-8px); opacity: 0.5; }
  66%  { transform: translateY(8px);  opacity: 0.5; }
  100% { transform: translateY(0);    opacity: 1; }
}

/* Landing bounce animation */
.pick-slot-name.landing-anim {
  animation: slotLand 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slotLand {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.15); opacity: 1; }
  70%  { transform: scale(0.92); }
  85%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.pick-slot-status {
  font-size: 15px;
  color: var(--text-secondary);
  min-height: 24px;
  text-align: center;
  transition: color 0.4s ease;
}
.pick-slot-status.success {
  color: var(--accent-teal);
}

.btn-roll-icon {
  font-size: 20px;
  display: inline-block;
  margin-right: 4px;
}

/* Celebration confetti-like particle burst */
.pick-slot-window.celebrate {
  animation: celebrateBurst 0.8s ease-out;
}
@keyframes celebrateBurst {
  0%   { filter: brightness(1.4); }
  30%  { filter: brightness(2); }
  100% { filter: brightness(1); }
}

/* Particle burst overlay */
.particle-burst {
  position: fixed;
  pointer-events: none;
  z-index: 999;
}
.particle-dot {
  position: absolute;
  border-radius: 50%;
  animation: particleFly 1s ease-out forwards;
}
@keyframes particleFly {
  0%   { transform: translate(0, 0) scale(1);   opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ------------------------------------------------------------
   5. Group Mode
   ------------------------------------------------------------ */
.pick-group-config {
  margin-bottom: 20px;
}
.pick-group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.pick-group-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 8px 16px;
}
.pick-input-prefix,
.pick-input-suffix {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.pick-number-input {
  width: 56px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-body);
  text-align: center;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.pick-number-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

/* Group result cards */
.pick-group-result {
  min-height: 160px;
}
.pick-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.pick-group-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 14px;
  padding: 16px;
  animation: cardFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.pick-group-card:nth-child(1) { animation-delay: 0.05s; }
.pick-group-card:nth-child(2) { animation-delay: 0.1s; }
.pick-group-card:nth-child(3) { animation-delay: 0.15s; }
.pick-group-card:nth-child(4) { animation-delay: 0.2s; }
.pick-group-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pick-group-card-header {
  font-family: var(--font-hero);
  font-size: 15px;
  font-weight: 700;
  color: var(--cat-study);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
}
.pick-group-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pick-name-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ------------------------------------------------------------
   6. List Pick Mode
   ------------------------------------------------------------ */
.pick-list-config {
  margin-bottom: 20px;
}
.pick-list-result {
  min-height: 120px;
}
.pick-list-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pick-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  animation: listPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.pick-list-item:nth-child(1) { animation-delay: 0.05s; }
.pick-list-item:nth-child(2) { animation-delay: 0.1s; }
.pick-list-item:nth-child(3) { animation-delay: 0.15s; }
.pick-list-item:nth-child(4) { animation-delay: 0.2s; }
.pick-list-item:nth-child(5) { animation-delay: 0.25s; }
.pick-list-item:nth-child(n+6) { animation-delay: 0.3s; }

@keyframes listPopIn {
  from { opacity: 0; transform: scale(0.5) rotateY(-30deg); }
  to   { opacity: 1; transform: scale(1) rotateY(0); }
}

.pick-list-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cat-study);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   7. History Panel
   ------------------------------------------------------------ */
.pick-history {
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 20px;
}
.pick-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pick-history-title {
  font-family: var(--font-hero);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.pick-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}
.pick-history-list::-webkit-scrollbar {
  width: 5px;
}
.pick-history-list::-webkit-scrollbar-track {
  background: transparent;
}
.pick-history-list::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 99px;
}
.pick-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
  color: var(--text-secondary);
  animation: historyFadeIn 0.3s ease;
}
@keyframes historyFadeIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.pick-history-item .hist-icon {
  flex-shrink: 0;
  font-size: 16px;
}
.pick-history-item .hist-label {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.pick-history-item .hist-result {
  flex: 1;
  color: var(--cat-study);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-history-item .hist-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.hist-copy-btn {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}
.hist-copy-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--cat-study);
}

/* ------------------------------------------------------------
   8. Pick Roll Button
   ------------------------------------------------------------ */
.pick-roll-btn {
  padding: 22px 56px !important;
  font-size: 20px !important;
}
.pick-roll-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ------------------------------------------------------------
   9. Responsive
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .pick-mode-tabs {
    gap: 6px;
  }
  .pick-mode-tab {
    padding: 8px 16px;
    font-size: 13px;
  }
  .pick-slot-window {
    width: 220px;
    height: 100px;
  }
  .pick-slot-name {
    font-size: clamp(24px, 5vw, 36px);
  }
  .pick-result-center {
    padding: 32px 16px 40px;
    gap: 20px;
    min-height: 260px;
  }
  .pick-roll-btn {
    padding: 18px 40px !important;
    font-size: 17px !important;
  }
  .pick-groups-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .pick-group-row {
    flex-direction: column;
    align-items: stretch;
  }
  .pick-source-actions {
    gap: 6px;
  }
  .pick-count {
    margin-left: 0;
    width: 100%;
    text-align: right;
    margin-top: 4px;
  }
}

@media (max-width: 480px) {
  .pick-mode-tab {
    padding: 7px 12px;
    font-size: 12px;
  }
  .pick-slot-window {
    width: 180px;
    height: 86px;
    border-radius: 16px;
  }
  .pick-slot-name {
    font-size: clamp(20px, 4.5vw, 30px);
  }
  .pick-result-center {
    padding: 24px 12px 32px;
    gap: 16px;
    min-height: 220px;
  }
  .pick-roll-btn {
    padding: 14px 32px !important;
    font-size: 16px !important;
  }
  .pick-groups-grid {
    grid-template-columns: 1fr;
  }
  .pick-history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
