/* 小智 AI 固件刷入工具 — 玻璃拟态渐变 · 科技风 */
:root {
  color-scheme: dark; /* 原生控件（select/option/滚动条）深色渲染 */
  --text: #e8ecf8;
  --text-dim: rgba(232, 236, 248, 0.65);
  --text-faint: rgba(232, 236, 248, 0.5);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.13);
  --glass-border-hi: rgba(255, 255, 255, 0.22);
  --violet: #8b5cf6;
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --indigo: #818cf8;
  --success: #34d399;
  --danger: #f87171;
  --radius: 20px;
}

* { box-sizing: border-box; }

/* display 类样式会覆盖 UA 对 [hidden] 的 display:none，这里统一兜底 */
[hidden] { display: none !important; }

html { background: #0b1020; }

/* 全局深色细滚动条 */
html { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.28); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background:
    radial-gradient(ellipse 55% 40% at 12% -5%, rgba(139, 92, 246, 0.22), transparent 70%),
    radial-gradient(ellipse 50% 42% at 95% 8%, rgba(34, 211, 238, 0.13), transparent 70%),
    radial-gradient(ellipse 60% 45% at 50% 108%, rgba(59, 130, 246, 0.16), transparent 72%),
    #0b1020;
  background-attachment: fixed;
}

/* 缓慢漂浮的光晕层，营造 AI 产品的呼吸感 */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  animation: orbFloat 22s ease-in-out infinite alternate;
}
body::before {
  width: 480px; height: 480px;
  left: -140px; top: 8%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.20), transparent 65%);
}
body::after {
  width: 520px; height: 520px;
  right: -160px; bottom: -6%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.13), transparent 65%);
  animation-delay: -11s;
}
@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  to { transform: translate3d(40px, -30px, 0) scale(1.12); opacity: 1; }
}

/* ---------- 顶部横幅 ---------- */
.banner {
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  border-radius: 12px;
  margin: 14px 16px 0;
}
.banner.danger {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}
.banner.warn {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
  border-radius: var(--radius);
  margin-bottom: 14px;
  text-align: left;
}

/* ---------- 页头 ---------- */
.site-header {
  padding: 34px 16px 22px;
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.1), transparent);
}
.header-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 15px; }
.logo {
  width: 54px; height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--violet), var(--blue) 55%, var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: #fff;
  box-shadow: 0 0 26px rgba(99, 102, 241, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand h1 {
  margin: 0; font-size: 23px; letter-spacing: 1px;
  background: linear-gradient(90deg, #fff, #c7d2fe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand p { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }
.github-link {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.2s, background 0.2s;
}
.github-link:hover { border-color: var(--glass-border-hi); background: var(--glass-strong); }

/* ---------- 主体布局 ---------- */
.container { max-width: 780px; margin: 14px auto 44px; padding: 0 16px; display: flex; flex-direction: column; gap: 20px; }

.card {
  /* 顶部到底部的微渐变 + 1px 顶部高光，强化玻璃受光感 */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  padding: 24px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.card:hover {
  border-color: var(--glass-border-hi);
  box-shadow: 0 14px 46px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 24px rgba(99, 102, 241, 0.1);
}

/* ---------- 步骤 ---------- */
.step-header { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.step-num {
  width: 30px; height: 30px; flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.step-header h2 { margin: 0; font-size: 17px; letter-spacing: 0.5px; }
.step-state {
  margin-left: auto;
  font-size: 13px;
  padding: 2px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
}
.step-state.ok {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}
.step-state.bad {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.step-state.busy {
  background: rgba(129, 140, 248, 0.14);
  border-color: rgba(129, 140, 248, 0.5);
  color: #a5b4fc;
}

/* ---------- 选项卡 ---------- */
.tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.18s;
}
.tab.active {
  border-color: rgba(129, 140, 248, 0.6);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.12));
  color: #dbe4ff;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.25);
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.label-hint { font-weight: 400; color: var(--text-faint); }
input[type="text"], select, input[type="file"] {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(11, 16, 32, 0.55);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]::placeholder { color: var(--text-faint); }
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-strong);
  color: var(--text);
  padding: 6px 14px;
  margin-right: 12px;
  font-family: inherit;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--glass-border-hi); }

.check-field {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: var(--text);
  cursor: pointer; margin-bottom: 0;
}
.check-field input { margin-top: 3px; accent-color: var(--indigo); }

.inline-error { margin-top: 8px; font-size: 13px; color: var(--danger); }

/* ---------- 板型列表 ---------- */
.board-list {
  margin-top: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  max-height: 280px;
  overflow-y: auto;
  background: rgba(11, 16, 32, 0.45);
}
.board-item {
  padding: 9px 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  transition: background 0.12s;
}
.board-item:last-child { border-bottom: none; }
.board-item:hover { background: rgba(129, 140, 248, 0.15); }
.board-item.selected {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(34, 211, 238, 0.12));
  font-weight: 600;
}
.board-item .board-id { color: var(--text-dim); font-size: 12px; font-family: Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item .board-size { color: var(--text-dim); font-size: 12px; flex: none; }
.board-empty { padding: 14px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* 深色细滚动条 */
.board-list::-webkit-scrollbar, .log::-webkit-scrollbar { width: 8px; }
.board-list::-webkit-scrollbar-thumb, .log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

/* ---------- 固件信息 ---------- */
.fw-info {
  margin-top: 8px;
  padding: 13px 15px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(34, 211, 238, 0.08));
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 12px;
  font-size: 13px;
}
.fw-info .fw-name { font-weight: 600; word-break: break-all; color: #dbe4ff; }
.fw-info .fw-meta { color: var(--text-dim); margin-top: 2px; }

/* ---------- 高级选项 ---------- */
.advanced { margin-top: 6px; border-top: 1px dashed rgba(255, 255, 255, 0.12); padding-top: 13px; }
.advanced summary { cursor: pointer; font-size: 13px; color: var(--text-dim); user-select: none; }
.advanced summary:hover { color: var(--text); }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin-top: 12px; align-items: start; }
.adv-grid .check-field { grid-column: 1 / -1; }

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  transition: filter 0.18s, transform 0.06s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--violet), var(--blue) 60%, var(--cyan));
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.4);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.15); box-shadow: 0 0 30px rgba(99, 102, 241, 0.55); }
.btn.success {
  background: linear-gradient(135deg, #059669, #10b981 55%, #22d3ee);
  padding: 13px 32px; font-size: 16px;
  box-shadow: 0 0 26px rgba(16, 185, 129, 0.4);
}
.btn.success:hover:not(:disabled) { filter: brightness(1.12); box-shadow: 0 0 34px rgba(16, 185, 129, 0.55); }
.btn.danger {
  background: linear-gradient(135deg, #dc2626, #f97316);
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.35);
}
.btn.small { padding: 6px 14px; font-size: 13px; font-weight: 500; border-radius: 9px; }
.btn.ghost {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  backdrop-filter: blur(10px);
}
.btn.ghost:hover:not(:disabled) { border-color: var(--glass-border-hi); color: var(--text); }

/* ---------- 提示与设备信息 ---------- */
.hint-list { margin: 0 0 15px; padding-left: 20px; font-size: 13px; color: var(--text-dim); }
.hint-list li { margin-bottom: 4px; }
.hint-list b { color: var(--text); font-weight: 600; }

.dev-info {
  margin-top: 15px;
  padding: 15px 17px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(34, 211, 238, 0.07));
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 12px;
  font-size: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 20px;
}
.dev-info dt { color: var(--text-dim); }
.dev-info dd { margin: 0; font-weight: 600; color: #dbe4ff; }

/* ---------- 进度条 ---------- */
.progress-wrap { margin: 15px 0; }
.progress-label { font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #dbe4ff; }
.progress-bar {
  height: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--blue) 50%, var(--cyan));
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.6);
  transition: width 0.2s;
}
.progress-text { font-size: 12px; color: var(--text-dim); margin-top: 5px; text-align: right; }
.progress-fill.indeterminate {
  width: 40% !important;
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* ---------- 结果 ---------- */
.result {
  margin-top: 15px;
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 14px;
  white-space: pre-wrap;
}
.result.ok {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}
.result.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

/* ---------- 日志 ---------- */
.log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.log-header h3 { margin: 0; font-size: 15px; letter-spacing: 0.5px; }
.log-header > div { display: flex; gap: 8px; }
.log {
  margin: 0;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #6ee7b7;
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.55;
  max-height: 300px;
  min-height: 60px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log .log-err { color: #fda4af; }
.log .log-info { color: #93c5fd; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(5, 8, 20, 0.65);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: rgba(20, 26, 46, 0.92);
  backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border-hi);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.modal h3 { margin: 0 0 10px; font-size: 16px; }
.modal-body { font-size: 14px; color: var(--text); white-space: pre-wrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- 页脚 ---------- */
.site-footer {
  max-width: 780px;
  margin: 0 auto 34px;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}
.site-footer a { color: #93c5fd; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .adv-grid { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .btn.success { width: 100%; }
  body::before, body::after { filter: blur(60px); }
}
