/* ==============================================================================
   全页面通用屏幕右下角遥控器模拟器浮层 (可折叠为遥控器图标样式)
   ============================================================================== */

/* 1. 浮层容器 (固定在视口右下角) */
.virtual-remote-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Segoe UI", Roboto, sans-serif;
}

/* 2. 收起状态：精致遥控器图标按钮 */
.remote-collapsed-trigger {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: all 240ms cubic-bezier(0.16, 1, 0.3, 1);
  color: #38bdf8;
  position: relative;
  overflow: hidden;
}

.remote-collapsed-trigger:hover {
  transform: translateY(-3px) scale(1.08);
  background: rgba(15, 23, 42, 0.96);
  border-color: #38bdf8;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 28px rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.remote-collapsed-trigger:active {
  transform: scale(0.94);
}

.remote-collapsed-trigger svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.remote-collapsed-trigger .trigger-label {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  margin-top: 1px;
  letter-spacing: 0.5px;
}

/* 3. 展开状态：完整遥控器模拟器面板 (对齐用户高保真截图) */
.virtual-remote-panel {
  width: 204px;
  background: rgba(13, 20, 36, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.38);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 28px;
  padding: 16px 16px 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 35px rgba(56, 189, 248, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  transform-origin: bottom right;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
}

/* 头部：标题与折叠收起按钮 */
.remote-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

.remote-panel-title {
  font-size: 14px;
  font-weight: 800;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.btn-remote-collapse {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  font-size: 13px;
  font-weight: bold;
  transition: all 160ms ease;
}

.btn-remote-collapse:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
  transform: scale(1.08);
}

/* 十字方向键网格 (3x3) */
.remote-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 6px;
  justify-content: center;
}

.remote-dpad-slot-empty {
  visibility: hidden;
}

.remote-key-btn {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  outline: none;
  transition: all 120ms ease;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

.remote-key-btn:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #ffffff;
  transform: scale(1.05);
}

.remote-key-btn:active,
.remote-key-btn.is-active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.35);
  border-color: #7dd3fc;
}

/* 核心 OK 键 (亮蓝发光) */
.remote-key-btn.btn-key-ok {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: 1.5px solid #38bdf8;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45);
}

.remote-key-btn.btn-key-ok:hover {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.7);
  transform: scale(1.06);
}

.remote-key-btn.btn-key-ok:active,
.remote-key-btn.btn-key-ok.is-active {
  transform: scale(0.92);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* 底部 Back 返回宽键 (微暗红，符合 TV 遥控器惯例) */
.remote-back-row {
  width: 100%;
}

.remote-key-btn.btn-key-back {
  width: 100%;
  height: 38px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.16);
  border: 1.5px solid rgba(239, 68, 68, 0.38);
  color: #fca5a5;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.remote-key-btn.btn-key-back:hover {
  background: #ef4444;
  border-color: #f87171;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.45);
  transform: scale(1.03);
}

.remote-key-btn.btn-key-back:active,
.remote-key-btn.btn-key-back.is-active {
  transform: scale(0.95);
}

/* 4. 折叠 / 展开状态切换控制 */
.virtual-remote-host.is-collapsed .virtual-remote-panel {
  display: none !important;
}

.virtual-remote-host.is-collapsed .remote-collapsed-trigger {
  display: flex !important;
}

.virtual-remote-host:not(.is-collapsed) .remote-collapsed-trigger {
  display: none !important;
}

.virtual-remote-host:not(.is-collapsed) .virtual-remote-panel {
  display: flex !important;
}
