/* ==================== 布局 ==================== */
.app {
  display: grid;
  grid-template-rows: var(--tb-top-h) 1fr var(--tb-bottom-h);
  height: 100vh;
  overflow: hidden;
}

/* ==================== 顶部栏 ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--tb-top-h);
  padding: 0 14px;
  background: var(--tb-top-bg);
  background-image: var(--tb-topbar-bg-image, none);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--tb-border);
  box-shadow: var(--tb-shadow-1);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.topbar-brand .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(var(--tb-primary-rgb), 0.35);
}

.brand-logo {
  height: 34px;
  max-width: 100px;
  object-fit: contain;
}

.topbar-subtitle {
  font-size: 12.5px;
  color: var(--tb-text-sub);
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--tb-border);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 看板娘气泡 */
.topbar-mascot {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px;
  max-width: 460px;
  padding: 5px 14px 5px 5px;
  background: linear-gradient(135deg, rgba(var(--tb-primary-rgb), 0.1), rgba(var(--tb-primary-rgb), 0.04));
  border: 1px solid var(--tb-border);
  border-radius: 16px;
  transition: all 0.3s ease;
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}

.topbar-mascot:hover {
  border-color: var(--tb-primary);
  background: linear-gradient(135deg, rgba(var(--tb-primary-rgb), 0.15), rgba(var(--tb-primary-rgb), 0.06));
}

.topbar-mascot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(var(--tb-primary-rgb), 0.25);
}

.topbar-mascot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-mascot-text {
  font-size: 12.5px;
  color: var(--tb-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: mascotFade 0.5s ease;
}

@keyframes mascotFade {
  from {
    opacity: 0;
    transform: translateX(6px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ==================== 顶部栏状态（时间/网络/电量） ==================== */
.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  margin-right: 6px;
  font-size: 11.5px;
  color: var(--tb-text-sub);
  font-family: "Consolas", monospace;
}

.status-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(var(--tb-primary-rgb), 0.06);
  border-radius: 999px;
  white-space: nowrap;
}

.status-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.status-item.low {
  color: #dc2626;
}

.status-item.offline {
  color: #9ca3af;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: transparent;
  border: 1px solid var(--tb-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  color: var(--tb-text);
}

.user-chip:hover {
  border-color: var(--tb-primary);
  background: var(--tb-primary-soft);
}

.user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-chip .name {
  font-size: 13px;
}

/* ==================== 主体 ★ 5 列布局 ==================== */
.body {
  display: grid;
  grid-template-columns: var(--tb-side-w) 1fr 0px 0px 0px;
  overflow: hidden;
  min-height: 0;
  transition: grid-template-columns 0.22s ease;
}

.body.info-open {
  grid-template-columns: var(--tb-side-w) 1fr 320px 0px 0px;
}

.body.tactics-open {
  grid-template-columns: var(--tb-side-w) 1fr 0px 340px 0px;
}

.body.edit-open {
  grid-template-columns: var(--tb-side-w) 1fr 0px 0px 340px;
}

/* ★ 右侧面板不再 display:none，改为 0 宽列 + overflow 裁剪，配合 grid 过渡平滑开合 */
.body.tactics-open .info-panel,
.body.edit-open .info-panel {
  border-left-color: transparent;
}

.body.edit-open .tactics-panel {
  border-left-color: transparent;
}

/* ==================== 左侧栏 ==================== */
.side {
  background: var(--tb-side-bg);
  background-image: var(--tb-sidebar-bg-image, none);
  background-size: cover;
  background-position: center;
  border-right: 1px solid var(--tb-border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  min-height: 0;
}

.side-section {
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--tb-shadow-1);
  flex-shrink: 0;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* 侧栏分区标题前的小圆点装饰 */
.side-title>span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.side-title>span:first-child::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  box-shadow: 0 0 5px rgba(var(--tb-primary-rgb), 0.45);
}

.side-title .actions {
  display: flex;
  gap: 2px;
}

.side-title .hint-tip {
  font-size: 10.5px;
  color: var(--tb-text-sub);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}

/* ==================== 地图选择器 ==================== */
.map-selector {
  position: relative;
}

.map-selector-current {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--tb-top-bg), var(--tb-primary-soft));
  border: 1px solid var(--tb-border);
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  color: var(--tb-text);
}

.map-selector-current:hover {
  border-color: var(--tb-primary);
}

.map-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(var(--tb-primary-rgb), 0.15);
  flex-shrink: 0;
  border: 1px solid var(--tb-border);
}

.map-current-info {
  flex: 1;
  min-width: 0;
}

.map-current-name {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-current-sub {
  font-size: 11.5px;
  color: var(--tb-text-sub);
  margin-top: 3px;
}

.map-current-arrow {
  color: var(--tb-text-sub);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.map-selector.open .map-current-arrow {
  transform: rotate(180deg);
}

.map-selector-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 40, 90, 0.15);
  max-height: 340px;
  overflow-y: auto;
  z-index: 100;
  padding: 6px;
}

.map-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--tb-text);
  font-family: inherit;
}

.map-option:hover {
  background: rgba(var(--tb-primary-rgb), 0.06);
}

.map-option.active {
  background: var(--tb-primary-soft);
  color: var(--tb-primary);
  font-weight: 600;
}

.map-option-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(var(--tb-primary-rgb), 0.15);
  flex-shrink: 0;
  border: 1px solid var(--tb-border);
}

.map-option-info {
  flex: 1;
  min-width: 0;
}

.map-option-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-option-sub {
  font-size: 11px;
  color: var(--tb-text-sub);
  margin-top: 2px;
}

/* ==================== 点位 ==================== */
.point-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

.point-chip {
  padding: 8px 6px;
  border-radius: 6px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  color: var(--tb-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
  font-family: inherit;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.point-chip:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.point-chip.active {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
  box-shadow: 0 2px 6px rgba(var(--tb-primary-rgb), 0.3);
}

/* ==================== 工具 Tab ==================== */
.tool-tabs-section {
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.tool-tabs {
  display: flex;
  margin: 0 0 10px;
  background: rgba(var(--tb-primary-rgb), 0.07);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.tool-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border-radius: 7px;
  background: transparent;
  border: none;
  color: var(--tb-text-sub);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  font-family: inherit;
}

.tool-tab:hover {
  color: var(--tb-primary);
}

.tool-tab.active {
  background: var(--tb-top-bg);
  color: var(--tb-primary);
  box-shadow: 0 1px 4px rgba(15, 40, 90, 0.12), 0 0 0 1px rgba(var(--tb-primary-rgb), 0.3);
}

.tool-panel {
  padding: 0 2px 2px;
  min-height: 0;
}

/* ==================== 工具网格 ★ 带快捷键角标 ==================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tool-btn {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  color: var(--tb-text-sub);
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
  font-size: 10.5px;
  padding: 4px 4px 12px;
  /* ★ 底部留出角标位 */
  font-family: inherit;
}

.tool-btn svg {
  pointer-events: none;
}

.tool-btn:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.tool-btn.active {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
  box-shadow: var(--tb-shadow-glow);
}

.tool-btn-label {
  font-size: 10.5px;
}

/* ★ 快捷键角标 */
.tool-btn-key {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 8.5px;
  font-family: "Consolas", monospace;
  font-weight: 700;
  color: var(--tb-text-sub);
  background: rgba(var(--tb-primary-rgb), 0.1);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 12px;
  pointer-events: none;
  opacity: 0.75;
}

.tool-btn.active .tool-btn-key {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ==================== 颜色选择器 ==================== */
.color-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.color-current {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid var(--tb-border);
  background: #ff3b30;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.color-hex,
.form-input {
  flex: 1;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: "Consolas", "Courier New", monospace;
  color: var(--tb-text);
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  outline: none;
  text-transform: uppercase;
  width: 100%;
}

.form-input {
  text-transform: none;
  font-family: inherit;
  font-size: 13px;
}

.color-hex:focus,
.form-input:focus {
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px var(--tb-primary-soft);
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s;
  outline: none;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: var(--tb-text);
  transform: scale(1.08);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 0 2px var(--tb-primary-soft);
}

.color-input {
  flex: 1;
  height: 30px;
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
  outline: none;
}

.width-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.width-row label {
  font-size: 12px;
  color: var(--tb-text-sub);
  flex-shrink: 0;
  min-width: 36px;
}

.width-row input[type=range] {
  flex: 1;
  accent-color: var(--tb-primary);
}

.width-val {
  font-size: 12px;
  color: var(--tb-text-sub);
  width: 32px;
  text-align: right;
  font-family: "Consolas", monospace;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.field-row label {
  font-size: 12px;
  color: var(--tb-text-sub);
  flex-shrink: 0;
  min-width: 56px;
}

.field-tip {
  font-size: 11px;
  color: #9aabc4;
  line-height: 1.5;
}

.fill-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--tb-text-sub);
  cursor: pointer;
  user-select: none;
}

.fill-toggle input {
  accent-color: var(--tb-primary);
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--tb-text);
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aabc4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.form-select:focus {
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px var(--tb-primary-soft);
}

/* ==================== 图标库 ==================== */
.icon-lib-scroll {
  max-height: 220px;
  overflow-y: auto;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
  padding: 6px;
}

.icon-lib-group {
  margin-bottom: 8px;
}

.icon-lib-group:last-child {
  margin-bottom: 0;
}

.icon-lib-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--tb-text-sub);
  padding: 4px 4px 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.85;
  border-bottom: 1px dashed var(--tb-border);
  margin-bottom: 6px;
}

.icon-lib-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.icon-lib-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: grab;
  background: #2a2f38;
  border: 2px solid transparent;
  transition: all 0.12s;
  padding: 4px;
  outline: none;
  position: relative;
}

.icon-lib-item:active {
  cursor: grabbing;
}

.icon-lib-item:hover {
  border-color: var(--tb-primary);
}

.icon-lib-item.active {
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px var(--tb-primary-soft);
}

.icon-lib-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* ==================== 棋子分类 Tab ==================== */
.piece-category-tabs {
  display: flex;
  gap: 4px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 8px;
}

.piece-cat-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--tb-text-sub);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  font-family: inherit;
}

.piece-cat-tab:hover {
  color: var(--tb-primary);
}

.piece-cat-tab.active {
  background: var(--tb-primary);
  color: #fff;
}

.piece-shape-tabs,
.bg-tabs {
  display: flex;
  gap: 4px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  padding: 3px;
}

.piece-shape-tab,
.bg-tab {
  flex: 1;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--tb-text-sub);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  font-family: inherit;
}

.piece-shape-tab:hover,
.bg-tab:hover {
  color: var(--tb-primary);
}

.piece-shape-tab.active,
.bg-tab.active {
  background: var(--tb-primary);
  color: #fff;
}

/* ==================== 图层 ==================== */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--tb-radius);
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.12s;
  border: 1px solid transparent;
}

.layer-item:hover {
  background: rgba(var(--tb-primary-rgb), 0.06);
}

.layer-item.active {
  background: var(--tb-primary-soft);
  border-color: var(--tb-primary);
  color: var(--tb-primary);
  font-weight: 600;
}

.layer-item .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-item .eye {
  color: var(--tb-text-sub);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.layer-item .eye:hover {
  color: var(--tb-primary);
  background: var(--tb-primary-soft);
}

.layer-item .eye.off {
  opacity: 0.35;
}

.layer-rename {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid var(--tb-primary);
  border-radius: 5px;
  background: var(--tb-top-bg);
  color: var(--tb-text);
  font-size: 12.5px;
  outline: none;
  font-family: inherit;
}

.undo-redo-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.icon-btn.wide {
  flex: 1;
  height: 32px;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius);
}

.icon-btn.wide:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==================== ★ 侧栏看板娘大立绘 ==================== */
.side-mascot {
  position: relative;
  margin: 8px 0 0;
  padding: 0 0 10px;
  border-radius: 12px;
  background: linear-gradient(180deg,
      rgba(var(--tb-primary-rgb), 0.06) 0%,
      rgba(var(--tb-primary-rgb), 0.14) 100%);
  border: 1px solid var(--tb-border);
  text-align: center;
  overflow: hidden;
}

.sidebar-mascot-img {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 12px 12px 0 0;
}

.sidebar-mascot-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 12px auto 8px;
  box-shadow: 0 6px 18px rgba(var(--tb-primary-rgb), 0.25);
}

.sidebar-mascot-fallback {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 12px auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
}

.sidebar-mascot-text {
  font-size: 12px;
  color: var(--tb-text-sub);
  margin-top: 8px;
  padding: 0 12px;
  line-height: 1.5;
}

/* ==================== 舞台 ==================== */
.stage {
  position: relative;
  overflow: hidden;
  background: var(--tb-canvas-bg);
  min-height: 0;
  touch-action: none;
  user-select: none;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  outline: none;
}

.stage.tool-move canvas {
  cursor: grab;
}

.stage.tool-move.panning canvas {
  cursor: grabbing;
}

.stage.tool-drag canvas {
  cursor: move;
}

.stage.tool-rotate canvas {
  cursor: crosshair;
}

.zoom-indicator {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 11.5px;
  font-family: "Consolas", monospace;
  padding: 5px 11px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.5px;
}

.coord-indicator {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11.5px;
  font-family: "Consolas", monospace;
  padding: 6px 12px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  user-select: none;
  line-height: 1.5;
}

.coord-indicator .label {
  opacity: 0.6;
  margin-right: 6px;
}

.empty-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--tb-text-sub);
  pointer-events: none;
  text-align: center;
  padding: 20px;
}

.empty-stage p {
  margin: 0;
  font-size: 13px;
}

.stage-controls {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}

.selection-toolbar {
  position: absolute;
  display: flex;
  gap: 4px;
  z-index: 50;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ★ 未选中时自动淡出消失 */
.selection-toolbar.hiding {
  opacity: 0;
  transform: translate(-50%, calc(-100% + 5px));
  pointer-events: none;
}

.selection-toolbar button {
  width: 30px;
  height: 30px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  color: var(--tb-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.12s;
  outline: none;
}

.selection-toolbar button:hover {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

.selection-toolbar button.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* ==================== 右侧信息栏 ==================== */
.info-panel {
  background: var(--tb-top-bg);
  background-image: var(--tb-infobar-bg-image, none);
  background-size: cover;
  background-position: center;
  border-left: 1px solid transparent;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  transition: border-color 0.22s ease;
}

.body.info-open .info-panel {
  border-left-color: var(--tb-border);
}

.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tb-border);
  font-size: 13px;
  font-weight: 700;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.info-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--tb-border);
}

.info-block-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.info-piece-header {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--tb-side-bg);
  border-radius: 10px;
  margin-bottom: 12px;
}

.info-piece-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #2a2f38;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
}

.info-piece-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.info-piece-title {
  flex: 1;
  min-width: 0;
}

.info-piece-name {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-piece-sub {
  font-size: 11.5px;
  color: var(--tb-text-sub);
  margin-top: 3px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: var(--tb-side-bg);
  border-radius: 6px;
}

.info-item span {
  font-size: 10.5px;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.info-item b {
  font-size: 13px;
}

.info-members {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.info-member-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--tb-side-bg);
  border-radius: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}

.info-member-item .name {
  font-weight: 600;
  color: var(--tb-text);
  min-width: 50px;
}
.info-member-item .member-avatar { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: rgba(var(--tb-primary-rgb), .12); flex: 0 0 auto; }
.info-member-item .member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.info-member-item .member-main { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.info-member-item .member-stats { display: flex; gap: 6px; flex-wrap: wrap; color: var(--tb-text-sub); font-size: 10px; }
.info-member-item .member-stats b { color: #22c55e; font-weight: 700; }
.info-member-item .member-stats b.dead { color: #ef4444; }
.info-member-item .member-stats em { font-style: normal; }

.info-member-item .tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(var(--tb-primary-rgb), 0.12);
  color: var(--tb-primary);
}

.info-member-item .tag.equip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.info-member-item .tag.equip img {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.info-member-empty {
  font-size: 11px;
  color: var(--tb-text-sub);
  text-align: center;
  padding: 10px;
  opacity: 0.6;
}

.info-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.info-actions .btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn.danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.btn.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.info-side-group {
  margin-bottom: 12px;
}

.info-side-group:last-child {
  margin-bottom: 0;
}

.info-side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.info-side-title.attack {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.info-side-title.defense {
  background: rgba(22, 119, 255, 0.1);
  color: var(--tb-primary);
}

.info-side-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
}

.info-vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-vehicle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--tb-side-bg);
  border-radius: 6px;
  font-size: 12.5px;
}

.info-vehicle-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #2a2f38;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  flex-shrink: 0;
}

.info-vehicle-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.info-vehicle-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-vehicle-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(var(--tb-primary-rgb), 0.12);
  color: var(--tb-primary);
  white-space: nowrap;
}

.info-vehicle-tag.initial {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.info-vehicle-count {
  font-weight: 700;
  color: var(--tb-primary);
  font-family: "Consolas", monospace;
  font-size: 12px;
  min-width: 24px;
  text-align: right;
}

.info-empty {
  font-size: 11.5px;
  color: var(--tb-text-sub);
  text-align: center;
  padding: 12px;
  opacity: 0.7;
}

/* ==================== ★ 右侧：方案 / 合集面板 ==================== */
.tactics-panel {
  display: flex;
  background: var(--tb-top-bg);
  border-left: 1px solid transparent;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  width: 100%;
  transition: border-color 0.22s ease;
}

.body.tactics-open .tactics-panel {
  border-left-color: var(--tb-border);
}

/* ==================== ★ 右侧：编辑面板 ==================== */
.edit-panel {
  display: flex;
  background: var(--tb-top-bg);
  border-left: 1px solid transparent;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  width: 100%;
  transition: border-color 0.22s ease;
}

.body.edit-open .edit-panel {
  border-left-color: var(--tb-border);
}

.edit-panel .info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tb-border);
  font-size: 13px;
  font-weight: 700;
}

.edit-panel #edit-panel-body {
  padding: 14px 16px;
}

.edit-panel .pedit-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--tb-border);
}

.edit-panel .pedit-section:last-child {
  border-bottom: none;
}

.edit-panel .pedit-section h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edit-panel .pedit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.edit-panel .pedit-row label {
  min-width: 68px;
  font-size: 12px;
  color: var(--tb-text-sub);
  flex-shrink: 0;
}

.edit-panel .pedit-row input,
.edit-panel .pedit-row select,
.edit-panel .pedit-row textarea {
  flex: 1;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  background: var(--tb-top-bg);
  color: var(--tb-text);
  outline: none;
  font-family: inherit;
}

.edit-panel .pedit-row input[type="color"] {
  padding: 2px;
  height: 28px;
  cursor: pointer;
  flex: 0 0 auto;
  width: 40px;
}

.edit-panel .pedit-row input[type="range"] {
  accent-color: var(--tb-primary);
}

.edit-panel .pedit-row input[type="checkbox"] {
  accent-color: var(--tb-primary);
  flex: 0 0 auto;
}

.edit-panel .hint-tip {
  font-size: 11.5px;
  color: var(--tb-text-sub);
  margin: 6px 0;
  line-height: 1.5;
}

/* ==================== ★ 内联文本编辑器 ==================== */
.inline-text-editor {
  position: absolute;
  /* ★ 修复：必须 absolute，否则 left/top 不生效，编辑器不会出现在点击位置 */
  caret-color: var(--tb-primary);
  min-height: 1.4em;
  cursor: text;
  font-family: -apple-system, "PingFang SC", sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  user-select: text;
  color: #fff;
}

.inline-text-editor:empty::before {
  content: "输入文字…";
  opacity: 0.5;
}

/* ==================== 测距 ==================== */
.ruler-info {
  font-size: 13px;
}

.ruler-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--tb-text);
}

.ruler-row>span:first-child {
  min-width: 50px;
  color: var(--tb-text-sub);
  font-size: 12px;
}

.ruler-row input[type="number"] {
  padding: 5px 8px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--tb-text);
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  outline: none;
  width: 70px;
}

.ruler-row input[type="number"]:focus {
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 2px var(--tb-primary-soft);
}

.ruler-row strong {
  color: var(--tb-primary);
  font-size: 15px;
  font-family: "Consolas", monospace;
}

.hint-tip {
  font-size: 11.5px;
  color: var(--tb-text-sub);
  margin: 8px 0 0;
  line-height: 1.5;
}

/* ==================== 底部栏 ==================== */
.bottombar {
  height: var(--tb-bottom-h);
  background: var(--tb-top-bg);
  background-image: linear-gradient(180deg, rgba(var(--tb-primary-rgb), 0) 40%, rgba(var(--tb-primary-rgb), 0.05)),
    var(--tb-bottombar-bg-image, none);
  background-size: cover;
  background-position: center;
  border-top: 1px solid var(--tb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  color: var(--tb-text-sub);
}

.bottombar-left,
.bottombar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bottombar .link {
  color: var(--tb-text-sub);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

.bottombar .link:hover {
  color: var(--tb-primary);
}

.bottombar-right span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bottombar-right span::before {
  content: "✦";
  color: var(--tb-primary);
  opacity: 0.7;
  font-size: 10px;
}

/* ==================== 弹窗 ==================== */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.modal-body {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  background: var(--tb-top-bg);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--tb-text);
}

.modal-tactics,
.modal-squads,
.modal-members,
.modal-style,
.modal-piece-edit,
.modal-text-edit,
.modal-vehicle-data,
.modal-tutorial {
  max-width: 620px;
}

.modal-prompt {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--tb-border);
  flex-shrink: 0;
  user-select: none;
}

.modal-header:active {
  cursor: grabbing;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* 弹窗看板娘头像装饰 */
.modal-mascot-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(var(--tb-primary-rgb), 0.3);
}

.modal-mascot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-content {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  line-height: 1.7;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--tb-border);
  flex-shrink: 0;
}

/* ==================== 按钮 ==================== */
.btn {
  padding: 8px 18px;
  border-radius: var(--tb-radius);
  border: 1px solid var(--tb-border);
  background: transparent;
  color: var(--tb-text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.btn.primary {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

.btn.primary:hover {
  background: var(--tb-accent);
  border-color: var(--tb-accent);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--tb-text-sub);
  transition: all 0.15s;
  outline: none;
}

.icon-btn:hover {
  background: var(--tb-primary-soft);
  color: var(--tb-primary);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn svg {
  pointer-events: none;
  display: block;
}

.icon-btn.small {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.icon-btn.float {
  width: 36px;
  height: 36px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  box-shadow: var(--tb-shadow-1);
}

/* ==================== toast ==================== */
.toasts {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  font-size: 13px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  max-width: 340px;
  word-break: break-word;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: rgba(22, 163, 74, 0.95);
}

.toast-error {
  background: rgba(220, 38, 38, 0.95);
}

.toast-warning {
  background: rgba(217, 119, 6, 0.95);
}

/* ==================== 文档/方案/小队/风格 ==================== */
.doc-content {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.85;
}

.tactics-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tactics-actions .btn {
  flex: 1;
  min-width: 100px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tactics-list-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 8px;
}

.tactics-list-title:first-of-type {
  margin-top: 0;
}

.tactics-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tactics-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--tb-side-bg);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  transition: all 0.12s;
  flex-wrap: wrap;
}

.tactics-item:hover {
  border-color: var(--tb-primary);
}

.tactics-item-info {
  flex: 1;
  min-width: 0;
}

.tactics-item-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tactics-item-sub {
  font-size: 11px;
  color: var(--tb-text-sub);
  margin-top: 2px;
}

.tactics-item-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* 方案面板 Tab */
.tactics-tabs {
  display: flex;
  gap: 4px;
}

.tactics-tab {
  padding: 5px 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--tb-border);
  color: var(--tb-text-sub);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  font-family: inherit;
}

.tactics-tab:hover {
  color: var(--tb-primary);
  border-color: var(--tb-primary);
}

.tactics-tab.active {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

/* 队员 */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 8px;
  background: var(--tb-side-bg);
  border-radius: 8px;
  border: 1px solid var(--tb-border);
}

.member-row-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.member-row-fields input,
.member-row-fields select {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  background: var(--tb-top-bg);
  color: var(--tb-text);
  outline: none;
  font-family: inherit;
  min-width: 0;
}

.member-row-fields .full {
  grid-column: 1 / -1;
}

.member-row-del {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 风格列表 */
.style-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--tb-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--tb-text);
  font-family: inherit;
}

.style-item:hover {
  border-color: var(--tb-primary);
}

.style-item.active {
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px var(--tb-primary-soft);
}

.style-item-mascot {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: rgba(var(--tb-primary-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.style-item-mascot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.style-item-info {
  flex: 1;
  min-width: 0;
}

.style-item-name {
  font-weight: 700;
  font-size: 14px;
}

.style-item-swatches {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.style-item-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ==================== 预设 ==================== */
.preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  color: var(--tb-text);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
  font-family: inherit;
  position: relative;
  max-width: 100%;
}

.preset-chip:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.preset-chip .remove {
  color: #dc2626;
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
  opacity: 0.6;
}

.preset-chip .remove:hover {
  opacity: 1;
}

.preset-empty {
  font-size: 11px;
  color: var(--tb-text-sub);
  text-align: center;
  padding: 8px;
  opacity: 0.7;
}

/* ==================== 看板娘气泡 ==================== */
.mascot-toast-wrap {
  position: fixed;
  left: 16px;
  bottom: 56px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 9998;
  pointer-events: none;
}

.mascot-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 320px;
  padding: 10px 14px 10px 10px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 40, 90, 0.15);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  pointer-events: auto;
}

.mascot-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mascot-toast .mavatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  overflow: hidden;
}

.mascot-toast .mavatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mascot-toast .mtext {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--tb-text);
  flex: 1;
}

/* ==================== 教程 ==================== */
.modal-tutorial {
  max-width: 620px;
}

.tutorial-mascot {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.tutorial-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(var(--tb-primary-rgb), 0.3);
}

.tutorial-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tutorial-bubble {
  flex: 1;
  padding: 14px 18px;
  background: var(--tb-side-bg);
  border-radius: 14px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--tb-text);
  position: relative;
}

.tutorial-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 16px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: var(--tb-side-bg);
  border-left: 0;
}

.tutorial-body {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--tb-text);
  padding: 0 4px;
}

.tutorial-body h4 {
  margin: 12px 0 6px;
  font-size: 13px;
  color: var(--tb-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tutorial-body ul {
  padding-left: 20px;
  margin: 6px 0;
}

.tutorial-body kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--tb-primary-soft);
  border-radius: 4px;
  font-family: "Consolas", monospace;
  font-size: 11.5px;
  color: var(--tb-primary);
  margin: 0 2px;
}

.tutorial-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tb-border);
  transition: all 0.2s;
}

.tutorial-dot.active {
  background: var(--tb-primary);
  transform: scale(1.3);
}

/* ==================== 载具属性 ==================== */
.vd-section {
  margin-bottom: 14px;
}

.vd-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vd-item {
  padding: 8px 10px;
  background: var(--tb-side-bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.vd-item span {
  font-size: 10.5px;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.vd-item b {
  font-size: 14px;
  color: var(--tb-text);
}

/* ==================== 编辑弹窗内 ==================== */
.pedit-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--tb-border);
}

.pedit-section:last-child {
  border-bottom: none;
}

.pedit-section h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tb-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pedit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pedit-row label {
  font-size: 12px;
  color: var(--tb-text-sub);
  min-width: 68px;
  flex-shrink: 0;
}

.pedit-row input[type="text"],
.pedit-row input[type="number"],
.pedit-row select {
  flex: 1;
  padding: 6px 10px;
  font-size: 12.5px;
  background: var(--tb-top-bg);
  color: var(--tb-text);
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  outline: none;
  font-family: inherit;
}

.pedit-row input[type="color"] {
  width: 40px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--tb-border);
  background: transparent;
  padding: 2px;
}

.pedit-section textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  padding: 8px 10px;
  background: var(--tb-top-bg);
  color: var(--tb-text);
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  outline: none;
  resize: vertical;
}

.flip-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.flip-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  color: var(--tb-text-sub);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
  font-family: inherit;
}

.flip-btn:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.flip-btn.active {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

/* 文本框 */
#text-edit-content {
  width: 100%;
  min-height: 120px;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  background: var(--tb-top-bg);
  color: var(--tb-text);
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  outline: none;
  resize: vertical;
}

#text-edit-content:focus {
  border-color: var(--tb-primary);
  box-shadow: 0 0 0 3px var(--tb-primary-soft);
}

.text-tool-preview {
  padding: 8px 10px;
  background: var(--tb-side-bg);
  border-radius: 8px;
  font-size: 12px;
  color: var(--tb-text-sub);
  margin-bottom: 8px;
  text-align: center;
}

/* ==================== 合集列表 ==================== */
.collection-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.collection-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--tb-top-bg);
  border: 1px solid var(--tb-border);
  color: var(--tb-text-sub);
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
  font-family: inherit;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-chip:hover {
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

.collection-chip.active {
  background: var(--tb-primary);
  color: #fff;
  border-color: var(--tb-primary);
}

.collection-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ★ 合集分页 */
.collection-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.collection-pager-info {
  font-size: 12px;
  color: var(--tb-text-sub);
  font-family: "Consolas", monospace;
}

/* ==================== 快速生成步兵 ==================== */
.quick-spawn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.quick-spawn-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px !important;
  font-size: 12px !important;
}

.quick-spawn-btn.attack {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.quick-spawn-btn.attack:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #dc2626;
}

.quick-spawn-btn.defense {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.35);
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.quick-spawn-btn.defense:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: #2563eb;
}

/* ==================== 通用颜色选择器 ==================== */
.modal-color-picker {
  max-width: 420px;
}

.cp-current-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.cp-current-dot {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--tb-border);
  flex-shrink: 0;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.cp-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.cp-swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s;
  outline: none;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.cp-swatch:hover {
  transform: scale(1.15);
}

.cp-swatch.active {
  border-color: var(--tb-text);
  transform: scale(1.1);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 0 2px var(--tb-primary-soft);
}

.cp-native-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--tb-border);
}

.cp-native-row label {
  font-size: 12.5px;
  color: var(--tb-text-sub);
}

.cp-native-row input[type="color"] {
  flex: 1;
  height: 34px;
  border: 1px solid var(--tb-border);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  padding: 2px;
}

/* ==================== 顶部栏：柔和渐变装饰 ==================== */
.topbar {
  background-image: linear-gradient(180deg,
      rgba(var(--tb-primary-rgb), 0.05),
      rgba(var(--tb-primary-rgb), 0) 60%),
    var(--tb-topbar-bg-image, none);
  box-shadow: 0 1px 0 rgba(var(--tb-primary-rgb), 0.12), var(--tb-shadow-1);
}

/* ==================== 响应式 ==================== */
.menu-toggle {
  display: none;
}

@media (max-width: 1100px) {
  .body.info-open {
    grid-template-columns: var(--tb-side-w) 1fr 280px 0px 0px;
  }

  .body.tactics-open {
    grid-template-columns: var(--tb-side-w) 1fr 0px 300px 0px;
  }

  .body.edit-open {
    grid-template-columns: var(--tb-side-w) 1fr 0px 0px 300px;
  }

  .topbar-mascot {
    max-width: 280px;
  }

  .topbar-status .status-item span {
    display: none;
  }
}

@media (max-width: 900px) {
  :root {
    --tb-side-w: 240px;
    --tb-top-h: 48px;
  }

  .body,
  .body.info-open,
  .body.tactics-open,
  .body.edit-open {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    top: var(--tb-top-h);
    bottom: var(--tb-bottom-h);
    left: 0;
    width: 300px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--tb-shadow-2);
  }

  .side.open {
    transform: translateX(0);
  }

  .info-panel {
    position: fixed;
    top: var(--tb-top-h);
    bottom: var(--tb-bottom-h);
    right: 0;
    width: 300px;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    box-shadow: var(--tb-shadow-2);
  }

  .body.info-open .info-panel {
    transform: translateX(0);
  }

  .body:not(.info-open) .info-panel {
    display: flex;
  }

  .tactics-panel {
    position: fixed;
    top: var(--tb-top-h);
    bottom: var(--tb-bottom-h);
    right: 0;
    width: 320px;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    box-shadow: var(--tb-shadow-2);
  }

  .body.tactics-open .tactics-panel {
    transform: translateX(0);
    display: flex;
  }

  .edit-panel {
    position: fixed;
    top: var(--tb-top-h);
    bottom: var(--tb-bottom-h);
    right: 0;
    width: 320px;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    box-shadow: var(--tb-shadow-2);
  }

  .body.edit-open .edit-panel {
    transform: translateX(0);
    display: flex;
  }

  .topbar-subtitle {
    display: none;
  }

  .topbar-mascot {
    display: none;
  }

  .topbar-status {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .topbar-brand span:last-child {
    display: none;
  }

  .user-chip .name {
    display: none;
  }

  .zoom-indicator {
    bottom: 10px;
    right: 10px;
    font-size: 10.5px;
  }

  .bottombar {
    padding: 0 12px;
    gap: 8px;
  }
}

/* ==================== 可拖拽模态框 ==================== */
.modal-body {
  transition: none;
}

.modal-header {
  user-select: none;
}

.modal-header:active {
  cursor: grabbing;
}

/* ==================== 路径点选中高亮 ==================== */
.path-node-selected {
  outline: 2px solid #f59e0b;
}

/* ============================================================
 * ★ 8.1 新增：功能区折叠 / 顶部栏动画 / 信息化 HUD / 立绘优化
 * ============================================================ */

/* ---------- 侧栏小功能组展开收起（大分区常开） ---------- */
.sub-group {
  border-radius: 10px;
}

.sub-group+.sub-group {
  margin-top: 2px;
}

.sub-group-head {
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  padding: 5px 8px;
  margin: 0 -8px 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.sub-group-head:hover {
  color: var(--tb-primary);
  background: rgba(var(--tb-primary-rgb), 0.07);
}

.sub-group-chev {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  color: var(--tb-text-sub);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sub-group.collapsed .sub-group-chev {
  transform: rotate(-90deg);
}

.sub-group-body {
  overflow: hidden;
  animation: collapse-in 0.18s ease;
}

@keyframes collapse-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.sub-group.collapsed .sub-group-body {
  display: none;
}

.sub-group.collapsed .sub-group-head {
  margin-bottom: 2px;
}

/* 小功能组内的标题去掉多余上边距（间距由组统一控制） */
.sub-group-body .side-title {
  margin-top: 0 !important;
}

/* ---------- 顶部栏动画：logo 闪烁 + 打字机光标 ---------- */
@keyframes logo-blink {

  0%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(var(--tb-primary-rgb), 0.85));
  }

  50% {
    opacity: 0.55;
    filter: drop-shadow(0 0 1px rgba(var(--tb-primary-rgb), 0.25));
  }
}

.topbar-brand .mark,
.brand-logo {
  animation: logo-blink 2.6s ease-in-out infinite;
}

.brand-text.typing::after,
.topbar-subtitle.typing::after {
  content: "▌";
  margin-left: 1px;
  color: var(--tb-primary);
  animation: caret-blink 0.75s step-end infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

/* ---------- 信息化 HUD 风格 ---------- */
/* 顶部栏底部分隔能量线（扫光效果已移除） */
.topbar {
  position: relative;
}

.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      var(--tb-primary),
      transparent);
  opacity: 0.65;
  pointer-events: none;
}

/* 底栏顶部能量线 */
.bottombar {
  position: relative;
}

.bottombar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(var(--tb-primary-rgb), 0.5),
      transparent);
  pointer-events: none;
}

/* 数据读数用等宽字体，更像战术终端 */
.status-item,
.zoom-indicator,
.coord-indicator,
.width-val,
.collection-pager-info {
  font-family: Consolas, "JetBrains Mono", "Courier New", monospace;
}

/* 舞台网格底纹（地图加载前也有信息化底色） */
.stage {
  background-image:
    linear-gradient(rgba(var(--tb-primary-rgb), 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--tb-primary-rgb), 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* 面板标题终端化 */
.info-header {
  letter-spacing: 2px;
}

/* 工具 / 按钮激活态发光 */
.tool-btn.active {
  box-shadow: 0 0 10px rgba(var(--tb-primary-rgb), 0.45),
    inset 0 0 6px rgba(var(--tb-primary-rgb), 0.22);
}

.btn.primary {
  box-shadow: 0 0 12px rgba(var(--tb-primary-rgb), 0.3);
}

.btn.primary:hover {
  box-shadow: 0 0 18px rgba(var(--tb-primary-rgb), 0.55);
}

.point-chip.active {
  box-shadow: 0 0 8px rgba(var(--tb-primary-rgb), 0.5);
}

/* 图标按钮激活态（顶栏信息栏 / 方案按钮等） */
.icon-btn.active {
  color: var(--tb-primary);
  background: rgba(var(--tb-primary-rgb), 0.12);
  box-shadow: inset 0 0 0 1px rgba(var(--tb-primary-rgb), 0.45),
    0 0 8px rgba(var(--tb-primary-rgb), 0.3);
}

/* ---------- 侧栏二次元立绘优化 ---------- */
.side-mascot {
  margin: 12px 6px 4px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(var(--tb-primary-rgb), 0.18), transparent 65%),
    linear-gradient(180deg,
      rgba(var(--tb-primary-rgb), 0.05) 0%,
      rgba(var(--tb-primary-rgb), 0.12) 100%);
  border: 1px solid rgba(var(--tb-primary-rgb), 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18),
    inset 0 0 24px rgba(var(--tb-primary-rgb), 0.06);
  animation: mascot-in 0.5s ease;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.side-mascot:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24),
    0 0 18px rgba(var(--tb-primary-rgb), 0.25),
    inset 0 0 24px rgba(var(--tb-primary-rgb), 0.08);
}

.sidebar-mascot-img {
  object-fit: contain;
  max-height: 300px;
  padding: 6px 6px 0;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 12px rgba(var(--tb-primary-rgb), 0.28));
  animation: mascot-float 4.2s ease-in-out infinite;
}

@keyframes mascot-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes mascot-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* 立绘脚下展台光环 */
.side-mascot::after {
  content: "";
  display: block;
  height: 12px;
  margin: -8px 20px 2px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
      rgba(var(--tb-primary-rgb), 0.4),
      transparent 70%);
}

.sidebar-mascot-text {
  display: inline-block;
  margin: 6px 12px 10px;
  padding: 5px 12px;
  border-radius: 12px;
  background: rgba(var(--tb-primary-rgb), 0.1);
  border: 1px solid rgba(var(--tb-primary-rgb), 0.28);
  font-size: 12px;
  color: var(--tb-text);
  line-height: 1.5;
}

/* ============================================================
 * ★ 8.2 侧栏卡片化重设计补充
 * ============================================================ */

/* 侧栏页脚弱化，贴底 */
.side-footer {
  margin-top: auto;
  padding: 8px 6px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--tb-text-sub);
  opacity: 0.7;
  flex-shrink: 0;
  letter-spacing: 0.4px;
}

/* 立绘与侧栏新间距协调 */
.side-mascot {
  margin: 2px 2px 0;
  border-radius: 14px;
}

/* 地图选择卡片内边距微调 */
.map-selector-current {
  padding: 8px 10px;
}

.map-thumb {
  width: 46px;
  height: 46px;
}

/* 撤销/重做行与上方列表间距 */
.undo-redo-row {
  margin-top: 8px;
}

/* 图层列表在卡片内的紧凑边距 */
.layer-list {
  margin: 0 -2px;
}

/* 方案合集快捷筛选 chips 换行更紧凑 */
.collection-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 点位网格贴边对齐 */
.point-grid {
  margin: 0 -2px;
}

/* 工具面板里最后一个分组底部留白 */
.tool-panel>.sub-group:last-child {
  margin-bottom: 2px;
}

/* 小功能组标题行 hover 时小箭头变色 */
.sub-group-head:hover .sub-group-chev {
  color: var(--tb-primary);
}

/* ============================================================
 * ★ 8.3 方案面板 Tab 化（解决过长问题）
 * ============================================================ */

.panel-tabs {
  display: flex;
  gap: 2px;
  margin: 0 14px 10px;
  padding: 3px;
  background: rgba(var(--tb-primary-rgb), 0.07);
  border-radius: 10px;
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 6px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tb-text-sub);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  outline: none;
}

.panel-tab:hover {
  color: var(--tb-primary);
}

.panel-tab.active {
  background: var(--tb-top-bg);
  color: var(--tb-primary);
  box-shadow: 0 1px 4px rgba(15, 40, 90, 0.12), 0 0 0 1px rgba(var(--tb-primary-rgb), 0.3);
}

.panel-tab-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* 方案面板内块更紧凑 */
.tactics-panel .info-block {
  padding: 10px 14px;
}

.tactics-panel .info-block+.info-block {
  border-top: 1px dashed var(--tb-border);
}

/* 方案操作按钮行允许三个并排 */
.tactics-panel .quick-spawn-row {
  display: flex;
  gap: 6px;
}

.tactics-panel .quick-spawn-row .btn {
  flex: 1;
  white-space: nowrap;
  padding: 6px 4px;
  font-size: 12px;
}

/* 方案面板内部滚动由 tab-body 承担，避免双滚动条 */
.tactics-panel {
  overflow-y: hidden;
}

/* ============================================================
 * ★ 8.4 联机房间
 * ============================================================ */

.modal-room {
  max-width: 420px;
}

.room-join-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.room-join-row .form-input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-family: Consolas, "JetBrains Mono", monospace;
  font-weight: 700;
}

.room-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed rgba(var(--tb-primary-rgb), 0.4);
  border-radius: 12px;
  background: rgba(var(--tb-primary-rgb), 0.05);
}

.room-code-label {
  font-size: 11px;
  color: var(--tb-text-sub);
  margin-bottom: 4px;
}

.room-code {
  font-family: Consolas, "JetBrains Mono", monospace;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--tb-primary);
}

.room-member-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--tb-border);
  border-radius: 10px;
  font-size: 12.5px;
}

.room-member.me {
  border-color: rgba(var(--tb-primary-rgb), 0.45);
  background: rgba(var(--tb-primary-rgb), 0.06);
}

.room-member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;
  flex-shrink: 0;
}

.room-member-dot[data-role="host"] {
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  box-shadow: 0 0 6px rgba(var(--tb-primary-rgb), 0.5);
}

.room-member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-member-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent));
  flex-shrink: 0;
}

.room-member-rtt {
  font-family: Consolas, "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--tb-text-sub);
  min-width: 42px;
  text-align: right;
  flex-shrink: 0;
}

/* 顶栏联机状态 */
.status-item.room-on {
  color: var(--tb-primary);
  background: rgba(var(--tb-primary-rgb), 0.12);
  box-shadow: inset 0 0 0 1px rgba(var(--tb-primary-rgb), 0.3);
}

/* 成员跟随模式：画布角标提示 */
.stage.room-guest::after {
  content: "跟随主机视角 · 只读";
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--tb-primary);
  background: rgba(var(--tb-top-bg-rgb, 255, 255, 255), 0.85);
  border: 1px solid rgba(var(--tb-primary-rgb), 0.4);
  box-shadow: var(--tb-shadow-1);
  pointer-events: none;
  z-index: 40;
}

/* ============================================================
 * ★ 8.5 顶栏提示整合 / 操作显示区 / 全屏按钮
 * ============================================================ */

/* toast 移至顶栏正下方，视觉上"整合到顶部栏" */
.toasts {
  position: fixed;
  top: calc(var(--tb-top-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 16px;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12.5px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 460px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* 顶部操作/提示显示区 */
.topbar-activity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  margin-right: 4px;
  border-radius: 999px;
  background: rgba(var(--tb-primary-rgb), 0.08);
  border: 1px solid rgba(var(--tb-primary-rgb), 0.22);
  font-size: 11.5px;
  color: var(--tb-text-sub);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.25s ease;
}

.topbar-activity svg {
  flex-shrink: 0;
  color: var(--tb-primary);
}

.topbar-activity span {
  overflow: hidden;
  text-overflow: ellipsis;
  animation: act-fade 0.3s ease;
}

.topbar-activity.flash {
  background: rgba(var(--tb-primary-rgb), 0.2);
  border-color: var(--tb-primary);
  color: var(--tb-primary);
}

@keyframes act-fade {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* 全屏按钮激活态 */
#btn-fullscreen.active {
  color: var(--tb-primary);
  background: rgba(var(--tb-primary-rgb), 0.12);
  box-shadow: inset 0 0 0 1px rgba(var(--tb-primary-rgb), 0.45),
    0 0 8px rgba(var(--tb-primary-rgb), 0.3);
}

@media (max-width: 900px) {
  .topbar-activity {
    display: none;
  }
}

/* ============================================================
 * ★ 8.6 左侧栏尺寸优化 + 立绘贴底
 * ============================================================ */

.side {
  padding: 10px 9px;
  gap: 8px;
}

.side-section {
  padding: 10px;
  border-radius: 12px;
}

/* 地图选择器尺寸更紧凑 */
.map-thumb {
  width: 44px;
  height: 44px;
}

.map-selector-current {
  padding: 8px 10px;
  gap: 10px;
}

.map-current-name {
  font-size: 13px;
}

.map-current-sub {
  font-size: 11px;
}

/* 工具按钮略小一点，4 列 */
.tool-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.tool-btn {
  padding: 4px 3px 11px;
}

.tool-btn-label {
  font-size: 10px;
}

.tool-btn-key {
  font-size: 8px;
}

/* 侧栏大立绘：固定贴底，不被压缩 */
.side-mascot {
  flex-shrink: 0;
  /* ★ 不被压缩 */
  margin: auto 2px 0;
  /* ★ 顶到最底部（页脚上方） */
}

.side-footer {
  margin-top: 6px;
  /* 原来 auto 交给立绘 */
}

/* 窄屏隐藏立绘，节省空间 */
@media (max-width: 900px) {
  .side-mascot {
    display: none !important;
  }
}