/* ==========================================================================
   MCC Web Console
   Design language ported from the reference component set: light-first SaaS
   look, blue primary, 14px radii, hairline borders, soft shadows, system sans.
   Dark theme is a first-class variant toggled with [data-theme="dark"].
   ========================================================================== */

:root {
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f8f9fb; --panel-3: #eef1f5;
  --text: #1a1d21; --text-2: #4b5563; --muted: #6b7280; --border: #e3e6ea;
  --primary: #3b82f6; --primary-dark: #2563eb; --primary-light: rgba(59, 130, 246, .12);
  --success: #10b981; --success-dark: #059669; --success-light: rgba(16, 185, 129, .13);
  --warning: #f59e0b; --warning-dark: #d97706; --warning-light: rgba(245, 158, 11, .15);
  --danger: #ef4444; --danger-dark: #dc2626; --danger-light: rgba(239, 68, 68, .12);
  --info: #0ea5e9; --purple: #8b5cf6; --pink: #ec4899; --cyan: #06b6d4;
  --radius: 10px; --radius-lg: 14px; --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .10);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #0e1015; --panel: #161a22; --panel-2: #1d222c; --panel-3: #252b38;
  --text: #e7e9ee; --text-2: #c3c8d4; --muted: #99a1b3; --border: #2a3140;
  --primary-light: rgba(59, 130, 246, .18);
  --success-light: rgba(16, 185, 129, .18);
  --warning-light: rgba(245, 158, 11, .18);
  --danger-light: rgba(239, 68, 68, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .65);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.muted-sep { color: var(--border); }
.hint { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; line-height: 1.6; }
.empty-desc { font-size: 12.5px; color: var(--muted); margin: 0; }
.error-text { font-size: 12px; color: var(--danger); min-height: 16px; margin: 4px 0 0; }
.inline-code, .kbd {
  font-family: var(--font-mono); font-size: 12px; padding: 1px 6px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2);
}

/* ---------------------------------------------------------------- layout --- */
.app { display: flex; align-items: flex-start; }

.sidebar {
  position: sticky; top: 0; height: 100vh; width: 232px; flex: none;
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 20px 12px; overflow-y: auto; z-index: 20;
}

.main { flex: 1; min-width: 0; padding: 26px 32px 80px; }
.container { max-width: 1180px; margin: 0 auto; }

/* ---------------------------------------------------------------- brand ---- */
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; letter-spacing: .3px;
  padding: 0 10px 12px;
}
.brand-icon {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-size: 15px;
  box-shadow: 0 1px 2px rgba(59, 130, 246, .35);
}
.brand-logo { object-fit: contain; background: transparent; box-shadow: none; }
.brand small {
  display: block; font-weight: 400; color: var(--muted); font-size: 10.5px;
  letter-spacing: 1.1px; text-transform: uppercase; margin-top: 2px;
}
.brand-center { justify-content: center; padding: 0 0 8px; }

/* Sidebar menu toolbar */
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 4px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.menu-header-title {
  letter-spacing: .5px;
}
.menu-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.menu-btn, .menu-toggle-btn {
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: 1px solid transparent;
  transition: .15s;
}
.menu-btn:hover, .menu-toggle-btn:hover {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border);
}

/* ------------------------------------------------------------ sidebar nav -- */
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

/* 大分类区块容器：区块间有清晰间距与分隔线 */
.nav-group-section {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  transition: background .2s;
}
.nav-group-section:first-child {
  margin-top: 2px;
  padding-top: 0;
  border-top: none;
}

/* 大分类标题栏：层次清晰、整行可点、底色微显、折叠/展开交互流畅 */
.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 9px;
  cursor: pointer;
  user-select: none;
  background: var(--panel-2);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: background .15s, border-color .15s, box-shadow .15s;
  margin-bottom: 4px;
}
html[data-theme="dark"] .nav-group-header {
  border-color: rgba(255, 255, 255, 0.05);
}
.nav-group-header:hover {
  background: var(--panel-3);
  border-color: var(--border);
}

.nav-group-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* 大分类图标徽章：醒目的实体方圆胶囊，带阴影与边框，与小功能纯文本图标形成极其鲜明的对比 */
.nav-group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-size: 14px;
  line-height: 1;
  flex: none;
  transition: transform .18s cubic-bezier(0.4, 0, 0.2, 1), border-color .18s, background .18s, box-shadow .18s;
}
.nav-group-header:hover .nav-group-badge {
  transform: scale(1.08);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

/* 大分类文字标题：粗体、显眼、辨识度高 */
.nav-group-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 大类重命名：笔（hover 显现）与原地输入框 */
.nav-group-rename {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  cursor: pointer;
  transition: opacity .15s, color .15s;
  flex: none;
}
.nav-group-left:hover .nav-group-rename { opacity: .6; }
.nav-group-rename:hover { opacity: 1 !important; color: var(--primary); }
.nav-group-title-input {
  font: inherit; font-size: 12px; font-weight: 700; color: var(--text);
  width: 120px; padding: 2px 6px;
  border: 1px solid var(--primary); border-radius: 6px; background: var(--panel);
  outline: none;
}
/* 大类排序把手：hover 显现，与小功能的把手一致 */
.nav-group-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; font-size: 11px;
  color: var(--muted); opacity: 0; transition: opacity .15s;
  cursor: grab; user-select: none; flex: none;
  -webkit-user-drag: element;
}
.nav-group-header:hover .nav-group-drag-handle { opacity: .55; }
.nav-group-drag-handle:hover { opacity: 1; }
.nav-group-section.is-dragging { opacity: .45; }
.nav-group-section.drop-section-above { box-shadow: 0 -2px 0 0 var(--primary); }
.nav-group-section.drop-section-below { box-shadow: 0 2px 0 0 var(--primary); }

.nav-group-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* 大分类右侧功能数量气泡 */
.nav-group-count {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  line-height: 1.3;
}

.nav-group-chevron {
  font-size: 11px;
  color: var(--muted);
  transition: transform .2s ease;
  line-height: 1;
}
.nav-group-section.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

/* 小功能列表容器：整体向右缩进，并附有左侧树状层级引导线 */
.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  margin-top: 3px;
  margin-bottom: 6px;
  transition: border-color .15s;
}
.nav-group-section:hover .nav-group-items {
  border-left-color: rgba(59, 130, 246, 0.35);
}
.nav-group-section.collapsed .nav-group-items {
  display: none;
}

.side-status { padding: 10px 12px; margin: 4px 4px 12px; box-shadow: none; }
.side-status-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.side-status-sub {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, .15);
}
.dot.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-light); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-light); }

/* --------------------------------------------------------------- topbar ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap; margin-bottom: 30px;
}
.topbar h1 { margin: 0; font-size: 23px; letter-spacing: -.5px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* -------------------------------------------------------------- section ---- */
.section { margin-bottom: 40px; scroll-margin-top: 16px; }
.section > h2 { font-size: 16.5px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.section > h2::before { content: ''; width: 4px; height: 15px; border-radius: 2px; background: var(--primary); }
.section > .desc { color: var(--muted); font-size: 12.5px; margin: 0 0 15px 12px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.grid.kpi-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
/* 概览顶部四张状态卡：始终并排一行，窄屏才折行 */
.grid.kpi-grid.kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .grid.kpi-grid.kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.kpi-grid.kpi-row { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- cards ---- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 16px; }
.card-header {
  padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-sub { font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: .5px; text-transform: uppercase; }
.card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-footer {
  padding: 11px 16px; border-top: 1px solid var(--border); background: var(--panel-2);
  font-size: 12px; color: var(--muted);
}
.kpi { padding: 16px; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value {
  font-size: clamp(14px, 1.15vw, 19px); font-weight: 700; letter-spacing: -.3px; line-height: 1.35;
  margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 坐标要完整显示（x, y, z），所以这里允许换行，不允许省略 */
.stat-value.kpi-pos {
  white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums; font-size: clamp(13px, 1.02vw, 17px); line-height: 1.3;
}
/* 角色状态里的机器人 id：加粗、加深，比标题更显眼 */
#mc-hud-player-name { font-weight: 700; color: var(--text); letter-spacing: .4px; }
/* 玩家列表收放 */
#players-card.collapsed .card-body { display: none; }
.badge-solid-success { background: var(--success); border-color: var(--success); color: #fff; }
.badge-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.badge-solid-muted { background: var(--muted); border-color: var(--muted); color: #fff; }

/* -------------------------------------------------------------- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font-size: 13.5px; font-family: inherit; line-height: 1.2;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel);
  color: var(--text); cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, transform .06s, color .15s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled, .btn.busy { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(59, 130, 246, .35); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-dark); border-color: var(--success-dark); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--warning-dark); border-color: var(--warning-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-text { background: none; border: none; padding: 4px 6px; color: var(--muted); }
.btn-text:hover { color: var(--text); background: var(--panel-2); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* --------------------------------------------------------------- fields ---- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 500; }
.field-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.field-row .field { flex: 1 1 90px; }
.field-row .btn { flex: none; }

/* 卡密生成：三个字段都要有可见标签，窄屏改单列 */
.license-form-row .field { flex: 0 1 auto; }
.license-form-row .license-field-note { flex: 1 1 260px; }
.license-form-row .license-field-days,
.license-form-row .license-field-count { flex: 0 0 150px; }
@media (max-width: 640px) {
  .license-form-row .license-field-note,
  .license-form-row .license-field-days,
  .license-form-row .license-field-count { flex: 1 1 auto; }
}

.input, .select, .textarea {
  width: 100%; padding: 8px 12px; font-size: 13.5px; font-family: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .7; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.textarea { font-family: var(--font-mono); font-size: 12.5px; resize: vertical; }
.select { cursor: pointer; }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 12px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 32px; height: 18px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .22s; flex: none; }
html[data-theme="dark"] .switch-track { background: #3a4256; }
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s;
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(14px); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .select { flex: 1 1 320px; }
.details { margin-top: 10px; font-size: 12px; color: var(--muted); }
.details summary { cursor: pointer; }
.details .textarea { margin-top: 6px; }

/* --------------------------------------------------------------- badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; font-size: 11.5px;
  border-radius: 999px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border); font-weight: 500; line-height: 1.7; white-space: nowrap;
}
.badge-success { background: var(--success-light); color: var(--success-dark); border-color: transparent; }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); border-color: transparent; }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); border-color: transparent; }
.badge-primary { background: var(--primary-light); color: var(--primary); border-color: transparent; }
.badge-purple { background: rgba(139, 92, 246, .14); color: var(--purple); border-color: transparent; }
html[data-theme="dark"] .badge-success { color: #34d399; }
html[data-theme="dark"] .badge-warning { color: #fbbf24; }
html[data-theme="dark"] .badge-danger { color: #f87171; }
html[data-theme="dark"] .badge-primary { color: #93c5fd; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* --------------------------------------------------------------- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 320px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  background: var(--panel-2); font-weight: 600; color: var(--muted);
  font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--panel-2); }
.table-compact th, .table-compact td { padding: 7px 12px; }
.table code { font-family: var(--font-mono); font-size: 12px; }

/* 玩家列表滚轮上下滑动 */
#players-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#players-table-wrap::-webkit-scrollbar {
  width: 6px;
}
#players-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
#players-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#players-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
#players-table-wrap thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

/* ------------------------------------------------------------------- kv ---- */
.kv { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.kv .item {
  display: flex; gap: 12px; justify-content: space-between; align-items: baseline;
  padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px;
}
.kv .item:last-child { border-bottom: none; }
.kv .item > span:first-child { color: var(--muted); flex: none; }
.kv .item > span:last-child { text-align: right; word-break: break-word; font-family: var(--font-mono); font-size: 12px; }

.desc-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13px; }
.desc-list dt { color: var(--muted); }
.desc-list dd { margin: 0; word-break: break-all; }

/* ---------------------------------------------------------------- chat ----- */
.chat-log {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px 12px; min-height: 240px; max-height: 58vh; overflow-y: auto;
}
html[data-theme="dark"] .chat-log { background: #12161d; }

.chat-item { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.chat-item:last-child { border-bottom: none; }
.chat-item .avatar { margin-top: 2px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: inline-flex;
  align-items: center; justify-content: center; background: var(--primary); color: #fff;
  font-weight: 600; font-size: 11px; user-select: none;
}
.avatar-primary { background: var(--primary); }
.avatar-purple { background: var(--purple); }
.avatar-gray { background: #94a3b8; }
.avatar-danger { background: var(--danger); }
.avatar-success { background: var(--success); }
.chat-body { min-width: 0; flex: 1; }
.chat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-name { font-weight: 600; font-size: 13px; }
.chat-time { color: var(--muted); font-size: 11.5px; }
.chat-text { font-size: 13.5px; color: var(--text-2); margin-top: 1px; white-space: pre-wrap; word-break: break-word; }
.chat-item.sent .chat-text { color: var(--primary); }

.composer { display: flex; gap: 8px; margin-top: 12px; }
.composer .input { flex: 1; }

/* ----------------------------------------------------------------- log ----- */
.log {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  color: var(--text-2); max-height: 260px; overflow-y: auto;
}
html[data-theme="dark"] .log { background: #12161d; }
.log .line { padding: 2px 0; border-bottom: 1px dashed var(--border); word-break: break-word; }
.log .line:last-child { border-bottom: none; }

/* ------------------------------------------------- 实时控制台 console ----- */
/* 终端观感：深色底 + 等宽字体，颜色由行内的 span 给（MCC 的 § 码转过来的）。
   浅色主题下也用深底 —— 控制台里那些为黑底选的颜色（§e 黄字等）在浅色背景上
   几乎看不清。 */
.console {
  background: #0f1319; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.65;
  color: #d7dce5; height: 420px; overflow-y: auto; overflow-x: hidden;
  white-space: pre-wrap; word-break: break-word;
}
.console .console-line { padding: 1px 0; }
.console .console-line.is-supervisor { color: #7dd3fc; }
.console .console-line.is-panel { color: #c4b5fd; }
.console .console-line.is-warn { color: #fbbf24; }
.console .console-line.is-error { color: #f87171; }
.console .empty-desc { color: #6b7280; }
.console .console-line.hidden { display: none; }

.code {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text);
  overflow: auto; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
html[data-theme="dark"] .code { background: #12161d; }
.result { max-height: 340px; margin: 8px 0 0; }
.result-head { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* ------------------------------------------------------------ progress ---- */
/* .progress / .progress-bar 的基础样式以前完全缺失（只有 .striped/.success
   这些变体），于是自动走路的进度条根本看不见。 */
.progress {
  width: 100%; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--panel-3); border: 1px solid var(--border);
}
.progress-bar {
  height: 100%; width: 0; border-radius: 999px; background: var(--primary);
  transition: width .3s ease, background-color .3s ease;
}
.progress-bar.success { background: var(--success); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.striped {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .22) 25%, transparent 25%,
    transparent 50%, rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, .22) 75%, transparent 75%, transparent);
  background-size: 12px 12px;
  animation: progress-stripes 1s linear infinite;
}
@keyframes progress-stripes {
  from { background-position: 0 0; }
  to { background-position: 12px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar.striped { animation: none; }
}

/* --------------------------------------------------------------- alerts ---- */
.alert {
  display: flex; gap: 10px; padding: 11px 14px; border-radius: 11px; font-size: 13px;
  border: 1px solid; align-items: flex-start; line-height: 1.5; margin-bottom: 10px;
}
.alert:last-child { margin-bottom: 0; }
.alert-icon { flex: none; font-size: 14px; line-height: 1.4; }
.alert strong { display: block; margin-bottom: 2px; }
.alert-info { background: rgba(14, 165, 233, .10); border-color: rgba(14, 165, 233, .35); }
.alert-warning { background: var(--warning-light); border-color: rgba(245, 158, 11, .4); }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty-icon { font-size: 34px; display: block; margin-bottom: 10px; opacity: .6; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* ---------------------------------------------------------------- login ---- */
.login {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: var(--bg); padding: 20px;
}
.login-card {
  display: flex; flex-direction: column; gap: 14px; width: min(380px, 100%);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------------ responsive --- */
/* <=1040px：侧栏变成抽屉 —— 平时藏起，点顶栏「☰ 功能」滑出，选完自动收起。
   手机上功能页有 40 多个，把菜单塞在页面顶部的话，改一个设置要在页面和菜单间
   来回滚很远；抽屉让功能列表永远一键可达。 */
@media (max-width: 1040px) {
  .app { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: min(82vw, 300px);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 60;
    box-shadow: none;
    padding: 16px 12px;
  }
  .sidebar.sidebar-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .menu-header { display: flex; }
  /* 分组手风琴保持可用（640px 以下的细节在下面的窄屏块里） */
  .nav-group-header { display: flex; }
  .nav-group-section { display: block; margin-bottom: 6px; }
  .nav-group-items { display: none; flex-direction: column; gap: 2px; }
  .nav-group-section:not(.collapsed) .nav-group-items { display: flex; }
  .sidebar nav { flex-direction: column; overflow: visible; gap: 2px; }
  .sidebar nav a { white-space: normal; }
  .nav-group { display: flex; }
  .side-status { margin: 10px 0; }
  .main { padding: 20px 16px 60px; width: 100%; }
  .topbar h1 { font-size: 19px; }
  /* 汉堡按钮只在抽屉模式显示 */
  #menu-drawer-toggle { display: inline-flex; }
}
@media (min-width: 1041px) {
  #menu-drawer-toggle { display: none; }
  .sidebar-backdrop { display: none !important; }
}
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(15, 19, 25, .45);
  z-index: 55; border: none; padding: 0; cursor: pointer;
}

/* 手机窄屏：栅格会退化成单列，工具栏和表格需要更紧凑一点。
   原来只有一个 1040px 断点，更小的屏幕上表单会挤成一团。 */
@media (max-width: 640px) {
  .main { padding: 16px 12px 48px; }
  .topbar h1 { font-size: 17px; }
  .topbar { margin-bottom: 20px; gap: 10px; }
  .topbar-actions { width: 100%; }
  .grid, .grid.two, .grid.kpi-grid, .config-grid, .form-grid { grid-template-columns: 1fr; }
  .card-body { padding: 13px; }
  .card-header { padding: 11px 13px; font-size: 13.5px; }
  .field-row { flex-direction: column; align-items: stretch; }
  .field-row .btn { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .select, .toolbar .input { flex: 1 1 auto; width: 100%; }
  .btn-row { gap: 6px; }
  .btn-row .btn { flex: 1 1 auto; }
  .sidebar nav a { font-size: 12.5px; padding: 5px 8px; }
  .console { height: 300px; font-size: 11.5px; }
  .table { min-width: 0; }
  .table th, .table td { padding: 8px 10px; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }

  /* —— 手机侧栏：恢复"分组手风琴"形态 ——
     1040px 断点把分组标题藏掉、功能平铺成一行横滑，屏宽 <640 时找功能太痛苦；
     这里把分组标题请回来，让菜单回到可折叠的竖向列表（折叠状态用户自己点）。 */
  .sidebar { padding: 10px 10px 6px; }
  .nav-group-header { display: flex; }
  .nav-group-section { display: block; margin-bottom: 6px; }
  .nav-group-items { display: none; flex-direction: column; gap: 2px; }
  .nav-group-section:not(.collapsed) .nav-group-items { display: flex; }
  .sidebar nav { flex-direction: column; overflow-x: visible; gap: 2px; }
  .sidebar nav a { white-space: normal; font-size: 13px; padding: 8px 10px; }

  /* 触控目标：小按钮和标签的 × 至少 32px 见方，手指点得中 */
  .btn-xs, .btn-sm { min-height: 32px; }
  .entity-chip-x { width: 26px; height: 26px; font-size: 16px; }
  .entity-item { padding: 8px 10px; }

  /* 宽表格在手机上交给横向滚动（.table-wrap 已有），但别再被内联 min-width 撑爆 */
  .table th[style], .table td[style] { min-width: 0 !important; }

  /* 聊天/智能助手的输入行：窄屏竖排，输入框独占一行 */
  .composer { flex-wrap: wrap; }
  .composer .input { flex: 1 1 100%; }
  .composer .btn { flex: 1 1 auto; }

  /* 实体清单与模型设置在手机上单列 */
  .entity-picker-list { grid-template-columns: 1fr; }
  .entity-picker-head { flex-wrap: wrap; }
  .agent-config-grid { grid-template-columns: 1fr; }

  /* iOS：输入类控件字号 >=16px，聚焦时 Safari 不再自动放大页面 */
  .input, .select, .textarea, input[type="text"], input[type="number"], input[type="password"], textarea {
    font-size: 16px;
  }
}

/* 需要很窄的表格（别名、回复规则）在手机上仍然可读 */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* ==========================================================================
   Feature menu, pages, and the panels behind them
   ========================================================================== */

.menu-item {
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  cursor: pointer;
  user-select: none;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s, box-shadow .15s;
}
.menu-item:hover {
  background: var(--panel-2);
  color: var(--text);
}
.menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* 小功能图标：纯文本轻量风格，无实体方块胶囊，尺寸适度，与大分类的方圆徽章形成强烈的主从对比 */
.menu-icon {
  width: 16px;
  text-align: center;
  font-size: 12.5px;
  flex: none;
  opacity: .85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu-item.active .menu-icon {
  opacity: 1;
}

.menu-title-text {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s;
  cursor: grab;
  user-select: none;
  flex: none;
  margin-left: auto;
}
.menu-item:hover .drag-handle {
  opacity: 0.55;
}
.drag-handle:hover {
  opacity: 1;
}

.menu-item[draggable="true"] {
  cursor: grab;
}
.menu-item.is-dragging {
  opacity: 0.35;
  background: var(--panel-2) !important;
  border: 1px dashed var(--primary);
}

/* 拖拽指示器（插入位置参考线） */
.menu-item.drop-above {
  box-shadow: 0 -2px 0 0 var(--primary) !important;
}
.menu-item.drop-below {
  box-shadow: 0 2px 0 0 var(--primary) !important;
}

.nav-group-section.drag-over-section {
  background: rgba(59, 130, 246, 0.05);
  border-radius: 8px;
}
.nav-group-header.drag-over-header {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-group-items.drag-over-empty {
  min-height: 36px;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  background: var(--primary-light);
}

/* 激活状态：左侧竖向引导指示条，精准吸附于树状层级引导线上 */
.menu-item.active::before {
  content: '';
  position: absolute;
  left: -11px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary-light);
}

.page { display: block; }
.page > * { margin-bottom: 16px; }
.page > *:last-child { margin-bottom: 0; }
.page:not(.hidden) { animation: pageIn .22s ease; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* settings pages ---------------------------------------------------------- */
.config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 12px; }
.config-field {
  display: flex; flex-direction: column; gap: 6px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2);
}
.config-field > label { font-size: 12.5px; font-weight: 600; }
.config-field .help { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.config-field .field-row .field label { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.config-field textarea { min-height: 84px; }

/* presets, reset list ---------------------------------------------------- */
.list-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row-main span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42ch; }
.check-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 0;
  border-bottom: 1px dashed var(--border); font-size: 13px;
}
.check-row:last-child { border-bottom: none; }
.check-row input { width: 15px; height: 15px; accent-color: var(--primary); }

/* hotbar & Minecraft inventory ------------------------------------------- */
.hotbar { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.hotbar-slot {
  position: relative; height: 66px; padding: 4px 3px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.hotbar-slot:hover { border-color: var(--primary); }
.hotbar-slot.active {
  border-color: var(--primary); background: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.hotbar-key { font-size: 10px; color: var(--muted); }
.hotbar-name { font-size: 10px; line-height: 1.15; text-align: center; word-break: break-all; color: var(--text-2); }
.hotbar-count { position: absolute; right: 4px; bottom: 3px; font-size: 10px; color: var(--text); }
.hotbar-slot.active .hotbar-key, .hotbar-slot.active .hotbar-name { color: var(--primary); }

/* In-Game Minecraft Inventory GUI */
.mc-inventory-wrap {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.mc-inventory-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); display: flex; align-items: center; justify-content: space-between;
}
.mc-section-sub { font-size: 11px; font-weight: normal; color: var(--muted); text-transform: none; }
.mc-equipment-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 14px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mc-armor-group {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex: 1; max-width: 250px;
}
.mc-equipment-divider {
  width: 1px; height: 50px; background: var(--border);
}
.mc-offhand-group {
  display: flex; align-items: center; gap: 8px;
}
.mc-grid {
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px;
}
/* 服务器菜单容器：同样是 9 列，但行数按容器实际槽位来（菜单常见 6 行 54 格） */
.mc-container-grid {
  display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px;
}
/* 服务器别名表：地址列吃掉剩余宽度，端口固定窄列，避免长 IP 把端口挤掉 */
.server-alias-table { table-layout: fixed; }
.server-alias-table .col-alias { width: 150px; }
.server-alias-table .col-host { width: auto; }
.server-alias-table .col-port { width: 104px; }
.server-alias-table .col-del { width: 46px; }
.server-alias-table td { min-width: 0; }
.server-alias-table td .input { width: 100%; min-width: 0; box-sizing: border-box; }
.server-alias-table td input[type="number"] { padding-right: 4px; }

/* 服务器弹窗（dialog）：正文逐行，按钮流式换行 */
.dialog-body {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 14px; line-height: 1.6; margin-bottom: 12px;
}
.dialog-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.mc-slot {
  position: relative; aspect-ratio: 1; min-height: 52px;
  border-radius: 8px; border: 2px solid var(--border);
  background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  padding: 0; margin: 0; box-sizing: border-box;
  cursor: pointer; user-select: none; transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .mc-slot {
  background: #171b23; border-color: #262c3b;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.35), inset -1px -1px 0 rgba(255, 255, 255, 0.05);
}
.mc-slot:hover {
  border-color: var(--primary); transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); z-index: 2;
}
.mc-slot.selected {
  border-color: var(--primary) !important;
  background: var(--primary-light) !important;
  box-shadow: 0 0 0 2px var(--primary), inset 0 0 10px var(--primary-light) !important;
  z-index: 3;
}
.mc-slot.active-held {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px #f59e0b, 0 0 12px rgba(245, 158, 11, 0.45) !important;
}
.mc-slot.active-held::before {
  content: "★"; position: absolute; top: -5px; right: -5px;
  width: 15px; height: 15px; background: #f59e0b; color: #fff;
  font-size: 9px; line-height: 15px; text-align: center; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); pointer-events: none; z-index: 4;
}
.mc-slot-empty { opacity: 0.65; }
.mc-slot-placeholder-icon {
  font-size: 18px; opacity: 0.45; filter: grayscale(1); pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.mc-slot-placeholder-icon img {
  width: 28px; height: 28px; image-rendering: pixelated; image-rendering: crisp-edges;
  opacity: 0.35; pointer-events: none;
}
.mc-slot-visual {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; pointer-events: none;
}
.mc-slot-icon {
  font-size: 24px; line-height: 1; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.mc-item-icon {
  width: 34px; height: 34px; image-rendering: pixelated; image-rendering: crisp-edges;
  object-fit: contain; pointer-events: none; user-select: none;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.45));
}
.table-item-icon {
  width: 22px; height: 22px; image-rendering: pixelated; image-rendering: crisp-edges;
  vertical-align: middle; margin-right: 6px; object-fit: contain; display: inline-block;
}
.mc-slot-key {
  position: absolute; top: 2px; left: 4px; font-size: 9px; font-weight: 700; line-height: 1;
  color: var(--muted); pointer-events: none; z-index: 5;
}
.mc-slot-name {
  font-size: 9px; line-height: 1.1; max-width: 92%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center;
  color: var(--text-2); margin-top: 2px; pointer-events: none;
}
.mc-slot-count {
  position: absolute; bottom: 2px; right: 4px; font-size: 12px; font-weight: 800; line-height: 1;
  color: #ffffff; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 1px 0 #000, 1px 0 0 #000, 0 -1px 0 #000, -1px 0 0 #000;
  font-family: var(--font-mono); pointer-events: none; user-select: none; z-index: 5;
}
.mc-slot-damage-bar {
  position: absolute; bottom: 2px; left: 4px; right: 4px; height: 2px;
  background: #374151; border-radius: 1px; overflow: hidden; pointer-events: none; z-index: 4;
}
.mc-slot-damage-fill {
  height: 100%; background: #10b981;
}

/* Hand & Slot action panels */
.hand-actions-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.slot-item-header {
  display: flex; gap: 14px; align-items: center; margin-bottom: 14px;
}
.slot-item-icon-large {
  font-size: 34px; width: 54px; height: 54px; border-radius: 12px;
  background: var(--panel-3); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); flex-shrink: 0;
}
.slot-item-icon-large img {
  width: 44px; height: 44px; image-rendering: pixelated; image-rendering: crisp-edges;
  object-fit: contain; filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.4));
}
.slot-item-info { min-width: 0; flex: 1; }
.slot-item-title {
  font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-item-type {
  font-size: 12px; color: var(--muted); font-family: var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-item-badge-row {
  display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap;
}
.slot-lore-box {
  background: #101216; border: 1px solid #232731; border-radius: 8px;
  padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  color: #a0a6b5; margin-bottom: 14px; max-height: 160px; overflow-y: auto;
}
.mc-enchant-row {
  color: #c084fc; font-weight: 600; margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px;
}
.mc-enchant-row.is-curse { color: #f87171; }
.mc-effect-row {
  color: #38bdf8; font-weight: 500; margin-bottom: 3px;
  display: flex; align-items: center; gap: 6px;
}
.badge-purple {
  background: rgba(168, 85, 247, 0.15); color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}
.badge-cyan {
  background: rgba(6, 182, 212, 0.15); color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
}
.mc-slot-enchant-glint {
  position: absolute; top: 3px; right: 3px; width: 6px; height: 6px;
  border-radius: 50%; background: #c084fc; box-shadow: 0 0 6px #a855f7;
  pointer-events: none; z-index: 5;
}
.mc-slot-effect-dot {
  position: absolute; top: 3px; right: 3px; width: 6px; height: 6px;
  border-radius: 50%; background: #22d3ee; box-shadow: 0 0 6px #06b6d4;
  pointer-events: none; z-index: 5;
}
.slot-actions-panel {
  background: var(--panel-2); border-radius: var(--radius); padding: 12px;
  border: 1px solid var(--border);
}
.slot-actions-label {
  font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  margin-bottom: 6px; letter-spacing: 0.5px;
}
.quick-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tag-pill {
  padding: 2px 8px; border-radius: 6px; background: var(--panel-3);
  border: 1px solid var(--border); font-size: 11px; cursor: pointer;
  color: var(--text-2); transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tag-pill:hover {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}

/* progress --------------------------------------------------------------- */
.progress-bar.striped {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .22) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, .22) 75%, transparent 75%);
  background-size: 16px 16px;
  animation: stripes 1s linear infinite;
}
.progress-bar.success { background: var(--success); }
.progress-bar.danger { background: var(--danger); }
@keyframes stripes {
  from { background-position: 0 0; }
  to { background-position: 16px 0; }
}

/* small inputs and misc -------------------------------------------------- */
.input-sm { padding: 5px 9px; font-size: 12.5px; border-radius: 7px; }
.badge-solid-success { background: var(--success); }
.badge-solid-danger { background: var(--danger); }
.card + .card, .grid + .card, .card + .grid { margin-top: 16px; }
.page .card + .card { margin-top: 0; }

/* toast ------------------------------------------------------------------ */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 12px; padding: 11px 16px; box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: min(440px, 88vw);
  opacity: 0; transform: translateY(8px); transition: .22s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast-info { border-left-color: var(--info); }
.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-danger { border-left-color: var(--danger); }

/* ==========================================================================
   Multi-bot: picker, device code card, bot console
   ========================================================================== */

.bot-picker { padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.bot-picker label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .9px; font-weight: 700; }
.bot-picker .select { padding: 6px 10px; font-size: 12.5px; }
.bot-picker-meta { font-size: 11px; color: var(--muted); }

.device-code {
  margin-top: 12px; padding: 16px; border: 1px dashed var(--primary);
  border-radius: 12px; background: var(--primary-light); text-align: center;
}
.device-code-value {
  font-family: var(--font-mono); font-size: 30px; font-weight: 700; letter-spacing: 4px;
  color: var(--primary); margin-bottom: 12px; user-select: all;
}
.device-code .btn-row { justify-content: center; }

.alert-success { background: var(--success-light); border-color: rgba(16, 185, 129, .35); }

#bot-log { max-height: 380px; }

/* ==========================================================================
   Scripts editor and the natural-language console
   ========================================================================== */

#script-code { min-height: 340px; font-size: 12.5px; line-height: 1.6; }

.agent-log {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; min-height: 260px; max-height: 56vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.agent-msg { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.agent-user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.agent-bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.agent-meta { margin-top: 6px; font-size: 11px; color: var(--muted); }
.agent-tool { align-self: flex-start; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); padding: 2px 6px; }
/* 智能助手的模型设置表单（API Key 等） */
.agent-config {
  margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 12px;
  background: var(--panel-2);
}
.agent-config-grid {
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.agent-config-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.agent-config-grid .input { width: 100%; }
.agent-config .help { align-self: center; }
/* 实体名单的中英对照选择器（AutoAttack.Entites_List 等） */
.entity-picker { margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); padding: 8px 10px; }
.entity-picker-head { display: flex; gap: 10px; align-items: center; }
.entity-picker-head .input-sm { max-width: 260px; height: 30px; font-size: 12.5px; }
/* 清单的展开/收起按钮：加黑加粗，一眼能看到 */
.entity-picker-toggle {
  font-weight: 700; color: var(--text); border: 1px solid var(--border);
  background: var(--panel);
}
.entity-picker-toggle:hover { border-color: var(--primary); color: var(--primary); }
.entity-picker-count { font-size: 12px; }
.entity-picker-list {
  margin-top: 8px; display: grid; gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  max-height: 300px; overflow-y: auto;
}
.entity-item {
  display: flex; align-items: baseline; gap: 6px; text-align: left;
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); cursor: pointer; font-family: inherit; font-size: 12px;
}
.entity-item:hover { border-color: var(--primary); background: var(--primary-light, rgba(59, 130, 246, .08)); }
.entity-item:disabled { opacity: .45; cursor: not-allowed; }
.entity-zh { font-weight: 600; white-space: nowrap; }
.entity-en { font-family: var(--font-mono); font-size: 11px; color: var(--muted); word-break: break-all; }
.entity-miss { margin-left: auto; font-size: 10px; color: var(--muted); white-space: nowrap; }
/* 名单的标签视图：一个名字一个标签，点 × 删除 */
.entity-chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 38px; margin-bottom: 8px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
}
.entity-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-2); font-size: 12.5px;
}
.entity-chip-bad { border-color: var(--danger, #dc2626); }
.entity-chip-zh { font-weight: 600; }
.entity-chip-en { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.entity-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0; font-family: inherit;
}
.entity-chip-x:hover { background: var(--danger, #dc2626); color: #fff; }

/* Switch fix: the knob used to receive the "开启/关闭" text because the label span was
   selected with span:last-child, which matched the thumb inside the track. */
.switch-thumb { font-size: 0; line-height: 0; overflow: hidden; }
.switch-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* Signed-in user strip in the sidebar */
.whoami {
  display: flex; align-items: center; gap: 8px; margin: 4px 4px 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2); font-size: 12.5px;
}
.whoami #who-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami .dot { width: 8px; height: 8px; }
/* Custom quick-command chips */
.chips-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips-row .chips { margin-top: 0; flex: 1; }
.chips-editor {
  margin-top: 10px; padding: 12px 14px; border: 1px dashed var(--border);
  border-radius: 12px; background: var(--panel-2);
}
.chips-editor .edit-list { margin-top: 10px; }
.chip-del {
  border: none; background: none; color: var(--danger); cursor: pointer;
  font-size: 12px; padding: 0 0 0 4px; line-height: 1;
}
.chip-wrap { display: inline-flex; align-items: center; }
/* 多行字段（物品/关键词名单）占满整行：否则它所在的格子高度不同，
   会让相邻页面的字段看起来没对齐。 */
.config-field--wide { grid-column: 1 / -1; }
.config-field--wide .textarea { min-height: 84px; }

/* ----------------------------------------------------------- Minecraft HUD -- */
.mc-hud-card {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.mc-hud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.mc-hud-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel-2);
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color .2s;
}

.mc-hud-row:hover {
  border-color: var(--primary);
}

.mc-hud-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mc-hud-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.mc-hud-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.mc-hud-icons {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 20px;
  flex-wrap: nowrap;
}

.mc-hud-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  shape-rendering: crispEdges;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
  transition: transform .1s ease;
}

.mc-hud-icon:hover {
  transform: translateY(-2px) scale(1.15);
}

/* 枚举名单填错时的输入框状态 */
.input-error, textarea.input-error { border-color: var(--danger, #dc2626) !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.enum-hint { display: block; margin-top: 4px; }

/* ------------------------------------------------------------------ 经验条 ----
   按原版样式：一条扁平的深色槽 + 绿色渐变填充，等级数字居中在槽的上方，
   绿色字带黑色描边（原版是像素字体 + 1px 阴影，这里用系统字体 + 多层文字阴影近似）。
   等级 0 时不显示数字（原版行为）。 */
.mc-xp {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding-top: 22px;
}
.mc-xp-level {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: .5px;
  color: #80ff20;
  text-shadow: 2px 2px 0 #0a0a0a, -1px -1px 0 #0a0a0a, 1px -1px 0 #0a0a0a, -1px 1px 0 #0a0a0a, 0 0 6px rgba(128, 255, 32, .25);
}
.mc-xp-track {
  height: 8px;
  background: #14170f;
  border: 1px solid #000;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.mc-xp-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(180deg, #b6ff5c 0%, #80ff20 45%, #5fd117 100%);
  box-shadow: 0 0 6px rgba(128, 255, 32, .45);
  transition: width .25s linear;
}