/* Wiki Spy - Editorial Devil AI Styling */
:root {
  --bg-page: #FAF9F6;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F4F1EA;
  --text-primary: #242424;
  --text-secondary: #77736E;
  --text-muted: #9E9B95;
  --border-color: #E8E5DF;
  --border-light: #F2EFEB;
  --accent: #F46D82;
  --accent-soft: #FFE4E8;
  --accent-gold: #CA8A04;
  --accent-gold-soft: #FEF9C3;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-subtle: 0 4px 18px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 12px 36px rgba(0, 0, 0, 0.08);
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, monospace;
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.wiki-spy-page {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Header Integration */
.weegoes-header {
  height: 54px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.weegoes-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.weegoes-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}
.weegoes-back-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
}

.weegoes-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-primary);
}
.weegoes-brand-logo {
  width: 22px;
  height: 22px;
  background: var(--text-primary);
  color: #FFF;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.weegoes-brand-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.weegoes-brand-badge {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 600;
}

.weegoes-header-center {
  display: flex;
  align-items: center;
}
.weegoes-active-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.weegoes-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weegoes-tool-btn, .weegoes-share-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition-smooth);
}
.weegoes-tool-btn:hover, .weegoes-share-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Main Container */
.spy-container {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.spy-hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 28px;
}

.spy-kicker {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.spy-title {
  font-family: var(--font-serif);
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.05;
}

.spy-sub {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Mission HUD Banner */
.mission-hud {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-subtle);
  flex-wrap: wrap;
}

.mission-status-group {
  flex: 1;
  min-width: 280px;
}

.mission-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(244, 109, 130, 0.7);
  animation: pulsePing 1.8s infinite;
}

@keyframes pulsePing {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 109, 130, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(244, 109, 130, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(244, 109, 130, 0); }
}

.mission-target-text {
  font-size: 17px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}
.mission-target-text strong {
  color: var(--accent);
  font-weight: 700;
}

.mission-clue-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-style: italic;
}

.mission-actions-group {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.mission-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.progress-count {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.mission-buttons {
  display: flex;
  gap: 8px;
}

.btn-hint, .btn-skip {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-hint {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(244, 109, 130, 0.3);
}
.btn-hint:hover {
  background: #FFD2DA;
}

.btn-skip {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-skip:hover {
  background: #EBE7DD;
  color: var(--text-primary);
}

/* Controls Bar */
.spy-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#spySearchInput {
  width: 100%;
  padding: 12px 42px 12px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  box-shadow: var(--shadow-subtle);
  outline: none;
  transition: var(--transition-smooth);
}

#spySearchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 109, 130, 0.15);
}

.clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
}
.clear-btn:hover {
  color: var(--text-primary);
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.category-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chip:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.chip.active {
  background: var(--text-primary);
  color: #FFFFFF;
  border-color: var(--text-primary);
}

/* Mosaic Grid */
.mosaic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.mosaic-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.mosaic-card:hover {
  transform: translateY(-3px);
  border-color: rgba(244, 109, 130, 0.4);
  box-shadow: var(--shadow-float);
}

.mosaic-card.target-highlight {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(244, 109, 130, 0.35) !important;
  animation: cardJiggle 0.6s ease;
}

@keyframes cardJiggle {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-4px) rotate(-1.5deg); }
  75% { transform: translateY(-4px) rotate(1.5deg); }
}

.card-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.card-visual-wrapper {
  width: 110px;
  height: 110px;
  margin: 14px 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.mosaic-card:hover .card-visual-wrapper {
  transform: scale(1.08);
}

.card-visual-wrapper svg {
  width: 100%;
  height: 100%;
}

.card-name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.2;
}

.card-epoch {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.card-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}
.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.btn-reset-filters {
  background: var(--text-primary);
  color: #FFF;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

/* Inspector Modal */
.inspector-modal {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.inspector-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(36, 36, 36, 0.45);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
  max-width: 680px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 101;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.inspector-modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--bg-subtle);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}
.modal-close-btn:hover {
  background: #E8E4DA;
  color: var(--text-primary);
}

.modal-body {
  padding: 32px 28px;
}

.modal-visual-frame {
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-visual-frame svg {
  width: 100%;
  height: 100%;
}

.modal-category-tag {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.1;
}

.modal-epoch {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-summary {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 22px;
}

.modal-metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.meta-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-wiki-link {
  flex: 1;
  min-width: 200px;
  background: var(--text-primary);
  color: #FFFFFF;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-smooth);
}
.btn-wiki-link:hover {
  background: #383838;
}

.btn-find-similar {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-find-similar:hover {
  background: #E8E4DA;
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 640px) {
  .mission-hud {
    flex-direction: column;
    align-items: flex-start;
  }
  .mission-actions-group {
    width: 100%;
    justify-content: space-between;
  }
  .mosaic-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .modal-metadata-grid {
    grid-template-columns: 1fr;
  }
}
