/* ═══════════════════════════════════════════
   玩具控制中心 · 底部面板 + 悬浮胶囊
   ═══════════════════════════════════════════ */

/* ── 遮罩 ── */
.toy-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.toy-mask.open { display: block; }

/* ── 底部面板 ── */
.toy-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 88vh;
  background: var(--bg-card, #fff);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}
.toy-sheet.open { transform: translateY(0); }

/* 拖拽把手 */
.toy-handle {
  width: 36px; height: 4px;
  background: var(--line, #ddd);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* 顶栏 */
.toy-header {
  display: flex; align-items: center;
  padding: 8px 14px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line, #eee);
  gap: 8px;
}
.toy-tabs {
  display: flex; gap: 6px; flex: 1; overflow-x: auto;
  scrollbar-width: none;
}
.toy-tabs::-webkit-scrollbar { display: none; }
.toy-tab {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--line, #ddd);
  background: transparent;
  font-size: 13px; color: var(--ink-soft, #888);
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s; flex-shrink: 0;
}
.toy-tab.active {
  background: var(--accent-soft, #fde8d8);
  border-color: var(--accent, #C97D2E);
  color: var(--accent, #C97D2E);
  font-weight: 500;
}
.toy-tab .toy-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ccc; flex-shrink: 0;
  transition: background 0.3s;
}
.toy-tab.connected .toy-dot { background: #4CAF50; }

.toy-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line, #ddd);
  background: transparent; color: var(--ink-soft, #888);
  cursor: pointer; font-size: 13px; flex-shrink: 0;
  display: grid; place-items: center;
  transition: background 0.15s;
}
.toy-close:hover { background: var(--accent-soft, #fde8d8); }

/* iframe 区域 */
.toy-frames {
  flex: 1; position: relative; overflow: hidden;
}
.toy-iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: none;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.toy-iframe.active {
  opacity: 1; pointer-events: auto;
}

/* ── 悬浮胶囊 ── */
.toy-pill {
  position: fixed;
  display: none;
  touch-action: none; /* 拖拽时不触发页面滚动 */
  align-items: center; gap: 7px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--line, #ddd);
  border-radius: 24px;
  padding: 6px 10px 6px 12px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.10);
  z-index: 202;
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.toy-pill:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.toy-pill.visible { display: flex; }

.toy-pill-statuses {
  display: flex; gap: 5px; align-items: center;
}
.toy-pill-item {
  position: relative;
  font-size: 17px; line-height: 1;
  cursor: pointer;
  user-select: none;
}
.toy-pill-item .dot {
  position: absolute; bottom: -1px; right: -2px;
  width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--bg-card, #fff);
  background: #ccc;
  transition: background 0.3s;
}
.toy-pill-item.on .dot { background: #4CAF50; }

.toy-pill-stop {
  background: #e74c3c; color: #fff;
  border: none; border-radius: 10px;
  padding: 3px 9px; font-size: 11px;
  cursor: pointer; font-weight: 600;
  letter-spacing: 0.03em;
  transition: opacity 0.15s;
}
.toy-pill-stop:active { opacity: 0.8; }
.toy-pill-close {
  background: none; border: none;
  color: #aaa; font-size: 14px; line-height: 1;
  padding: 0 2px; cursor: pointer;
  transition: color 0.15s;
}
.toy-pill-close:hover { color: #555; }

/* ── 暗色模式 ── */
[data-theme="dark"] .toy-sheet {
  background: #120804 !important;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4) !important;
}
[data-theme="dark"] .toy-handle { background: #2A1408 !important; }
[data-theme="dark"] .toy-header { border-bottom-color: #2A1408 !important; }
[data-theme="dark"] .toy-tab { border-color: #2A1408 !important; color: #8A6040 !important; }
[data-theme="dark"] .toy-tab.active { background: rgba(48,24,6,.8) !important; color: #C4873A !important; }
[data-theme="dark"] .toy-close { border-color: #2A1408 !important; color: #8A6040 !important; }
[data-theme="dark"] .toy-pill {
  background: #120804 !important;
  border-color: #2A1408 !important;
}
[data-theme="dark"] .toy-pill-item .dot { border-color: #120804 !important; }
