*{box-sizing:border-box} :root{
  --bg:#0b0c10; --panel:#11131a; --card:#0f1117; --border:#23263a;
  --text:#e9ecff; --muted:#9aa3c7; --accent:#7aa2ff; --accent2:#53f0b7;
  --danger:#ff6b6b; --warn:#ffd166; --ok:#53f0b7;
  --shadow:0 14px 38px rgba(0,0,0,.35);
  --radius:16px; --radius2:22px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
}
html,body{height:100%}
body{margin:0;background:radial-gradient(1200px 600px at 10% 10%, rgba(122,162,255,.12), transparent 55%),
     radial-gradient(1000px 500px at 70% 20%, rgba(83,240,183,.08), transparent 55%),
     var(--bg);
     color:var(--text); font-family:var(--sans);}

.topbar{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);
  position:sticky;top:0;background:rgba(11,12,16,.8);backdrop-filter: blur(10px); z-index:10}
.brand{display:flex;gap:12px;align-items:center}
.logo{width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg, var(--accent), var(--accent2));
  color:#071018; font-weight:900;display:flex;align-items:center;justify-content:center;box-shadow:var(--shadow)}
.title{font-weight:800;letter-spacing:.2px}
.subtitle{font-size:12px;color:var(--muted);margin-top:2px}
.topbar-actions{display:flex;gap:10px;align-items:center}

.app{display:grid;grid-template-columns: 340px 1fr;gap:16px; padding:16px; max-width: 1400px; margin:0 auto;}
.sidebar{display:flex;flex-direction:column;gap:14px}
.main{min-width:0}
.panel{background:rgba(17,19,26,.75); border:1px solid var(--border); border-radius: var(--radius2); padding:14px; box-shadow:var(--shadow)}
.panel.small{padding:12px}
.panel-title{font-size:13px; color:var(--muted); letter-spacing:.35px; text-transform:uppercase; margin-bottom:10px}
.nav{display:flex;flex-direction:column;gap:8px}
.nav button{width:100%; text-align:left; background:transparent; border:1px solid var(--border); padding:10px 10px; border-radius:14px;
  color:var(--text); cursor:pointer; transition:.15s transform, .15s background, .15s border}
.nav button:hover{transform:translateY(-1px); background:rgba(122,162,255,.06); border-color:rgba(122,162,255,.35)}
.nav button.active{background:rgba(122,162,255,.12); border-color:rgba(122,162,255,.6)}
.nav .tag{font-size:11px;color:var(--muted); float:right}

.card{background:rgba(15,17,23,.72); border:1px solid var(--border); border-radius: var(--radius2); padding:14px; box-shadow:var(--shadow)}
.card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.card-title{font-size:20px; font-weight:900}
.card-desc{font-size:13px;color:var(--muted); margin-top:4px; line-height:1.35}
.card-head-actions{display:flex;gap:10px; flex-wrap:wrap}

.btn{border:1px solid var(--border); background:rgba(255,255,255,.02); color:var(--text); padding:10px 12px;border-radius:14px;
  cursor:pointer; transition:.15s transform, .15s background, .15s border}
.btn:hover{transform:translateY(-1px); background:rgba(255,255,255,.04); border-color:rgba(122,162,255,.35)}
.btn.primary{background:linear-gradient(135deg, rgba(122,162,255,.92), rgba(83,240,183,.72)); color:#071018; border-color:transparent; font-weight:900}
.btn.primary:hover{background:linear-gradient(135deg, rgba(122,162,255,1), rgba(83,240,183,.86))}
/* 主按钮 */
.btn.primary {
  box-shadow: 0 8px 30px rgba(122,162,255,.35);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(122,162,255,.35);
}
.nav button.active {
  background: linear-gradient(
    135deg,
    rgba(122,162,255,.18),
    rgba(83,240,183,.12)
  );
  border-color: rgba(122,162,255,.8);
}
/* === API KEY 错误提示 === */
input.error {
  border-color: #ff6b6b !important;
  box-shadow: 0 0 0 3px rgba(255,107,107,.18);
}

.input-error-hint {
  color: #ff6b6b;
  font-size: 12px;
  margin-top: 4px;
}


.btn.ghost{background:transparent}
.btn[disabled]{opacity:.45; cursor:not-allowed; transform:none}

.hr{height:1px;background:var(--border); margin:12px 0}

.field{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.field.row{flex-direction:row; align-items:center; gap:10px}
/* .label{font-size:12px; color:var(--muted)} */
.label {
  font-size: 12px;
  color: #b7c0f2;   /* 比 muted 稍亮 */
  letter-spacing: .3px;
}

.hint{font-size:12px;color:var(--muted); line-height:1.35}
/* === 强化输入框对比度 === */
input[type="text"],
input[type="password"],
textarea,
select {
  background: rgba(255,255,255,0.08);   /* ↑ 从 0.06 → 0.08 */
  border: 1px solid #343a66;             /* ↑ 对比更强 */
  color: var(--text);
}

/* placeholder 再亮一点 */
input::placeholder,
textarea::placeholder {
  color: #9aa3c7;
}

/* hover / focus 更像“可操作组件” */
input:hover,
textarea:hover,
select:hover {
  border-color: rgba(122,162,255,.75);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(122,162,255,.9);
  box-shadow: 0 0 0 3px rgba(122,162,255,.18);
}

/* hover / focus 更明显 */
input:hover, textarea:hover, select:hover {
  border-color: rgba(122,162,255,.6);
}

textarea{min-height:110px; font-family:var(--sans); resize:vertical}
select{padding:10px 12px}
input:focus, textarea:focus, select:focus{border-color: rgba(122,162,255,.7); box-shadow:0 0 0 3px rgba(122,162,255,.15)}

.form{display:grid;grid-template-columns: repeat(2, minmax(0, 1fr)); gap:12px}
.form .span2{grid-column:1/-1}
@media (max-width: 980px){ .app{grid-template-columns:1fr} .form{grid-template-columns:1fr} }

.result{margin-top:6px}
.result-head{display:flex; align-items:center; justify-content:space-between; gap:10px}
.status{font-size:12px; padding:8px 10px; border-radius:999px; border:1px solid var(--border); display:inline-flex; gap:8px; align-items:center}
.status.idle{color:var(--muted)}
.status.running{color:var(--warn); border-color:rgba(255,209,102,.45)}
.status.ok{color:var(--ok); border-color:rgba(83,240,183,.5)}
.status.err{color:var(--danger); border-color:rgba(255,107,107,.5)}
.textout{margin:10px 0 0; padding:12px; background:rgba(0,0,0,.25); border:1px solid var(--border); border-radius:16px; max-height:420px; overflow:auto; font-family:var(--mono); white-space:pre-wrap}
.raw pre, #rawOut{font-family:var(--mono)}
.raw{margin-top:10px}
.raw > summary{cursor:pointer;color:var(--muted)}
#rawOut{margin:10px 0 0; padding:12px; background:rgba(0,0,0,.25); border:1px solid var(--border); border-radius:16px; max-height:320px; overflow:auto}
.mediaout{margin-top:10px; display:grid; gap:10px}
.mediaout img, .mediaout video, .mediaout audio{max-width:100%; border-radius:16px; border:1px solid var(--border); background:rgba(0,0,0,.2)}
.footer{margin-top:10px; display:flex; justify-content:space-between; gap:10px; flex-wrap:wrap; color:var(--muted); font-size:12px}
.muted{opacity:.85}
.bullets{margin:0; padding-left:18px; color:var(--muted); font-size:12px; line-height:1.45}

.debug-only { display: none; }
/* === 修复 select / option 文字过暗问题 === */
select {
  color: #e9ecff;                 /* 当前选中值文字 */
  background-color: rgba(255,255,255,0.08);
}

select option {
  background-color: #11131a;      /* 下拉列表背景 */
  color: #e9ecff;                 /* 下拉项文字 */
}

/* 被选中/hover 的 option（部分浏览器支持） */
select option:checked,
select option:hover {
  background-color: #1c2240;
  color: #ffffff;
}

/* === 新增：侧边栏筛选 Tab === */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto; /* 防止小屏幕溢出 */
  padding-bottom: 4px;
}
.filter-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: .2s;
  white-space: nowrap;
  font-weight: 600;
}
.filter-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}
.filter-btn.active {
  background: var(--accent); /* 选中时的青色背景 */
  color: #000; /* 选中时文字变黑 */
  font-weight: 800;
}

/* === 重构：导航列表样式 (仿截图) === */
.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 240px); /* 让列表可滚动 */
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 10px;
}

/* 滚动条美化 */
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  position: relative;
  overflow: hidden;

  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
}

/* 选中状态：左侧高亮条 + 背景发光 */
.nav-item.active {
  background: linear-gradient(90deg, rgba(83,240,183,0.15), rgba(83,240,183,0.02));
  border: 1px solid rgba(83,240,183,0.3);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent2); /* 侧边亮条 */
}

/* 图标容器 */
.nav-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  /* 使用深色背景，突出 Emoji 的颜色 */
  background: rgba(255, 255, 255, 0.08); 
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px; /* 放大图标 */
  flex-shrink: 0;
  line-height: 1;
  /* 增加一点阴影 */
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 选中状态下，图标背景变亮一点 */
.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(122, 162, 255, 0.3);
}

.nav-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

.nav-icon-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(122,162,255,0.28), rgba(83,240,183,0.22));
  color: #eef4ff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}

.nav-item:hover .nav-icon-fallback {
  filter: brightness(1.05);
}

.nav-item.active .nav-icon-fallback {
  background: linear-gradient(135deg, rgba(122,162,255,0.38), rgba(83,240,183,0.30));
}

/* 文字区域 */
.nav-content {
  flex: 1;
  min-width: 0; /* 修复 flex 子项截断问题 */
}

.nav-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.nav-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(122,162,255,0.15);
  color: var(--accent);
  font-weight: 600;
  margin-left: 8px;
  flex-shrink: 0;
}

/* 不同类型的标签颜色 (可选) */
.nav-tag[data-tag="VIDEO"] { color: #ffd166; background: rgba(255,209,102,0.15); }
.nav-tag[data-tag="MUSIC"] { color: #ff6b6b; background: rgba(255,107,107,0.15); }

.nav-desc {
  font-size: 11px;
  color: #666; /* 比较暗的描述文字 */
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 最多显示2行 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nav-item:hover .nav-desc { color: #888; }
.nav-item.active .nav-desc { color: #abc; }
/* 当按钮被禁用时，鼠标变成禁止符号，且透明度降低 */
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none; /* 彻底禁止鼠标事件 */
}
/* === 网络信号指示器 === */
.net-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.net-status:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 信号点 */
.net-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #666; /* 默认灰色 */
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  transition: background-color 0.3s, box-shadow 0.3s;
}

/* 状态颜色 */
.net-status.good .dot {
  background-color: var(--ok); /* 绿色 */
  box-shadow: 0 0 8px rgba(83, 240, 183, 0.6);
}
.net-status.good { color: var(--ok); border-color: rgba(83, 240, 183, 0.3); }

.net-status.slow .dot {
  background-color: var(--warn); /* 黄色 */
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.6);
}
.net-status.slow { color: var(--warn); border-color: rgba(255, 209, 102, 0.3); }

.net-status.bad .dot {
  background-color: var(--danger); /* 红色 */
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}
.net-status.bad { color: var(--danger); border-color: rgba(255, 107, 107, 0.3); }