/* 基础样式重置 */
:host {
  all: initial;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  z-index: 99999;
  position: fixed;
  top: 20px;
  left: 20px;
  line-height: 1.5;

  /* Variables from 1.html */
  --primary-color: #1890ff;
  --cyber-color: #00f3ff; /* 赛博朋克蓝 */
  --success-color: #52c41a;
  --bg-color: #f0f2f5;
}

/* 容器 */
.nm-container {
  position: relative;
  /* 移除容器的背景和阴影，避免悬浮球模式下出现白边 */
  background-color: transparent !important;
  box-shadow: none !important;
  color: #333;
  transition: all 0.3s ease;
}

.nm-container.is-dragging {
  transition: none !important;
}

/* 悬浮球样式 */
.nm-ball {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* overflow: hidden; Removed to allow ripple effect */
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: transform 0.3s;
  position: relative;
}

.nm-ball img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  animation: rotate 10s linear infinite;
  position: relative;
  z-index: 2;
}

.nm-ball::before,
.nm-ball::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(24, 144, 255, 0.5);
  background: rgba(24, 144, 255, 0.05);
  z-index: 1;
  box-sizing: border-box;
}

.nm-ball::before {
  animation: ripple 2s infinite linear;
}

.nm-ball::after {
  animation: ripple 2s infinite linear 1s;
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.1; /* 边缘最浅 */
    border-width: 0px;
  }
  80% {
    opacity: 0.8; /* 扩散外围变深 */
    border-width: 2px;
  }
  100% {
    transform: scale(1.8); /* 扩散20px (50*1.8=90, r+20) */
    opacity: 0;
    border-width: 0px;
  }
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 主面板样式 */
.nm-panel {
  width: 360px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  /* 将阴影移到面板上 */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* 头部 */
.nm-header {
  height: 60px; /* Increased height */
  background: #f5f7fa;
  border-bottom: 1px solid #e4e7ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: move; /* 拖拽手势 */
  user-select: none;
}

.nm-header-title {
  font-weight: 600;
  font-size: 16px; /* Increased font size */
  color: #303133;
  flex: 1;
  text-align: center;
}

.nm-header-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #909399;
  border-radius: 4px;
  transition: background 0.2s;
}

.nm-header-btn:hover {
  background: #e6e8eb;
  color: #409eff;
}

/* 内容区域 */
.nm-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

/* 底部按钮区 */
.nm-footer {
  padding: 12px 15px;
  border-top: 1px solid #e4e7ed;
  background: #fff;
  display: flex;
  gap: 10px;
}

/* 按钮样式 */
.nm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: #fff;
  border: 1px solid #dcdfe6;
  color: #606266;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  margin: 0;
  transition: .1s;
  font-weight: 500;
  padding: 8px 15px;
  font-size: 12px;
  border-radius: 4px;
}

.nm-btn:hover {
  color: #409eff;
  border-color: #c6e2ff;
  background-color: #ecf5ff;
}

.nm-btn-primary {
  color: #fff;
  background-color: #409eff;
  border-color: #409eff;
}

.nm-btn-primary:hover {
  background: #66b1ff;
  border-color: #66b1ff;
  color: #fff;
}

.nm-btn-success {
  color: #fff;
  background-color: #67c23a;
  border-color: #67c23a;
}

.nm-btn-success:hover {
  background: #85ce61;
  border-color: #85ce61;
  color: #fff;
}

.nm-btn-danger {
  color: #fff;
  background-color: #f56c6c;
  border-color: #f56c6c;
}

.nm-btn-danger:hover {
  background: #f78989;
  border-color: #f78989;
  color: #fff;
}

/* 上传区域 */
.nm-upload-area {
  border: 1px dashed #dcdfe6;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  color: #606266;
  cursor: pointer;
  transition: border-color 0.3s;
  background: #fafafa;
}

.nm-upload-area:hover {
  border-color: #409eff;
}

/* Modal */
.nm-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.nm-modal.hidden {
  display: none;
}

.nm-modal-content {
  background: #fff;
  border-radius: 4px;
  width: 80%;
  max-width: 300px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.nm-modal-header {
  padding: 10px 15px;
  border-bottom: 1px solid #ebeef5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nm-modal-title {
  font-size: 14px;
  color: #303133;
  font-weight: bold;
}

.nm-modal-close {
  cursor: pointer;
  color: #909399;
  font-size: 16px;
}

.nm-modal-body {
  padding: 15px;
  font-size: 13px;
  color: #606266;
  line-height: 1.5;
}

.nm-modal-footer {
  padding: 10px 15px;
  text-align: right;
  border-top: 1px solid #ebeef5;
}

/* =========================================
   NEW FEATURES FROM 1.html
   ========================================= */

/* ★★★ 核心特效：激光定位 (优化版：更轻柔) ★★★ */
.laser-focus {
    border-color: rgba(0, 243, 255, 0.5) !important; 
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.4), inset 0 0 8px rgba(0, 243, 255, 0.1) !important;
    transform: scale(1.02);
    z-index: 10;
    position: relative;
    background-color: rgba(0, 243, 255, 0.02);
}

/* =========================================
   2. 迷你控制台 (嵌入任务窗口)
   ========================================= */
.mini-console {
    position: relative;
    width: 100%;
    height: 200px; /* 高度调长 */
    box-sizing: border-box;
    margin-bottom: 15px;
    
    background: #1e1e1e; 
    border-radius: 8px;
    border: 1px solid #333;
    
    color: #4af626; 
    font-family: "Consolas", "Monaco", monospace;
    font-size: 11px;
    
    /* 使用 Flex 布局，确保 Header 固定 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 容器本身不滚动 */
}

.console-header {
    font-size: 10px;
    color: #888;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    
    /* 移除之前的 margin/padding hack */
    padding: 10px;
    
    display: flex;
    justify-content: space-between;
    background-color: #1e1e1e;
    flex-shrink: 0; /* 防止被压缩 */
    z-index: 10;
}

.console-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 10px 10px 10px;
    scrollbar-width: none;
}
.console-body::-webkit-scrollbar { display: none; }

.log-line {
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
    line-height: 1.4;
    text-shadow: 0 0 2px rgba(74, 246, 38, 0.3);
}

.log-line.error { color: #ff4d4f; text-shadow: 0 0 2px rgba(255, 77, 79, 0.3); }
.log-line.warn { color: #faad14; }
.log-line.highlight { color: var(--cyber-color); font-weight: bold; }

@keyframes fadeIn { to { opacity: 1; } }

/* ★★★ 核心特效：动态进度环 ★★★ */
.progress-ring-container {
    position: relative;
    width: 40px; /* Slightly smaller for header */
    height: 40px;
    margin-right: 0; /* Adjusted */
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: bold;
    color: #333;
}

/* =========================================
   4. 全屏拖拽上传 (Drop Zone)
   ========================================= */
.drop-zone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

.drop-zone-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.drop-box {
    border: 2px dashed var(--cyber-color);
    border-radius: 20px;
    width: 80%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background: rgba(0, 243, 255, 0.05);
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.15);
}

.drop-icon { font-size: 64px; margin-bottom: 20px; }
.drop-text { font-size: 24px; font-weight: bold; letter-spacing: 1px; }

/* =========================================
   5. 成就结算模态框
   ========================================= */
.achievement-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    text-align: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 300px;
}

.achievement-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.stat-card {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid #eee;
}
.stat-val { font-size: 24px; font-weight: bold; color: var(--primary-color); }
.stat-label { font-size: 12px; color: #666; }

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    z-index: 1999;
}


.nm-btn {
  display: inline-block;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: #fff;
  border: 1px solid #dcdfe6;
  color: #606266;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  margin: 0;
  transition: .1s;
  font-weight: 500;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 4px;
  width: 100%;
}

.nm-btn-primary {
  color: #fff;
  background-color: #79bbff;
  border-color: #79bbff;
}

.nm-btn-primary:hover {
  background: #a0cfff;
  border-color: #a0cfff;
}

.nm-btn-danger {
  color: #fff;
  background-color: #f89898;
  border-color: #f89898;
}

.nm-btn-danger:hover {
  background: #fab6b6;
  border-color: #fab6b6;
}

.nm-btn-success {
  color: #fff;
  background-color: #95d475;
  border-color: #95d475;
}

.nm-btn-success:hover {
  background: #b3e19d;
  border-color: #b3e19d;
}

/* 特定按钮悬浮效果 */
#btn-extract-excel:hover {
  background-color: #ecf5ff;
  border-color: #c6e2ff;
  color: #409eff;
}

#btn-download-template:hover {
  background-color: #f0f9eb;
  border-color: #d1edc4;
  color: #67c23a;
}

/* 底部 */
.nm-footer {
  padding: 12px 16px;
  border-top: 1px solid #e4e7ed;
  display: flex;
  gap: 15px;
}

/* Tabs */
.nm-tabs {
  display: flex;
  border-bottom: 1px solid #eee;
  margin-bottom: 15px;
}

.nm-tab-btn {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  cursor: pointer;
  color: #606266;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
}

.nm-tab-btn.active {
  color: #409eff;
  border-bottom-color: #409eff;
}

.nm-alert {
  background: #fdf6ec;
  color: #e6a23c;
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 15px;
}

.nm-upload-area {
  border: 2px dashed #dcdfe6;
  border-radius: 6px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  color: #909399;
  transition: border-color .2s;
}

.nm-upload-area:hover {
  border-color: #409eff;
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 复制按钮悬浮效果 */
#btn-copy-uploaded {
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  margin-left: 5px;
}

#btn-copy-uploaded:hover {
  background-color: #f0f9eb;
  color: #529b2e;
}

/* Modal Styles */
.nm-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.nm-modal-content {
  background: #fff;
  border-radius: 4px;
  width: 80%;
  max-width: 300px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.nm-modal-header {
  padding: 15px;
  border-bottom: 1px solid #ebeef5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nm-modal-title {
  font-size: 16px;
  font-weight: bold;
  color: #303133;
}

.nm-modal-close {
  cursor: pointer;
  font-size: 20px;
  color: #909399;
}

.nm-modal-body {
  padding: 20px;
  font-size: 14px;
  color: #606266;
  line-height: 1.5;
  word-break: break-all;
}

.nm-modal-footer {
  padding: 10px 15px;
  text-align: right;
  border-top: 1px solid #ebeef5;
}
